From 7b2ea7dca3c9c81bbc8d9c9ce6234d44a1cfc771 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 17 Sep 2025 03:46:23 +0000 Subject: [PATCH 1/5] Regenerate repository SDK with TypeSpec build 20250916.1 --- ...ient-csharp-mgmt-emitter-package-lock.json | 209 +++++++++--------- ...tp-client-csharp-mgmt-emitter-package.json | 20 +- 2 files changed, 114 insertions(+), 115 deletions(-) diff --git a/eng/azure-typespec-http-client-csharp-mgmt-emitter-package-lock.json b/eng/azure-typespec-http-client-csharp-mgmt-emitter-package-lock.json index 879a30c482f6..86c0d1bb1417 100644 --- a/eng/azure-typespec-http-client-csharp-mgmt-emitter-package-lock.json +++ b/eng/azure-typespec-http-client-csharp-mgmt-emitter-package-lock.json @@ -5,39 +5,39 @@ "packages": { "": { "dependencies": { - "@azure-typespec/http-client-csharp-mgmt": "1.0.0-alpha.20250915.1" + "@azure-typespec/http-client-csharp-mgmt": "1.0.0-alpha.20250916.1" }, "devDependencies": { - "@azure-tools/typespec-azure-core": "0.59.0", - "@azure-tools/typespec-azure-resource-manager": "0.59.0", - "@azure-tools/typespec-azure-rulesets": "0.59.0", - "@azure-tools/typespec-client-generator-core": "0.59.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", - "@typespec/compiler": "1.3.0", - "@typespec/http": "1.3.0", - "@typespec/openapi": "1.3.0", - "@typespec/rest": "0.73.0", - "@typespec/versioning": "0.73.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" } }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.59.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.59.0.tgz", - "integrity": "sha512-3vTWDTSR+P0qeyFcOKTgXortNOeA3nsyKTPpZqfFZVTtNFiiO17UWAM2Eg3i0IpNQ3qxMMAksIkwt1bqltTDqA==", + "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==", "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0", - "@typespec/http": "^1.3.0", - "@typespec/rest": "^0.73.0" + "@typespec/compiler": "^1.4.0", + "@typespec/http": "^1.4.0", + "@typespec/rest": "^0.74.0" } }, "node_modules/@azure-tools/typespec-azure-resource-manager": { - "version": "0.59.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.59.0.tgz", - "integrity": "sha512-q0UkBnwWE4+9ivAkwAOOrDF9kvSb+qRIvMXJdUlqGfwFqDkOvQFwHSzSDeL/mBNK2fB9NIePKPFjDGP9lpC0vQ==", + "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==", "dev": true, "license": "MIT", "dependencies": { @@ -48,34 +48,34 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.59.0", - "@typespec/compiler": "^1.3.0", - "@typespec/http": "^1.3.0", - "@typespec/openapi": "^1.3.0", - "@typespec/rest": "^0.73.0", - "@typespec/versioning": "^0.73.0" + "@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" } }, "node_modules/@azure-tools/typespec-azure-rulesets": { - "version": "0.59.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.59.0.tgz", - "integrity": "sha512-+eKYH25ptj6SZHT+/YfxrX+g6HMAQQTphmHmqOoRCbbfPaE8l855OaDrwEgh5NDLV8WXnHpzTNI0dsYipEp10g==", + "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==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.59.0", - "@azure-tools/typespec-azure-resource-manager": "^0.59.0", - "@azure-tools/typespec-client-generator-core": "^0.59.0", - "@typespec/compiler": "^1.3.0" + "@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" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.59.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.59.0.tgz", - "integrity": "sha512-5+pVcOr7Uyq4IaZ3oLjLi8jnBuR+t/B8hQF4CZo+goe/uK+WkmDfw1TlY14G2ve7W7v8m9+Sk2nil6bN1uHWEQ==", + "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==", "license": "MIT", "dependencies": { "change-case": "~5.4.4", @@ -86,16 +86,16 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.59.0", - "@typespec/compiler": "^1.3.0", - "@typespec/events": "^0.73.0", - "@typespec/http": "^1.3.0", - "@typespec/openapi": "^1.3.0", - "@typespec/rest": "^0.73.0", - "@typespec/sse": "^0.73.0", - "@typespec/streams": "^0.73.0", - "@typespec/versioning": "^0.73.0", - "@typespec/xml": "^0.73.0" + "@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" } }, "node_modules/@azure-tools/typespec-liftr-base": { @@ -105,21 +105,21 @@ "dev": true }, "node_modules/@azure-typespec/http-client-csharp": { - "version": "1.0.0-alpha.20250903.2", - "resolved": "https://registry.npmjs.org/@azure-typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250903.2.tgz", - "integrity": "sha512-OSOdAii+eOusoSoXksB9cMMGztQAO2W3PDjH5aJyVEVKokn6IVhWs2xWgDnhApdQdrObBcfZ04Xvd1K5Rb/2uw==", + "version": "1.0.0-alpha.20250912.2", + "resolved": "https://registry.npmjs.org/@azure-typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250912.2.tgz", + "integrity": "sha512-RImdae8o0zJRTVo2dOx8tLY7t59IqNjlaYuqSVvSoyJgEH9XT6Fb3MyhCUpKbnNfLUq/qAq2LdHsEeqSwrKWbw==", "license": "MIT", "dependencies": { - "@typespec/http-client-csharp": "1.0.0-alpha.20250903.1" + "@typespec/http-client-csharp": "1.0.0-alpha.20250912.2" } }, "node_modules/@azure-typespec/http-client-csharp-mgmt": { - "version": "1.0.0-alpha.20250915.1", - "resolved": "https://registry.npmjs.org/@azure-typespec/http-client-csharp-mgmt/-/http-client-csharp-mgmt-1.0.0-alpha.20250915.1.tgz", - "integrity": "sha512-iKoocvVa7K8hizeqQ1MWoiopytll26MITI2MwPVxMy79nrxkjmCSlbHsQwRBxZRtGDSj49JDJdxJRk6Hi0kpow==", + "version": "1.0.0-alpha.20250916.1", + "resolved": "https://registry.npmjs.org/@azure-typespec/http-client-csharp-mgmt/-/http-client-csharp-mgmt-1.0.0-alpha.20250916.1.tgz", + "integrity": "sha512-OjWCjVvwMr54Yi3PDnPuvxiRgKHgrCSUAJ2y2Vv2Gp0JdNbNTJsLmMY6NYRYLBhsEex6StmMsmbOVwzEIdidaA==", "license": "MIT", "dependencies": { - "@azure-typespec/http-client-csharp": "1.0.0-alpha.20250903.2" + "@azure-typespec/http-client-csharp": "1.0.0-alpha.20250912.2" } }, "node_modules/@babel/code-frame": { @@ -539,9 +539,9 @@ } }, "node_modules/@typespec/compiler": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.3.0.tgz", - "integrity": "sha512-OqpoNP3C2y8riA6C5RofPMvmj9jNiGyyhde0tM2ZE7IBOv7BBaTDqw4CJD22YnC8JEilRfPmvdVCViNrPHEjrA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.4.0.tgz", + "integrity": "sha512-/AFiU3ImuhH/vHKzSGv7I2peewdJ7YLhgMCfFDNk6Ae0a5Ylrc8R1GOATVilisEPBFG9lnjHn3uUcyaZs5VWRw==", "license": "MIT", "dependencies": { "@babel/code-frame": "~7.27.1", @@ -571,29 +571,29 @@ } }, "node_modules/@typespec/events": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.73.0.tgz", - "integrity": "sha512-etlhp86amDaElD/UX27u9I4O58zREov73HkkV3xbdTWpv2RqOKyD3mkyGAWsW3hKaGVIxwHOvKcOZ2j+b07Gpw==", + "version": "0.74.0", + "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.74.0.tgz", + "integrity": "sha512-CY6JTtheMKAUlxiPmwx2fLIAWEwezsXmQYUMRhyuW44Q73unQIkexE43LUnNWOJSZckYucqUp+ihXh7jxzWeVQ==", "license": "MIT", "peer": true, "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0" + "@typespec/compiler": "^1.4.0" } }, "node_modules/@typespec/http": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.3.0.tgz", - "integrity": "sha512-4W3KsmBHZGgECVbvyh7S7KQG06948XyVVzae+UbVDDxoUj/x4Ry0AXw3q4HmzB2BVhxw6JBrwBuVa5mxjVMzdw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.4.0.tgz", + "integrity": "sha512-Y0PDDtBu+oZnwivfhbL0lN6Mk3QiCxZ66DgB5kFjcgKNpnXf0u440PPyaL42a8lbchzz5lVwz+cinyIMI89FIQ==", "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0", - "@typespec/streams": "^0.73.0" + "@typespec/compiler": "^1.4.0", + "@typespec/streams": "^0.74.0" }, "peerDependenciesMeta": { "@typespec/streams": { @@ -602,99 +602,98 @@ } }, "node_modules/@typespec/http-client-csharp": { - "version": "1.0.0-alpha.20250903.1", - "resolved": "https://registry.npmjs.org/@typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250903.1.tgz", - "integrity": "sha512-W3vbpxUhVJYBSoYPE4seMsDp/nvcqEwxsuYjVxBWMDliOOtO8ED05PYLvY5N4h+vKF2j30iT2d23NqpPo2qxeA==", + "version": "1.0.0-alpha.20250912.2", + "resolved": "https://registry.npmjs.org/@typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250912.2.tgz", + "integrity": "sha512-N3rMrsOj1jXw8dMBCvcNelLEGw+y3divFUAgYOMLM+1xYYhs34525MS7z2L8k2wLv81crW40BwRC7OzQnDjeDQ==", "license": "MIT", "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.59.0 <0.60.0 || ~0.60.0-0", - "@azure-tools/typespec-client-generator-core": ">=0.59.0 <0.60.0 || ~0.60.0-0", - "@typespec/compiler": "^1.3.0", - "@typespec/http": "^1.3.0", - "@typespec/openapi": "^1.3.0", - "@typespec/rest": ">=0.73.0 <0.74.0 || ~0.74.0-0", - "@typespec/streams": ">=0.73.0 <0.74.0 || ~0.74.0-0", - "@typespec/versioning": ">=0.73.0 <0.74.0 || ~0.74.0-0" + "@azure-tools/typespec-client-generator-core": ">=0.60.0 < 0.61.0 || ~0.61.0-0", + "@typespec/compiler": "^1.4.0", + "@typespec/http": "^1.4.0", + "@typespec/openapi": "^1.4.0", + "@typespec/rest": ">=0.74.0 <0.75.0 || ~0.75.0-0", + "@typespec/streams": ">=0.74.0 <0.75.0 || ~0.75.0-0", + "@typespec/versioning": ">=0.74.0 <0.75.0 || ~0.75.0-0" } }, "node_modules/@typespec/openapi": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.3.0.tgz", - "integrity": "sha512-BSeshjCZQodVGyVHn7ytcUeIcUGjqbG2Ac0NLOQaaKnISVrhTWNcgo5aFTqxAa24ZL/EuhqlSauLyYce2EV9fw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.4.0.tgz", + "integrity": "sha512-ZfrCsmZG/Zt1laLaWC0pKvnZr4jqrm/YS/YuZe/gVrSYKBxGLopXle7H0wrSSMYkIVCNCLiC68/HqRxV6XTfoA==", "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0", - "@typespec/http": "^1.3.0" + "@typespec/compiler": "^1.4.0", + "@typespec/http": "^1.4.0" } }, "node_modules/@typespec/rest": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.73.0.tgz", - "integrity": "sha512-28hgFGvreBg34Xuguw+E++pQC/kbRxy1Bpx/9nU7x87Ly6ykns3lpx74gjY9ByE8VYKVbXtC7lzdnp19DRSjIQ==", + "version": "0.74.0", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.74.0.tgz", + "integrity": "sha512-dE+Xmv01AQ7m8jUvEbGsUQLSVo3sLzMpnHRbQEOnJX42oDqtIsz/2GEOXKQpNm1AKBISK66E2FFB5boz999Ziw==", "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0", - "@typespec/http": "^1.3.0" + "@typespec/compiler": "^1.4.0", + "@typespec/http": "^1.4.0" } }, "node_modules/@typespec/sse": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.73.0.tgz", - "integrity": "sha512-WTnRJ1b1M3RPzlHxhnK9sh6+AGKPKWpuA0TSAqzyxb/uRHFYLNeoDKPOnlQ749SJ8lJz71Oh0nUsP3vB0EzO6Q==", + "version": "0.74.0", + "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.74.0.tgz", + "integrity": "sha512-+m7/elbGp7q/kqCGaBRj8v8wVMWKVEV8AsZOjf1PY2MkMUrux9ivOijBIktgoLBXDn+ocO2qVfFrHWG2slZSaw==", "license": "MIT", "peer": true, "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0", - "@typespec/events": "^0.73.0", - "@typespec/http": "^1.3.0", - "@typespec/streams": "^0.73.0" + "@typespec/compiler": "^1.4.0", + "@typespec/events": "^0.74.0", + "@typespec/http": "^1.4.0", + "@typespec/streams": "^0.74.0" } }, "node_modules/@typespec/streams": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.73.0.tgz", - "integrity": "sha512-pL4xffHXEIhBQKPlB9L4AKuM0bn44WsGKjnz91wa6wBtP/CbsPrGQicof0Z7GPGdddtDi4G8PWGmJtVFw53V9g==", + "version": "0.74.0", + "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.74.0.tgz", + "integrity": "sha512-LIWizQgzGt8qN8ravte4DrPLPNOk9ge73bV9Us2TOECagTVQWwgMVy7+o/Beff3sOLQO/sEOwfzvmnNpSlauHg==", "license": "MIT", "peer": true, "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0" + "@typespec/compiler": "^1.4.0" } }, "node_modules/@typespec/versioning": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.73.0.tgz", - "integrity": "sha512-cfFvzTsvsu4VpdwZcRULr3p/fawKZnjiJClQxlLcYW0dLs/5k5jh7l0YyPkYvgkOcncUrIB6hIu82tQhKrMDKQ==", + "version": "0.74.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.74.0.tgz", + "integrity": "sha512-eFIa23tycWJgv3Lxyu6jUlRi02dhtQE4Jjx3Ui5vEbwHW8pMEzuyF7ALt1c+V9HOLkfDkS4dJkiOVIoikZHPvQ==", "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0" + "@typespec/compiler": "^1.4.0" } }, "node_modules/@typespec/xml": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.73.0.tgz", - "integrity": "sha512-vlMM8/L22O/PbI3ovj3qoww/3Z8wNwn7og4jzlGRM93jZBJvrOeDSwZo1Dc4rMJyU6KfjPkP3/l5TLbgW8x0zA==", + "version": "0.74.0", + "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.74.0.tgz", + "integrity": "sha512-NiXatOfpyPxU94f2tEBAygxJeS7CvIr5lvnfZkC0tUHwkiJeLrI1jt13kDVB5CE6zNK6I3d7c37xsQs9WXGFAQ==", "license": "MIT", "peer": true, "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.3.0" + "@typespec/compiler": "^1.4.0" } }, "node_modules/ajv": { diff --git a/eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json b/eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json index 684d5a269249..60d7b2f4bfce 100644 --- a/eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json +++ b/eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json @@ -1,18 +1,18 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-typespec/http-client-csharp-mgmt": "1.0.0-alpha.20250915.1" + "@azure-typespec/http-client-csharp-mgmt": "1.0.0-alpha.20250916.1" }, "devDependencies": { - "@azure-tools/typespec-azure-core": "0.59.0", - "@azure-tools/typespec-azure-resource-manager": "0.59.0", - "@azure-tools/typespec-azure-rulesets": "0.59.0", - "@azure-tools/typespec-client-generator-core": "0.59.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", - "@typespec/compiler": "1.3.0", - "@typespec/http": "1.3.0", - "@typespec/openapi": "1.3.0", - "@typespec/rest": "0.73.0", - "@typespec/versioning": "0.73.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" } } \ No newline at end of file From e94aa8153ca03ad752e0bb5f0a582354c6bd7aa2 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 17 Sep 2025 03:59:19 +0000 Subject: [PATCH 2/5] Update SDK code re_wo_4 --- .../Azure.Data.SchemaRegistry.sln | 48 ++ .../src/Azure.Data.SchemaRegistry.csproj | 25 + .../src/Generated/Internal/Argument.cs | 74 +++ .../Internal/ChangeTrackingDictionary.cs | 189 ++++++ .../Generated/Internal/ChangeTrackingList.cs | 168 ++++++ .../Internal/ClientPipelineExtensions.cs | 72 +++ .../Internal/CodeGenMemberAttribute.cs | 20 + .../Internal/CodeGenSerializationAttribute.cs | 48 ++ .../Internal/CodeGenSuppressAttribute.cs | 29 + .../Internal/CodeGenTypeAttribute.cs | 24 + .../src/Generated/Internal/ErrorResult.cs | 32 ++ .../Internal/ModelSerializationExtensions.cs | 258 +++++++++ .../src/Generated/Internal/Optional.cs | 51 ++ .../Internal/RequestContextExtensions.cs | 26 + .../src/Generated/Internal/TypeFormatters.cs | 152 +++++ .../Models/AzureDataSchemaRegistryContext.cs | 24 + .../SchemaContentTypeValues.Serialization.cs | 46 ++ .../Models/SchemaContentTypeValues.cs | 22 + .../Models/SchemaGroups.Serialization.cs | 189 ++++++ .../src/Generated/Models/SchemaGroups.cs | 44 ++ .../Models/SchemaVersions.Serialization.cs | 177 ++++++ .../src/Generated/Models/SchemaVersions.cs | 44 ++ .../SchemaRegistryClient.RestClient.cs | 151 +++++ .../src/Generated/SchemaRegistryClient.cs | 543 ++++++++++++++++++ .../SchemaRegistryClientBuilderExtensions.cs | 42 ++ ...entGetSchemaGroupsAsyncCollectionResult.cs | 80 +++ ...GetSchemaGroupsAsyncCollectionResultOfT.cs | 75 +++ ...ryClientGetSchemaGroupsCollectionResult.cs | 79 +++ ...lientGetSchemaGroupsCollectionResultOfT.cs | 74 +++ ...tGetSchemaVersionsAsyncCollectionResult.cs | 91 +++ ...tSchemaVersionsAsyncCollectionResultOfT.cs | 86 +++ ...ClientGetSchemaVersionsCollectionResult.cs | 90 +++ ...entGetSchemaVersionsCollectionResultOfT.cs | 85 +++ .../Generated/SchemaRegistryClientOptions.cs | 45 ++ 34 files changed, 3203 insertions(+) create mode 100644 @azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln create mode 100644 @azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs create mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs diff --git a/@azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln b/@azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln new file mode 100644 index 000000000000..525c49f3a8c6 --- /dev/null +++ b/@azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln @@ -0,0 +1,48 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Data.SchemaRegistry", "src\Azure.Data.SchemaRegistry.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/@azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj b/@azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj new file mode 100644 index 000000000000..85b738042061 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj @@ -0,0 +1,25 @@ + + + This is the Azure.Data.SchemaRegistry client library for developing .NET applications with rich experience. + SDK Code Generation Azure.Data.SchemaRegistry + 1.0.0-beta.1 + Azure.Data.SchemaRegistry + true + + + + + + + + + + + + + + + + + + diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..92b5cd8448b7 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Data.SchemaRegistry +{ + internal static partial class Argument + { + /// The value. + /// The name. + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..0f98a07b9b08 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + /// The inner dictionary. + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + /// The inner dictionary. + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + /// Gets the IsUndefined. + public bool IsUndefined => _innerDictionary == null; + + /// Gets the Count. + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + /// Gets the IsReadOnly. + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + /// Gets the Keys. + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + /// Gets the Values. + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + /// Gets or sets the value associated with the specified key. + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + /// Gets the Keys. + IEnumerable IReadOnlyDictionary.Keys => Keys; + + /// Gets the Values. + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// The item to add. + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + /// The item to search for. + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + /// The array to copy. + /// The index. + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + /// The item to remove. + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + /// The key. + /// The value to add. + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + /// The key to search for. + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + /// The key. + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + /// The key to search for. + /// The value. + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..a2421736259e --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + /// The inner list. + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + /// The inner list. + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + /// Gets the IsUndefined. + public bool IsUndefined => _innerList == null; + + /// Gets the Count. + public int Count => IsUndefined ? 0 : EnsureList().Count; + + /// Gets the IsReadOnly. + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + /// Gets or sets the value associated with the specified key. + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// The item to add. + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + /// The item. + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + /// The array to copy to. + /// The array index. + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + /// The item. + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + /// The item. + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + /// The inner list. + /// The item. + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + /// The inner list. + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..c518bae0338d --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Data.SchemaRegistry +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..db095f49188c --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Data.SchemaRegistry +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..7b3a72060417 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Data.SchemaRegistry +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string propertySerializationName) + { + PropertyName = propertyName; + PropertySerializationName = propertySerializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string PropertySerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..d23f48e3f23c --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Data.SchemaRegistry +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..70b3e4e25256 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Data.SchemaRegistry +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..a8ca31b0e5c4 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..f17d377f7062 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,258 @@ +// 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.Diagnostics; +using System.Globalization; +using System.Text.Json; + +namespace Azure.Data.SchemaRegistry +{ + internal static partial class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + Dictionary dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + List list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + string text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) + { + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + string value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..5bba373a1ca7 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Data.SchemaRegistry +{ + internal static partial class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(string value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..eee08a69baf1 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.Data.SchemaRegistry +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..cad23b55d4d6 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; + +namespace Azure.Data.SchemaRegistry +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => System.Xml.XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => System.Xml.XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => System.Xml.XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs new file mode 100644 index 000000000000..755f550ac609 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using Azure; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information + /// + [ModelReaderWriterBuildable(typeof(ResponseError))] + [ModelReaderWriterBuildable(typeof(SchemaGroups))] + [ModelReaderWriterBuildable(typeof(SchemaVersions))] + public partial class AzureDataSchemaRegistryContext : ModelReaderWriterContext + { + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs new file mode 100644 index 000000000000..d444682c786f --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Data.SchemaRegistry.Models +{ + internal static partial class SchemaContentTypeValuesExtensions + { + /// The value to serialize. + public static string ToSerialString(this SchemaContentTypeValues value) => value switch + { + SchemaContentTypeValues.Avro => "application/json; serialization=Avro", + SchemaContentTypeValues.Json => "application/json; serialization=Json", + SchemaContentTypeValues.Custom => "text/plain; charset=utf-8", + SchemaContentTypeValues.Protobuf => "text/vnd.ms.protobuf", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SchemaContentTypeValues value.") + }; + + /// The value to deserialize. + public static SchemaContentTypeValues ToSchemaContentTypeValues(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "application/json; serialization=Avro")) + { + return SchemaContentTypeValues.Avro; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "application/json; serialization=Json")) + { + return SchemaContentTypeValues.Json; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "text/plain; charset=utf-8")) + { + return SchemaContentTypeValues.Custom; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "text/vnd.ms.protobuf")) + { + return SchemaContentTypeValues.Protobuf; + } + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SchemaContentTypeValues value."); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs new file mode 100644 index 000000000000..9b21e1199703 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Data.SchemaRegistry.Models +{ + /// Describes closed list of schema content type values. + internal enum SchemaContentTypeValues + { + /// Avro encoding. + Avro, + /// JSON encoding. + Json, + /// Plain text custom encoding. + Custom, + /// Protobuf encoding. + Protobuf + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs new file mode 100644 index 000000000000..561f0295c464 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs @@ -0,0 +1,189 @@ +// 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.Data.SchemaRegistry; + +namespace Azure.Data.SchemaRegistry.Models +{ + /// The list of schema group names with server paging support. + internal partial class SchemaGroups : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SchemaGroups() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchemaGroups)} does not support writing '{format}' format."); + } + writer.WritePropertyName("Value"u8); + writer.WriteStartArray(); + foreach (string item in Value) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("NextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SchemaGroups IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SchemaGroups JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchemaGroups)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchemaGroups(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SchemaGroups DeserializeSchemaGroups(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("Value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + value = array; + continue; + } + if (prop.NameEquals("NextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SchemaGroups(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureDataSchemaRegistryContext.Default); + default: + throw new FormatException($"The model {nameof(SchemaGroups)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SchemaGroups IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SchemaGroups PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSchemaGroups(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchemaGroups)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator SchemaGroups(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSchemaGroups(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs new file mode 100644 index 000000000000..45a467c17e24 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Data.SchemaRegistry.Models +{ + /// The list of schema group names with server paging support. + internal partial class SchemaGroups + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The collection of pageable schema group name items. + internal SchemaGroups(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The collection of pageable schema group name items. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchemaGroups(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The collection of pageable schema group name items. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs new file mode 100644 index 000000000000..6a31375839ed --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs @@ -0,0 +1,177 @@ +// 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.Data.SchemaRegistry; + +namespace Azure.Data.SchemaRegistry.Models +{ + /// The list of schema versions with server paging support. + internal partial class SchemaVersions : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SchemaVersions() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchemaVersions)} does not support writing '{format}' format."); + } + writer.WritePropertyName("Value"u8); + writer.WriteStartArray(); + foreach (int item in Value) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("NextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SchemaVersions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SchemaVersions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchemaVersions)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchemaVersions(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SchemaVersions DeserializeSchemaVersions(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("Value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + value = array; + continue; + } + if (prop.NameEquals("NextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SchemaVersions(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureDataSchemaRegistryContext.Default); + default: + throw new FormatException($"The model {nameof(SchemaVersions)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SchemaVersions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SchemaVersions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSchemaVersions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchemaVersions)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator SchemaVersions(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSchemaVersions(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs new file mode 100644 index 000000000000..32916c706348 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Data.SchemaRegistry.Models +{ + /// The list of schema versions with server paging support. + internal partial class SchemaVersions + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The collection of schema version pageable items. + internal SchemaVersions(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The collection of schema version pageable items. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchemaVersions(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The collection of schema version pageable items. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs new file mode 100644 index 000000000000..667eae734d79 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; + +namespace Azure.Data.SchemaRegistry +{ + /// + public partial class SchemaRegistryClient + { + private static ResponseClassifier _pipelineMessageClassifier200; + private static ResponseClassifier _pipelineMessageClassifier204; + + private static ResponseClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = new StatusCodeClassifier(stackalloc ushort[] { 200 }); + + private static ResponseClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 = new StatusCodeClassifier(stackalloc ushort[] { 204 }); + + internal HttpMessage CreateGetSchemaGroupsRequest(RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/$schemaGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetSchemaGroupsRequest(Uri nextPage, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSchemaVersionsRequest(string groupName, string schemaName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/$schemaGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetSchemaVersionsRequest(Uri nextPage, string groupName, string schemaName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSchemaByIdRequest(string id, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/$schemaGroups/$schemas/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json; serialization=Avro, application/json; serialization=Json, text/plain; charset=utf-8, text/vnd.ms.protobuf"); + return message; + } + + internal HttpMessage CreateGetSchemaByVersionRequest(string groupName, string schemaName, int schemaVersion, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/$schemaGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(schemaVersion.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json; serialization=Avro, application/json; serialization=Json, text/plain; charset=utf-8, text/vnd.ms.protobuf"); + return message; + } + + internal HttpMessage CreateGetSchemaPropertiesByContentRequest(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/$schemaGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath(":get-id", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", contentType); + request.Content = content; + return message; + } + + internal HttpMessage CreateRegisterSchemaRequest(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/$schemaGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", contentType); + request.Content = content; + return message; + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs new file mode 100644 index 000000000000..41de26afeb30 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + /// SchemaRegistryClient is a client for registering and retrieving schemas from the Azure Schema Registry service. + public partial class SchemaRegistryClient + { + private readonly Uri _endpoint; + /// A credential used to authenticate to the service. + private readonly TokenCredential _tokenCredential; + private static readonly string[] AuthorizationScopes = new string[] { "https://eventhubs.azure.net/.default" }; + private readonly string _apiVersion; + + /// Initializes a new instance of SchemaRegistryClient for mocking. + protected SchemaRegistryClient() + { + } + + /// Initializes a new instance of SchemaRegistryClient. + /// The Schema Registry service endpoint, for example 'my-namespace.servicebus.windows.net'. + /// A credential used to authenticate to the service. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public SchemaRegistryClient(string fullyQualifiedNamespace, TokenCredential credential) : this(fullyQualifiedNamespace, credential, new SchemaRegistryClientOptions()) + { + } + + /// Initializes a new instance of SchemaRegistryClient. + /// The Schema Registry service endpoint, for example 'my-namespace.servicebus.windows.net'. + /// A credential used to authenticate to the service. + /// The options for configuring the client. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public SchemaRegistryClient(string fullyQualifiedNamespace, TokenCredential credential, SchemaRegistryClientOptions options) + { + Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace)); + Argument.AssertNotNull(credential, nameof(credential)); + + options ??= new SchemaRegistryClientOptions(); + + _endpoint = new Uri($"https://{fullyQualifiedNamespace}"); + _tokenCredential = credential; + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }); + _apiVersion = options.Version; + ClientDiagnostics = new ClientDiagnostics(options, true); + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// + /// [Protocol Method] Gets the list of schema groups user is authorized to access. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, 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. + internal virtual Pageable GetSchemaGroups(RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); + scope.Start(); + try + { + return new SchemaRegistryClientGetSchemaGroupsCollectionResult(this, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets the list of schema groups user is authorized to access. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, 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. + internal virtual AsyncPageable GetSchemaGroupsAsync(RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); + scope.Start(); + try + { + return new SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult(this, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the list of schema groups user is authorized to access. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual Pageable GetSchemaGroups(CancellationToken cancellationToken = default) + { + return new SchemaRegistryClientGetSchemaGroupsCollectionResultOfT(this, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + } + + /// Gets the list of schema groups user is authorized to access. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual AsyncPageable GetSchemaGroupsAsync(CancellationToken cancellationToken = default) + { + return new SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT(this, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + } + + /// + /// [Protocol Method] Gets the list of all versions of one schema. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// The request options, 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. + internal virtual Pageable GetSchemaVersions(string groupName, string schemaName, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); + scope.Start(); + try + { + return new SchemaRegistryClientGetSchemaVersionsCollectionResult(this, groupName, schemaName, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets the list of all versions of one schema. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// The request options, 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. + internal virtual AsyncPageable GetSchemaVersionsAsync(string groupName, string schemaName, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); + scope.Start(); + try + { + return new SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult(this, groupName, schemaName, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the list of all versions of one schema. + /// Name of schema group. + /// Name of schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual Pageable GetSchemaVersions(string groupName, string schemaName, CancellationToken cancellationToken = default) + { + return new SchemaRegistryClientGetSchemaVersionsCollectionResultOfT(this, groupName, schemaName, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + } + + /// Gets the list of all versions of one schema. + /// Name of schema group. + /// Name of schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual AsyncPageable GetSchemaVersionsAsync(string groupName, string schemaName, CancellationToken cancellationToken = default) + { + return new SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT(this, groupName, schemaName, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + } + + /// + /// [Protocol Method] Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Schema ID that uniquely identifies a schema in the registry namespace. + /// The request options, 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. + internal virtual Response GetSchemaById(string id, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaById"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSchemaByIdRequest(id, context); + return Pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Schema ID that uniquely identifies a schema in the registry namespace. + /// The request options, 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. + internal virtual async Task GetSchemaByIdAsync(string id, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaById"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSchemaByIdRequest(id, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. + /// Schema ID that uniquely identifies a schema in the registry namespace. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual Response GetSchemaById(string id, CancellationToken cancellationToken = default) + { + Response result = GetSchemaById(id, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + return Response.FromValue(result.Content, result); + } + + /// Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. + /// Schema ID that uniquely identifies a schema in the registry namespace. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual async Task> GetSchemaByIdAsync(string id, CancellationToken cancellationToken = default) + { + Response result = await GetSchemaByIdAsync(id, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); + return Response.FromValue(result.Content, result); + } + + /// + /// [Protocol Method] Gets one specific version of one schema. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// Version number of specific schema. + /// The request options, 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. + internal virtual Response GetSchemaByVersion(string groupName, string schemaName, int schemaVersion, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaByVersion"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSchemaByVersionRequest(groupName, schemaName, schemaVersion, context); + return Pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets one specific version of one schema. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// Version number of specific schema. + /// The request options, 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. + internal virtual async Task GetSchemaByVersionAsync(string groupName, string schemaName, int schemaVersion, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaByVersion"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSchemaByVersionRequest(groupName, schemaName, schemaVersion, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets one specific version of one schema. + /// Name of schema group. + /// Name of schema. + /// Version number of specific schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual Response GetSchemaByVersion(string groupName, string schemaName, int schemaVersion, CancellationToken cancellationToken = default) + { + Response result = GetSchemaByVersion(groupName, schemaName, schemaVersion, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + return Response.FromValue(result.Content, result); + } + + /// Gets one specific version of one schema. + /// Name of schema group. + /// Name of schema. + /// Version number of specific schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual async Task> GetSchemaByVersionAsync(string groupName, string schemaName, int schemaVersion, CancellationToken cancellationToken = default) + { + Response result = await GetSchemaByVersionAsync(groupName, schemaName, schemaVersion, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); + return Response.FromValue(result.Content, result); + } + + /// + /// [Protocol Method] Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// The content to send as the body of the request. + /// The request options, 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. + internal virtual Response GetSchemaPropertiesByContent(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaPropertiesByContent"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSchemaPropertiesByContentRequest(groupName, schemaName, contentType, content, context); + return Pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// The content to send as the body of the request. + /// The request options, 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. + internal virtual async Task GetSchemaPropertiesByContentAsync(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaPropertiesByContent"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSchemaPropertiesByContentRequest(groupName, schemaName, contentType, content, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// String representation (UTF-8) of the schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual Response GetSchemaPropertiesByContent(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) + { + return GetSchemaPropertiesByContent(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + } + + /// Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// String representation (UTF-8) of the schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual async Task GetSchemaPropertiesByContentAsync(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) + { + return await GetSchemaPropertiesByContentAsync(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); + } + + /// + /// [Protocol Method] Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// The content to send as the body of the request. + /// The request options, 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. + internal virtual Response RegisterSchema(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.RegisterSchema"); + scope.Start(); + try + { + using HttpMessage message = CreateRegisterSchemaRequest(groupName, schemaName, contentType, content, context); + return Pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// The content to send as the body of the request. + /// The request options, 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. + internal virtual async Task RegisterSchemaAsync(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.RegisterSchema"); + scope.Start(); + try + { + using HttpMessage message = CreateRegisterSchemaRequest(groupName, schemaName, contentType, content, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// String representation (UTF-8) of the schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual Response RegisterSchema(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) + { + return RegisterSchema(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); + } + + /// Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. + /// Name of schema group. + /// Name of schema. + /// The content type for given schema. + /// String representation (UTF-8) of the schema. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + internal virtual async Task RegisterSchemaAsync(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) + { + return await RegisterSchemaAsync(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs new file mode 100644 index 000000000000..34aa778160a2 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics.CodeAnalysis; +using Azure.Core.Extensions; +using Azure.Data.SchemaRegistry; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add clients to . + public static partial class SchemaRegistryClientBuilderExtensions + { + /// Registers a client with the specified . + /// The builder to register with. + /// The Schema Registry service endpoint, for example 'my-namespace.servicebus.windows.net'. + /// is null. + /// is an empty string, and was expected to be non-empty. + public static IAzureClientBuilder AddSchemaRegistryClient(this TBuilder builder, string fullyQualifiedNamespace) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace)); + + return builder.RegisterClientFactory((options, credential) => new SchemaRegistryClient(fullyQualifiedNamespace, credential, options)); + } + + /// Registers a client with the specified . + /// The builder to register with. + /// The configuration to use for the client. + [RequiresUnreferencedCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] + [RequiresDynamicCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] + public static IAzureClientBuilder AddSchemaRegistryClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs new file mode 100644 index 000000000000..84f0e20a84f2 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult : AsyncPageable + { + private readonly SchemaRegistryClient _client; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SchemaGroups result = (SchemaGroups)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(BinaryData.FromObjectAsJson(item)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..808cce2b0b15 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT : AsyncPageable + { + private readonly SchemaRegistryClient _client; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SchemaGroups result = (SchemaGroups)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs new file mode 100644 index 000000000000..f4d6f3e6718b --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaGroupsCollectionResult : Pageable + { + private readonly SchemaRegistryClient _client; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsCollectionResult, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public SchemaRegistryClientGetSchemaGroupsCollectionResult(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaGroupsCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaGroupsCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SchemaGroups result = (SchemaGroups)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(BinaryData.FromObjectAsJson(item)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs new file mode 100644 index 000000000000..d35a440e111c --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaGroupsCollectionResultOfT : Pageable + { + private readonly SchemaRegistryClient _client; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public SchemaRegistryClientGetSchemaGroupsCollectionResultOfT(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaGroupsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaGroupsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SchemaGroups result = (SchemaGroups)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs new file mode 100644 index 000000000000..21c080eeac18 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult : AsyncPageable + { + private readonly SchemaRegistryClient _client; + private readonly string _groupName; + private readonly string _schemaName; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// Name of schema group. + /// Name of schema. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + _client = client; + _groupName = groupName; + _schemaName = schemaName; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SchemaVersions result = (SchemaVersions)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(BinaryData.FromObjectAsJson(item)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..6c5bd9de152e --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT : AsyncPageable + { + private readonly SchemaRegistryClient _client; + private readonly string _groupName; + private readonly string _schemaName; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// Name of schema group. + /// Name of schema. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + _client = client; + _groupName = groupName; + _schemaName = schemaName; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SchemaVersions result = (SchemaVersions)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs new file mode 100644 index 000000000000..441b14d475b9 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaVersionsCollectionResult : Pageable + { + private readonly SchemaRegistryClient _client; + private readonly string _groupName; + private readonly string _schemaName; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsCollectionResult, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// Name of schema group. + /// Name of schema. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SchemaRegistryClientGetSchemaVersionsCollectionResult(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + _client = client; + _groupName = groupName; + _schemaName = schemaName; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaVersionsCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaVersionsCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SchemaVersions result = (SchemaVersions)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(BinaryData.FromObjectAsJson(item)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs new file mode 100644 index 000000000000..cde2e5762d6c --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Data.SchemaRegistry.Models; + +namespace Azure.Data.SchemaRegistry +{ + internal partial class SchemaRegistryClientGetSchemaVersionsCollectionResultOfT : Pageable + { + private readonly SchemaRegistryClient _client; + private readonly string _groupName; + private readonly string _schemaName; + private readonly RequestContext _context; + + /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The SchemaRegistryClient client used to send requests. + /// Name of schema group. + /// Name of schema. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SchemaRegistryClientGetSchemaVersionsCollectionResultOfT(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); + + _client = client; + _groupName = groupName; + _schemaName = schemaName; + _context = context; + } + + /// Gets the pages of SchemaRegistryClientGetSchemaVersionsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SchemaRegistryClientGetSchemaVersionsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SchemaVersions result = (SchemaVersions)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs new file mode 100644 index 000000000000..e856951e57f0 --- /dev/null +++ b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Data.SchemaRegistry +{ + /// Client options for . + public partial class SchemaRegistryClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2023_07_01; + + /// Initializes a new instance of SchemaRegistryClientOptions. + /// The service version. + public SchemaRegistryClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2021_10 => "2021-10", + ServiceVersion.V2022_10 => "2022-10", + ServiceVersion.V2023_07_01 => "2023-07-01", + _ => throw new NotSupportedException() + }; + } + + /// Gets the Version. + internal string Version { get; } + + /// The version of the service to use. + public enum ServiceVersion + { + /// Azure Schema Registry 2021-10 Version. + V2021_10 = 1, + /// Azure Schema Registry 2022-10 Version. + V2022_10 = 2, + /// Azure Schema Registry 2023-07-01 Version. This is the default version. + V2023_07_01 = 3 + } + } +} From 314f4140151257ab515857005f680538db248a37 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Sep 2025 13:39:10 +0800 Subject: [PATCH 3/5] clean up --- .../Azure.Data.SchemaRegistry.sln | 48 -- .../src/Azure.Data.SchemaRegistry.csproj | 25 - .../src/Generated/Internal/Argument.cs | 74 --- .../Internal/ChangeTrackingDictionary.cs | 189 ------ .../Generated/Internal/ChangeTrackingList.cs | 168 ------ .../Internal/ClientPipelineExtensions.cs | 72 --- .../Internal/CodeGenMemberAttribute.cs | 20 - .../Internal/CodeGenSerializationAttribute.cs | 48 -- .../Internal/CodeGenSuppressAttribute.cs | 29 - .../Internal/CodeGenTypeAttribute.cs | 24 - .../src/Generated/Internal/ErrorResult.cs | 32 -- .../Internal/ModelSerializationExtensions.cs | 258 --------- .../src/Generated/Internal/Optional.cs | 51 -- .../Internal/RequestContextExtensions.cs | 26 - .../src/Generated/Internal/TypeFormatters.cs | 152 ----- .../Models/AzureDataSchemaRegistryContext.cs | 24 - .../SchemaContentTypeValues.Serialization.cs | 46 -- .../Models/SchemaContentTypeValues.cs | 22 - .../Models/SchemaGroups.Serialization.cs | 189 ------ .../src/Generated/Models/SchemaGroups.cs | 44 -- .../Models/SchemaVersions.Serialization.cs | 177 ------ .../src/Generated/Models/SchemaVersions.cs | 44 -- .../SchemaRegistryClient.RestClient.cs | 151 ----- .../src/Generated/SchemaRegistryClient.cs | 543 ------------------ .../SchemaRegistryClientBuilderExtensions.cs | 42 -- ...entGetSchemaGroupsAsyncCollectionResult.cs | 80 --- ...GetSchemaGroupsAsyncCollectionResultOfT.cs | 75 --- ...ryClientGetSchemaGroupsCollectionResult.cs | 79 --- ...lientGetSchemaGroupsCollectionResultOfT.cs | 74 --- ...tGetSchemaVersionsAsyncCollectionResult.cs | 91 --- ...tSchemaVersionsAsyncCollectionResultOfT.cs | 86 --- ...ClientGetSchemaVersionsCollectionResult.cs | 90 --- ...entGetSchemaVersionsCollectionResultOfT.cs | 85 --- .../Generated/SchemaRegistryClientOptions.cs | 45 -- 34 files changed, 3203 deletions(-) delete mode 100644 @azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln delete mode 100644 @azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs delete mode 100644 @azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs diff --git a/@azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln b/@azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln deleted file mode 100644 index 525c49f3a8c6..000000000000 --- a/@azure-typespec/http-client-csharp/Azure.Data.SchemaRegistry.sln +++ /dev/null @@ -1,48 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Data.SchemaRegistry", "src\Azure.Data.SchemaRegistry.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} - EndGlobalSection -EndGlobal diff --git a/@azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj b/@azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj deleted file mode 100644 index 85b738042061..000000000000 --- a/@azure-typespec/http-client-csharp/src/Azure.Data.SchemaRegistry.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - This is the Azure.Data.SchemaRegistry client library for developing .NET applications with rich experience. - SDK Code Generation Azure.Data.SchemaRegistry - 1.0.0-beta.1 - Azure.Data.SchemaRegistry - true - - - - - - - - - - - - - - - - - - diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs deleted file mode 100644 index 92b5cd8448b7..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/Argument.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Azure.Data.SchemaRegistry -{ - internal static partial class Argument - { - /// The value. - /// The name. - public static void AssertNotNull(T value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNull(T? value, string name) - where T : struct - { - if (!value.HasValue) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(IEnumerable value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value is ICollection collectionOfT && collectionOfT.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - if (value is ICollection collection && collection.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - using IEnumerator e = value.GetEnumerator(); - if (!e.MoveNext()) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value.Length == 0) - { - throw new ArgumentException("Value cannot be an empty string.", name); - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs deleted file mode 100644 index 0f98a07b9b08..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingDictionary.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary - where TKey : notnull - { - private IDictionary _innerDictionary; - - public ChangeTrackingDictionary() - { - } - - /// The inner dictionary. - public ChangeTrackingDictionary(IDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(dictionary); - } - - /// The inner dictionary. - public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(); - foreach (var pair in dictionary) - { - _innerDictionary.Add(pair); - } - } - - /// Gets the IsUndefined. - public bool IsUndefined => _innerDictionary == null; - - /// Gets the Count. - public int Count => IsUndefined ? 0 : EnsureDictionary().Count; - - /// Gets the IsReadOnly. - public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; - - /// Gets the Keys. - public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; - - /// Gets the Values. - public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; - - /// Gets or sets the value associated with the specified key. - public TValue this[TKey key] - { - get - { - if (IsUndefined) - { - throw new KeyNotFoundException(nameof(key)); - } - return EnsureDictionary()[key]; - } - set - { - EnsureDictionary()[key] = value; - } - } - - /// Gets the Keys. - IEnumerable IReadOnlyDictionary.Keys => Keys; - - /// Gets the Values. - IEnumerable IReadOnlyDictionary.Values => Values; - - public IEnumerator> GetEnumerator() - { - if (IsUndefined) - { - IEnumerator> enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureDictionary().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// The item to add. - public void Add(KeyValuePair item) - { - EnsureDictionary().Add(item); - } - - public void Clear() - { - EnsureDictionary().Clear(); - } - - /// The item to search for. - public bool Contains(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Contains(item); - } - - /// The array to copy. - /// The index. - public void CopyTo(KeyValuePair[] array, int index) - { - if (IsUndefined) - { - return; - } - EnsureDictionary().CopyTo(array, index); - } - - /// The item to remove. - public bool Remove(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(item); - } - - /// The key. - /// The value to add. - public void Add(TKey key, TValue value) - { - EnsureDictionary().Add(key, value); - } - - /// The key to search for. - public bool ContainsKey(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().ContainsKey(key); - } - - /// The key. - public bool Remove(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(key); - } - - /// The key to search for. - /// The value. - public bool TryGetValue(TKey key, out TValue value) - { - if (IsUndefined) - { - value = default; - return false; - } - return EnsureDictionary().TryGetValue(key, out value); - } - - public IDictionary EnsureDictionary() - { - return _innerDictionary ??= new Dictionary(); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs deleted file mode 100644 index a2421736259e..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/ChangeTrackingList.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class ChangeTrackingList : IList, IReadOnlyList - { - private IList _innerList; - - public ChangeTrackingList() - { - } - - /// The inner list. - public ChangeTrackingList(IList innerList) - { - if (innerList != null) - { - _innerList = innerList; - } - } - - /// The inner list. - public ChangeTrackingList(IReadOnlyList innerList) - { - if (innerList != null) - { - _innerList = innerList.ToList(); - } - } - - /// Gets the IsUndefined. - public bool IsUndefined => _innerList == null; - - /// Gets the Count. - public int Count => IsUndefined ? 0 : EnsureList().Count; - - /// Gets the IsReadOnly. - public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; - - /// Gets or sets the value associated with the specified key. - public T this[int index] - { - get - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - return EnsureList()[index]; - } - set - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList()[index] = value; - } - } - - public void Reset() - { - _innerList = null; - } - - public IEnumerator GetEnumerator() - { - if (IsUndefined) - { - IEnumerator enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureList().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// The item to add. - public void Add(T item) - { - EnsureList().Add(item); - } - - public void Clear() - { - EnsureList().Clear(); - } - - /// The item. - public bool Contains(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Contains(item); - } - - /// The array to copy to. - /// The array index. - public void CopyTo(T[] array, int arrayIndex) - { - if (IsUndefined) - { - return; - } - EnsureList().CopyTo(array, arrayIndex); - } - - /// The item. - public bool Remove(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Remove(item); - } - - /// The item. - public int IndexOf(T item) - { - if (IsUndefined) - { - return -1; - } - return EnsureList().IndexOf(item); - } - - /// The inner list. - /// The item. - public void Insert(int index, T item) - { - EnsureList().Insert(index, item); - } - - /// The inner list. - public void RemoveAt(int index) - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList().RemoveAt(index); - } - - public IList EnsureList() - { - return _innerList ??= new List(); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs deleted file mode 100644 index c518bae0338d..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/ClientPipelineExtensions.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Data.SchemaRegistry -{ - internal static partial class ClientPipelineExtensions - { - public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) - { - (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); - await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); - - if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) - { - throw new RequestFailedException(message.Response); - } - - return message.Response; - } - - public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) - { - (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); - pipeline.Send(message, userCancellationToken); - - if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) - { - throw new RequestFailedException(message.Response); - } - - return message.Response; - } - - public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) - { - Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - switch (response.Status) - { - case >= 200 and < 300: - return Response.FromValue(true, response); - case >= 400 and < 500: - return Response.FromValue(false, response); - default: - return new ErrorResult(response, new RequestFailedException(response)); - } - } - - public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) - { - Response response = pipeline.ProcessMessage(message, context); - switch (response.Status) - { - case >= 200 and < 300: - return Response.FromValue(true, response); - case >= 400 and < 500: - return Response.FromValue(false, response); - default: - return new ErrorResult(response, new RequestFailedException(response)); - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs deleted file mode 100644 index db095f49188c..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenMemberAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Data.SchemaRegistry -{ - [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] - internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute - { - /// The original name of the member. - public CodeGenMemberAttribute(string originalName) : base(originalName) - { - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs deleted file mode 100644 index 7b3a72060417..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSerializationAttribute.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Data.SchemaRegistry -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] - internal partial class CodeGenSerializationAttribute : Attribute - { - /// The property name which these hooks apply to. - public CodeGenSerializationAttribute(string propertyName) - { - PropertyName = propertyName; - } - - /// The property name which these hooks apply to. - /// The serialization name of the property. - public CodeGenSerializationAttribute(string propertyName, string propertySerializationName) - { - PropertyName = propertyName; - PropertySerializationName = propertySerializationName; - } - - /// Gets or sets the property name which these hooks should apply to. - public string PropertyName { get; } - - /// Gets or sets the serialization name of the property. - public string PropertySerializationName { get; set; } - - /// - /// Gets or sets the method name to use when serializing the property value (property name excluded). - /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); - /// - public string SerializationValueHook { get; set; } - - /// - /// Gets or sets the method name to use when deserializing the property value from the JSON. - /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required - /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional - /// - public string DeserializationValueHook { get; set; } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs deleted file mode 100644 index d23f48e3f23c..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenSuppressAttribute.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Data.SchemaRegistry -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] - internal partial class CodeGenSuppressAttribute : Attribute - { - /// The member to suppress. - /// The types of the parameters of the member. - public CodeGenSuppressAttribute(string member, params Type[] parameters) - { - Member = member; - Parameters = parameters; - } - - /// Gets the Member. - public string Member { get; } - - /// Gets the Parameters. - public Type[] Parameters { get; } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs deleted file mode 100644 index 70b3e4e25256..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/CodeGenTypeAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Data.SchemaRegistry -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] - internal partial class CodeGenTypeAttribute : Attribute - { - /// The original name of the type. - public CodeGenTypeAttribute(string originalName) - { - OriginalName = originalName; - } - - /// Gets the OriginalName. - public string OriginalName { get; } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs deleted file mode 100644 index a8ca31b0e5c4..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/ErrorResult.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class ErrorResult : Response - { - private readonly Response _response; - private readonly RequestFailedException _exception; - - public ErrorResult(Response response, RequestFailedException exception) - { - _response = response; - _exception = exception; - } - - /// Gets the Value. - public override T Value => throw _exception; - - /// - public override Response GetRawResponse() - { - return _response; - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs deleted file mode 100644 index f17d377f7062..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/ModelSerializationExtensions.cs +++ /dev/null @@ -1,258 +0,0 @@ -// 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.Diagnostics; -using System.Globalization; -using System.Text.Json; - -namespace Azure.Data.SchemaRegistry -{ - internal static partial class ModelSerializationExtensions - { - internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions - { - MaxDepth = 256 - }; - - public static object GetObject(this JsonElement element) - { - switch (element.ValueKind) - { - case JsonValueKind.String: - return element.GetString(); - case JsonValueKind.Number: - if (element.TryGetInt32(out int intValue)) - { - return intValue; - } - if (element.TryGetInt64(out long longValue)) - { - return longValue; - } - return element.GetDouble(); - case JsonValueKind.True: - return true; - case JsonValueKind.False: - return false; - case JsonValueKind.Undefined: - case JsonValueKind.Null: - return null; - case JsonValueKind.Object: - Dictionary dictionary = new Dictionary(); - foreach (var jsonProperty in element.EnumerateObject()) - { - dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); - } - return dictionary; - case JsonValueKind.Array: - List list = new List(); - foreach (var item in element.EnumerateArray()) - { - list.Add(item.GetObject()); - } - return list.ToArray(); - default: - throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); - } - } - - public static byte[] GetBytesFromBase64(this JsonElement element, string format) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - - return format switch - { - "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), - "D" => element.GetBytesFromBase64(), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - } - - public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch - { - "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), - _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) - }; - - public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); - - public static char GetChar(this JsonElement element) - { - if (element.ValueKind == JsonValueKind.String) - { - string text = element.GetString(); - if (text == null || text.Length != 1) - { - throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); - } - return text[0]; - } - else - { - throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); - } - } - - [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) - { - throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); - } - - public static string GetRequiredString(this JsonElement element) - { - string value = element.GetString(); - if (value == null) - { - throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); - } - return value; - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, char value) - { - writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); - } - - public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) - { - if (value == null) - { - writer.WriteNullValue(); - return; - } - switch (format) - { - case "U": - writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); - break; - case "D": - writer.WriteBase64StringValue(value); - break; - default: - throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); - } - } - - public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - if (format != "U") - { - throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); - } - writer.WriteNumberValue(value.ToUnixTimeSeconds()); - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) - { - switch (value) - { - case null: - writer.WriteNullValue(); - break; - case IJsonModel jsonModel: - jsonModel.Write(writer, options ?? WireOptions); - break; - case byte[] bytes: - writer.WriteBase64StringValue(bytes); - break; - case BinaryData bytes0: - writer.WriteBase64StringValue(bytes0); - break; - case JsonElement json: - json.WriteTo(writer); - break; - case int i: - writer.WriteNumberValue(i); - break; - case decimal d: - writer.WriteNumberValue(d); - break; - case double d0: - if (double.IsNaN(d0)) - { - writer.WriteStringValue("NaN"); - } - else - { - writer.WriteNumberValue(d0); - } - break; - case float f: - writer.WriteNumberValue(f); - break; - case long l: - writer.WriteNumberValue(l); - break; - case string s: - writer.WriteStringValue(s); - break; - case bool b: - writer.WriteBooleanValue(b); - break; - case Guid g: - writer.WriteStringValue(g); - break; - case DateTimeOffset dateTimeOffset: - writer.WriteStringValue(dateTimeOffset, "O"); - break; - case DateTime dateTime: - writer.WriteStringValue(dateTime, "O"); - break; - case IEnumerable> enumerable: - writer.WriteStartObject(); - foreach (var pair in enumerable) - { - writer.WritePropertyName(pair.Key); - writer.WriteObjectValue(pair.Value, options); - } - writer.WriteEndObject(); - break; - case IEnumerable objectEnumerable: - writer.WriteStartArray(); - foreach (var item in objectEnumerable) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - break; - case TimeSpan timeSpan: - writer.WriteStringValue(timeSpan, "P"); - break; - default: - throw new NotSupportedException($"Not supported type {value.GetType()}"); - } - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) - { - writer.WriteObjectValue(value, options); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs deleted file mode 100644 index 5bba373a1ca7..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/Optional.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; - -namespace Azure.Data.SchemaRegistry -{ - internal static partial class Optional - { - public static bool IsCollectionDefined(IEnumerable collection) - { - return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); - } - - public static bool IsCollectionDefined(IDictionary collection) - { - return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); - } - - public static bool IsCollectionDefined(IReadOnlyDictionary collection) - { - return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); - } - - public static bool IsDefined(T? value) - where T : struct - { - return value.HasValue; - } - - public static bool IsDefined(object value) - { - return value != null; - } - - public static bool IsDefined(string value) - { - return value != null; - } - - public static bool IsDefined(JsonElement value) - { - return value.ValueKind != JsonValueKind.Undefined; - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs deleted file mode 100644 index eee08a69baf1..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/RequestContextExtensions.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Azure; - -namespace Azure.Data.SchemaRegistry -{ - internal static partial class RequestContextExtensions - { - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - public static ValueTuple Parse(this RequestContext context) - { - if (context == null) - { - return (CancellationToken.None, ErrorOptions.Default); - } - return (context.CancellationToken, context.ErrorOptions); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs b/@azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs deleted file mode 100644 index cad23b55d4d6..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Internal/TypeFormatters.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; - -namespace Azure.Data.SchemaRegistry -{ - internal static partial class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => System.Xml.XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; - int size = checked (numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => System.Xml.XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => System.Xml.XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs deleted file mode 100644 index 755f550ac609..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/AzureDataSchemaRegistryContext.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using Azure; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - /// - /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information - /// - [ModelReaderWriterBuildable(typeof(ResponseError))] - [ModelReaderWriterBuildable(typeof(SchemaGroups))] - [ModelReaderWriterBuildable(typeof(SchemaVersions))] - public partial class AzureDataSchemaRegistryContext : ModelReaderWriterContext - { - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs deleted file mode 100644 index d444682c786f..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Data.SchemaRegistry.Models -{ - internal static partial class SchemaContentTypeValuesExtensions - { - /// The value to serialize. - public static string ToSerialString(this SchemaContentTypeValues value) => value switch - { - SchemaContentTypeValues.Avro => "application/json; serialization=Avro", - SchemaContentTypeValues.Json => "application/json; serialization=Json", - SchemaContentTypeValues.Custom => "text/plain; charset=utf-8", - SchemaContentTypeValues.Protobuf => "text/vnd.ms.protobuf", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SchemaContentTypeValues value.") - }; - - /// The value to deserialize. - public static SchemaContentTypeValues ToSchemaContentTypeValues(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "application/json; serialization=Avro")) - { - return SchemaContentTypeValues.Avro; - } - if (StringComparer.OrdinalIgnoreCase.Equals(value, "application/json; serialization=Json")) - { - return SchemaContentTypeValues.Json; - } - if (StringComparer.OrdinalIgnoreCase.Equals(value, "text/plain; charset=utf-8")) - { - return SchemaContentTypeValues.Custom; - } - if (StringComparer.OrdinalIgnoreCase.Equals(value, "text/vnd.ms.protobuf")) - { - return SchemaContentTypeValues.Protobuf; - } - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SchemaContentTypeValues value."); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs deleted file mode 100644 index 9b21e1199703..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaContentTypeValues.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Data.SchemaRegistry.Models -{ - /// Describes closed list of schema content type values. - internal enum SchemaContentTypeValues - { - /// Avro encoding. - Avro, - /// JSON encoding. - Json, - /// Plain text custom encoding. - Custom, - /// Protobuf encoding. - Protobuf - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs deleted file mode 100644 index 561f0295c464..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.Serialization.cs +++ /dev/null @@ -1,189 +0,0 @@ -// 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.Data.SchemaRegistry; - -namespace Azure.Data.SchemaRegistry.Models -{ - /// The list of schema group names with server paging support. - internal partial class SchemaGroups : IJsonModel - { - /// Initializes a new instance of for deserialization. - internal SchemaGroups() - { - } - - /// The JSON writer. - /// The client options for reading and writing models. - 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) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SchemaGroups)} does not support writing '{format}' format."); - } - writer.WritePropertyName("Value"u8); - writer.WriteStartArray(); - foreach (string item in Value) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("NextLink"u8); - writer.WriteStringValue(NextLink.AbsoluteUri); - } - if (options.Format != "W" && _additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - /// The JSON reader. - /// The client options for reading and writing models. - SchemaGroups IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - - /// The JSON reader. - /// The client options for reading and writing models. - protected virtual SchemaGroups JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SchemaGroups)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSchemaGroups(document.RootElement, options); - } - - /// The JSON element to deserialize. - /// The client options for reading and writing models. - internal static SchemaGroups DeserializeSchemaGroups(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList value = default; - Uri nextLink = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("Value"u8)) - { - List array = new List(); - foreach (var item in prop.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(item.GetString()); - } - } - value = array; - continue; - } - if (prop.NameEquals("NextLink"u8)) - { - if (prop.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nextLink = new Uri(prop.Value.GetString()); - continue; - } - if (options.Format != "W") - { - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - } - return new SchemaGroups(value, nextLink, additionalBinaryDataProperties); - } - - /// The client options for reading and writing models. - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - - /// The client options for reading and writing models. - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureDataSchemaRegistryContext.Default); - default: - throw new FormatException($"The model {nameof(SchemaGroups)} does not support writing '{options.Format}' format."); - } - } - - /// The data to parse. - /// The client options for reading and writing models. - SchemaGroups IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - - /// The data to parse. - /// The client options for reading and writing models. - protected virtual SchemaGroups PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data)) - { - return DeserializeSchemaGroups(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SchemaGroups)} does not support reading '{options.Format}' format."); - } - } - - /// The client options for reading and writing models. - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator SchemaGroups(Response result) - { - using Response response = result; - using JsonDocument document = JsonDocument.Parse(response.Content); - return DeserializeSchemaGroups(document.RootElement, ModelSerializationExtensions.WireOptions); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs deleted file mode 100644 index 45a467c17e24..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaGroups.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Data.SchemaRegistry.Models -{ - /// The list of schema group names with server paging support. - internal partial class SchemaGroups - { - /// Keeps track of any properties unknown to the library. - private protected readonly IDictionary _additionalBinaryDataProperties; - - /// Initializes a new instance of . - /// The collection of pageable schema group name items. - internal SchemaGroups(IEnumerable value) - { - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// The collection of pageable schema group name items. - /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal SchemaGroups(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) - { - Value = value; - NextLink = nextLink; - _additionalBinaryDataProperties = additionalBinaryDataProperties; - } - - /// The collection of pageable schema group name items. - public IList Value { get; } - - /// The link to the next page of items. - public Uri NextLink { get; } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs deleted file mode 100644 index 6a31375839ed..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.Serialization.cs +++ /dev/null @@ -1,177 +0,0 @@ -// 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.Data.SchemaRegistry; - -namespace Azure.Data.SchemaRegistry.Models -{ - /// The list of schema versions with server paging support. - internal partial class SchemaVersions : IJsonModel - { - /// Initializes a new instance of for deserialization. - internal SchemaVersions() - { - } - - /// The JSON writer. - /// The client options for reading and writing models. - 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) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SchemaVersions)} does not support writing '{format}' format."); - } - writer.WritePropertyName("Value"u8); - writer.WriteStartArray(); - foreach (int item in Value) - { - writer.WriteNumberValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("NextLink"u8); - writer.WriteStringValue(NextLink.AbsoluteUri); - } - if (options.Format != "W" && _additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - /// The JSON reader. - /// The client options for reading and writing models. - SchemaVersions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - - /// The JSON reader. - /// The client options for reading and writing models. - protected virtual SchemaVersions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SchemaVersions)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSchemaVersions(document.RootElement, options); - } - - /// The JSON element to deserialize. - /// The client options for reading and writing models. - internal static SchemaVersions DeserializeSchemaVersions(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList value = default; - Uri nextLink = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("Value"u8)) - { - List array = new List(); - foreach (var item in prop.Value.EnumerateArray()) - { - array.Add(item.GetInt32()); - } - value = array; - continue; - } - if (prop.NameEquals("NextLink"u8)) - { - if (prop.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nextLink = new Uri(prop.Value.GetString()); - continue; - } - if (options.Format != "W") - { - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - } - return new SchemaVersions(value, nextLink, additionalBinaryDataProperties); - } - - /// The client options for reading and writing models. - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - - /// The client options for reading and writing models. - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureDataSchemaRegistryContext.Default); - default: - throw new FormatException($"The model {nameof(SchemaVersions)} does not support writing '{options.Format}' format."); - } - } - - /// The data to parse. - /// The client options for reading and writing models. - SchemaVersions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - - /// The data to parse. - /// The client options for reading and writing models. - protected virtual SchemaVersions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data)) - { - return DeserializeSchemaVersions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SchemaVersions)} does not support reading '{options.Format}' format."); - } - } - - /// The client options for reading and writing models. - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// The to deserialize the from. - public static explicit operator SchemaVersions(Response result) - { - using Response response = result; - using JsonDocument document = JsonDocument.Parse(response.Content); - return DeserializeSchemaVersions(document.RootElement, ModelSerializationExtensions.WireOptions); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs b/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs deleted file mode 100644 index 32916c706348..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/Models/SchemaVersions.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Data.SchemaRegistry.Models -{ - /// The list of schema versions with server paging support. - internal partial class SchemaVersions - { - /// Keeps track of any properties unknown to the library. - private protected readonly IDictionary _additionalBinaryDataProperties; - - /// Initializes a new instance of . - /// The collection of schema version pageable items. - internal SchemaVersions(IEnumerable value) - { - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// The collection of schema version pageable items. - /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal SchemaVersions(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) - { - Value = value; - NextLink = nextLink; - _additionalBinaryDataProperties = additionalBinaryDataProperties; - } - - /// The collection of schema version pageable items. - public IList Value { get; } - - /// The link to the next page of items. - public Uri NextLink { get; } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs deleted file mode 100644 index 667eae734d79..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.RestClient.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure; -using Azure.Core; - -namespace Azure.Data.SchemaRegistry -{ - /// - public partial class SchemaRegistryClient - { - private static ResponseClassifier _pipelineMessageClassifier200; - private static ResponseClassifier _pipelineMessageClassifier204; - - private static ResponseClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = new StatusCodeClassifier(stackalloc ushort[] { 200 }); - - private static ResponseClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 = new StatusCodeClassifier(stackalloc ushort[] { 204 }); - - internal HttpMessage CreateGetSchemaGroupsRequest(RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/$schemaGroups", false); - uri.AppendQuery("api-version", _apiVersion, true); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Get; - request.Headers.SetValue("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateNextGetSchemaGroupsRequest(Uri nextPage, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(nextPage); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Get; - request.Headers.SetValue("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSchemaVersionsRequest(string groupName, string schemaName, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/$schemaGroups/", false); - uri.AppendPath(groupName, true); - uri.AppendPath("/schemas/", false); - uri.AppendPath(schemaName, true); - uri.AppendPath("/versions", false); - uri.AppendQuery("api-version", _apiVersion, true); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Get; - request.Headers.SetValue("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateNextGetSchemaVersionsRequest(Uri nextPage, string groupName, string schemaName, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(nextPage); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Get; - request.Headers.SetValue("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSchemaByIdRequest(string id, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/$schemaGroups/$schemas/", false); - uri.AppendPath(id, true); - uri.AppendQuery("api-version", _apiVersion, true); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Get; - request.Headers.SetValue("Accept", "application/json; serialization=Avro, application/json; serialization=Json, text/plain; charset=utf-8, text/vnd.ms.protobuf"); - return message; - } - - internal HttpMessage CreateGetSchemaByVersionRequest(string groupName, string schemaName, int schemaVersion, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/$schemaGroups/", false); - uri.AppendPath(groupName, true); - uri.AppendPath("/schemas/", false); - uri.AppendPath(schemaName, true); - uri.AppendPath("/versions/", false); - uri.AppendPath(schemaVersion.ToString(), true); - uri.AppendQuery("api-version", _apiVersion, true); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Get; - request.Headers.SetValue("Accept", "application/json; serialization=Avro, application/json; serialization=Json, text/plain; charset=utf-8, text/vnd.ms.protobuf"); - return message; - } - - internal HttpMessage CreateGetSchemaPropertiesByContentRequest(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/$schemaGroups/", false); - uri.AppendPath(groupName, true); - uri.AppendPath("/schemas/", false); - uri.AppendPath(schemaName, true); - uri.AppendPath(":get-id", false); - uri.AppendQuery("api-version", _apiVersion, true); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Post; - request.Headers.SetValue("Content-Type", contentType); - request.Content = content; - return message; - } - - internal HttpMessage CreateRegisterSchemaRequest(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context) - { - RawRequestUriBuilder uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/$schemaGroups/", false); - uri.AppendPath(groupName, true); - uri.AppendPath("/schemas/", false); - uri.AppendPath(schemaName, true); - uri.AppendQuery("api-version", _apiVersion, true); - HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); - Request request = message.Request; - request.Uri = uri; - request.Method = RequestMethod.Put; - request.Headers.SetValue("Content-Type", contentType); - request.Content = content; - return message; - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs deleted file mode 100644 index 41de26afeb30..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClient.cs +++ /dev/null @@ -1,543 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - /// SchemaRegistryClient is a client for registering and retrieving schemas from the Azure Schema Registry service. - public partial class SchemaRegistryClient - { - private readonly Uri _endpoint; - /// A credential used to authenticate to the service. - private readonly TokenCredential _tokenCredential; - private static readonly string[] AuthorizationScopes = new string[] { "https://eventhubs.azure.net/.default" }; - private readonly string _apiVersion; - - /// Initializes a new instance of SchemaRegistryClient for mocking. - protected SchemaRegistryClient() - { - } - - /// Initializes a new instance of SchemaRegistryClient. - /// The Schema Registry service endpoint, for example 'my-namespace.servicebus.windows.net'. - /// A credential used to authenticate to the service. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public SchemaRegistryClient(string fullyQualifiedNamespace, TokenCredential credential) : this(fullyQualifiedNamespace, credential, new SchemaRegistryClientOptions()) - { - } - - /// Initializes a new instance of SchemaRegistryClient. - /// The Schema Registry service endpoint, for example 'my-namespace.servicebus.windows.net'. - /// A credential used to authenticate to the service. - /// The options for configuring the client. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public SchemaRegistryClient(string fullyQualifiedNamespace, TokenCredential credential, SchemaRegistryClientOptions options) - { - Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace)); - Argument.AssertNotNull(credential, nameof(credential)); - - options ??= new SchemaRegistryClientOptions(); - - _endpoint = new Uri($"https://{fullyQualifiedNamespace}"); - _tokenCredential = credential; - Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }); - _apiVersion = options.Version; - ClientDiagnostics = new ClientDiagnostics(options, true); - } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get; } - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// - /// [Protocol Method] Gets the list of schema groups user is authorized to access. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The request options, 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. - internal virtual Pageable GetSchemaGroups(RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); - scope.Start(); - try - { - return new SchemaRegistryClientGetSchemaGroupsCollectionResult(this, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the list of schema groups user is authorized to access. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The request options, 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. - internal virtual AsyncPageable GetSchemaGroupsAsync(RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); - scope.Start(); - try - { - return new SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult(this, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the list of schema groups user is authorized to access. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual Pageable GetSchemaGroups(CancellationToken cancellationToken = default) - { - return new SchemaRegistryClientGetSchemaGroupsCollectionResultOfT(this, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - } - - /// Gets the list of schema groups user is authorized to access. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual AsyncPageable GetSchemaGroupsAsync(CancellationToken cancellationToken = default) - { - return new SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT(this, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - } - - /// - /// [Protocol Method] Gets the list of all versions of one schema. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// The request options, 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. - internal virtual Pageable GetSchemaVersions(string groupName, string schemaName, RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); - scope.Start(); - try - { - return new SchemaRegistryClientGetSchemaVersionsCollectionResult(this, groupName, schemaName, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the list of all versions of one schema. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// The request options, 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. - internal virtual AsyncPageable GetSchemaVersionsAsync(string groupName, string schemaName, RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); - scope.Start(); - try - { - return new SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult(this, groupName, schemaName, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the list of all versions of one schema. - /// Name of schema group. - /// Name of schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual Pageable GetSchemaVersions(string groupName, string schemaName, CancellationToken cancellationToken = default) - { - return new SchemaRegistryClientGetSchemaVersionsCollectionResultOfT(this, groupName, schemaName, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - } - - /// Gets the list of all versions of one schema. - /// Name of schema group. - /// Name of schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual AsyncPageable GetSchemaVersionsAsync(string groupName, string schemaName, CancellationToken cancellationToken = default) - { - return new SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT(this, groupName, schemaName, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - } - - /// - /// [Protocol Method] Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Schema ID that uniquely identifies a schema in the registry namespace. - /// The request options, 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. - internal virtual Response GetSchemaById(string id, RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaById"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSchemaByIdRequest(id, context); - return Pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Schema ID that uniquely identifies a schema in the registry namespace. - /// The request options, 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. - internal virtual async Task GetSchemaByIdAsync(string id, RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaById"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSchemaByIdRequest(id, context); - return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. - /// Schema ID that uniquely identifies a schema in the registry namespace. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual Response GetSchemaById(string id, CancellationToken cancellationToken = default) - { - Response result = GetSchemaById(id, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - return Response.FromValue(result.Content, result); - } - - /// Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. Operation response type is based on serialization of schema requested. - /// Schema ID that uniquely identifies a schema in the registry namespace. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual async Task> GetSchemaByIdAsync(string id, CancellationToken cancellationToken = default) - { - Response result = await GetSchemaByIdAsync(id, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); - return Response.FromValue(result.Content, result); - } - - /// - /// [Protocol Method] Gets one specific version of one schema. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// Version number of specific schema. - /// The request options, 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. - internal virtual Response GetSchemaByVersion(string groupName, string schemaName, int schemaVersion, RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaByVersion"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSchemaByVersionRequest(groupName, schemaName, schemaVersion, context); - return Pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets one specific version of one schema. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// Version number of specific schema. - /// The request options, 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. - internal virtual async Task GetSchemaByVersionAsync(string groupName, string schemaName, int schemaVersion, RequestContext context) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaByVersion"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSchemaByVersionRequest(groupName, schemaName, schemaVersion, context); - return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets one specific version of one schema. - /// Name of schema group. - /// Name of schema. - /// Version number of specific schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual Response GetSchemaByVersion(string groupName, string schemaName, int schemaVersion, CancellationToken cancellationToken = default) - { - Response result = GetSchemaByVersion(groupName, schemaName, schemaVersion, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - return Response.FromValue(result.Content, result); - } - - /// Gets one specific version of one schema. - /// Name of schema group. - /// Name of schema. - /// Version number of specific schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual async Task> GetSchemaByVersionAsync(string groupName, string schemaName, int schemaVersion, CancellationToken cancellationToken = default) - { - Response result = await GetSchemaByVersionAsync(groupName, schemaName, schemaVersion, cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); - return Response.FromValue(result.Content, result); - } - - /// - /// [Protocol Method] Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// The content to send as the body of the request. - /// The request options, 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. - internal virtual Response GetSchemaPropertiesByContent(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaPropertiesByContent"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSchemaPropertiesByContentRequest(groupName, schemaName, contentType, content, context); - return Pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// The content to send as the body of the request. - /// The request options, 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. - internal virtual async Task GetSchemaPropertiesByContentAsync(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaPropertiesByContent"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSchemaPropertiesByContentRequest(groupName, schemaName, contentType, content, context); - return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// String representation (UTF-8) of the schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual Response GetSchemaPropertiesByContent(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) - { - return GetSchemaPropertiesByContent(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - } - - /// Gets the properties referencing an existing schema within the specified schema group, as matched by schema content comparison. - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// String representation (UTF-8) of the schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual async Task GetSchemaPropertiesByContentAsync(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) - { - return await GetSchemaPropertiesByContentAsync(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); - } - - /// - /// [Protocol Method] Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// The content to send as the body of the request. - /// The request options, 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. - internal virtual Response RegisterSchema(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.RegisterSchema"); - scope.Start(); - try - { - using HttpMessage message = CreateRegisterSchemaRequest(groupName, schemaName, contentType, content, context); - return Pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// The content to send as the body of the request. - /// The request options, 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. - internal virtual async Task RegisterSchemaAsync(string groupName, string schemaName, string contentType, RequestContent content, RequestContext context = null) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope("SchemaRegistryClient.RegisterSchema"); - scope.Start(); - try - { - using HttpMessage message = CreateRegisterSchemaRequest(groupName, schemaName, contentType, content, context); - return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// String representation (UTF-8) of the schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual Response RegisterSchema(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) - { - return RegisterSchema(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null); - } - - /// Register new schema. If schema of specified name does not exist in specified group, schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. - /// Name of schema group. - /// Name of schema. - /// The content type for given schema. - /// String representation (UTF-8) of the schema. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - internal virtual async Task RegisterSchemaAsync(string groupName, string schemaName, SchemaContentTypeValues contentType, BinaryData schemaContent, CancellationToken cancellationToken = default) - { - return await RegisterSchemaAsync(groupName, schemaName, contentType.ToSerialString(), RequestContent.Create(schemaContent), cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null).ConfigureAwait(false); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs deleted file mode 100644 index 34aa778160a2..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientBuilderExtensions.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Diagnostics.CodeAnalysis; -using Azure.Core.Extensions; -using Azure.Data.SchemaRegistry; - -namespace Microsoft.Extensions.Azure -{ - /// Extension methods to add clients to . - public static partial class SchemaRegistryClientBuilderExtensions - { - /// Registers a client with the specified . - /// The builder to register with. - /// The Schema Registry service endpoint, for example 'my-namespace.servicebus.windows.net'. - /// is null. - /// is an empty string, and was expected to be non-empty. - public static IAzureClientBuilder AddSchemaRegistryClient(this TBuilder builder, string fullyQualifiedNamespace) - where TBuilder : IAzureClientFactoryBuilderWithCredential - { - Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace)); - - return builder.RegisterClientFactory((options, credential) => new SchemaRegistryClient(fullyQualifiedNamespace, credential, options)); - } - - /// Registers a client with the specified . - /// The builder to register with. - /// The configuration to use for the client. - [RequiresUnreferencedCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] - [RequiresDynamicCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] - public static IAzureClientBuilder AddSchemaRegistryClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration - { - return builder.RegisterClientFactory(configuration); - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs deleted file mode 100644 index 84f0e20a84f2..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult : AsyncPageable - { - private readonly SchemaRegistryClient _client; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) - { - _client = client; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResult as an enumerable collection. - public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); - if (response is null) - { - yield break; - } - SchemaGroups result = (SchemaGroups)response; - List items = new List(); - foreach (var item in result.Value) - { - items.Add(BinaryData.FromObjectAsJson(item)); - } - yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); - scope.Start(); - try - { - return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs deleted file mode 100644 index 808cce2b0b15..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT : AsyncPageable - { - private readonly SchemaRegistryClient _client; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) - { - _client = client; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaGroupsAsyncCollectionResultOfT as an enumerable collection. - public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); - if (response is null) - { - yield break; - } - SchemaGroups result = (SchemaGroups)response; - yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); - scope.Start(); - try - { - return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs deleted file mode 100644 index f4d6f3e6718b..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResult.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaGroupsCollectionResult : Pageable - { - private readonly SchemaRegistryClient _client; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsCollectionResult, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SchemaRegistryClientGetSchemaGroupsCollectionResult(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) - { - _client = client; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaGroupsCollectionResult as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaGroupsCollectionResult as an enumerable collection. - public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = GetNextResponse(pageSizeHint, nextPage); - if (response is null) - { - yield break; - } - SchemaGroups result = (SchemaGroups)response; - List items = new List(); - foreach (var item in result.Value) - { - items.Add(BinaryData.FromObjectAsJson(item)); - } - yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private Response GetNextResponse(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); - scope.Start(); - try - { - return _client.Pipeline.ProcessMessage(message, _context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs deleted file mode 100644 index d35a440e111c..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaGroupsCollectionResultOfT.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaGroupsCollectionResultOfT : Pageable - { - private readonly SchemaRegistryClient _client; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaGroupsCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public SchemaRegistryClientGetSchemaGroupsCollectionResultOfT(SchemaRegistryClient client, RequestContext context) : base(context?.CancellationToken ?? default) - { - _client = client; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaGroupsCollectionResultOfT as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaGroupsCollectionResultOfT as an enumerable collection. - public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = GetNextResponse(pageSizeHint, nextPage); - if (response is null) - { - yield break; - } - SchemaGroups result = (SchemaGroups)response; - yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private Response GetNextResponse(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaGroupsRequest(nextLink, _context) : _client.CreateGetSchemaGroupsRequest(_context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaGroups"); - scope.Start(); - try - { - return _client.Pipeline.ProcessMessage(message, _context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs deleted file mode 100644 index 21c080eeac18..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult : AsyncPageable - { - private readonly SchemaRegistryClient _client; - private readonly string _groupName; - private readonly string _schemaName; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// Name of schema group. - /// Name of schema. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) - { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); - Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); - - _client = client; - _groupName = groupName; - _schemaName = schemaName; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResult as an enumerable collection. - public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); - if (response is null) - { - yield break; - } - SchemaVersions result = (SchemaVersions)response; - List items = new List(); - foreach (var item in result.Value) - { - items.Add(BinaryData.FromObjectAsJson(item)); - } - yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); - scope.Start(); - try - { - return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs deleted file mode 100644 index 6c5bd9de152e..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT : AsyncPageable - { - private readonly SchemaRegistryClient _client; - private readonly string _groupName; - private readonly string _schemaName; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// Name of schema group. - /// Name of schema. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) - { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); - Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); - - _client = client; - _groupName = groupName; - _schemaName = schemaName; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaVersionsAsyncCollectionResultOfT as an enumerable collection. - public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); - if (response is null) - { - yield break; - } - SchemaVersions result = (SchemaVersions)response; - yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); - scope.Start(); - try - { - return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs deleted file mode 100644 index 441b14d475b9..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResult.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaVersionsCollectionResult : Pageable - { - private readonly SchemaRegistryClient _client; - private readonly string _groupName; - private readonly string _schemaName; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsCollectionResult, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// Name of schema group. - /// Name of schema. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public SchemaRegistryClientGetSchemaVersionsCollectionResult(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) - { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); - Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); - - _client = client; - _groupName = groupName; - _schemaName = schemaName; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaVersionsCollectionResult as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaVersionsCollectionResult as an enumerable collection. - public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = GetNextResponse(pageSizeHint, nextPage); - if (response is null) - { - yield break; - } - SchemaVersions result = (SchemaVersions)response; - List items = new List(); - foreach (var item in result.Value) - { - items.Add(BinaryData.FromObjectAsJson(item)); - } - yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private Response GetNextResponse(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); - scope.Start(); - try - { - return _client.Pipeline.ProcessMessage(message, _context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs deleted file mode 100644 index cde2e5762d6c..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientGetSchemaVersionsCollectionResultOfT.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Data.SchemaRegistry.Models; - -namespace Azure.Data.SchemaRegistry -{ - internal partial class SchemaRegistryClientGetSchemaVersionsCollectionResultOfT : Pageable - { - private readonly SchemaRegistryClient _client; - private readonly string _groupName; - private readonly string _schemaName; - private readonly RequestContext _context; - - /// Initializes a new instance of SchemaRegistryClientGetSchemaVersionsCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The SchemaRegistryClient client used to send requests. - /// Name of schema group. - /// Name of schema. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public SchemaRegistryClientGetSchemaVersionsCollectionResultOfT(SchemaRegistryClient client, string groupName, string schemaName, RequestContext context) : base(context?.CancellationToken ?? default) - { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); - Argument.AssertNotNullOrEmpty(schemaName, nameof(schemaName)); - - _client = client; - _groupName = groupName; - _schemaName = schemaName; - _context = context; - } - - /// Gets the pages of SchemaRegistryClientGetSchemaVersionsCollectionResultOfT as an enumerable collection. - /// A continuation token indicating where to resume paging. - /// The number of items per page. - /// The pages of SchemaRegistryClientGetSchemaVersionsCollectionResultOfT as an enumerable collection. - public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) - { - Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; - while (true) - { - Response response = GetNextResponse(pageSizeHint, nextPage); - if (response is null) - { - yield break; - } - SchemaVersions result = (SchemaVersions)response; - yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); - nextPage = result.NextLink; - if (nextPage == null) - { - yield break; - } - } - } - - /// Get next page. - /// The number of items per page. - /// The next link to use for the next page of results. - private Response GetNextResponse(int? pageSizeHint, Uri nextLink) - { - HttpMessage message = nextLink != null ? _client.CreateNextGetSchemaVersionsRequest(nextLink, _groupName, _schemaName, _context) : _client.CreateGetSchemaVersionsRequest(_groupName, _schemaName, _context); - using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SchemaRegistryClient.GetSchemaVersions"); - scope.Start(); - try - { - return _client.Pipeline.ProcessMessage(message, _context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs b/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs deleted file mode 100644 index e856951e57f0..000000000000 --- a/@azure-typespec/http-client-csharp/src/Generated/SchemaRegistryClientOptions.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Data.SchemaRegistry -{ - /// Client options for . - public partial class SchemaRegistryClientOptions : ClientOptions - { - private const ServiceVersion LatestVersion = ServiceVersion.V2023_07_01; - - /// Initializes a new instance of SchemaRegistryClientOptions. - /// The service version. - public SchemaRegistryClientOptions(ServiceVersion version = LatestVersion) - { - Version = version switch - { - ServiceVersion.V2021_10 => "2021-10", - ServiceVersion.V2022_10 => "2022-10", - ServiceVersion.V2023_07_01 => "2023-07-01", - _ => throw new NotSupportedException() - }; - } - - /// Gets the Version. - internal string Version { get; } - - /// The version of the service to use. - public enum ServiceVersion - { - /// Azure Schema Registry 2021-10 Version. - V2021_10 = 1, - /// Azure Schema Registry 2022-10 Version. - V2022_10 = 2, - /// Azure Schema Registry 2023-07-01 Version. This is the default version. - V2023_07_01 = 3 - } - } -} From 43d1774f5bbc7f49a91abeb81e72bc711eb7dc03 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Sep 2025 14:05:40 +0800 Subject: [PATCH 4/5] regen code --- .../tsp-location.yaml | 2 +- .../Azure.ResourceManager.StorageActions/tsp-location.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml b/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml index 6295849a543f..838e91283818 100644 --- a/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml +++ b/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/portalservices/CopilotSettings.Management -commit: a6b58db4a5390da2098e7c238758f2c4617c2542 +commit: d5f63f49431cd1175dcf18b1c1a8f7a7a415d445 repo: Azure/azure-rest-api-specs emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml b/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml index 4ec277e7fdaa..a30e82532b33 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storageactions/StorageAction.Management -commit: 34dbcd13a20458705a4d3529c66466b3bb16da08 +commit: d5f63f49431cd1175dcf18b1c1a8f7a7a415d445 repo: Azure/azure-rest-api-specs emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" From 3cf69bd55a6807360acd5a1db72168b2f34b8e04 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 17 Sep 2025 15:24:00 +0800 Subject: [PATCH 5/5] update commit id --- .../tsp-location.yaml | 2 +- .../Azure.ResourceManager.StorageActions/tsp-location.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml b/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml index 838e91283818..7cdb190f79b8 100644 --- a/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml +++ b/sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/portalservices/CopilotSettings.Management -commit: d5f63f49431cd1175dcf18b1c1a8f7a7a415d445 +commit: c90b62daed903080ed53766cefd53b6df2621cc6 repo: Azure/azure-rest-api-specs emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml b/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml index a30e82532b33..837598030fff 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/storageactions/StorageAction.Management -commit: d5f63f49431cd1175dcf18b1c1a8f7a7a415d445 +commit: c90b62daed903080ed53766cefd53b6df2621cc6 repo: Azure/azure-rest-api-specs emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json"