From 14743b5bf18cb23588f49cdaf42169be11922427 Mon Sep 17 00:00:00 2001 From: Mary Gao Date: Wed, 24 Apr 2024 16:53:11 +0800 Subject: [PATCH] Sync latest main back to feature lro v3 branch (#2464) * deprecate-baseurl-in-favor-of-endpoint (#2246) * deprecate-baseurl-in-favor-of-endpoint * codegen change * fix integration test and unit test * update smoke-test && merge main * revert smoke-test-list * update * revert change * update * update * update * update * Revert "update" This reverts commit 02967a1b398c4d1f7a9d4d488106599254141c81. * update * fix ci * rename endpoint parameter * update (#15) * update test --------- Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> * Support usage and access (#2356) * support-usage-and-access * add generate orphan models options * test push code to pr * add test case for clientGeneratorCore access and usage * rename public as operation name for now * fix integration test * add modular test case and remove duplicate case * regenerate all test * regenerate rlc test * fix ci --------- Co-authored-by: Jiao Di (MSFT) <80496810+v-jiaodi@users.noreply.github.com> * Support server versions in modular and add cadl-ranch test cases (#2261) * add modular server versions * fix version param global calculation * fix api version in operation logic * fix versioned test * fix ci * fix ci * add rlc server versions in this pr * revert smoke test * should only have client side api version if api version exists in all operations * fix batch * fix ut * unify api version when it exists in all operations * fix smoke test * fix ci * fix parameters * fix ci * add ut for api version in modular * Update packages/typespec-ts/test/modularUnit/apiOperations.spec.ts * fix ut * reserve work * generate client level required apiVersion * handle api-version in both url and query * fix ci * should not export apiVersion in operation level signature when it has default value * Update packages/typespec-ts/src/modular/helpers/operationHelpers.ts * fix integration test * fix smoke-test * regen smoke-test * regen cadl test case * add ut and fix smoke test * resolve comments --------- Co-authored-by: qiaozha Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> * Add coverage cases for Server NotDefined in cadl-ranch (#2370) * Supplement server endpoint not-defined * update cadl-ranch version * bump cadl ranch version regen code * Add coverage cases for Azure Core Scalar in cadl-ranch (#2369) * Supplement azure core scalar * update test case * remove .only in test case * update test case * fix easm build failure (#2379) * add easm test case * Fix the core model renaming due to enableModelNamespace option enabled * update * update * remove easm --------- Co-authored-by: Mary Gao * Upgrade the emitter version in April (#2395) * Upgrade the emitter version * Update the changelog * Update the changelog * Update the changelog * Update packages/autorest.typescript/CHANGELOG.md * Update packages/rlc-common/CHANGELOG.md * Update packages/typespec-ts/CHANGELOG.md --------- Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> * Fix missing scripts issue in package.json and bump emitter version (#2402) * fix rlc package.json script issue * Update the Unit test * Update the changelog and regen smoke test * Update the issue number * Update the lock file --------- Co-authored-by: Mary Gao * Support special words (#2387) * support-special-words * update cadl ranch list * update * Update specialWords.spec.ts * design implementation * update test * Update nameUtils.spec.ts * update * fix naming if operation name duplicate * update typespec-test smoke-test * Update clientContext.spec.ts * fix-naming-parity-with-hlc (#17) * fix optional params * update rlc test * update non-branded-test * should not rename property name --------- Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> * Update specialWords.spec.ts (#2431) * Add rlc coverage cases for payload media type in cadl-ranch (#2265) * add rlc payload media type * rege code and remove .only in test case * update test case * Upgrade `mkdirp` to ^3.0.1 by doing a string replacement * Support server parameter in modular (#2424) * enable-modular-in-parameterized-host * support optional client parameter in modular * enable anomaly detector modular generation * fix ut * fix cadl ranch test case * fix smoke test * reserve work * fix anomaly detector api version missing * use camel case for file name in modular client * fix filename uppercase * fix client name upper case * resolve duplicate files * fix batch rename * fix rename in chatapi * fix rename for contentsafety * fix renaming in smoke test * fix renaming in integration test * fix batch rename * fix smoke-test * normalize name * fix non-branded case * fix ci * fix ci * Add modular coverage cases for payload media type in cadl-ranch (#2266) * add modular payload media type * update test case * fix issus * use local dev version * update @azure-rest/core-client to 1.4.0 * regen code --------- Co-authored-by: Qiaoqiao Zhang * Fix the missing scripts issues and add test config (#2426) * Fix the missing scripts issues * add ut * update * update * fix ci * Remove the @azure-tools/vite-plugin-browser-test-map dependency * Added the browser config in azure mono repo * update smoke test * update --------- Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> * Upgrade generated packages to have `typescript@~5.4.5` * Extensible/fixed enum support & upgrade compiler to v0.55 (#2380) * Update the tcgc to latest dev * Fix build issue * Update the UTs * Update the enum and union cases * Update the extensible enum * Update the modular enum and union * regen code * Set the default flattenUnionAsEnum option * gen fixedEnums and extensibleEnums code * Enable the option flatten-union-as-enum as false for ts * Refactor rlc UTs * Regenerate the union cases in modular * update smoeke test * Update the UnitTest * update input usage * skip overload and generate code * Update the import issue * Disable the overload case * regen code * Upgrade to the latest * Revert overload * Resolve conflicts * Remove skipped cases * add union enum case * smoke test * regen integration code * Disable the server case * regen smoke test * enable server path multiple * rege integration code * rebuild server path multiple * Update the apiVerison fix * update lock file * lock file update * Update the extensible and fixed enum * update the changes * update deleted files * Regenerate smoke test * Resolve comments --------- Co-authored-by: Jiao Di (MSFT) <80496810+v-jiaodi@users.noreply.github.com> Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> * Update core client (#2441) * update core client * update format * fix ci error * Bump `typescript` version to ~5.4.5 in code generator packages * Upgrade `c8` version to ^9.1.0 in generated packages The c8 version azure-sdk-for-js repro has been upgraded to ^9.1.0 already. * Support additional properties full cases in RLC (#2445) * upgrade cadl-ranch version * update * fix rlc additional properties * update test case * update * update test case --------- Co-authored-by: qiaozha * 9.1.0 * Update the changelog and bump versions in mid April (#2452) * Update the changelog and bump versions * update the lock file * upgrade the tcgc to the latest stable * revert version * Downgrade to 18.19.x version * Downgrade to 18.19.x --------- Co-authored-by: Jiao Di (MSFT) <80496810+v-jiaodi@users.noreply.github.com> * add server test case for modular and rlc (#2457) * Document package-version in README.md (#2365) * Add encode bytes missing test (#2456) * add missing test * fix body parameter format --------- Co-authored-by: qiaozha * Replace `esm` dev dependency with `tsx` for js mono repo as we already switched to `tsx` in PR https://github.com/Azure/azure-sdk-for-js/pull/28826/files#diff-164a9ae95cf7571742ca1882b5fdc0a43e7000c271ff566de5e99ef2c2820021R34 * update unit test * use `dev-tool run extract-api` in packages generated for JS mono repo This follows the commit in JS repo: https://github.com/Azure/azure-sdk-for-js/commit/224f7c1c1493ad737b22fd58ae634ccad8cdd71b * update test baselines * fix unit tests * fix test * switch back to nyc * update unit test * add cancellationToken case (#2463) * add cancellationToken case * update * update to the latest * Update the smoke test code to the latest main * update the integration to latest main * update the latest modular int * Adopt change to latest main * Regen smoke and integration test * change the client name * Delete useless code * remove ut * update the integration for lro * Upgrade the tcgc to v0.41.3 (#2453) * Update the changelog and bump versions * update the lock file * upgrade the tcgc to the latest stable * update version * update version * upgrade tcgc * fix ci error * regen smoke test * Remove the hard coded template logic * regen integration and smoke test --------- Co-authored-by: Mary Gao * upgrade rush version (#2468) * merge to the latest feature branch * merge to the main * update the lock file * fix ci error --------- Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com> Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Co-authored-by: Jiao Di (MSFT) <80496810+v-jiaodi@users.noreply.github.com> Co-authored-by: qiaozha Co-authored-by: Jeremy Meng Co-authored-by: Jeremy Meng Co-authored-by: Max Horstmann --- .scripts/build.yml | 2 +- .scripts/ci.yml | 20 +- .scripts/release.yml | 24 +- .scripts/smoke-test.yml | 4 +- .vscode/launch.json | 3 +- common/config/rush/pnpm-lock.yaml | 532 ++++---- common/scripts/install-run-rush-pnpm.js | 5 +- common/scripts/install-run-rush.js | 12 +- common/scripts/install-run-rushx.js | 5 +- common/scripts/install-run.js | 210 ++- packages/autorest.typescript/CHANGELOG.md | 25 + packages/autorest.typescript/README.md | 3 + packages/autorest.typescript/package.json | 8 +- .../generators/static/packageFileGenerator.ts | 7 +- .../additionalProperties/package.json | 6 +- .../generated/appconfiguration/package.json | 6 +- .../appconfigurationexport/package.json | 6 +- .../generated/arrayConstraints/package.json | 6 +- .../generated/attestation/package.json | 6 +- .../azureParameterGrouping/package.json | 6 +- .../generated/azureReport/package.json | 6 +- .../azureSpecialProperties/package.json | 6 +- .../generated/bodyArray/package.json | 6 +- .../generated/bodyBoolean/package.json | 6 +- .../generated/bodyBooleanQuirks/package.json | 6 +- .../generated/bodyByte/package.json | 6 +- .../generated/bodyComplex/package.json | 6 +- .../bodyComplexWithTracing/package.json | 6 +- .../generated/bodyDate/package.json | 6 +- .../generated/bodyDateTime/package.json | 6 +- .../bodyDateTimeRfc1123/package.json | 6 +- .../generated/bodyDictionary/package.json | 6 +- .../generated/bodyDuration/package.json | 6 +- .../generated/bodyFile/package.json | 6 +- .../generated/bodyFormData/package.json | 6 +- .../generated/bodyInteger/package.json | 6 +- .../generated/bodyNumber/package.json | 6 +- .../generated/bodyString/package.json | 6 +- .../generated/bodyTime/package.json | 6 +- .../generated/constantParam/package.json | 6 +- .../generated/corecompattest/package.json | 6 +- .../generated/customUrl/package.json | 6 +- .../customUrlMoreOptions/package.json | 6 +- .../generated/customUrlPaging/package.json | 6 +- .../generated/datafactory/package.json | 6 +- .../generated/datalakestorage/package.json | 6 +- .../generated/datasearch/package.json | 6 +- .../deviceprovisioningservice/package.json | 6 +- .../generated/domainservices/package.json | 6 +- .../generated/extensibleEnums/package.json | 6 +- .../integration/generated/header/package.json | 6 +- .../generated/headerprefix/package.json | 6 +- .../generated/healthcareapis/package.json | 6 +- .../generated/httpInfrastructure/package.json | 6 +- .../generated/iotspaces/package.json | 6 +- .../generated/licenseHeader/package.json | 6 +- .../integration/generated/lro/package.json | 6 +- .../lroParametrizedEndpoints/package.json | 6 +- .../generated/mapperrequired/package.json | 6 +- .../generated/mediaTypes/package.json | 6 +- .../generated/mediaTypesV3/package.json | 6 +- .../generated/mediaTypesV3Lro/package.json | 6 +- .../mediaTypesWithTracing/package.json | 6 +- .../generated/modelFlattening/package.json | 6 +- .../multipleInheritance/package.json | 6 +- .../generated/nameChecker/package.json | 6 +- .../generated/noLicenseHeader/package.json | 6 +- .../generated/noMappers/package.json | 6 +- .../generated/noOperation/package.json | 6 +- .../generated/nonStringEnum/package.json | 6 +- .../generated/objectType/package.json | 6 +- .../generated/odataDiscriminator/package.json | 6 +- .../operationgroupclash/package.json | 6 +- .../generated/optionalnull/package.json | 6 +- .../integration/generated/paging/package.json | 6 +- .../generated/pagingNoIterators/package.json | 6 +- .../generated/patterntest/package.json | 6 +- .../generated/petstore/package.json | 6 +- .../generated/readmeFileChecker/package.json | 6 +- .../generated/regexConstraint/package.json | 6 +- .../integration/generated/report/package.json | 6 +- .../generated/requiredOptional/package.json | 6 +- .../generated/resources/package.json | 6 +- .../generated/sealedchoice/package.json | 6 +- .../generated/storageblob/package.json | 6 +- .../generated/storagefileshare/package.json | 6 +- .../subscriptionIdApiVersion/package.json | 6 +- .../generated/textanalytics/package.json | 6 +- .../integration/generated/url/package.json | 6 +- .../integration/generated/url2/package.json | 6 +- .../generated/urlMulti/package.json | 6 +- .../generated/useragentcorev1/package.json | 6 +- .../generated/useragentcorev2/package.json | 6 +- .../integration/generated/uuid/package.json | 6 +- .../generated/validation/package.json | 6 +- .../generated/xmlservice/package.json | 6 +- .../generated/xmsErrorResponses/package.json | 6 +- .../generated/azureReport/package.json | 6 +- .../generated/bodyComplexRest/package.json | 6 +- .../generated/bodyFileRest/package.json | 6 +- .../generated/bodyFormDataRest/package.json | 6 +- .../generated/bodyStringRest/package.json | 8 +- .../generated/customUrlRest/package.json | 6 +- .../generated/dpgCustomization/package.json | 17 +- .../generated/headerRest/package.json | 6 +- .../httpInfrastructureRest/package.json | 17 +- .../generated/lroRest/package.json | 6 +- .../generated/mediaTypesRest/package.json | 6 +- .../multipleInheritanceRest/package.json | 6 +- .../multipleUrlParameters/package.json | 17 +- .../generated/pagingRest/package.json | 6 +- .../generated/report/package.json | 4 +- .../generated/securityAADRest/package.json | 17 +- .../generated/securityKeyRest/package.json | 17 +- .../generated/urlRest/package.json | 6 +- .../agrifood-data-plane/package.json | 8 +- .../anomaly-detector-mv-rest/package.json | 6 +- .../anomaly-detector-rest/package.json | 8 +- .../package.json | 4 +- .../arm-package-features-2015-12/package.json | 4 +- .../arm-package-links-2016-09/package.json | 4 +- .../arm-package-locks-2016-09/package.json | 4 +- .../package.json | 4 +- .../arm-package-policy-2019-09/package.json | 4 +- .../package.json | 4 +- .../package.json | 6 +- .../compute-resource-manager/package.json | 6 +- .../cosmos-db-resource-manager/package.json | 4 +- .../graphrbac-data-plane/package.json | 4 +- .../keyvault-resource-manager/package.json | 6 +- .../generated/monitor-data-plane/package.json | 4 +- .../msi-resource-manager/package.json | 6 +- .../network-resource-manager/package.json | 6 +- .../package.json | 4 +- .../purview-administration-rest/package.json | 6 +- .../sql-resource-manager/package.json | 6 +- .../storage-resource-manager/package.json | 6 +- .../web-resource-manager/package.json | 6 +- .../generated/rlc-initial/package.json | 4 +- .../generated/rlc-updated/package.json | 4 +- packages/rlc-common/CHANGELOG.md | 29 + packages/rlc-common/package.json | 6 +- packages/rlc-common/src/buildClient.ts | 19 + packages/rlc-common/src/buildObjectTypes.ts | 18 +- .../rlc-common/src/helpers/importsUtil.ts | 6 +- packages/rlc-common/src/helpers/nameUtils.ts | 9 +- packages/rlc-common/src/index.ts | 1 + packages/rlc-common/src/interfaces.ts | 1 + .../src/metadata/buildBrowserConfig.ts | 42 + .../src/metadata/buildVitestConfig.ts | 8 - .../packageJson/azurePackageCommon.ts | 4 +- .../packageJson/buildAzureMonorepoPackage.ts | 19 +- .../src/metadata/packageJson/packageCommon.ts | 4 +- .../test/helpers/importsUtil.spec.ts | 2 +- .../rlc-common/test/helpers/nameUtils.spec.ts | 2 +- .../rlc-common/test/integration/mockHelper.ts | 50 + .../test/integration/packageJson.spec.ts | 105 +- .../test/integration/vitestConfig.spec.ts | 20 + packages/typespec-test/package.json | 24 +- .../generated/typespec-ts/package.json | 84 +- .../review/ai-anomaly-detector.api.md | 641 ++------- .../deleteMultivariateModelSample.ts | 30 - .../detectMultivariateBatchAnomalySample.ts | 37 - .../detectMultivariateLastAnomalySample.ts | 41 - .../detectUnivariateChangePointSample.ts | 38 - .../detectUnivariateEntireSeriesSample.ts | 40 - .../detectUnivariateLastPointSample.ts | 40 - ...tMultivariateBatchDetectionResultSample.ts | 30 - .../samples-dev/getMultivariateModelSample.ts | 30 - .../listMultivariateModelsSample.ts | 36 - .../trainMultivariateModelSample.ts | 61 - .../typespec-ts/src/anomalyDetectorClient.ts | 101 +- .../src/api/anomalyDetectorContext.ts | 41 + .../generated/typespec-ts/src/api/index.ts | 8 + .../typespec-ts/src/api/multivariate/index.ts | 833 ++++++++++++ .../typespec-ts/src/api/pagingHelpers.ts | 191 +++ .../typespec-ts/src/api/univariate/index.ts | 233 ++++ .../typespec-ts/src/classic/index.ts | 5 + .../src/classic/multivariate/index.ts | 107 ++ .../src/classic/univariate/index.ts | 61 + .../generated/typespec-ts/src/index.ts | 68 +- .../generated/typespec-ts/src/models/index.ts | 55 + .../typespec-ts/src/models/models.ts | 549 ++++++++ .../typespec-ts/src/models/options.ts | 39 + .../typespec-ts/src/models/pagingTypes.ts | 89 ++ .../src/rest/anomalyDetectorClient.ts | 59 + .../src/{ => rest}/clientDefinitions.ts | 2 +- .../generated/typespec-ts/src/rest/index.ts | 15 + .../src/{ => rest}/isUnexpected.ts | 0 .../typespec-ts/src/{ => rest}/models.ts | 71 +- .../src/{ => rest}/outputModels.ts | 55 +- .../src/{ => rest}/paginateHelper.ts | 0 .../typespec-ts/src/{ => rest}/parameters.ts | 0 .../typespec-ts/src/{ => rest}/responses.ts | 0 .../generated/typespec-ts/tsconfig.json | 5 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../test/anomalyDetector/tspconfig.yaml | 3 +- .../openapi/2022-05-15-preview/openapi.json | 12 +- .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/authoring.api.md | 118 +- .../typespec-ts/src/clientDefinitions.ts | 16 +- .../generated/typespec-ts/src/isUnexpected.ts | 34 +- .../generated/typespec-ts/src/models.ts | 11 +- .../generated/typespec-ts/src/outputModels.ts | 52 +- .../typespec-ts/src/pollingHelper.ts | 16 +- .../generated/typespec-ts/src/responses.ts | 24 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../generated/typespec-ts/review/batch.api.md | 509 +++---- .../api/{BatchContext.ts => batchContext.ts} | 4 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/operations.ts | 456 +++---- .../src/{BatchClient.ts => batchClient.ts} | 310 ++--- .../generated/typespec-ts/src/index.ts | 155 +-- .../generated/typespec-ts/src/models/index.ts | 153 +-- .../typespec-ts/src/models/models.ts | 252 ++-- .../typespec-ts/src/models/options.ts | 155 +-- .../generated/typespec-ts/src/rest/models.ts | 436 +++--- .../typespec-ts/src/rest/outputModels.ts | 677 ++++------ .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../review/ai-chat-protocol.api.md | 43 +- ...tocolContext.ts => chatProtocolContext.ts} | 4 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/operations.ts | 37 +- ...rotocolClient.ts => chatProtocolClient.ts} | 31 +- .../generated/typespec-ts/src/index.ts | 19 +- .../generated/typespec-ts/src/models/index.ts | 18 +- .../typespec-ts/src/models/models.ts | 61 +- .../typespec-ts/src/models/options.ts | 4 +- .../generated/typespec-ts/src/rest/models.ts | 11 +- .../typespec-ts/src/rest/outputModels.ts | 37 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../review/confidential-ledger.api.md | 22 +- .../generated/typespec-ts/src/models.ts | 5 +- .../generated/typespec-ts/src/outputModels.ts | 15 +- .../generated/typespec-ts/package.json | 6 +- .../review/ai-content-safety.api.md | 86 +- ...fetyContext.ts => contentSafetyContext.ts} | 9 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/operations.ts | 60 +- ...SafetyClient.ts => contentSafetyClient.ts} | 46 +- .../generated/typespec-ts/src/index.ts | 25 +- .../generated/typespec-ts/src/models/index.ts | 23 +- .../typespec-ts/src/models/models.ts | 35 +- .../typespec-ts/src/models/options.ts | 21 +- .../generated/typespec-ts/src/rest/models.ts | 29 +- .../typespec-ts/src/rest/outputModels.ts | 60 +- .../openapi/2022-11-01-preview/openapi.json | 3 +- .../generated/typespec-ts/package.json | 6 +- .../review/contosowidgetmanager-rest.api.md | 7 +- .../generated/typespec-ts/src/outputModels.ts | 23 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/eventgrid.api.md | 30 +- ...ventGridContext.ts => eventGridContext.ts} | 9 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/operations.ts | 36 +- ...{EventGridClient.ts => eventGridClient.ts} | 30 +- .../generated/typespec-ts/src/index.ts | 15 +- .../generated/typespec-ts/src/models/index.ts | 13 +- .../typespec-ts/src/models/models.ts | 3 + .../typespec-ts/src/models/options.ts | 12 +- .../typespec-ts/src/rest/outputModels.ts | 18 - .../typespec-ts/vitest.browser.config.ts | 1 - .../faceai/generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/ai-face-rest.api.md | 15 +- .../generated/typespec-ts/src/outputModels.ts | 25 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../health-insights-radiologyinsights.api.md | 192 ++- .../samples-dev/createJobSample.ts | 2 +- .../generated/typespec-ts/src/models.ts | 203 ++- .../generated/typespec-ts/src/outputModels.ts | 299 ++--- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../health-insights-clinicalmatching.api.md | 106 +- .../samples-dev/createJobSample.ts | 18 +- .../generated/typespec-ts/src/models.ts | 165 ++- .../generated/typespec-ts/src/outputModels.ts | 73 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../review/hierarchy-generic.api.md | 20 +- .../typespec-ts/src/api/b/c/index.ts | 6 +- .../typespec-ts/src/api/b/e/c/index.ts | 6 +- .../generated/typespec-ts/src/api/b/index.ts | 6 +- .../generated/typespec-ts/src/api/d/index.ts | 6 +- .../src/api/{FooContext.ts => fooContext.ts} | 0 .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/operations.ts | 6 +- .../typespec-ts/src/classic/b/c/index.ts | 9 +- .../typespec-ts/src/classic/b/e/c/index.ts | 9 +- .../typespec-ts/src/classic/b/e/index.ts | 2 +- .../typespec-ts/src/classic/b/index.ts | 9 +- .../typespec-ts/src/classic/d/index.ts | 8 +- .../src/{FooClient.ts => fooClient.ts} | 9 +- .../generated/typespec-ts/src/index.ts | 12 +- .../generated/typespec-ts/src/models/index.ts | 10 +- .../typespec-ts/src/models/options.ts | 10 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/openapi/2022-11-01/openapi.json | 15 +- .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/load-testing.api.md | 118 +- ...dTestAdministrationUploadTestFileSample.ts | 2 +- ...dTestRunListMetricDimensionValuesSample.ts | 2 +- .../loadTestRunListMetricsSample.ts | 2 +- .../generated/typespec-ts/src/models.ts | 110 +- .../generated/typespec-ts/src/outputModels.ts | 175 ++- .../generated/typespec-ts/src/parameters.ts | 26 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/load-testing.api.md | 232 ++-- ...t.ts => administrationOperationsClient.ts} | 56 +- ....ts => administrationOperationsContext.ts} | 9 +- .../src/administrationOperations/api/index.ts | 2 +- .../api/operations.ts | 76 +- .../src/administrationOperations/index.ts | 31 +- .../administrationOperations/models/index.ts | 29 +- .../administrationOperations/models/models.ts | 122 +- .../models/options.ts | 26 +- .../generated/typespec-ts/src/index.ts | 66 +- .../generated/typespec-ts/src/rest/models.ts | 110 +- .../typespec-ts/src/rest/outputModels.ts | 175 ++- .../typespec-ts/src/rest/parameters.ts | 26 +- .../src/testRunOperations/api/index.ts | 2 +- .../src/testRunOperations/api/operations.ts | 90 +- ...Context.ts => testRunOperationsContext.ts} | 9 +- .../src/testRunOperations/index.ts | 35 +- .../src/testRunOperations/models/index.ts | 33 +- .../src/testRunOperations/models/models.ts | 125 +- .../src/testRunOperations/models/options.ts | 31 +- .../testRunOperations/restorePollerHelpers.ts | 4 +- ...nsClient.ts => testRunOperationsClient.ts} | 66 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../openai/generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/openai.api.md | 57 +- .../generated/typespec-ts/src/models.ts | 44 +- .../generated/typespec-ts/src/outputModels.ts | 78 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/openai-generic.api.md | 115 +- .../src/api/audio/transcriptions/index.ts | 6 +- .../src/api/audio/translations/index.ts | 6 +- .../src/api/chat/completions/index.ts | 6 +- .../typespec-ts/src/api/completions/index.ts | 6 +- .../typespec-ts/src/api/edits/index.ts | 6 +- .../typespec-ts/src/api/embeddings/index.ts | 6 +- .../typespec-ts/src/api/files/index.ts | 55 +- .../typespec-ts/src/api/fineTunes/index.ts | 30 +- .../src/api/fineTuning/jobs/index.ts | 30 +- .../typespec-ts/src/api/images/index.ts | 18 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/models/index.ts | 45 +- .../typespec-ts/src/api/moderations/index.ts | 6 +- .../{OpenAIContext.ts => openAIContext.ts} | 0 .../typespec-ts/src/classic/audio/index.ts | 2 +- .../src/classic/audio/transcriptions/index.ts | 8 +- .../src/classic/audio/translations/index.ts | 8 +- .../src/classic/chat/completions/index.ts | 8 +- .../typespec-ts/src/classic/chat/index.ts | 2 +- .../src/classic/completions/index.ts | 8 +- .../typespec-ts/src/classic/edits/index.ts | 8 +- .../src/classic/embeddings/index.ts | 8 +- .../typespec-ts/src/classic/files/index.ts | 41 +- .../src/classic/fineTunes/index.ts | 38 +- .../src/classic/fineTuning/index.ts | 2 +- .../src/classic/fineTuning/jobs/index.ts | 37 +- .../typespec-ts/src/classic/images/index.ts | 20 +- .../typespec-ts/src/classic/models/index.ts | 29 +- .../src/classic/moderations/index.ts | 8 +- .../generated/typespec-ts/src/index.ts | 62 +- .../generated/typespec-ts/src/models/index.ts | 60 +- .../typespec-ts/src/models/models.ts | 90 +- .../typespec-ts/src/models/options.ts | 60 +- .../src/{OpenAIClient.ts => openAIClient.ts} | 2 +- .../typespec-ts/src/rest/clientDefinitions.ts | 16 +- .../typespec-ts/src/rest/isUnexpected.ts | 32 +- .../typespec-ts/src/rest/outputModels.ts | 2 +- .../typespec-ts/src/rest/responses.ts | 8 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/openai_modular.api.md | 122 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../{OpenAIContext.ts => openAIContext.ts} | 9 +- .../typespec-ts/src/api/operations.ts | 66 +- .../generated/typespec-ts/src/index.ts | 31 +- .../generated/typespec-ts/src/models/index.ts | 29 +- .../typespec-ts/src/models/models.ts | 393 +++--- .../typespec-ts/src/models/options.ts | 18 +- .../src/{OpenAIClient.ts => openAIClient.ts} | 46 +- .../generated/typespec-ts/src/rest/models.ts | 177 ++- .../typespec-ts/src/rest/outputModels.ts | 122 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 4 +- .../review/openai-non-branded.api.md | 115 +- .../src/api/audio/transcriptions/index.ts | 6 +- .../src/api/audio/translations/index.ts | 6 +- .../src/api/chat/completions/index.ts | 6 +- .../typespec-ts/src/api/completions/index.ts | 6 +- .../typespec-ts/src/api/edits/index.ts | 6 +- .../typespec-ts/src/api/embeddings/index.ts | 6 +- .../typespec-ts/src/api/files/index.ts | 55 +- .../typespec-ts/src/api/fineTunes/index.ts | 30 +- .../src/api/fineTuning/jobs/index.ts | 30 +- .../typespec-ts/src/api/images/index.ts | 18 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../typespec-ts/src/api/models/index.ts | 45 +- .../typespec-ts/src/api/moderations/index.ts | 6 +- .../{OpenAIContext.ts => openAIContext.ts} | 0 .../typespec-ts/src/classic/audio/index.ts | 2 +- .../src/classic/audio/transcriptions/index.ts | 8 +- .../src/classic/audio/translations/index.ts | 8 +- .../src/classic/chat/completions/index.ts | 8 +- .../typespec-ts/src/classic/chat/index.ts | 2 +- .../src/classic/completions/index.ts | 8 +- .../typespec-ts/src/classic/edits/index.ts | 8 +- .../src/classic/embeddings/index.ts | 8 +- .../typespec-ts/src/classic/files/index.ts | 41 +- .../src/classic/fineTunes/index.ts | 38 +- .../src/classic/fineTuning/index.ts | 2 +- .../src/classic/fineTuning/jobs/index.ts | 37 +- .../typespec-ts/src/classic/images/index.ts | 20 +- .../typespec-ts/src/classic/models/index.ts | 29 +- .../src/classic/moderations/index.ts | 8 +- .../generated/typespec-ts/src/index.ts | 62 +- .../generated/typespec-ts/src/models/index.ts | 60 +- .../typespec-ts/src/models/models.ts | 90 +- .../typespec-ts/src/models/options.ts | 60 +- .../src/{OpenAIClient.ts => openAIClient.ts} | 2 +- .../typespec-ts/src/rest/clientDefinitions.ts | 16 +- .../typespec-ts/src/rest/isUnexpected.ts | 32 +- .../typespec-ts/src/rest/outputModels.ts | 2 +- .../typespec-ts/src/rest/responses.ts | 8 +- .../generated/typespec-ts/package.json | 6 +- .../review/overload_modular.api.md | 14 +- .../src/api/fooOperations/index.ts | 12 +- .../generated/typespec-ts/src/api/index.ts | 2 +- ...agerContext.ts => widgetManagerContext.ts} | 9 +- .../src/classic/fooOperations/index.ts | 14 +- .../generated/typespec-ts/src/index.ts | 7 +- .../generated/typespec-ts/src/models/index.ts | 5 +- .../typespec-ts/src/models/models.ts | 6 + .../typespec-ts/src/models/options.ts | 6 +- ...anagerClient.ts => widgetManagerClient.ts} | 6 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 65 +- .../review/parametrized-host.api.md | 66 +- .../src/api/confidentialLedger/index.ts | 57 + .../generated/typespec-ts/src/api/index.ts | 8 + .../src/api/parametrizedHostContext.ts | 24 + .../src/classic/confidentialLedger/index.ts | 31 + .../typespec-ts/src/classic/index.ts | 4 + .../generated/typespec-ts/src/index.ts | 19 +- .../generated/typespec-ts/src/models/index.ts | 5 + .../typespec-ts/src/models/models.ts | 7 + .../typespec-ts/src/models/options.ts | 7 + .../typespec-ts/src/parametrizedHostClient.ts | 79 +- .../src/{ => rest}/clientDefinitions.ts | 2 +- .../generated/typespec-ts/src/rest/index.ts | 13 + .../src/{ => rest}/isUnexpected.ts | 0 .../src/{ => rest}/outputModels.ts | 0 .../typespec-ts/src/{ => rest}/parameters.ts | 0 .../src/rest/parametrizedHostClient.ts | 63 + .../typespec-ts/src/{ => rest}/responses.ts | 0 .../test/parametrizedHost/tspconfig.yaml | 1 + .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/schema-registry.api.md | 40 +- .../generated/typespec-ts/src/api/index.ts | 2 +- .../src/api/schemaOperations/index.ts | 60 +- ...tryContext.ts => schemaRegistryContext.ts} | 5 +- .../src/classic/schemaOperations/index.ts | 43 +- .../generated/typespec-ts/src/index.ts | 21 +- .../generated/typespec-ts/src/models/index.ts | 19 +- .../typespec-ts/src/models/models.ts | 59 +- .../typespec-ts/src/models/options.ts | 12 +- ...istryClient.ts => schemaRegistryClient.ts} | 2 +- .../generated/typespec-ts/package.json | 4 +- .../review/todo-non-branded.api.md | 6 +- .../typespec-ts/src/clientDefinitions.ts | 8 +- .../generated/typespec-ts/src/responses.ts | 4 +- .../generated/typespec-ts/package.json | 6 +- .../cognitiveservices-translator.api.md | 15 +- .../generated/typespec-ts/src/models.ts | 7 + .../generated/typespec-ts/src/parameters.ts | 14 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../generated/typespec-ts/package.json | 6 +- .../typespec-ts/review/widget_dpg.api.md | 53 +- .../generated/src/api/budgets/index.ts | 12 +- .../sources/generated/src/api/index.ts | 2 +- ...viceContext.ts => widgetServiceContext.ts} | 0 .../generated/src/api/widgets/index.ts | 54 +- .../generated/src/classic/budgets/index.ts | 14 +- .../generated/src/classic/widgets/index.ts | 63 +- .../sources/generated/src/index.ts | 27 +- .../sources/generated/src/models/index.ts | 25 +- .../sources/generated/src/models/models.ts | 6 +- .../sources/generated/src/models/options.ts | 24 +- .../generated/src/restorePollerHelpers.ts | 4 +- ...erviceClient.ts => widgetServiceClient.ts} | 2 +- .../typespec-ts/src/api/budgets/index.ts | 12 +- .../generated/typespec-ts/src/api/index.ts | 2 +- ...viceContext.ts => widgetServiceContext.ts} | 0 .../typespec-ts/src/api/widgets/index.ts | 54 +- .../typespec-ts/src/classic/budgets/index.ts | 14 +- .../typespec-ts/src/classic/widgets/index.ts | 63 +- .../generated/typespec-ts/src/index.ts | 27 +- .../generated/typespec-ts/src/models/index.ts | 25 +- .../typespec-ts/src/models/models.ts | 6 +- .../typespec-ts/src/models/options.ts | 24 +- .../typespec-ts/src/restorePollerHelpers.ts | 4 +- ...erviceClient.ts => widgetServiceClient.ts} | 2 +- .../typespec-ts/vitest.browser.config.ts | 1 - .../test/widget_dpg/spec/main.tsp | 3 +- .../test/widget_dpg/tspconfig.yaml | 2 +- packages/typespec-ts/CHANGELOG.md | 27 +- packages/typespec-ts/package.json | 40 +- packages/typespec-ts/src/index.ts | 31 +- .../src/modular/buildClassicalClient.ts | 14 +- .../src/modular/buildClientContext.ts | 26 +- .../typespec-ts/src/modular/buildCodeModel.ts | 132 +- .../typespec-ts/src/modular/buildLroFiles.ts | 5 +- .../typespec-ts/src/modular/buildRootIndex.ts | 17 +- .../typespec-ts/src/modular/emitModels.ts | 20 +- .../helpers/classicalOperationHelpers.ts | 25 +- .../src/modular/helpers/clientHelpers.ts | 1 + .../src/modular/helpers/namingHelpers.ts | 9 +- .../src/modular/helpers/operationHelpers.ts | 46 +- .../src/modular/helpers/typeHelpers.ts | 1 - .../src/modular/modularCodeModel.ts | 1 + .../typespec-ts/src/transform/transform.ts | 25 +- .../src/transform/transformApiVersionInfo.ts | 3 + .../src/transform/transformSchemas.ts | 64 +- packages/typespec-ts/src/utils/modelUtils.ts | 35 +- .../test/commands/cadl-ranch-list.ts | 32 +- .../test/integration/clientNaming.spec.ts | 25 + .../test/integration/encodeBytes.spec.ts | 100 +- .../authentication/apiKey/package.json | 6 +- .../authentication/http-custom/package.json | 6 +- .../clientGeneratorCore/access/package.json | 6 +- .../access/src/clientDefinitions.ts | 4 +- .../access/src/responses.ts | 2 +- .../clientGeneratorCore/usage/package.json | 6 +- .../generated/azure/core-scalar/package.json | 6 +- .../core-scalar/vitest.browser.config.ts | 1 - .../generated/azure/core-traits/package.json | 6 +- .../azure/core-traits/src/outputModels.ts | 15 - .../core-traits/vitest.browser.config.ts | 1 - .../generated/azure/core/package.json | 6 +- .../azure/core/src/clientDefinitions.ts | 16 +- .../generated/azure/core/src/isUnexpected.ts | 28 +- .../generated/azure/core/src/responses.ts | 16 +- .../generated/client/naming/package.json | 6 +- .../client/structure/default/package.json | 6 +- .../client/structure/default/src/index.ts | 1 + .../client/structure/default/src/models.ts | 9 + .../structure/default/src/serviceClient.ts | 5 +- .../structure/multi-client/package.json | 6 +- .../structure/multi-client/src/index.ts | 1 + .../structure/multi-client/src/models.ts | 9 + .../multi-client/src/serviceClient.ts | 5 +- .../structure/renamed-operation/package.json | 6 +- .../structure/renamed-operation/src/index.ts | 1 + .../structure/renamed-operation/src/models.ts | 9 + .../renamed-operation/src/serviceClient.ts | 5 +- .../two-operation-group/package.json | 6 +- .../two-operation-group/src/index.ts | 1 + .../two-operation-group/src/models.ts | 9 + .../two-operation-group/src/serviceClient.ts | 5 +- .../generated/dictionary/package.json | 6 +- .../generated/enums/extensible/package.json | 6 +- .../generated/enums/fixed/package.json | 6 +- .../generated/enums/fixed/src/index.ts | 2 + .../generated/enums/fixed/src/models.ts | 12 + .../generated/enums/fixed/src/outputModels.ts | 12 + .../generated/enums/fixed/src/parameters.ts | 19 +- .../generated/enums/fixed/src/responses.ts | 10 +- .../headers/clientRequestId/package.json | 6 +- .../headers/repeatability/package.json | 6 +- .../integration/generated/hello/package.json | 4 +- .../generated/lro/lroCore/package.json | 6 +- .../lro/lroCore/src/clientDefinitions.ts | 16 +- .../generated/lro/lroCore/src/isUnexpected.ts | 34 +- .../generated/lro/lroCore/src/outputModels.ts | 24 +- .../lro/lroCore/src/pollingHelper.ts | 16 +- .../generated/lro/lroCore/src/responses.ts | 24 +- .../generated/lro/lroRPC/package.json | 6 +- .../generated/lro/lroRPC/src/outputModels.ts | 22 +- .../generated/models/empty/package.json | 6 +- .../package.json | 6 +- .../src/models.ts | 4 +- .../src/outputModels.ts | 4 +- .../package.json | 6 +- .../models/inheritance-recursive/package.json | 6 +- .../package.json | 6 +- .../generated/models/inheritance/package.json | 6 +- .../models/propertyAdditional/package.json | 6 +- .../src/clientDefinitions.ts | 342 +++++ .../models/propertyAdditional/src/models.ts | 147 +- .../propertyAdditional/src/outputModels.ts | 148 +- .../propertyAdditional/src/parameters.ts | 180 +++ .../propertyAdditional/src/responses.ts | 232 ++++ .../models/propertyNullable/package.json | 6 +- .../models/propertyOptional/package.json | 6 +- .../models/propertyTypes/package.json | 6 +- .../models/propertyTypes/src/models.ts | 4 +- .../models/propertyTypes/src/outputModels.ts | 4 +- .../generated/models/usage/package.json | 6 +- .../generated/models/visibility/package.json | 6 +- .../media-type/src/clientDefinitions.ts | 55 + .../generated/payload/media-type/src/index.ts | 11 + .../payload/media-type/src/logger.ts | 5 + .../media-type/src/mediaTypeClient.ts} | 10 +- .../payload/media-type/src/parameters.ts | 32 + .../payload/media-type/src/responses.ts | 26 + .../media-type}/tspconfig.yaml | 4 +- .../multipart/src/clientDefinitions.ts | 11 + .../payload/multipart/src/parameters.ts | 20 + .../payload/multipart/src/responses.ts | 5 + .../projection/src/clientDefinitions.ts | 93 -- .../generated/projection/src/models.ts | 32 - .../generated/projection/src/parameters.ts | 64 - .../generated/projection/src/responses.ts | 44 - .../resiliency/srvDriven1/package.json | 6 +- .../resiliency/srvDriven2/package.json | 6 +- .../server/path/multiple/src/index.ts | 1 + .../server/path/multiple/src/models.ts | 5 + .../src/multipleParamInServerPathClient.ts | 3 +- .../versioned/src/clientDefinitions.ts | 12 + .../versions/versioned/src/parameters.ts | 11 + .../versions/versioned/src/responses.ts | 5 + .../generated/union-body/package.json | 6 +- .../generated/union-body/src/models.ts | 6 +- .../generated/union-body/src/outputModels.ts | 6 +- .../integration/generated/unions/package.json | 4 +- .../unions/samples-dev/enumsOnlySendSample.ts | 2 +- .../generated/unions/src/models.ts | 8 +- .../generated/unions/src/outputModels.ts | 8 +- .../modelPropertyAdditional.spec.ts | 678 +++++++++- .../integration/modelPropertyType.spec.ts | 4 + .../test/integration/payloadMediaType.spec.ts | 60 + .../test/integration/projection.spec.ts | 102 -- .../test/integration/server.spec.ts | 11 + .../test/integration/specialWords.spec.ts | 16 +- .../azureClientGeneratorCoreAccess.spec.ts | 2 +- .../test/modularIntegration/azureCore.spec.ts | 4 +- .../modularIntegration/clientNaming.spec.ts | 22 + .../modularIntegration/encodeBytes.spec.ts | 21 +- .../extensibleEnums.spec.ts | 51 + .../modularIntegration/fixedEnums.spec.ts | 42 + .../api/{ArrayContext.ts => arrayContext.ts} | 0 .../items/src/api/booleanValue/index.ts | 12 +- .../items/src/api/datetimeValue/index.ts | 12 +- .../items/src/api/durationValue/index.ts | 12 +- .../items/src/api/float32Value/index.ts | 12 +- .../generated/arrays/items/src/api/index.ts | 2 +- .../arrays/items/src/api/int32Value/index.ts | 12 +- .../arrays/items/src/api/int64Value/index.ts | 12 +- .../arrays/items/src/api/modelValue/index.ts | 12 +- .../items/src/api/nullableFloatValue/index.ts | 12 +- .../arrays/items/src/api/stringValue/index.ts | 12 +- .../items/src/api/unknownValue/index.ts | 12 +- .../src/{ArrayClient.ts => arrayClient.ts} | 2 +- .../items/src/classic/booleanValue/index.ts | 17 +- .../items/src/classic/datetimeValue/index.ts | 17 +- .../items/src/classic/durationValue/index.ts | 17 +- .../items/src/classic/float32Value/index.ts | 17 +- .../items/src/classic/int32Value/index.ts | 15 +- .../items/src/classic/int64Value/index.ts | 15 +- .../items/src/classic/modelValue/index.ts | 18 +- .../src/classic/nullableFloatValue/index.ts | 20 +- .../items/src/classic/stringValue/index.ts | 18 +- .../items/src/classic/unknownValue/index.ts | 17 +- .../generated/arrays/items/src/index.ts | 42 +- .../arrays/items/src/models/index.ts | 40 +- .../arrays/items/src/models/options.ts | 40 +- .../{ApiKeyContext.ts => apiKeyContext.ts} | 0 .../authentication/api-key/src/api/index.ts | 2 +- .../api-key/src/api/operations.ts | 13 +- .../src/{ApiKeyClient.ts => apiKeyClient.ts} | 13 +- .../authentication/api-key/src/index.ts | 4 +- .../api-key/src/models/index.ts | 2 +- .../api-key/src/models/options.ts | 4 +- .../{CustomContext.ts => customContext.ts} | 0 .../http-custom/src/api/index.ts | 2 +- .../http-custom/src/api/operations.ts | 13 +- .../src/{CustomClient.ts => customClient.ts} | 13 +- .../authentication/http-custom/src/index.ts | 4 +- .../http-custom/src/models/index.ts | 2 +- .../http-custom/src/models/options.ts | 4 +- .../authentication/oauth2/src/api/index.ts | 2 +- .../{OAuth2Context.ts => oAuth2Context.ts} | 0 .../oauth2/src/api/operations.ts | 13 +- .../authentication/oauth2/src/index.ts | 4 +- .../authentication/oauth2/src/models/index.ts | 2 +- .../oauth2/src/models/options.ts | 4 +- .../src/{OAuth2Client.ts => oAuth2Client.ts} | 13 +- .../authentication/union/src/api/index.ts | 2 +- .../union/src/api/operations.ts | 13 +- .../api/{UnionContext.ts => unionContext.ts} | 0 .../authentication/union/src/index.ts | 7 +- .../authentication/union/src/models/index.ts | 2 +- .../union/src/models/options.ts | 4 +- .../src/{UnionClient.ts => unionClient.ts} | 13 +- .../clientGeneratorCore/access/package.json | 6 +- .../src/{AccessClient.ts => accessClient.ts} | 49 +- .../{AccessContext.ts => accessContext.ts} | 0 .../access/src/api/index.ts | 4 +- .../access/src/api/operations.ts | 75 +- .../clientGeneratorCore/access/src/index.ts | 20 +- .../access/src/models/index.ts | 18 +- .../access/src/models/options.ts | 21 +- .../access/src/rest/clientDefinitions.ts | 4 +- .../access/src/rest/responses.ts | 2 +- .../clientGeneratorCore/usage/package.json | 6 +- .../usage/src/api/index.ts | 2 +- .../usage/src/api/operations.ts | 12 +- .../api/{UsageContext.ts => usageContext.ts} | 0 .../clientGeneratorCore/usage/src/index.ts | 6 +- .../usage/src/models/index.ts | 4 +- .../usage/src/models/options.ts | 4 +- .../src/{UsageClient.ts => usageClient.ts} | 10 +- .../generated/azure/core-scalar/package.json | 6 +- .../azure/core-scalar/src/api/index.ts | 2 +- .../azure/core-scalar/src/api/operations.ts | 30 +- .../{ScalarContext.ts => scalarContext.ts} | 0 .../generated/azure/core-scalar/src/index.ts | 13 +- .../azure/core-scalar/src/models/index.ts | 12 +- .../azure/core-scalar/src/models/models.ts | 4 + .../azure/core-scalar/src/models/options.ts | 10 +- .../src/{ScalarClient.ts => scalarClient.ts} | 22 +- .../generated/azure/core-traits/package.json | 6 +- .../azure/core-traits/src/api/index.ts | 2 +- .../azure/core-traits/src/api/operations.ts | 12 +- .../{TraitsContext.ts => traitsContext.ts} | 5 +- .../generated/azure/core-traits/src/index.ts | 7 +- .../azure/core-traits/src/models/index.ts | 6 +- .../azure/core-traits/src/models/models.ts | 3 + .../azure/core-traits/src/models/options.ts | 4 +- .../core-traits/src/rest/outputModels.ts | 15 - .../src/{TraitsClient.ts => traitsClient.ts} | 11 +- .../generated/azure/core/package.json | 6 +- .../api/{BasicContext.ts => basicContext.ts} | 5 +- .../generated/azure/core/src/api/index.ts | 6 +- .../azure/core/src/api/operations.ts | 120 +- .../src/{BasicClient.ts => basicClient.ts} | 71 +- .../generated/azure/core/src/index.ts | 31 +- .../generated/azure/core/src/models/index.ts | 29 +- .../generated/azure/core/src/models/models.ts | 44 +- .../azure/core/src/models/options.ts | 23 +- .../azure/core/src/rest/clientDefinitions.ts | 16 +- .../azure/core/src/rest/isUnexpected.ts | 28 +- .../azure/core/src/rest/responses.ts | 16 +- .../generated/client/naming/package.json | 6 +- .../naming/src/api/clientModel/index.ts | 12 +- .../generated/client/naming/src/api/index.ts | 2 +- .../{NamingContext.ts => namingContext.ts} | 0 .../client/naming/src/api/operations.ts | 42 +- .../client/naming/src/api/unionEnum/index.ts | 12 +- .../naming/src/classic/clientModel/index.ts | 14 +- .../naming/src/classic/unionEnum/index.ts | 14 +- .../generated/client/naming/src/index.ts | 24 +- .../client/naming/src/models/index.ts | 22 +- .../client/naming/src/models/options.ts | 25 +- .../src/{NamingClient.ts => namingClient.ts} | 32 +- .../client/structure/default/package.json | 6 +- .../structure/default/src/api/bar/index.ts | 13 +- .../default/src/api/baz/foo/index.ts | 6 +- .../structure/default/src/api/foo/index.ts | 13 +- .../client/structure/default/src/api/index.ts | 2 +- .../structure/default/src/api/operations.ts | 10 +- .../default/src/api/qux/bar/index.ts | 6 +- .../structure/default/src/api/qux/index.ts | 6 +- .../{ServiceContext.ts => serviceContext.ts} | 6 +- .../default/src/classic/bar/index.ts | 15 +- .../default/src/classic/baz/foo/index.ts | 8 +- .../default/src/classic/baz/index.ts | 2 +- .../default/src/classic/foo/index.ts | 15 +- .../default/src/classic/qux/bar/index.ts | 8 +- .../default/src/classic/qux/index.ts | 8 +- .../client/structure/default/src/index.ts | 20 +- .../structure/default/src/models/index.ts | 18 +- .../structure/default/src/models/models.ts | 8 +- .../structure/default/src/models/options.ts | 18 +- .../structure/default/src/rest/index.ts | 1 + .../structure/default/src/rest/models.ts | 9 + .../default/src/rest/serviceClient.ts | 5 +- .../{ServiceClient.ts => serviceClient.ts} | 14 +- .../structure/multi-client/package.json | 6 +- .../src/a/{AClient.ts => aClient.ts} | 20 +- .../src/a/api/{AContext.ts => aContext.ts} | 6 +- .../structure/multi-client/src/a/api/index.ts | 2 +- .../multi-client/src/a/api/operations.ts | 18 +- .../structure/multi-client/src/a/index.ts | 8 +- .../multi-client/src/a/models/index.ts | 6 +- .../multi-client/src/a/models/models.ts | 8 +- .../multi-client/src/a/models/options.ts | 6 +- .../src/b/api/{BContext.ts => bContext.ts} | 6 +- .../structure/multi-client/src/b/api/index.ts | 2 +- .../multi-client/src/b/api/operations.ts | 18 +- .../src/b/{BClient.ts => bClient.ts} | 20 +- .../structure/multi-client/src/b/index.ts | 8 +- .../multi-client/src/b/models/index.ts | 6 +- .../multi-client/src/b/models/models.ts | 8 +- .../multi-client/src/b/models/options.ts | 6 +- .../structure/multi-client/src/index.ts | 16 +- .../structure/multi-client/src/rest/index.ts | 1 + .../structure/multi-client/src/rest/models.ts | 9 + .../multi-client/src/rest/serviceClient.ts | 5 +- .../structure/renamed-operation/package.json | 4 +- .../renamed-operation/src/api/group/index.ts | 18 +- .../renamed-operation/src/api/index.ts | 2 +- .../renamed-operation/src/api/operations.ts | 18 +- ...nContext.ts => renamedOperationContext.ts} | 6 +- .../src/classic/group/index.ts | 20 +- .../structure/renamed-operation/src/index.ts | 14 +- .../renamed-operation/src/models/index.ts | 12 +- .../renamed-operation/src/models/models.ts | 8 +- .../renamed-operation/src/models/options.ts | 12 +- ...ionClient.ts => renamedOperationClient.ts} | 20 +- .../renamed-operation/src/rest/index.ts | 1 + .../renamed-operation/src/rest/models.ts | 9 + .../src/rest/serviceClient.ts | 5 +- .../two-operation-group/package.json | 6 +- .../src/api/group1/index.ts | 18 +- .../src/api/group2/index.ts | 18 +- .../two-operation-group/src/api/index.ts | 2 +- ...Context.ts => twoOperationGroupContext.ts} | 6 +- .../src/classic/group1/index.ts | 20 +- .../src/classic/group2/index.ts | 20 +- .../two-operation-group/src/index.ts | 14 +- .../two-operation-group/src/models/index.ts | 12 +- .../two-operation-group/src/models/models.ts | 8 +- .../two-operation-group/src/models/options.ts | 12 +- .../two-operation-group/src/rest/index.ts | 1 + .../two-operation-group/src/rest/models.ts | 9 + .../src/rest/serviceClient.ts | 5 +- ...upClient.ts => twoOperationGroupClient.ts} | 8 +- .../api/{BytesContext.ts => bytesContext.ts} | 0 .../encode/bytes/src/api/header/index.ts | 24 +- .../generated/encode/bytes/src/api/index.ts | 2 +- .../encode/bytes/src/api/property/index.ts | 24 +- .../encode/bytes/src/api/query/index.ts | 24 +- .../encode/bytes/src/api/requestBody/index.ts | 32 +- .../bytes/src/api/responseBody/index.ts | 30 +- .../src/{BytesClient.ts => bytesClient.ts} | 2 +- .../encode/bytes/src/classic/header/index.ts | 32 +- .../bytes/src/classic/property/index.ts | 34 +- .../encode/bytes/src/classic/query/index.ts | 32 +- .../bytes/src/classic/requestBody/index.ts | 40 +- .../bytes/src/classic/responseBody/index.ts | 37 +- .../generated/encode/bytes/src/index.ts | 46 +- .../encode/bytes/src/models/index.ts | 44 +- .../encode/bytes/src/models/options.ts | 47 +- ...{DatetimeContext.ts => datetimeContext.ts} | 0 .../encode/datetime/src/api/header/index.ts | 30 +- .../encode/datetime/src/api/index.ts | 2 +- .../encode/datetime/src/api/property/index.ts | 30 +- .../encode/datetime/src/api/query/index.ts | 30 +- .../datetime/src/api/responseHeader/index.ts | 24 +- .../datetime/src/classic/header/index.ts | 41 +- .../datetime/src/classic/property/index.ts | 32 +- .../datetime/src/classic/query/index.ts | 32 +- .../src/classic/responseHeader/index.ts | 26 +- .../{DatetimeClient.ts => datetimeClient.ts} | 2 +- .../generated/encode/datetime/src/index.ts | 40 +- .../encode/datetime/src/models/index.ts | 38 +- .../encode/datetime/src/models/options.ts | 42 +- ...{DurationContext.ts => durationContext.ts} | 0 .../encode/duration/src/api/header/index.ts | 30 +- .../encode/duration/src/api/index.ts | 2 +- .../encode/duration/src/api/property/index.ts | 30 +- .../encode/duration/src/api/query/index.ts | 30 +- .../duration/src/classic/header/index.ts | 50 +- .../duration/src/classic/property/index.ts | 32 +- .../duration/src/classic/query/index.ts | 38 +- .../{DurationClient.ts => durationClient.ts} | 2 +- .../generated/encode/duration/src/index.ts | 32 +- .../encode/duration/src/models/index.ts | 30 +- .../encode/duration/src/models/options.ts | 32 +- .../extensible/src/api/extensibleContext.ts | 17 + .../enums/extensible/src/api/index.ts | 8 + .../enums/extensible/src/api/string/index.ts | 134 ++ .../enums/extensible/src/classic/index.ts | 4 + .../extensible/src/classic/string/index.ts | 59 + .../enums/extensible/src/extensibleClient.ts | 30 + .../generated/enums/extensible/src/index.ts | 15 + .../generated/enums/extensible/src/logger.ts | 5 + .../enums/extensible/src/models/index.ts | 10 + .../enums/extensible/src/models/models.ts | 6 + .../enums/extensible/src/models/options.ts | 12 + .../extensible/src/rest/clientDefinitions.ts | 45 + .../extensible/src/rest/extensibleClient.ts | 36 + .../enums/extensible/src/rest/index.ts | 13 + .../enums/extensible/src/rest/models.ts | 13 + .../enums/extensible/src/rest/outputModels.ts | 13 + .../enums/extensible/src/rest/parameters.ts | 22 + .../enums/extensible/src/rest/responses.ts | 27 + .../generated/enums/extensible/tspconfig.yaml | 15 + .../enums/fixed/src/api/fixedContext.ts | 15 + .../generated/enums/fixed/src/api/index.ts | 8 + .../enums/fixed/src/api/string/index.ts | 108 ++ .../enums/fixed/src/classic/index.ts | 4 + .../enums/fixed/src/classic/string/index.ts | 50 + .../generated/enums/fixed/src/fixedClient.ts | 26 + .../generated/enums/fixed/src/index.ts | 11 + .../generated/enums/fixed}/src/logger.ts | 2 +- .../generated/enums/fixed/src/models/index.ts | 9 + .../enums/fixed/src/models/models.ts | 13 + .../enums/fixed/src/models/options.ts | 10 + .../enums/fixed/src/rest/clientDefinitions.ts | 43 + .../enums/fixed/src/rest/fixedClient.ts | 36 + .../generated/enums/fixed/src/rest/index.ts | 13 + .../generated/enums/fixed/src/rest/models.ts | 12 + .../enums/fixed/src/rest/outputModels.ts | 12 + .../enums/fixed/src/rest/parameters.ts | 23 + .../enums/fixed/src/rest/responses.ts | 21 + .../generated/enums/fixed/tspconfig.yaml | 14 + .../client-request-id/src/api/index.ts | 2 +- .../client-request-id/src/api/operations.ts | 6 +- ...equestIdContext.ts => requestIdContext.ts} | 0 .../headers/client-request-id/src/index.ts | 4 +- .../client-request-id/src/models/index.ts | 2 +- .../client-request-id/src/models/options.ts | 2 +- ...{RequestIdClient.ts => requestIdClient.ts} | 6 +- .../repeatability/generated/src/api/index.ts | 2 +- .../generated/src/api/operations.ts | 6 +- ...lityContext.ts => repeatabilityContext.ts} | 0 .../repeatability/generated/src/index.ts | 4 +- .../generated/src/models/index.ts | 2 +- .../generated/src/models/options.ts | 2 +- ...bilityClient.ts => repeatabilityClient.ts} | 6 +- .../generated/lro/rpc/generated/package.json | 6 +- .../lro/rpc/generated/src/api/index.ts | 2 +- .../lro/rpc/generated/src/api/operations.ts | 6 +- .../src/api/{RpcContext.ts => rpcContext.ts} | 5 +- .../generated/lro/rpc/generated/src/index.ts | 5 +- .../lro/rpc/generated/src/models/index.ts | 4 +- .../lro/rpc/generated/src/models/models.ts | 4 + .../lro/rpc/generated/src/models/options.ts | 2 +- .../rpc/generated/src/rest/outputModels.ts | 22 +- .../rpc/generated/src/restorePollerHelpers.ts | 4 +- .../src/{RpcClient.ts => rpcClient.ts} | 6 +- .../lro/standard/generated/package.json | 6 +- .../lro/standard/generated/src/api/index.ts | 8 +- .../standard/generated/src/api/operations.ts | 75 +- ...{StandardContext.ts => standardContext.ts} | 5 +- .../lro/standard/generated/src/index.ts | 9 +- .../standard/generated/src/models/index.ts | 8 +- .../standard/generated/src/models/models.ts | 4 + .../standard/generated/src/models/options.ts | 6 +- .../generated/src/rest/clientDefinitions.ts | 16 +- .../generated/src/rest/isUnexpected.ts | 34 +- .../generated/src/rest/outputModels.ts | 24 +- .../generated/src/rest/pollingHelper.ts | 16 +- .../standard/generated/src/rest/responses.ts | 24 +- .../generated/src/restorePollerHelpers.ts | 13 +- .../{StandardClient.ts => standardClient.ts} | 36 +- .../api/{EmptyContext.ts => emptyContext.ts} | 0 .../models/empty/generated/src/api/index.ts | 2 +- .../empty/generated/src/api/operations.ts | 18 +- .../src/{EmptyClient.ts => emptyClient.ts} | 14 +- .../models/empty/generated/src/index.ts | 8 +- .../empty/generated/src/models/index.ts | 6 +- .../empty/generated/src/models/options.ts | 6 +- .../enum-discriminator/package.json | 6 +- ...Context.ts => enumDiscriminatorContext.ts} | 0 .../enum-discriminator/src/api/index.ts | 2 +- .../enum-discriminator/src/api/operations.ts | 60 +- ...orClient.ts => enumDiscriminatorClient.ts} | 38 +- .../enum-discriminator/src/index.ts | 18 +- .../enum-discriminator/src/models/index.ts | 16 +- .../enum-discriminator/src/models/options.ts | 16 +- .../enum-discriminator/src/rest/models.ts | 4 +- .../src/rest/outputModels.ts | 4 +- .../nested-discriminator/package.json | 6 +- .../nested-discriminator/src/api/index.ts | 2 +- ...ntext.ts => nestedDiscriminatorContext.ts} | 0 .../src/api/operations.ts | 36 +- .../nested-discriminator/src/index.ts | 14 +- .../nested-discriminator/src/models/index.ts | 12 +- .../src/models/options.ts | 13 +- ...Client.ts => nestedDiscriminatorClient.ts} | 26 +- .../not-discriminated/package.json | 6 +- .../not-discriminated/src/api/index.ts | 2 +- ...dContext.ts => notDiscriminatedContext.ts} | 0 .../not-discriminated/src/api/operations.ts | 18 +- .../not-discriminated/src/index.ts | 8 +- .../not-discriminated/src/models/index.ts | 6 +- .../not-discriminated/src/models/options.ts | 6 +- ...tedClient.ts => notDiscriminatedClient.ts} | 14 +- .../recursive/generated/src/api/index.ts | 2 +- .../recursive/generated/src/api/operations.ts | 10 +- ...ecursiveContext.ts => recursiveContext.ts} | 0 .../recursive/generated/src/index.ts | 9 +- .../recursive/generated/src/models/index.ts | 2 +- .../recursive/generated/src/models/options.ts | 4 +- ...{RecursiveClient.ts => recursiveClient.ts} | 8 +- .../single-discriminator/package.json | 6 +- .../single-discriminator/src/api/index.ts | 2 +- .../src/api/operations.ts | 42 +- ...ntext.ts => singleDiscriminatorContext.ts} | 0 .../single-discriminator/src/index.ts | 16 +- .../single-discriminator/src/models/index.ts | 14 +- .../src/models/options.ts | 15 +- ...Client.ts => singleDiscriminatorClient.ts} | 30 +- .../generated/src/api/boolean/index.ts | 13 +- .../generated/src/api/booleanLiteral/index.ts | 12 +- .../generated/src/api/bytes/index.ts | 13 +- .../generated/src/api/collectionsInt/index.ts | 12 +- .../src/api/collectionsModel/index.ts | 12 +- .../src/api/collectionsString/index.ts | 12 +- .../generated/src/api/datetime/index.ts | 12 +- .../generated/src/api/decimal/index.ts | 13 +- .../generated/src/api/decimal128/index.ts | 12 +- .../src/api/dictionaryString/index.ts | 12 +- .../generated/src/api/duration/index.ts | 12 +- .../generated/src/api/enum/index.ts | 13 +- .../generated/src/api/extensibleEnum/index.ts | 12 +- .../generated/src/api/float/index.ts | 13 +- .../generated/src/api/floatLiteral/index.ts | 12 +- .../propertyTypes/generated/src/api/index.ts | 2 +- .../generated/src/api/int/index.ts | 13 +- .../generated/src/api/intLiteral/index.ts | 12 +- .../generated/src/api/model/index.ts | 13 +- .../generated/src/api/never/index.ts | 13 +- .../generated/src/api/string/index.ts | 13 +- .../generated/src/api/stringLiteral/index.ts | 12 +- .../generated/src/api/unionEnumValue/index.ts | 12 +- .../src/api/unionFloatLiteral/index.ts | 12 +- .../src/api/unionIntLiteral/index.ts | 12 +- .../src/api/unionStringLiteral/index.ts | 12 +- .../generated/src/api/unknownArray/index.ts | 12 +- .../generated/src/api/unknownDict/index.ts | 12 +- .../generated/src/api/unknownInt/index.ts | 12 +- .../generated/src/api/unknownString/index.ts | 12 +- ...ueTypesContext.ts => valueTypesContext.ts} | 0 .../generated/src/classic/boolean/index.ts | 18 +- .../src/classic/booleanLiteral/index.ts | 20 +- .../generated/src/classic/bytes/index.ts | 15 +- .../src/classic/collectionsInt/index.ts | 20 +- .../src/classic/collectionsModel/index.ts | 14 +- .../src/classic/collectionsString/index.ts | 14 +- .../generated/src/classic/datetime/index.ts | 17 +- .../generated/src/classic/decimal/index.ts | 18 +- .../generated/src/classic/decimal128/index.ts | 15 +- .../src/classic/dictionaryString/index.ts | 14 +- .../generated/src/classic/duration/index.ts | 17 +- .../generated/src/classic/enum/index.ts | 15 +- .../src/classic/extensibleEnum/index.ts | 20 +- .../generated/src/classic/float/index.ts | 15 +- .../src/classic/floatLiteral/index.ts | 20 +- .../generated/src/classic/int/index.ts | 15 +- .../generated/src/classic/intLiteral/index.ts | 15 +- .../generated/src/classic/model/index.ts | 15 +- .../generated/src/classic/never/index.ts | 15 +- .../generated/src/classic/string/index.ts | 18 +- .../src/classic/stringLiteral/index.ts | 20 +- .../src/classic/unionEnumValue/index.ts | 20 +- .../src/classic/unionFloatLiteral/index.ts | 14 +- .../src/classic/unionIntLiteral/index.ts | 18 +- .../src/classic/unionStringLiteral/index.ts | 14 +- .../src/classic/unknownArray/index.ts | 20 +- .../src/classic/unknownDict/index.ts | 15 +- .../generated/src/classic/unknownInt/index.ts | 15 +- .../src/classic/unknownString/index.ts | 20 +- .../propertyTypes/generated/src/index.ts | 119 +- .../generated/src/models/index.ts | 117 +- .../generated/src/models/models.ts | 4 + .../generated/src/models/options.ts | 116 +- .../generated/src/rest/models.ts | 4 +- .../generated/src/rest/outputModels.ts | 4 +- ...alueTypesClient.ts => valueTypesClient.ts} | 2 +- .../models/usage/generated/src/api/index.ts | 2 +- .../usage/generated/src/api/operations.ts | 18 +- .../api/{UsageContext.ts => usageContext.ts} | 0 .../models/usage/generated/src/index.ts | 8 +- .../usage/generated/src/models/index.ts | 6 +- .../usage/generated/src/models/options.ts | 6 +- .../src/{UsageClient.ts => usageClient.ts} | 14 +- ...tyContext.ts => bodyOptionalityContext.ts} | 0 .../body-optionality/src/api/index.ts | 2 +- .../body-optionality/src/api/operations.ts | 12 +- .../src/api/optionalExplicit/index.ts | 12 +- ...lityClient.ts => bodyOptionalityClient.ts} | 10 +- .../src/classic/optionalExplicit/index.ts | 14 +- .../parameters/body-optionality/src/index.ts | 10 +- .../body-optionality/src/models/index.ts | 8 +- .../body-optionality/src/models/options.ts | 8 +- ...tContext.ts => collectionFormatContext.ts} | 0 .../collection-format/src/api/header/index.ts | 6 +- .../collection-format/src/api/index.ts | 2 +- .../collection-format/src/api/query/index.ts | 30 +- .../src/classic/header/index.ts | 8 +- .../src/classic/query/index.ts | 38 +- ...matClient.ts => collectionFormatClient.ts} | 2 +- .../parameters/collection-format/src/index.ts | 14 +- .../collection-format/src/models/index.ts | 12 +- .../collection-format/src/models/options.ts | 12 +- .../parameters/spread/src/api/alias/index.ts | 22 +- .../parameters/spread/src/api/index.ts | 2 +- .../parameters/spread/src/api/model/index.ts | 6 +- .../{SpreadContext.ts => spreadContext.ts} | 0 .../spread/src/classic/alias/index.ts | 20 +- .../spread/src/classic/model/index.ts | 8 +- .../generated/parameters/spread/src/index.ts | 10 +- .../parameters/spread/src/models/index.ts | 8 +- .../parameters/spread/src/models/options.ts | 10 +- .../src/{SpreadClient.ts => spreadClient.ts} | 2 +- .../payload/media-type/src/api/index.ts | 8 + .../media-type/src/api/mediaTypeContext.ts | 18 + .../media-type/src/api/stringBody/index.ts | 141 ++ .../payload/media-type/src/classic/index.ts | 4 + .../src/classic/stringBody/index.ts | 50 + .../generated/payload/media-type/src/index.ts | 11 + .../payload/media-type/src/logger.ts | 5 + .../payload/media-type/src/mediaTypeClient.ts | 31 + .../payload/media-type/src/models/index.ts | 9 + .../payload/media-type/src/models/options.ts | 16 + .../media-type/src/rest/clientDefinitions.ts | 47 + .../payload/media-type/src/rest/index.ts | 11 + .../media-type/src/rest/mediaTypeClient.ts | 36 + .../payload/media-type/src/rest/parameters.ts | 30 + .../payload/media-type/src/rest/responses.ts | 26 + .../payload/media-type/tspconfig.yaml | 14 + .../payload/pageable/src/api/index.ts | 2 +- .../payload/pageable/src/api/operations.ts | 8 +- ...{PageableContext.ts => pageableContext.ts} | 0 .../generated/payload/pageable/src/index.ts | 6 +- .../payload/pageable/src/models/index.ts | 4 +- .../payload/pageable/src/models/models.ts | 14 +- .../payload/pageable/src/models/options.ts | 2 +- .../{PageableClient.ts => pageableClient.ts} | 6 +- .../generated/scalar/src/api/boolean/index.ts | 13 +- .../scalar/src/api/decimal128Type/index.ts | 22 +- .../scalar/src/api/decimal128Verify/index.ts | 12 +- .../scalar/src/api/decimalType/index.ts | 18 +- .../scalar/src/api/decimalVerify/index.ts | 12 +- .../generated/scalar/src/api/index.ts | 2 +- .../{ScalarContext.ts => scalarContext.ts} | 0 .../generated/scalar/src/api/string/index.ts | 13 +- .../generated/scalar/src/api/unknown/index.ts | 13 +- .../scalar/src/classic/boolean/index.ts | 15 +- .../src/classic/decimal128Type/index.ts | 24 +- .../src/classic/decimal128Verify/index.ts | 14 +- .../scalar/src/classic/decimalType/index.ts | 26 +- .../scalar/src/classic/decimalVerify/index.ts | 17 +- .../scalar/src/classic/string/index.ts | 15 +- .../scalar/src/classic/unknown/index.ts | 15 +- .../generated/scalar/src/index.ts | 34 +- .../generated/scalar/src/models/index.ts | 32 +- .../generated/scalar/src/models/options.ts | 39 +- .../src/{ScalarClient.ts => scalarClient.ts} | 2 +- .../encoded-name/json/src/api/index.ts | 2 +- .../api/{JsonContext.ts => jsonContext.ts} | 0 .../encoded-name/json/src/api/operations.ts | 10 +- .../encoded-name/json/src/index.ts | 6 +- .../json/src/{JsonClient.ts => jsonClient.ts} | 8 +- .../encoded-name/json/src/models/index.ts | 2 +- .../encoded-name/json/src/models/options.ts | 4 +- .../endpoint/not-defined/src/api/index.ts | 2 +- ...DefinedContext.ts => notDefinedContext.ts} | 0 .../not-defined/src/api/operations.ts | 6 +- .../server/endpoint/not-defined/src/index.ts | 4 +- .../endpoint/not-defined/src/models/index.ts | 2 +- .../not-defined/src/models/options.ts | 2 +- ...otDefinedClient.ts => notDefinedClient.ts} | 6 +- .../server/path/multiple/src/api/index.ts | 2 +- ...{MultipleContext.ts => multipleContext.ts} | 10 +- .../path/multiple/src/api/operations.ts | 12 +- .../server/path/multiple/src/index.ts | 6 +- .../server/path/multiple/src/models/index.ts | 4 +- .../server/path/multiple/src/models/models.ts | 4 +- .../path/multiple/src/models/options.ts | 5 +- .../{MultipleClient.ts => multipleClient.ts} | 14 +- .../server/path/multiple/src/rest/index.ts | 1 + .../server/path/multiple/src/rest/models.ts | 5 + .../path/multiple/src/rest/multipleClient.ts | 3 +- .../server/path/single/src/api/index.ts | 2 +- .../server/path/single/src/api/operations.ts | 6 +- .../{SingleContext.ts => singleContext.ts} | 4 +- .../generated/server/path/single/src/index.ts | 4 +- .../server/path/single/src/models/index.ts | 2 +- .../server/path/single/src/models/options.ts | 2 +- .../src/{SingleClient.ts => singleClient.ts} | 10 +- .../versions/not-versioned/src/api/index.ts | 2 +- ...ionedContext.ts => notVersionedContext.ts} | 4 +- .../not-versioned/src/api/operations.ts | 18 +- .../versions/not-versioned/src/index.ts | 8 +- .../not-versioned/src/models/index.ts | 6 +- .../not-versioned/src/models/options.ts | 6 +- ...rsionedClient.ts => notVersionedClient.ts} | 18 +- .../versions/versioned/src/api/index.ts | 3 +- .../versions/versioned/src/api/operations.ts | 52 +- ...ersionedContext.ts => versionedContext.ts} | 4 +- .../server/versions/versioned/src/index.ts | 10 +- .../versions/versioned/src/models/index.ts | 8 +- .../versions/versioned/src/models/models.ts | 6 + .../versions/versioned/src/models/options.ts | 10 +- .../versioned/src/rest/clientDefinitions.ts | 12 + .../versions/versioned/src/rest/parameters.ts | 11 + .../versions/versioned/src/rest/responses.ts | 5 + ...{VersionedClient.ts => versionedClient.ts} | 30 +- .../generated/specialWords/src/api/index.ts | 115 ++ .../src/api/modelProperties/index.ts | 46 + .../specialWords/src/api/models/index.ts | 1170 ++++++++++++++++ .../specialWords/src/api/operations/index.ts | 970 ++++++++++++++ .../specialWords/src/api/parameters/index.ts | 1189 +++++++++++++++++ .../src/api/specialWordsContext.ts | 57 + .../specialWords/src/classic/index.ts | 7 + .../src/classic/modelProperties/index.ts | 31 + .../specialWords/src/classic/models/index.ts | 294 ++++ .../src/classic/operations/index.ts | 189 +++ .../src/classic/parameters/index.ts | 328 +++++ .../generated/specialWords/src/index.ts | 150 +++ .../generated/specialWords/src/logger.ts | 5 + .../specialWords/src/models/index.ts | 142 ++ .../specialWords/src/models/models.ts | 138 ++ .../specialWords/src/models/options.ts | 210 +++ .../src/rest/clientDefinitions.ts | 1029 ++++++++++++++ .../generated/specialWords/src/rest}/index.ts | 6 +- .../generated/specialWords/src/rest/models.ts | 138 ++ .../specialWords/src/rest/parameters.ts | 680 ++++++++++ .../specialWords/src/rest/responses.ts | 510 +++++++ .../src/rest/specialWordsClient.ts | 36 + .../specialWords/src/specialWordsClient.ts | 91 ++ .../generated/specialWords/tspconfig.yaml | 16 + .../unions/src/api/enumsOnly/index.ts | 12 +- .../unions/src/api/floatsOnly/index.ts | 12 +- .../generated/unions/src/api/index.ts | 2 +- .../unions/src/api/intsOnly/index.ts | 12 +- .../unions/src/api/mixedLiterals/index.ts | 12 +- .../unions/src/api/mixedTypes/index.ts | 12 +- .../unions/src/api/modelsOnly/index.ts | 12 +- .../unions/src/api/stringAndArray/index.ts | 12 +- .../unions/src/api/stringExtensible/index.ts | 12 +- .../src/api/stringExtensibleNamed/index.ts | 12 +- .../unions/src/api/stringsOnly/index.ts | 12 +- .../api/{UnionContext.ts => unionContext.ts} | 0 .../unions/src/classic/enumsOnly/index.ts | 20 +- .../unions/src/classic/floatsOnly/index.ts | 17 +- .../unions/src/classic/intsOnly/index.ts | 17 +- .../unions/src/classic/mixedLiterals/index.ts | 18 +- .../unions/src/classic/mixedTypes/index.ts | 17 +- .../unions/src/classic/modelsOnly/index.ts | 18 +- .../src/classic/stringAndArray/index.ts | 18 +- .../src/classic/stringExtensible/index.ts | 18 +- .../classic/stringExtensibleNamed/index.ts | 14 +- .../unions/src/classic/stringsOnly/index.ts | 17 +- .../generated/unions/src/index.ts | 44 +- .../generated/unions/src/models/index.ts | 42 +- .../generated/unions/src/models/models.ts | 9 +- .../generated/unions/src/models/options.ts | 42 +- .../generated/unions/src/rest/models.ts | 8 +- .../generated/unions/src/rest/outputModels.ts | 8 +- .../src/{UnionClient.ts => unionClient.ts} | 2 +- .../modularIntegration/lroStardard.spec.ts | 24 +- .../modelPropertyType.spec.ts | 12 + .../payloadMediaType.spec.ts | 51 + .../test/modularIntegration/server.spec.ts | 11 + .../modularIntegration/specialWords.spec.ts | 988 ++++++++++++++ .../test/modularUnit/anonymousModel.spec.ts | 131 +- .../test/modularUnit/apiOperations.spec.ts | 88 +- .../test/modularUnit/clientContext.spec.ts | 24 +- .../test/modularUnit/enumUnion.spec.ts | 890 ++++++++++++ .../test/modularUnit/modelsGenerator.spec.ts | 327 +---- .../test/modularUnit/operations.spec.ts | 40 +- .../test/modularUnit/serializeUtil.spec.ts | 80 +- .../typespec-ts/test/modularUnit/type.spec.ts | 238 ---- .../generated/models/usage/src/api/index.ts | 2 +- .../models/usage/src/api/operations.ts | 18 +- .../api/{UsageContext.ts => usageContext.ts} | 0 .../generated/models/usage/src/index.ts | 8 +- .../models/usage/src/models/index.ts | 6 +- .../models/usage/src/models/options.ts | 6 +- .../src/{UsageClient.ts => usageClient.ts} | 14 +- .../typespec-ts/test/unit/apiVersion.spec.ts | 22 +- .../test/unit/clientFactoryGenerator.spec.ts | 65 +- .../test/unit/modelsGenerator.spec.ts | 537 ++++---- .../unit/transform/transformSchemas.spec.ts | 446 ++++--- packages/typespec-ts/test/util/emitUtil.ts | 30 +- packages/typespec-ts/test/util/testUtil.ts | 18 +- rush.json | 2 +- 1285 files changed, 28557 insertions(+), 12890 deletions(-) create mode 100644 packages/rlc-common/src/metadata/buildBrowserConfig.ts create mode 100644 packages/rlc-common/test/integration/mockHelper.ts create mode 100644 packages/rlc-common/test/integration/vitestConfig.spec.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/deleteMultivariateModelSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateBatchAnomalySample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateLastAnomalySample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateChangePointSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateEntireSeriesSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateLastPointSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateBatchDetectionResultSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateModelSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/listMultivariateModelsSample.ts delete mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/trainMultivariateModelSample.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/pagingHelpers.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/options.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/pagingTypes.ts create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/anomalyDetectorClient.ts rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/clientDefinitions.ts (99%) create mode 100644 packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/index.ts rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/isUnexpected.ts (100%) rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/models.ts (89%) rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/outputModels.ts (91%) rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/paginateHelper.ts (100%) rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/parameters.ts (100%) rename packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/{ => rest}/responses.ts (100%) rename packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/{BatchContext.ts => batchContext.ts} (86%) rename packages/typespec-test/test/batch_modular/generated/typespec-ts/src/{BatchClient.ts => batchClient.ts} (81%) rename packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/{ChatProtocolContext.ts => chatProtocolContext.ts} (87%) rename packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/{ChatProtocolClient.ts => chatProtocolClient.ts} (59%) rename packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/{ContentSafetyContext.ts => contentSafetyContext.ts} (78%) rename packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/{ContentSafetyClient.ts => contentSafetyClient.ts} (75%) rename packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/{EventGridContext.ts => eventGridContext.ts} (68%) rename packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/{EventGridClient.ts => eventGridClient.ts} (83%) rename packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/{FooContext.ts => fooContext.ts} (100%) rename packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/{FooClient.ts => fooClient.ts} (82%) rename packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/{AdministrationOperationsClient.ts => administrationOperationsClient.ts} (74%) rename packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/{AdministrationOperationsContext.ts => administrationOperationsContext.ts} (76%) rename packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/{TestRunOperationsContext.ts => testRunOperationsContext.ts} (76%) rename packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/{TestRunOperationsClient.ts => testRunOperationsClient.ts} (73%) rename packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/{OpenAIContext.ts => openAIContext.ts} (100%) rename packages/typespec-test/test/openai_generic/generated/typespec-ts/src/{OpenAIClient.ts => openAIClient.ts} (98%) rename packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/{OpenAIContext.ts => openAIContext.ts} (68%) rename packages/typespec-test/test/openai_modular/generated/typespec-ts/src/{OpenAIClient.ts => openAIClient.ts} (78%) rename packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/{OpenAIContext.ts => openAIContext.ts} (100%) rename packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/{OpenAIClient.ts => openAIClient.ts} (98%) rename packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/{WidgetManagerContext.ts => widgetManagerContext.ts} (77%) create mode 100644 packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts rename packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/{WidgetManagerClient.ts => widgetManagerClient.ts} (84%) create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/index.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/confidentialLedger/index.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/index.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/index.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/models.ts create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/options.ts rename packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/{ => rest}/clientDefinitions.ts (93%) create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/index.ts rename packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/{ => rest}/isUnexpected.ts (100%) rename packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/{ => rest}/outputModels.ts (100%) rename packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/{ => rest}/parameters.ts (100%) create mode 100644 packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/parametrizedHostClient.ts rename packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/{ => rest}/responses.ts (100%) rename packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/{SchemaRegistryContext.ts => schemaRegistryContext.ts} (90%) rename packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/{SchemaRegistryClient.ts => schemaRegistryClient.ts} (94%) rename packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/{WidgetServiceContext.ts => widgetServiceContext.ts} (100%) rename packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/{WidgetServiceClient.ts => widgetServiceClient.ts} (94%) rename packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/{WidgetServiceContext.ts => widgetServiceContext.ts} (100%) rename packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/{WidgetServiceClient.ts => widgetServiceClient.ts} (94%) create mode 100644 packages/typespec-ts/test/integration/generated/client/structure/default/src/models.ts create mode 100644 packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/models.ts create mode 100644 packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/models.ts create mode 100644 packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/models.ts create mode 100644 packages/typespec-ts/test/integration/generated/enums/fixed/src/models.ts create mode 100644 packages/typespec-ts/test/integration/generated/enums/fixed/src/outputModels.ts create mode 100644 packages/typespec-ts/test/integration/generated/payload/media-type/src/clientDefinitions.ts create mode 100644 packages/typespec-ts/test/integration/generated/payload/media-type/src/index.ts create mode 100644 packages/typespec-ts/test/integration/generated/payload/media-type/src/logger.ts rename packages/typespec-ts/test/integration/generated/{projection/src/projectionClient.ts => payload/media-type/src/mediaTypeClient.ts} (76%) create mode 100644 packages/typespec-ts/test/integration/generated/payload/media-type/src/parameters.ts create mode 100644 packages/typespec-ts/test/integration/generated/payload/media-type/src/responses.ts rename packages/typespec-ts/test/integration/generated/{projection => payload/media-type}/tspconfig.yaml (73%) delete mode 100644 packages/typespec-ts/test/integration/generated/projection/src/clientDefinitions.ts delete mode 100644 packages/typespec-ts/test/integration/generated/projection/src/models.ts delete mode 100644 packages/typespec-ts/test/integration/generated/projection/src/parameters.ts delete mode 100644 packages/typespec-ts/test/integration/generated/projection/src/responses.ts create mode 100644 packages/typespec-ts/test/integration/generated/server/path/multiple/src/models.ts create mode 100644 packages/typespec-ts/test/integration/payloadMediaType.spec.ts delete mode 100644 packages/typespec-ts/test/integration/projection.spec.ts create mode 100644 packages/typespec-ts/test/modularIntegration/extensibleEnums.spec.ts create mode 100644 packages/typespec-ts/test/modularIntegration/fixedEnums.spec.ts rename packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/{ArrayContext.ts => arrayContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/{ArrayClient.ts => arrayClient.ts} (98%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/{ApiKeyContext.ts => apiKeyContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/{ApiKeyClient.ts => apiKeyClient.ts} (73%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/{CustomContext.ts => customContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/{CustomClient.ts => customClient.ts} (73%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/{OAuth2Context.ts => oAuth2Context.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/{OAuth2Client.ts => oAuth2Client.ts} (74%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/{UnionContext.ts => unionContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/{UnionClient.ts => unionClient.ts} (75%) rename packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/{AccessClient.ts => accessClient.ts} (66%) rename packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/{AccessContext.ts => accessContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/{UsageContext.ts => usageContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/{UsageClient.ts => usageClient.ts} (80%) rename packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/{ScalarContext.ts => scalarContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/{ScalarClient.ts => scalarClient.ts} (73%) rename packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/{TraitsContext.ts => traitsContext.ts} (78%) rename packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/{TraitsClient.ts => traitsClient.ts} (78%) rename packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/{BasicContext.ts => basicContext.ts} (77%) rename packages/typespec-ts/test/modularIntegration/generated/azure/core/src/{BasicClient.ts => basicClient.ts} (59%) rename packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/{NamingContext.ts => namingContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/client/naming/src/{NamingClient.ts => namingClient.ts} (74%) rename packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/{ServiceContext.ts => serviceContext.ts} (88%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/models.ts rename packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/{ServiceClient.ts => serviceClient.ts} (81%) rename packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/{AClient.ts => aClient.ts} (65%) rename packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/{AContext.ts => aContext.ts} (80%) rename packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/{BContext.ts => bContext.ts} (80%) rename packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/{BClient.ts => bClient.ts} (65%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/models.ts rename packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/{RenamedOperationContext.ts => renamedOperationContext.ts} (81%) rename packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/{RenamedOperationClient.ts => renamedOperationClient.ts} (70%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/models.ts rename packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/{TwoOperationGroupContext.ts => twoOperationGroupContext.ts} (81%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/models.ts rename packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/{TwoOperationGroupClient.ts => twoOperationGroupClient.ts} (84%) rename packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/{BytesContext.ts => bytesContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/{BytesClient.ts => bytesClient.ts} (96%) rename packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/{DatetimeContext.ts => datetimeContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/{DatetimeClient.ts => datetimeClient.ts} (96%) rename packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/{DurationContext.ts => durationContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/{DurationClient.ts => durationClient.ts} (95%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/extensibleContext.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/string/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/string/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/extensibleClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/logger.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/models.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/options.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/clientDefinitions.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/extensibleClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/models.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/outputModels.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/parameters.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/responses.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/extensible/tspconfig.yaml create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/fixedContext.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/string/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/string/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/fixedClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/index.ts rename packages/typespec-ts/test/{integration/generated/projection => modularIntegration/generated/enums/fixed}/src/logger.ts (69%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/models.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/options.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/clientDefinitions.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/fixedClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/models.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/outputModels.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/parameters.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/responses.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/enums/fixed/tspconfig.yaml rename packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/{RequestIdContext.ts => requestIdContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/{RequestIdClient.ts => requestIdClient.ts} (78%) rename packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/{RepeatabilityContext.ts => repeatabilityContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/{RepeatabilityClient.ts => repeatabilityClient.ts} (82%) rename packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/{RpcContext.ts => rpcContext.ts} (78%) rename packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/{RpcClient.ts => rpcClient.ts} (83%) rename packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/{StandardContext.ts => standardContext.ts} (78%) rename packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/{StandardClient.ts => standardClient.ts} (55%) rename packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/{EmptyContext.ts => emptyContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/{EmptyClient.ts => emptyClient.ts} (76%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/{EnumDiscriminatorContext.ts => enumDiscriminatorContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/{EnumDiscriminatorClient.ts => enumDiscriminatorClient.ts} (71%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/{NestedDiscriminatorContext.ts => nestedDiscriminatorContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/{NestedDiscriminatorClient.ts => nestedDiscriminatorClient.ts} (69%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/{NotDiscriminatedContext.ts => notDiscriminatedContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/{NotDiscriminatedClient.ts => notDiscriminatedClient.ts} (76%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/{RecursiveContext.ts => recursiveContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/{RecursiveClient.ts => recursiveClient.ts} (74%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/{SingleDiscriminatorContext.ts => singleDiscriminatorContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/{SingleDiscriminatorClient.ts => singleDiscriminatorClient.ts} (68%) rename packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/{ValueTypesContext.ts => valueTypesContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/{ValueTypesClient.ts => valueTypesClient.ts} (99%) rename packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/{UsageContext.ts => usageContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/{UsageClient.ts => usageClient.ts} (77%) rename packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/{BodyOptionalityContext.ts => bodyOptionalityContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/{BodyOptionalityClient.ts => bodyOptionalityClient.ts} (83%) rename packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/{CollectionFormatContext.ts => collectionFormatContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/{CollectionFormatClient.ts => collectionFormatClient.ts} (94%) rename packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/{SpreadContext.ts => spreadContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/{SpreadClient.ts => spreadClient.ts} (94%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/mediaTypeContext.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/stringBody/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/stringBody/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/logger.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/mediaTypeClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/options.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/clientDefinitions.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/mediaTypeClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/parameters.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/responses.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml rename packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/{PageableContext.ts => pageableContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/{PageableClient.ts => pageableClient.ts} (81%) rename packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/{ScalarContext.ts => scalarContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/scalar/src/{ScalarClient.ts => scalarClient.ts} (97%) rename packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/{JsonContext.ts => jsonContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/{JsonClient.ts => jsonClient.ts} (76%) rename packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/{NotDefinedContext.ts => notDefinedContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/{NotDefinedClient.ts => notDefinedClient.ts} (78%) rename packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/{MultipleContext.ts => multipleContext.ts} (60%) rename packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/{MultipleClient.ts => multipleClient.ts} (64%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/models.ts rename packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/{SingleContext.ts => singleContext.ts} (85%) rename packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/{SingleClient.ts => singleClient.ts} (62%) rename packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/{NotVersionedContext.ts => notVersionedContext.ts} (86%) rename packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/{NotVersionedClient.ts => notVersionedClient.ts} (65%) rename packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/{VersionedContext.ts => versionedContext.ts} (85%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/models.ts rename packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/{VersionedClient.ts => versionedClient.ts} (54%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/modelProperties/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/models/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/operations/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/parameters/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/specialWordsContext.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/modelProperties/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/models/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/operations/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/parameters/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/logger.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/index.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/models.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/options.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/clientDefinitions.ts rename packages/typespec-ts/test/{integration/generated/projection/src => modularIntegration/generated/specialWords/src/rest}/index.ts (61%) create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/models.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/parameters.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/responses.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/specialWordsClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/src/specialWordsClient.ts create mode 100644 packages/typespec-ts/test/modularIntegration/generated/specialWords/tspconfig.yaml rename packages/typespec-ts/test/modularIntegration/generated/unions/src/api/{UnionContext.ts => unionContext.ts} (100%) rename packages/typespec-ts/test/modularIntegration/generated/unions/src/{UnionClient.ts => unionClient.ts} (98%) create mode 100644 packages/typespec-ts/test/modularIntegration/payloadMediaType.spec.ts create mode 100644 packages/typespec-ts/test/modularIntegration/specialWords.spec.ts create mode 100644 packages/typespec-ts/test/modularUnit/enumUnion.spec.ts delete mode 100644 packages/typespec-ts/test/modularUnit/type.spec.ts rename packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/{UsageContext.ts => usageContext.ts} (100%) rename packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/{UsageClient.ts => usageClient.ts} (77%) diff --git a/.scripts/build.yml b/.scripts/build.yml index cc582f4b04..f3e8f705e9 100644 --- a/.scripts/build.yml +++ b/.scripts/build.yml @@ -1,7 +1,7 @@ steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Use Node 18" - script: | npm install -g @microsoft/rush diff --git a/.scripts/ci.yml b/.scripts/ci.yml index 623081eb56..9853ad54ec 100644 --- a/.scripts/ci.yml +++ b/.scripts/ci.yml @@ -104,11 +104,11 @@ stages: macOS_Node18: Pool: OSVmImage: "macOS-latest" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Linux_Node18: Pool: ${{ parameters.LinuxPool }} OSVmImage: "ubuntu-20.04" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Windows_Latest: Pool: OSVmImage: "Windows-latest" @@ -134,11 +134,11 @@ stages: macOS_Node18: Pool: OSVmImage: "macOS-latest" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Linux_Node18: Pool: ${{ parameters.LinuxPool }} OSVmImage: "ubuntu-20.04" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Windows_Latest: Pool: OSVmImage: "Windows-latest" @@ -169,11 +169,11 @@ stages: macOS_Node18: Pool: OSVmImage: "macOS-latest" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Linux_Node18: Pool: ${{ parameters.LinuxPool }} OSVmImage: "ubuntu-20.04" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" pool: name: $[coalesce(variables['Pool'], '')] vmImage: $[coalesce(variables['OSVmImage'], '')] @@ -231,11 +231,11 @@ stages: macOS_Node18: Pool: OSVmImage: "macOS-latest" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Linux_Node18: Pool: ${{ parameters.LinuxPool }} OSVmImage: "ubuntu-20.04" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Windows_Latest: Pool: OSVmImage: "Windows-latest" @@ -261,11 +261,11 @@ stages: macOS_Node18: Pool: OSVmImage: "macOS-latest" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Linux_Node18: Pool: ${{ parameters.LinuxPool }} OSVmImage: "ubuntu-20.04" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" # Windows_Latest: # Pool: # OSVmImage: "Windows-latest" diff --git a/.scripts/release.yml b/.scripts/release.yml index 33cef268fc..d25188456b 100644 --- a/.scripts/release.yml +++ b/.scripts/release.yml @@ -36,7 +36,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | tar zxvf $(Pipeline.Workspace)/packages/$(TAR_NAME) @@ -59,7 +59,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | cd $(Pipeline.Workspace)/packages @@ -90,7 +90,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | tar zxvf $(Pipeline.Workspace)/packages/$(TAR_NAME) @@ -113,7 +113,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | cd $(Pipeline.Workspace)/packages @@ -145,7 +145,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | tar zxvf $(Pipeline.Workspace)/packages/$(TAR_NAME) @@ -168,7 +168,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | cd $(Pipeline.Workspace)/packages @@ -196,7 +196,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | tar zxvf $(Pipeline.Workspace)/packages/$(TAR_NAME) @@ -221,7 +221,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | tar zxvf $(Pipeline.Workspace)/packages/$(TAR_NAME) @@ -246,7 +246,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | tar zxvf $(Pipeline.Workspace)/packages/$(TAR_NAME) @@ -270,7 +270,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | cd $(Pipeline.Workspace)/packages @@ -293,7 +293,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | cd $(Pipeline.Workspace)/packages @@ -316,7 +316,7 @@ stages: steps: - task: NodeTool@0 inputs: - versionSpec: "18.19.x" + versionSpec: "18.x" displayName: "Install Node.js" - script: | cd $(Pipeline.Workspace)/packages diff --git a/.scripts/smoke-test.yml b/.scripts/smoke-test.yml index 13cde6caa2..6f2f6138b0 100644 --- a/.scripts/smoke-test.yml +++ b/.scripts/smoke-test.yml @@ -11,11 +11,11 @@ jobs: macOS_Node18: Pool: OSVmImage: "macOS-latest" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Linux_Node18: Pool: ${{ parameters.LinuxPool }} OSVmImage: "ubuntu-20.04" - NodeTestVersion: "18.19.x" + NodeTestVersion: "18.x" Windows_Latest: Pool: OSVmImage: "Windows-latest" diff --git a/.vscode/launch.json b/.vscode/launch.json index d268934228..3dfb12cc6b 100755 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -126,8 +126,7 @@ "runtimeArgs": [ "ts-node", "./test/commands/gen-cadl-ranch.ts", - "--tag=rlc", - "--debug" + "--tag=modular" ], "runtimeExecutable": "npx", "skipFiles": ["/**"], diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 8008c0eae1..01614e68ee 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10,9 +10,9 @@ importers: '@autorest/codemodel': ~4.19.2 '@autorest/extension-base': ^3.5.0 '@autorest/testmodeler': ^2.4.0 - '@azure-rest/core-client': ^1.2.0 + '@azure-rest/core-client': ^1.4.0 '@azure-tools/codegen': ^2.9.1 - '@azure-tools/rlc-common': workspace:^0.25.0 + '@azure-tools/rlc-common': workspace:^0.27.0 '@azure-tools/test-recorder': ^3.0.0 '@azure/abort-controller': ^1.0.1 '@azure/core-auth': ^1.6.0 @@ -69,7 +69,7 @@ importers: ts-morph: ^15.1.0 ts-node: ^8.5.2 tslib: ^2.3.1 - typescript: ~5.2.0 + typescript: ~5.4.5 wait-port: ^0.2.6 webpack: ^5.72.0 webpack-cli: ^4.9.2 @@ -78,7 +78,7 @@ importers: '@autorest/codemodel': 4.19.3 '@autorest/extension-base': 3.5.2 '@autorest/testmodeler': 2.6.1 - '@azure-rest/core-client': 1.2.0 + '@azure-rest/core-client': 1.4.0 '@azure-tools/codegen': 2.9.2 '@azure-tools/rlc-common': link:../rlc-common '@azure/core-auth': 1.6.0 @@ -113,8 +113,8 @@ importers: '@types/sinon': 10.0.17 '@types/xmlbuilder': 0.0.34 '@types/yargs': 17.0.25 - '@typescript-eslint/eslint-plugin': 6.8.0_qc27boxdfajyxyoyktucppwpla - '@typescript-eslint/parser': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa + '@typescript-eslint/eslint-plugin': 6.8.0_xunbxrh7emkzv2ys2f2orljele + '@typescript-eslint/parser': 6.8.0_afxi7czp26kyxjrij76jotv2vq autorest: 3.6.3 buffer: 6.0.3 chai: 4.3.8 @@ -132,13 +132,13 @@ importers: npm-run-all: 4.1.5 openapi-types: 7.2.3 path-browserify: 1.0.1 - puppeteer: 22.4.1_typescript@5.2.2 + puppeteer: 22.4.1_typescript@5.4.5 rimraf: 5.0.4 sinon: 10.0.1 source-map-loader: 1.1.3_webpack@5.88.2 - ts-node: 8.10.2_typescript@5.2.2 + ts-node: 8.10.2_typescript@5.4.5 tslib: 2.6.2 - typescript: 5.2.2 + typescript: 5.4.5 wait-port: 0.2.14 webpack: 5.88.2_webpack-cli@4.10.0 webpack-cli: 4.10.0_webpack@5.88.2 @@ -165,7 +165,7 @@ importers: rimraf: ^5.0.0 ts-morph: ^15.1.0 ts-node: ^10.7.0 - typescript: ~5.2.0 + typescript: ~5.4.5 dependencies: handlebars: 4.7.8 lodash: 4.17.21 @@ -176,8 +176,8 @@ importers: '@types/lodash': 4.14.199 '@types/mocha': 10.0.1 '@types/node': 18.18.0 - '@typescript-eslint/eslint-plugin': 6.8.0_qc27boxdfajyxyoyktucppwpla - '@typescript-eslint/parser': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa + '@typescript-eslint/eslint-plugin': 6.8.0_xunbxrh7emkzv2ys2f2orljele + '@typescript-eslint/parser': 6.8.0_afxi7czp26kyxjrij76jotv2vq chai: 4.3.8 cross-env: 7.0.3 eslint: 8.50.0 @@ -186,53 +186,53 @@ importers: mocha: 10.2.0 prettier: 3.1.1 rimraf: 5.0.4 - ts-node: 10.9.1_5a6lqx2r5gtzmizq73fzykbege - typescript: 5.2.2 + ts-node: 10.9.1_zhb5j7z2epl224l2ylrhvblng4 + typescript: 5.4.5 ../../packages/typespec-test: specifiers: - '@azure-tools/typespec-autorest': '>=0.40.0 <1.0.0' - '@azure-tools/typespec-azure-core': '>=0.40.0 <1.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.40.0 <1.0.0' - '@azure-tools/typespec-ts': workspace:^0.25.0 + '@azure-tools/typespec-autorest': '>=0.41.0 <1.0.0' + '@azure-tools/typespec-azure-core': '>=0.41.0 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.41.3 <1.0.0' + '@azure-tools/typespec-ts': workspace:^0.27.0 '@types/mocha': ^5.2.7 '@types/node': ^18.0.0 - '@typespec/compiler': '>=0.54.0 <1.0.0' - '@typespec/http': '>=0.54.0 <1.0.0' - '@typespec/openapi': '>=0.54.0 <1.0.0' - '@typespec/openapi3': '>=0.54.0 <1.0.0' - '@typespec/rest': '>=0.54.0 <1.0.0' - '@typespec/versioning': '>=0.54.0 <1.0.0' + '@typespec/compiler': '>=0.55.0 <1.0.0' + '@typespec/http': '>=0.55.0 <1.0.0' + '@typespec/openapi': '>=0.55.0 <1.0.0' + '@typespec/openapi3': '>=0.55.0 <1.0.0' + '@typespec/rest': '>=0.55.0 <1.0.0' + '@typespec/versioning': '>=0.55.0 <1.0.0' prettier: ^3.1.0 ts-node: ^8.5.2 - typescript: ~5.2.0 + typescript: ~5.4.5 dependencies: - '@azure-tools/typespec-autorest': 0.40.0_u3hxo7ph6nrgz7xxlaohzqy24a - '@azure-tools/typespec-azure-core': 0.40.0_r7faphy27mfblbs27ccm7re44u - '@azure-tools/typespec-client-generator-core': 0.40.0_7d65p6cqvelxcgmavq4zy7blpy + '@azure-tools/typespec-autorest': 0.41.1_qgf42bahc6a3au7lyt3fze77by + '@azure-tools/typespec-azure-core': 0.41.0_osvotlf4anf4wofkp3olgsifya + '@azure-tools/typespec-client-generator-core': 0.41.3_ejdluhimozvsug6nabr5tzgmai '@azure-tools/typespec-ts': link:../typespec-ts - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/openapi': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/openapi3': 0.54.0_gawyyuwi7rfkgwwvtpeudeqoo4 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/openapi': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/openapi3': 0.55.0_uutarydilqfrmegus37wddce6m + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 prettier: 3.1.1 devDependencies: '@types/mocha': 5.2.7 '@types/node': 18.18.0 - ts-node: 8.10.2_typescript@5.2.2 - typescript: 5.2.2 + ts-node: 8.10.2_typescript@5.4.5 + typescript: 5.4.5 ../../packages/typespec-ts: specifiers: - '@azure-rest/core-client': ^1.3.0 - '@azure-tools/cadl-ranch': ^0.12.4 - '@azure-tools/cadl-ranch-expect': ^0.13.2 - '@azure-tools/cadl-ranch-specs': ^0.31.5 - '@azure-tools/rlc-common': workspace:^0.25.0 - '@azure-tools/typespec-azure-core': '>=0.40.0 <1.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.40.0 <1.0.0' + '@azure-rest/core-client': ^1.4.0 + '@azure-tools/cadl-ranch': ^0.12.7 + '@azure-tools/cadl-ranch-expect': ^0.13.3 + '@azure-tools/cadl-ranch-specs': ^0.31.8 + '@azure-tools/rlc-common': workspace:^0.27.0 + '@azure-tools/typespec-azure-core': '>=0.41.0 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.41.3 <1.0.0' '@azure/abort-controller': ^2.0.0 '@azure/core-auth': ^1.6.0 '@azure/core-lro': 3.0.0-beta.1 @@ -246,25 +246,25 @@ importers: '@types/node': ^18.0.0 '@typescript-eslint/eslint-plugin': ^6.8.0 '@typescript-eslint/parser': ^6.8.0 - '@typespec/compiler': '>=0.54.0 <1.0.0' - '@typespec/http': '>=0.54.0 <1.0.0' - '@typespec/rest': '>=0.54.0 <1.0.0' + '@typespec/compiler': '>=0.55.0 <1.0.0' + '@typespec/http': '>=0.55.0 <1.0.0' + '@typespec/rest': '>=0.55.0 <1.0.0' '@typespec/ts-http-runtime': 1.0.0-alpha.20240314.2 - '@typespec/versioning': '>=0.54.0 <1.0.0' + '@typespec/versioning': '>=0.55.0 <1.0.0' chai: ^4.3.6 chalk: ^4.0.0 cross-env: ^7.0.3 eslint: ^8.9.0 eslint-plugin-require-extensions: 0.1.3 fs-extra: ^11.1.0 - mkdirp: ^2.1.2 + mkdirp: ^3.0.1 mocha: ^9.2.2 prettier: ^3.1.0 rimraf: ^5.0.0 ts-morph: ^15.1.0 ts-node: ~10.9.1 tslib: ^2.3.1 - typescript: ~5.2.0 + typescript: ~5.4.5 dependencies: '@azure-tools/rlc-common': link:../rlc-common fs-extra: 11.1.1 @@ -272,12 +272,12 @@ importers: ts-morph: 15.1.0 tslib: 2.6.2 devDependencies: - '@azure-rest/core-client': 1.3.0 - '@azure-tools/cadl-ranch': 0.12.4_27iinb5lot767z4cqqvftnszfu - '@azure-tools/cadl-ranch-expect': 0.13.2_7d65p6cqvelxcgmavq4zy7blpy - '@azure-tools/cadl-ranch-specs': 0.31.5_tl5l4xe44yzem5nticz333o2oa - '@azure-tools/typespec-azure-core': 0.40.0_r7faphy27mfblbs27ccm7re44u - '@azure-tools/typespec-client-generator-core': 0.40.0_7d65p6cqvelxcgmavq4zy7blpy + '@azure-rest/core-client': 1.4.0 + '@azure-tools/cadl-ranch': 0.12.7_2st3rkk3ecy4zxpm646kh3x7we + '@azure-tools/cadl-ranch-expect': 0.13.3_jqtt3simmngrcvnphehjbnp5v4 + '@azure-tools/cadl-ranch-specs': 0.31.8_sn2g2ali27qzgjd2nm42z5e5my + '@azure-tools/typespec-azure-core': 0.41.0_osvotlf4anf4wofkp3olgsifya + '@azure-tools/typespec-client-generator-core': 0.41.3_ejdluhimozvsug6nabr5tzgmai '@azure/abort-controller': 2.0.0 '@azure/core-auth': 1.6.0 '@azure/core-lro': 3.0.0-beta.1 @@ -289,23 +289,23 @@ importers: '@types/fs-extra': 9.0.13 '@types/mocha': 9.1.1 '@types/node': 18.18.0 - '@typescript-eslint/eslint-plugin': 6.8.0_qc27boxdfajyxyoyktucppwpla - '@typescript-eslint/parser': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 + '@typescript-eslint/eslint-plugin': 6.8.0_xunbxrh7emkzv2ys2f2orljele + '@typescript-eslint/parser': 6.8.0_afxi7czp26kyxjrij76jotv2vq + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 '@typespec/ts-http-runtime': 1.0.0-alpha.20240314.2 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 chai: 4.3.8 chalk: 4.1.2 cross-env: 7.0.3 eslint: 8.50.0 eslint-plugin-require-extensions: 0.1.3_eslint@8.50.0 - mkdirp: 2.1.6 + mkdirp: 3.0.1 mocha: 9.2.2 rimraf: 5.0.4 - ts-node: 10.9.1_5a6lqx2r5gtzmizq73fzykbege - typescript: 5.2.2 + ts-node: 10.9.1_zhb5j7z2epl224l2ylrhvblng4 + typescript: 5.4.5 packages: @@ -335,8 +335,8 @@ packages: resolution: {integrity: sha512-7OXzYet3S/Hiow9LzHUY5qdNRnceSQd41wKEGzfcGVleyWRobYJgYxGmUEyFZP4ZSerAb+QqygSvo9yWIC3nrQ==} dev: false - /@azure-rest/core-client/1.2.0: - resolution: {integrity: sha512-+3zapvYc+25FpTzCkcYqsh/v8BiSJhMGseWhMgec5RqsH1VovIUHNyNS7hQDECv3QslL6M3TxZnDNmCqoz5IZA==} + /@azure-rest/core-client/1.4.0: + resolution: {integrity: sha512-ozTDPBVUDR5eOnMIwhggbnVmOrka4fXCs8n8mvUo4WLLc38kki6bAOByDoVZZPz/pZy2jMt2kwfpvy/UjALj6w==} engines: {node: '>=18.0.0'} dependencies: '@azure/abort-controller': 2.0.0 @@ -347,21 +347,6 @@ packages: tslib: 2.6.2 transitivePeerDependencies: - supports-color - dev: false - - /@azure-rest/core-client/1.3.0: - resolution: {integrity: sha512-OmAB+qbWZJk4p9+aqF3zM3J3J371RTdz1gRvz4uxl/+MGLKfKBMzZqVkAUIY8h1qzux4ypozCiRPJ3wdWyPDUg==} - engines: {node: '>=18.0.0'} - dependencies: - '@azure/abort-controller': 2.0.0 - '@azure/core-auth': 1.6.0 - '@azure/core-rest-pipeline': 1.14.0 - '@azure/core-tracing': 1.0.1 - '@azure/core-util': 1.5.0 - tslib: 2.6.2 - transitivePeerDependencies: - - supports-color - dev: true /@azure-tools/async-io/3.0.254: resolution: {integrity: sha512-X1C7XdyCuo50ch9FzKtTvmK18FgDxxf1Bbt3cSoknQqeDaRegHSSCO+zByq2YA4NvUzKXeZ1engh29IDxZXgpQ==} @@ -389,8 +374,8 @@ packages: - '@types/express' dev: true - /@azure-tools/cadl-ranch-coverage-sdk/0.8.1: - resolution: {integrity: sha512-gvt5NElamTmId/puH2iblJYCMKghL6/jUm3tB49LHOYFXwKdnz9Vss9cNSsmdCctGGbRutFu+9CGTzS5aiXwGw==} + /@azure-tools/cadl-ranch-coverage-sdk/0.8.2: + resolution: {integrity: sha512-Os5tVUfuL2MmtYMbmYmCM0vFClH3Ik3i3BDz6yCaPlccx/TzgOXL0o9hRYxpmUhmV1VciE+Rpv5IwYVsfZBxnw==} engines: {node: '>=16.0.0'} dependencies: '@azure/identity': 3.3.0 @@ -401,64 +386,64 @@ packages: - supports-color dev: true - /@azure-tools/cadl-ranch-expect/0.13.2_7d65p6cqvelxcgmavq4zy7blpy: - resolution: {integrity: sha512-5W/jcyfQHeJ7QJZ/fQyIzYn/D9rXlxL8zWELTs/wnVlT3Cf45kJT83+SwKqMPAN/bJsWSnebS84mRAHhQijmZA==} + /@azure-tools/cadl-ranch-expect/0.13.3_jqtt3simmngrcvnphehjbnp5v4: + resolution: {integrity: sha512-CkLsiRci29AvU08vJXLx8O4t2p+60cH7OhLD11IBvfx4czwsShI5AKswvm0ESanuwpquCF3RATu+UTqVM+pYTA==} engines: {node: '>=16.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 dev: true - /@azure-tools/cadl-ranch-specs/0.31.5_tl5l4xe44yzem5nticz333o2oa: - resolution: {integrity: sha512-owj1jtWepksi97HwbMiqZqTg1giYgcaFZwcfHw76UzVoX4dHQQJ5UyzE3ZR4kg5Bj6g6DuT39TA16h0rk9o7tw==} + /@azure-tools/cadl-ranch-specs/0.31.8_sn2g2ali27qzgjd2nm42z5e5my: + resolution: {integrity: sha512-KNp+eP8KN4m+z1eMzBbO84h5kEHOLCoR0Tn37rs1MTTIxiJQhJ2MKEktAcrLI8jqzaA8UUhomTwZIf6ZMSTR5Q==} engines: {node: '>=16.0.0'} peerDependencies: - '@azure-tools/cadl-ranch-expect': ~0.13.2 - '@azure-tools/typespec-azure-core': ~0.40.0 - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@azure-tools/cadl-ranch': 0.12.4_27iinb5lot767z4cqqvftnszfu + '@azure-tools/cadl-ranch-expect': ~0.13.3 + '@azure-tools/typespec-azure-core': ~0.41.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@azure-tools/cadl-ranch': 0.12.7_2st3rkk3ecy4zxpm646kh3x7we '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-expect': 0.13.2_7d65p6cqvelxcgmavq4zy7blpy - '@azure-tools/typespec-azure-core': 0.40.0_r7faphy27mfblbs27ccm7re44u - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 + '@azure-tools/cadl-ranch-expect': 0.13.3_jqtt3simmngrcvnphehjbnp5v4 + '@azure-tools/typespec-azure-core': 0.41.0_osvotlf4anf4wofkp3olgsifya + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 transitivePeerDependencies: - '@types/express' - encoding - supports-color dev: true - /@azure-tools/cadl-ranch/0.12.4_27iinb5lot767z4cqqvftnszfu: - resolution: {integrity: sha512-uYjwBFl7s/7AXqzaeL0u5CueMnfqiN7Ov9KUCvHOjorE34ERzQsyVO1G0ZsadsKX1D9lttVlmRRLtiFila+otA==} + /@azure-tools/cadl-ranch/0.12.7_2st3rkk3ecy4zxpm646kh3x7we: + resolution: {integrity: sha512-lhJP81l7i+ScW14TYJ7P4qerkYsGGXFpAsxXUUk7hhu5vQL6TuMj/dyVXFU5nE3h2TAW+SOM+Lk6awRLxY5s+A==} engines: {node: '>=16.0.0'} hasBin: true dependencies: '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-coverage-sdk': 0.8.1 - '@azure-tools/cadl-ranch-expect': 0.13.2_7d65p6cqvelxcgmavq4zy7blpy + '@azure-tools/cadl-ranch-coverage-sdk': 0.8.2 + '@azure-tools/cadl-ranch-expect': 0.13.3_jqtt3simmngrcvnphehjbnp5v4 '@azure/identity': 3.3.0 '@types/js-yaml': 4.0.6 - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 ajv: 8.12.0 body-parser: 1.20.2 deep-equal: 2.2.2 - express: 4.18.2 - express-promise-router: 4.1.1_express@4.18.2 + express: 4.19.2 + express-promise-router: 4.1.1_express@4.19.2 glob: 10.3.9 jackspeak: 2.1.1 js-yaml: 4.1.0 @@ -503,53 +488,55 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest/0.40.0_u3hxo7ph6nrgz7xxlaohzqy24a: - resolution: {integrity: sha512-aMgJk0pudvg11zs/2dlUWPEsdK920NvTqGkbYhy+4UeJ1hEzMM3btOyujE/irhDlcZeEgDlaXQc+xiK/Vik71A==} + /@azure-tools/typespec-autorest/0.41.1_qgf42bahc6a3au7lyt3fze77by: + resolution: {integrity: sha512-m2Rq8aFMvICfkG/+B1kGSDepCUDHhiQ93y1/IcE+XU1+IU2iuNoSgUd0lHgksP5Aqnvs3Wm9JDmA9nMNjOM1Ww==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-azure-core': ~0.40.0 - '@azure-tools/typespec-client-generator-core': ~0.40.0 - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/openapi': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@azure-tools/typespec-azure-core': 0.40.0_r7faphy27mfblbs27ccm7re44u - '@azure-tools/typespec-client-generator-core': 0.40.0_7d65p6cqvelxcgmavq4zy7blpy - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/openapi': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 + '@azure-tools/typespec-azure-core': ~0.41.0 + '@azure-tools/typespec-client-generator-core': ~0.41.1 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/openapi': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.41.0_osvotlf4anf4wofkp3olgsifya + '@azure-tools/typespec-client-generator-core': 0.41.3_ejdluhimozvsug6nabr5tzgmai + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/openapi': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 dev: false - /@azure-tools/typespec-azure-core/0.40.0_r7faphy27mfblbs27ccm7re44u: - resolution: {integrity: sha512-l5U47zXKYQKFbipRQLpjG4EwvPJg0SogdFEe5a3rRr7mUy8sWPkciHpngLZVOd2cKZQD5m7nqwfWL798I9TJnQ==} + /@azure-tools/typespec-azure-core/0.41.0_osvotlf4anf4wofkp3olgsifya: + resolution: {integrity: sha512-bnVrLxyjhMfKv75POL3m+lWjyqpLtWYEM9t2mrhFECHfW3+gWzTKIg98oNMKLXmev/sCc9QhbkKLs72jqxNL1Q==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/rest': ~0.54.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/rest': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 - /@azure-tools/typespec-client-generator-core/0.40.0_7d65p6cqvelxcgmavq4zy7blpy: - resolution: {integrity: sha512-Nm/OfDtSWBr1lylISbXR37B9QKWlZHK1j4T8L439Y1v3VcvJsC/0F5PLemY0odHpOYZNwu2uevJjAeM5W56wlw==} + /@azure-tools/typespec-client-generator-core/0.41.3_ejdluhimozvsug6nabr5tzgmai: + resolution: {integrity: sha512-f5H6gz7GCi0kUd7/8LoyJaMq68E0fNldZKQPxUIxqwlQHTFUI/7K37kCkOMNVk8gqmLgLKCShBLhE7zONKe8MA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/rest': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 - change-case: 5.4.3 + '@azure-tools/typespec-azure-core': ~0.41.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.41.0_osvotlf4anf4wofkp3olgsifya + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/rest': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 + change-case: 5.4.4 pluralize: 8.0.0 /@azure/abort-controller/1.1.0: @@ -756,24 +743,25 @@ packages: - encoding dev: true - /@babel/code-frame/7.23.5: - resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} + /@babel/code-frame/7.24.2: + resolution: {integrity: sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/highlight': 7.23.4 - chalk: 2.4.2 + '@babel/highlight': 7.24.2 + picocolors: 1.0.0 /@babel/helper-validator-identifier/7.22.20: resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} - /@babel/highlight/7.23.4: - resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} + /@babel/highlight/7.24.2: + resolution: {integrity: sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-validator-identifier': 7.22.20 chalk: 2.4.2 js-tokens: 4.0.0 + picocolors: 1.0.0 /@colors/colors/1.5.0: resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} @@ -989,8 +977,8 @@ packages: - supports-color dev: true - /@sindresorhus/merge-streams/1.0.0: - resolution: {integrity: sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==} + /@sindresorhus/merge-streams/2.3.0: + resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} engines: {node: '>=18'} /@sinonjs/commons/1.8.6: @@ -1203,7 +1191,7 @@ packages: dev: true optional: true - /@typescript-eslint/eslint-plugin/6.8.0_qc27boxdfajyxyoyktucppwpla: + /@typescript-eslint/eslint-plugin/6.8.0_xunbxrh7emkzv2ys2f2orljele: resolution: {integrity: sha512-GosF4238Tkes2SHPQ1i8f6rMtG6zlKwMEB0abqSJ3Npvos+doIlc/ATG+vX1G9coDF3Ex78zM3heXHLyWEwLUw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1215,10 +1203,10 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.8.2 - '@typescript-eslint/parser': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa + '@typescript-eslint/parser': 6.8.0_afxi7czp26kyxjrij76jotv2vq '@typescript-eslint/scope-manager': 6.8.0 - '@typescript-eslint/type-utils': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa - '@typescript-eslint/utils': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa + '@typescript-eslint/type-utils': 6.8.0_afxi7czp26kyxjrij76jotv2vq + '@typescript-eslint/utils': 6.8.0_afxi7czp26kyxjrij76jotv2vq '@typescript-eslint/visitor-keys': 6.8.0 debug: 4.3.4 eslint: 8.50.0 @@ -1226,13 +1214,13 @@ packages: ignore: 5.2.4 natural-compare: 1.4.0 semver: 7.5.4 - ts-api-utils: 1.0.3_typescript@5.2.2 - typescript: 5.2.2 + ts-api-utils: 1.0.3_typescript@5.4.5 + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/6.8.0_jk7qbkaijtltyu4ajmze3dfiwa: + /@typescript-eslint/parser/6.8.0_afxi7czp26kyxjrij76jotv2vq: resolution: {integrity: sha512-5tNs6Bw0j6BdWuP8Fx+VH4G9fEPDxnVI7yH1IAPkQH5RUtvKwRoqdecAPdQXv4rSOADAaz1LFBZvZG7VbXivSg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1244,11 +1232,11 @@ packages: dependencies: '@typescript-eslint/scope-manager': 6.8.0 '@typescript-eslint/types': 6.8.0 - '@typescript-eslint/typescript-estree': 6.8.0_typescript@5.2.2 + '@typescript-eslint/typescript-estree': 6.8.0_typescript@5.4.5 '@typescript-eslint/visitor-keys': 6.8.0 debug: 4.3.4 eslint: 8.50.0 - typescript: 5.2.2 + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true @@ -1261,7 +1249,7 @@ packages: '@typescript-eslint/visitor-keys': 6.8.0 dev: true - /@typescript-eslint/type-utils/6.8.0_jk7qbkaijtltyu4ajmze3dfiwa: + /@typescript-eslint/type-utils/6.8.0_afxi7czp26kyxjrij76jotv2vq: resolution: {integrity: sha512-RYOJdlkTJIXW7GSldUIHqc/Hkto8E+fZN96dMIFhuTJcQwdRoGN2rEWA8U6oXbLo0qufH7NPElUb+MceHtz54g==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1271,12 +1259,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.8.0_typescript@5.2.2 - '@typescript-eslint/utils': 6.8.0_jk7qbkaijtltyu4ajmze3dfiwa + '@typescript-eslint/typescript-estree': 6.8.0_typescript@5.4.5 + '@typescript-eslint/utils': 6.8.0_afxi7czp26kyxjrij76jotv2vq debug: 4.3.4 eslint: 8.50.0 - ts-api-utils: 1.0.3_typescript@5.2.2 - typescript: 5.2.2 + ts-api-utils: 1.0.3_typescript@5.4.5 + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true @@ -1286,7 +1274,7 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree/6.8.0_typescript@5.2.2: + /@typescript-eslint/typescript-estree/6.8.0_typescript@5.4.5: resolution: {integrity: sha512-ISgV0lQ8XgW+mvv5My/+iTUdRmGspducmQcDw5JxznasXNnZn3SKNrTRuMsEXv+V/O+Lw9AGcQCfVaOPCAk/Zg==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1300,14 +1288,14 @@ packages: debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.3_typescript@5.2.2 - typescript: 5.2.2 + semver: 7.6.0 + ts-api-utils: 1.0.3_typescript@5.4.5 + typescript: 5.4.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/6.8.0_jk7qbkaijtltyu4ajmze3dfiwa: + /@typescript-eslint/utils/6.8.0_afxi7czp26kyxjrij76jotv2vq: resolution: {integrity: sha512-dKs1itdE2qFG4jr0dlYLQVppqTE+Itt7GmIf/vX6CSvsW+3ov8PbWauVKyyfNngokhIO9sKZeRGCUo1+N7U98Q==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1318,9 +1306,9 @@ packages: '@types/semver': 7.5.3 '@typescript-eslint/scope-manager': 6.8.0 '@typescript-eslint/types': 6.8.0 - '@typescript-eslint/typescript-estree': 6.8.0_typescript@5.2.2 + '@typescript-eslint/typescript-estree': 6.8.0_typescript@5.4.5 eslint: 8.50.0 - semver: 7.5.4 + semver: 7.6.0 transitivePeerDependencies: - supports-color - typescript @@ -1334,15 +1322,15 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typespec/compiler/0.54.0: - resolution: {integrity: sha512-lxMqlvUq5m1KZUjg+IoM/gEwY+yeSjjnpUsz6wmzjK4cO9cIY4wPJdrZwe8jUc2UFOoqKXN3AK8N1UWxA+w9Dg==} + /@typespec/compiler/0.55.0: + resolution: {integrity: sha512-JxBkP7fTc3yzDYZ+Ms+ZHYlL2Ym22oloLDl6107SGaShNJBdQlabgE0aV8WvYRRBYt8g0RNb+sDLEcjvahj6Gw==} engines: {node: '>=18.0.0'} hasBin: true dependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.24.2 ajv: 8.12.0 change-case: 5.4.3 - globby: 14.0.0 + globby: 14.0.1 mustache: 4.2.0 picocolors: 1.0.0 prettier: 3.2.5 @@ -1350,53 +1338,53 @@ packages: semver: 7.6.0 vscode-languageserver: 9.0.1 vscode-languageserver-textdocument: 1.0.11 - yaml: 2.3.4 + yaml: 2.4.1 yargs: 17.7.2 - /@typespec/http/0.54.0_@typespec+compiler@0.54.0: - resolution: {integrity: sha512-/hZd9pkjJh3ogOekyKzZnpVV2kXzxtWDiTt3Gekc6iHTGk/CE1JpRFts8xwXoI5d3FqYotfb4w5ztVw62WjOcA==} + /@typespec/http/0.55.0_@typespec+compiler@0.55.0: + resolution: {integrity: sha512-r30RWzMTJgbyRpdtZxezlvXI/nkAvgilX1OM+s3A039lGLA+JRukgvKIZ3LaNr3lNXHiqeWQDrIZNhqBnpW1zw==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 + '@typespec/compiler': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 + '@typespec/compiler': 0.55.0 - /@typespec/openapi/0.54.0_3ibda3a7sockbtny7x3hj4zqn4: - resolution: {integrity: sha512-QJkwq3whcqKb29ScMD5IQzqvDmPQyLAubRl82Zj6kVMCqabRwegOX9aN+K0083nci65zt9rflZbv9bKY5GRy/A==} + /@typespec/openapi/0.55.0_h4qt3u6oalgs36clp2xs2lq3z4: + resolution: {integrity: sha512-5T4VuJSOGfMFSs+1dOl3U3BC6VhKAxSTBrwcQDIEEygnqCSbj/tMFDhNfzKYKARRDotgM8ESOrZU6XH5srVR7A==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 dev: false - /@typespec/openapi3/0.54.0_gawyyuwi7rfkgwwvtpeudeqoo4: - resolution: {integrity: sha512-ryqa6iNWA3Vb2TcyTUD0NrRecGVY5MGaEuAdBJnnEEPcE6CSQY0j0dFZXzRLBUd4LiR332B4Y7Brkq6MjRdrNg==} + /@typespec/openapi3/0.55.0_uutarydilqfrmegus37wddce6m: + resolution: {integrity: sha512-dfn/wrKSF4Ls1dWMpAguQggoc4HGx2tf3FN2xhBln6EtahNZNgN5sOE+XY0hGPI4MCE5QexMUlXSiXpxzlNA/A==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/openapi': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 - '@typespec/openapi': 0.54.0_3ibda3a7sockbtny7x3hj4zqn4 - '@typespec/versioning': 0.54.0_@typespec+compiler@0.54.0 - yaml: 2.3.4 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/openapi': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 + '@typespec/openapi': 0.55.0_h4qt3u6oalgs36clp2xs2lq3z4 + '@typespec/versioning': 0.55.0_@typespec+compiler@0.55.0 + yaml: 2.4.1 dev: false - /@typespec/rest/0.54.0_3ibda3a7sockbtny7x3hj4zqn4: - resolution: {integrity: sha512-F1hq/Per9epPJQ8Ey84mAtrgrZeLu6fDMIxNao1XlTfDEFZuYgFuCSyg0pyIi0Xg7KUBMvrvSv83WoF3mN2szw==} + /@typespec/rest/0.55.0_h4qt3u6oalgs36clp2xs2lq3z4: + resolution: {integrity: sha512-RPZnx5D4xdTNiP0l++9IA8mUhnegPxetbdJ5RaG/QX2fTyF/gQ7t6AHIgdq8DfYVXqukQI/iGytJ135ObftbtQ==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0_@typespec+compiler@0.54.0 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0_@typespec+compiler@0.55.0 /@typespec/ts-http-runtime/1.0.0-alpha.20240314.2: resolution: {integrity: sha512-Rc/bFkKLbrEo9KKXiSdRYNSmosZ1W6ycQKEKScpXvK4jaXFNyCvmS0tLv7rEN4EzEEds2fPzEHNtX4e8gMu/lA==} @@ -1409,13 +1397,13 @@ packages: - supports-color dev: true - /@typespec/versioning/0.54.0_@typespec+compiler@0.54.0: - resolution: {integrity: sha512-IlGpveOJ0WBTbn3w8nfzgSNhJWNd0+H+bo1Ljrjpeb9SFQmS8bX2fDf0vqsHVl50XgvKIZxgOpEXN5TmuzNnRw==} + /@typespec/versioning/0.55.0_@typespec+compiler@0.55.0: + resolution: {integrity: sha512-89LTgkA3IBLnaaM4D4qfsrcEU0g3gasE1MmkrQ2HG21fYX88zKbmR1cKWeUxQx9MIXFOH4cPC9KhA/uLknRVMQ==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 + '@typespec/compiler': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 + '@typespec/compiler': 0.55.0 /@ungap/promise-all-settled/1.1.2: resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} @@ -2026,6 +2014,9 @@ packages: /change-case/5.4.3: resolution: {integrity: sha512-4cdyvorTy/lViZlVzw2O8/hHCLUuHqp4KpSSP3DlauhFCf3LdnfF+p5s0EAhjKsU7bqrMzu7iQArYfoPiHO2nw==} + /change-case/5.4.4: + resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} + /check-error/1.0.2: resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==} dev: true @@ -2210,6 +2201,11 @@ packages: engines: {node: '>= 0.6'} dev: true + /cookie/0.6.0: + resolution: {integrity: sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==} + engines: {node: '>= 0.6'} + dev: true + /core-util-is/1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} dev: true @@ -2222,7 +2218,7 @@ packages: vary: 1.1.2 dev: true - /cosmiconfig/9.0.0_typescript@5.2.2: + /cosmiconfig/9.0.0_typescript@5.4.5: resolution: {integrity: sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==} engines: {node: '>=14'} peerDependencies: @@ -2235,7 +2231,7 @@ packages: import-fresh: 3.3.0 js-yaml: 4.1.0 parse-json: 5.2.0 - typescript: 5.2.2 + typescript: 5.4.5 dev: true /create-require/1.1.1: @@ -2854,6 +2850,22 @@ packages: methods: 1.1.2 dev: true + /express-promise-router/4.1.1_express@4.19.2: + resolution: {integrity: sha512-Lkvcy/ZGrBhzkl3y7uYBHLMtLI4D6XQ2kiFg9dq7fbktBch5gjqJ0+KovX0cvCAvTJw92raWunRLM/OM+5l4fA==} + engines: {node: '>=10'} + peerDependencies: + '@types/express': ^4.0.0 + express: ^4.0.0 + peerDependenciesMeta: + '@types/express': + optional: true + dependencies: + express: 4.19.2 + is-promise: 4.0.0 + lodash.flattendeep: 4.4.0 + methods: 1.1.2 + dev: true + /express/4.18.2: resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==} engines: {node: '>= 0.10.0'} @@ -2891,6 +2903,43 @@ packages: vary: 1.1.2 dev: true + /express/4.19.2: + resolution: {integrity: sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==} + engines: {node: '>= 0.10.0'} + dependencies: + accepts: 1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.2 + content-disposition: 0.5.4 + content-type: 1.0.5 + cookie: 0.6.0 + cookie-signature: 1.0.6 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: 1.0.2 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 1.2.0 + fresh: 0.5.2 + http-errors: 2.0.0 + merge-descriptors: 1.0.1 + methods: 1.1.2 + on-finished: 2.4.1 + parseurl: 1.3.3 + path-to-regexp: 0.1.7 + proxy-addr: 2.0.7 + qs: 6.11.0 + range-parser: 1.2.1 + safe-buffer: 5.2.1 + send: 0.18.0 + serve-static: 1.15.0 + setprototypeof: 1.2.0 + statuses: 2.0.1 + type-is: 1.6.18 + utils-merge: 1.0.1 + vary: 1.1.2 + dev: true + /extend/3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} dev: true @@ -3308,11 +3357,11 @@ packages: slash: 3.0.0 dev: true - /globby/14.0.0: - resolution: {integrity: sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==} + /globby/14.0.1: + resolution: {integrity: sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==} engines: {node: '>=18'} dependencies: - '@sindresorhus/merge-streams': 1.0.0 + '@sindresorhus/merge-streams': 2.3.0 fast-glob: 3.3.2 ignore: 5.2.4 path-type: 5.0.0 @@ -4319,8 +4368,8 @@ packages: hasBin: true dev: false - /mkdirp/2.1.6: - resolution: {integrity: sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==} + /mkdirp/3.0.1: + resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} engines: {node: '>=10'} hasBin: true dev: true @@ -4702,7 +4751,7 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} dependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.24.2 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 @@ -4918,14 +4967,14 @@ packages: - utf-8-validate dev: true - /puppeteer/22.4.1_typescript@5.2.2: + /puppeteer/22.4.1_typescript@5.4.5: resolution: {integrity: sha512-Mag1wRLanzwS4yEUyrDRBUgsKlH3dpL6oAfVwNHG09oxd0+ySsatMvYj7HwjynWy/S+Hg+XHLgjyC/F6CsL/lg==} engines: {node: '>=18'} hasBin: true requiresBuild: true dependencies: '@puppeteer/browsers': 2.1.0 - cosmiconfig: 9.0.0_typescript@5.2.2 + cosmiconfig: 9.0.0_typescript@5.4.5 puppeteer-core: 22.4.1 transitivePeerDependencies: - bufferutil @@ -5761,13 +5810,13 @@ packages: engines: {node: '>= 14.0.0'} dev: true - /ts-api-utils/1.0.3_typescript@5.2.2: + /ts-api-utils/1.0.3_typescript@5.4.5: resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} engines: {node: '>=16.13.0'} peerDependencies: typescript: '>=4.2.0' dependencies: - typescript: 5.2.2 + typescript: 5.4.5 dev: true /ts-morph/15.1.0: @@ -5777,7 +5826,7 @@ packages: code-block-writer: 11.0.3 dev: false - /ts-node/10.9.1_5a6lqx2r5gtzmizq73fzykbege: + /ts-node/10.9.1_zhb5j7z2epl224l2ylrhvblng4: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -5803,12 +5852,12 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.2.2 + typescript: 5.4.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true - /ts-node/8.10.2_typescript@5.2.2: + /ts-node/8.10.2_typescript@5.4.5: resolution: {integrity: sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==} engines: {node: '>=6.0.0'} hasBin: true @@ -5819,7 +5868,7 @@ packages: diff: 4.0.2 make-error: 1.3.6 source-map-support: 0.5.21 - typescript: 5.2.2 + typescript: 5.4.5 yn: 3.1.1 dev: true @@ -5907,8 +5956,8 @@ packages: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: true - /typescript/5.2.2: - resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + /typescript/5.4.5: + resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -6343,9 +6392,10 @@ packages: /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - /yaml/2.3.4: - resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} + /yaml/2.4.1: + resolution: {integrity: sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==} engines: {node: '>= 14'} + hasBin: true /yargs-parser/20.2.4: resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} diff --git a/common/scripts/install-run-rush-pnpm.js b/common/scripts/install-run-rush-pnpm.js index 5c149955de..2356649f4e 100644 --- a/common/scripts/install-run-rush-pnpm.js +++ b/common/scripts/install-run-rush-pnpm.js @@ -10,6 +10,9 @@ // node common/scripts/install-run-rush-pnpm.js pnpm-command // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ +// +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See the @microsoft/rush package's LICENSE file for details. /******/ (() => { // webpackBootstrap /******/ "use strict"; @@ -19,7 +22,7 @@ var __webpack_exports__ = {}; \*****************************************************/ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. +// See LICENSE in the project root for license information. require('./install-run-rush'); //# sourceMappingURL=install-run-rush-pnpm.js.map module.exports = __webpack_exports__; diff --git a/common/scripts/install-run-rush.js b/common/scripts/install-run-rush.js index cada1eded2..9676fc718f 100644 --- a/common/scripts/install-run-rush.js +++ b/common/scripts/install-run-rush.js @@ -8,6 +8,9 @@ // node common/scripts/install-run-rush.js install // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ +// +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See the @microsoft/rush package's LICENSE file for details. /******/ (() => { // webpackBootstrap /******/ "use strict"; @@ -113,7 +116,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ 657147); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. +// See LICENSE in the project root for license information. +/* eslint-disable no-console */ const { installAndRun, findRushJsonFolder, RUSH_JSON_FILENAME, runWithErrorAndStatusCode } = require('./install-run'); @@ -136,8 +140,8 @@ function _getRushVersion(logger) { return rushJsonMatches[1]; } catch (e) { - throw new Error(`Unable to determine the required version of Rush from rush.json (${rushJsonFolder}). ` + - "The 'rushVersion' field is either not assigned in rush.json or was specified " + + throw new Error(`Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). ` + + `The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified ` + 'using an unexpected syntax.'); } } @@ -196,7 +200,7 @@ function _run() { } runWithErrorAndStatusCode(logger, () => { const version = _getRushVersion(logger); - logger.info(`The rush.json configuration requests Rush version ${version}`); + logger.info(`The ${RUSH_JSON_FILENAME} configuration requests Rush version ${version}`); const lockFilePath = process.env[INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE]; if (lockFilePath) { logger.info(`Found ${INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE}="${lockFilePath}", installing with lockfile.`); diff --git a/common/scripts/install-run-rushx.js b/common/scripts/install-run-rushx.js index b05df262bc..6581521f3c 100644 --- a/common/scripts/install-run-rushx.js +++ b/common/scripts/install-run-rushx.js @@ -10,6 +10,9 @@ // node common/scripts/install-run-rushx.js custom-command // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ +// +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See the @microsoft/rush package's LICENSE file for details. /******/ (() => { // webpackBootstrap /******/ "use strict"; @@ -19,7 +22,7 @@ var __webpack_exports__ = {}; \*************************************************/ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. +// See LICENSE in the project root for license information. require('./install-run-rush'); //# sourceMappingURL=install-run-rushx.js.map module.exports = __webpack_exports__; diff --git a/common/scripts/install-run.js b/common/scripts/install-run.js index 68b1b56fc5..9283c44526 100644 --- a/common/scripts/install-run.js +++ b/common/scripts/install-run.js @@ -8,6 +8,9 @@ // node common/scripts/install-run.js qrcode@1.2.2 qrcode https://rushjs.io // // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ +// +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See the @microsoft/rush package's LICENSE file for details. /******/ (() => { // webpackBootstrap /******/ "use strict"; @@ -21,6 +24,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "isVariableSetInNpmrcFile": () => (/* binding */ isVariableSetInNpmrcFile), /* harmony export */ "syncNpmrc": () => (/* binding */ syncNpmrc) /* harmony export */ }); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ 657147); @@ -33,23 +37,30 @@ __webpack_require__.r(__webpack_exports__); /** - * As a workaround, copyAndTrimNpmrcFile() copies the .npmrc file to the target folder, and also trims + * This function reads the content for given .npmrc file path, and also trims * unusable lines from the .npmrc file. * - * Why are we trimming the .npmrc lines? NPM allows environment variables to be specified in - * the .npmrc file to provide different authentication tokens for different registry. - * However, if the environment variable is undefined, it expands to an empty string, which - * produces a valid-looking mapping with an invalid URL that causes an error. Instead, - * we'd prefer to skip that line and continue looking in other places such as the user's - * home directory. - * * @returns * The text of the the .npmrc. */ -function _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath) { - logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose - logger.info(` --> "${targetNpmrcPath}"`); - let npmrcFileLines = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(sourceNpmrcPath).toString().split('\n'); +// create a global _combinedNpmrc for cache purpose +const _combinedNpmrcMap = new Map(); +function _trimNpmrcFile(options) { + const { sourceNpmrcPath, linesToPrepend, linesToAppend } = options; + const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath); + if (combinedNpmrcFromCache !== undefined) { + return combinedNpmrcFromCache; + } + let npmrcFileLines = []; + if (linesToPrepend) { + npmrcFileLines.push(...linesToPrepend); + } + if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) { + npmrcFileLines.push(...fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(sourceNpmrcPath).toString().split('\n')); + } + if (linesToAppend) { + npmrcFileLines.push(...linesToAppend); + } npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim()); const resultLines = []; // This finds environment variable tokens that look like "${VAR_NAME}" @@ -57,8 +68,13 @@ function _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath) { // Comment lines start with "#" or ";" const commentRegExp = /^\s*[#;]/; // Trim out lines that reference environment variables that aren't defined - for (const line of npmrcFileLines) { + for (let line of npmrcFileLines) { let lineShouldBeTrimmed = false; + //remove spaces before or after key and value + line = line + .split('=') + .map((lineToTrim) => lineToTrim.trim()) + .join('='); // Ignore comment lines if (!commentRegExp.test(line)) { const environmentVariables = line.match(expansionRegExp); @@ -85,27 +101,44 @@ function _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath) { } } const combinedNpmrc = resultLines.join('\n'); + //save the cache + _combinedNpmrcMap.set(sourceNpmrcPath, combinedNpmrc); + return combinedNpmrc; +} +function _copyAndTrimNpmrcFile(options) { + const { logger, sourceNpmrcPath, targetNpmrcPath, linesToPrepend, linesToAppend } = options; + logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose + logger.info(` --> "${targetNpmrcPath}"`); + const combinedNpmrc = _trimNpmrcFile({ + sourceNpmrcPath, + linesToPrepend, + linesToAppend + }); fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(targetNpmrcPath, combinedNpmrc); return combinedNpmrc; } -/** - * syncNpmrc() copies the .npmrc file to the target folder, and also trims unusable lines from the .npmrc file. - * If the source .npmrc file not exist, then syncNpmrc() will delete an .npmrc that is found in the target folder. - * - * IMPORTANT: THIS CODE SHOULD BE KEPT UP TO DATE WITH Utilities._syncNpmrc() - * - * @returns - * The text of the the synced .npmrc, if one exists. If one does not exist, then undefined is returned. - */ -function syncNpmrc(sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish, logger = { - info: console.log, - error: console.error -}) { +function syncNpmrc(options) { + const { sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish, logger = { + // eslint-disable-next-line no-console + info: console.log, + // eslint-disable-next-line no-console + error: console.error + }, createIfMissing = false, linesToAppend, linesToPrepend } = options; const sourceNpmrcPath = path__WEBPACK_IMPORTED_MODULE_1__.join(sourceNpmrcFolder, !useNpmrcPublish ? '.npmrc' : '.npmrc-publish'); const targetNpmrcPath = path__WEBPACK_IMPORTED_MODULE_1__.join(targetNpmrcFolder, '.npmrc'); try { - if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) { - return _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath); + if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath) || createIfMissing) { + // Ensure the target folder exists + if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcFolder)) { + fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(targetNpmrcFolder, { recursive: true }); + } + return _copyAndTrimNpmrcFile({ + sourceNpmrcPath, + targetNpmrcPath, + logger, + linesToAppend, + linesToPrepend + }); } else if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcPath)) { // If the source .npmrc doesn't exist and there is one in the target, delete the one in the target @@ -117,6 +150,16 @@ function syncNpmrc(sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish, logger throw new Error(`Error syncing .npmrc file: ${e}`); } } +function isVariableSetInNpmrcFile(sourceNpmrcFolder, variableKey) { + const sourceNpmrcPath = `${sourceNpmrcFolder}/.npmrc`; + //if .npmrc file does not exist, return false directly + if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) { + return false; + } + const trimmedNpmrcFile = _trimNpmrcFile({ sourceNpmrcPath }); + const variableKeyRegExp = new RegExp(`^${variableKey}=`, 'm'); + return trimmedNpmrcFile.match(variableKeyRegExp) !== null; +} //# sourceMappingURL=npmrcUtilities.js.map /***/ }), @@ -253,7 +296,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utilities/npmrcUtilities */ 679877); // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See the @microsoft/rush package's LICENSE file for license information. +// See LICENSE in the project root for license information. +/* eslint-disable no-console */ @@ -297,7 +341,7 @@ let _npmPath = undefined; function getNpmPath() { if (!_npmPath) { try { - if (os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32') { + if (_isWindows()) { // We're on Windows const whereOutput = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('where npm', { stdio: [] }).toString(); const lines = whereOutput.split(os__WEBPACK_IMPORTED_MODULE_2__.EOL).filter((line) => !!line); @@ -359,6 +403,23 @@ function _getRushTempFolder(rushCommonFolder) { return _ensureAndJoinPath(rushCommonFolder, 'temp'); } } +/** + * Compare version strings according to semantic versioning. + * Returns a positive integer if "a" is a later version than "b", + * a negative integer if "b" is later than "a", + * and 0 otherwise. + */ +function _compareVersionStrings(a, b) { + const aParts = a.split(/[.-]/); + const bParts = b.split(/[.-]/); + const numberOfParts = Math.max(aParts.length, bParts.length); + for (let i = 0; i < numberOfParts; i++) { + if (aParts[i] !== bParts[i]) { + return (Number(aParts[i]) || 0) - (Number(bParts[i]) || 0); + } + } + return 0; +} /** * Resolve a package specifier to a static version */ @@ -376,32 +437,55 @@ function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) { try { const rushTempFolder = _getRushTempFolder(rushCommonFolder); const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush'); - (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)(sourceNpmrcFolder, rushTempFolder, undefined, logger); + (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({ + sourceNpmrcFolder, + targetNpmrcFolder: rushTempFolder, + logger + }); const npmPath = getNpmPath(); // This returns something that looks like: - // @microsoft/rush@3.0.0 '3.0.0' - // @microsoft/rush@3.0.1 '3.0.1' - // ... - // @microsoft/rush@3.0.20 '3.0.20' - // - const npmVersionSpawnResult = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(npmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier'], { + // ``` + // [ + // "3.0.0", + // "3.0.1", + // ... + // "3.0.20" + // ] + // ``` + // + // if multiple versions match the selector, or + // + // ``` + // "3.0.0" + // ``` + // + // if only a single version matches. + const spawnSyncOptions = { cwd: rushTempFolder, - stdio: [] - }); + stdio: [], + shell: _isWindows() + }; + const platformNpmPath = _getPlatformPath(npmPath); + const npmVersionSpawnResult = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformNpmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier', '--json'], spawnSyncOptions); if (npmVersionSpawnResult.status !== 0) { throw new Error(`"npm view" returned error code ${npmVersionSpawnResult.status}`); } const npmViewVersionOutput = npmVersionSpawnResult.stdout.toString(); - const versionLines = npmViewVersionOutput.split('\n').filter((line) => !!line); - const latestVersion = versionLines[versionLines.length - 1]; + const parsedVersionOutput = JSON.parse(npmViewVersionOutput); + const versions = Array.isArray(parsedVersionOutput) + ? parsedVersionOutput + : [parsedVersionOutput]; + let latestVersion = versions[0]; + for (let i = 1; i < versions.length; i++) { + const latestVersionCandidate = versions[i]; + if (_compareVersionStrings(latestVersionCandidate, latestVersion) > 0) { + latestVersion = latestVersionCandidate; + } + } if (!latestVersion) { throw new Error('No versions found for the specified version range.'); } - const versionMatches = latestVersion.match(/^.+\s\'(.+)\'$/); - if (!versionMatches) { - throw new Error(`Invalid npm output ${latestVersion}`); - } - return versionMatches[1]; + return latestVersion; } catch (e) { throw new Error(`Unable to resolve version ${version} of package ${name}: ${e}`); @@ -427,7 +511,7 @@ function findRushJsonFolder() { } } while (basePath !== (tempPath = path__WEBPACK_IMPORTED_MODULE_3__.dirname(basePath))); // Exit the loop when we hit the disk root if (!_rushJsonFolder) { - throw new Error('Unable to find rush.json.'); + throw new Error(`Unable to find ${RUSH_JSON_FILENAME}.`); } } return _rushJsonFolder; @@ -515,10 +599,12 @@ function _installPackage(logger, packageInstallFolder, name, version, command) { try { logger.info(`Installing ${name}...`); const npmPath = getNpmPath(); - const result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(npmPath, [command], { + const platformNpmPath = _getPlatformPath(npmPath); + const result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformNpmPath, [command], { stdio: 'inherit', cwd: packageInstallFolder, - env: process.env + env: process.env, + shell: _isWindows() }); if (result.status !== 0) { throw new Error(`"npm ${command}" encountered an error`); @@ -534,9 +620,18 @@ function _installPackage(logger, packageInstallFolder, name, version, command) { */ function _getBinPath(packageInstallFolder, binName) { const binFolderPath = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); - const resolvedBinName = os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32' ? `${binName}.cmd` : binName; + const resolvedBinName = _isWindows() ? `${binName}.cmd` : binName; return path__WEBPACK_IMPORTED_MODULE_3__.resolve(binFolderPath, resolvedBinName); } +/** + * Returns a cross-platform path - windows must enclose any path containing spaces within double quotes. + */ +function _getPlatformPath(platformPath) { + return _isWindows() && platformPath.includes(' ') ? `"${platformPath}"` : platformPath; +} +function _isWindows() { + return os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32'; +} /** * Write a flag file to the package's install directory, signifying that the install was successful. */ @@ -558,7 +653,11 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack // The package isn't already installed _cleanInstallFolder(rushTempFolder, packageInstallFolder, lockFilePath); const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush'); - (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)(sourceNpmrcFolder, packageInstallFolder, undefined, logger); + (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({ + sourceNpmrcFolder, + targetNpmrcFolder: packageInstallFolder, + logger + }); _createPackageJson(packageInstallFolder, packageName, packageVersion); const command = lockFilePath ? 'ci' : 'install'; _installPackage(logger, packageInstallFolder, packageName, packageVersion, command); @@ -574,15 +673,14 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack const originalEnvPath = process.env.PATH || ''; let result; try { - // Node.js on Windows can not spawn a file when the path has a space on it - // unless the path gets wrapped in a cmd friendly way and shell mode is used - const shouldUseShell = binPath.includes(' ') && os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32'; - const platformBinPath = shouldUseShell ? `"${binPath}"` : binPath; + // `npm` bin stubs on Windows are `.cmd` files + // Node.js will not directly invoke a `.cmd` file unless `shell` is set to `true` + const platformBinPath = _getPlatformPath(binPath); process.env.PATH = [binFolderPath, originalEnvPath].join(path__WEBPACK_IMPORTED_MODULE_3__.delimiter); result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformBinPath, packageBinArgs, { stdio: 'inherit', windowsVerbatimArguments: false, - shell: shouldUseShell, + shell: _isWindows(), cwd: process.cwd(), env: process.env }); diff --git a/packages/autorest.typescript/CHANGELOG.md b/packages/autorest.typescript/CHANGELOG.md index bb26929d66..86bcc9010c 100644 --- a/packages/autorest.typescript/CHANGELOG.md +++ b/packages/autorest.typescript/CHANGELOG.md @@ -1,3 +1,28 @@ +## 6.0.21 (2024-04-18) + +- [Feature] Support server parameter in modular. Please refer to [#2424](https://github.com/Azure/autorest.typescript/pull/2424). +- [Feature] Support special words. Please refer to [#2387](https://github.com/Azure/autorest.typescript/pull/2387). +- [Feature] Support additional properties full cases in RLC. Please refer to [#2445](https://github.com/Azure/autorest.typescript/pull/2445). +- [Feature] Support the change for union and enums in modular and RLC. Please refer to [#2380](https://github.com/Azure/autorest.typescript/pull/2380). +- [Feature] Upgrade typespec compiler to 0.55.0. Please refer to [#2380](https://github.com/Azure/autorest.typescript/pull/2380). +- [Feature] Bump typescript version to typescript@~5.4.5. Please refer to [#2442](https://github.com/Azure/autorest.typescript/pull/2442). +- [Feature] Update @azure-rest/core-client to 1.4.0.. Please refer to [#2441](https://github.com/Azure/autorest.typescript/pull/2441). +- [Feature] Upgrade mkdirp to ^3.0.1. Please refer to [#2436](https://github.com/Azure/autorest.typescript/pull/2436). +- [Bugfix] Fix missing `pack` scripts in package.json. Please refer to [#2426](https://github.com/Azure/autorest.typescript/pull/2426). + +## 6.0.20 (2024-04-04) + +- [Bugfix] Fix missing scripts in package.json file. Please refer to [#2402](https://github.com/Azure/autorest.typescript/pull/2402). + +## 6.0.19 (2024-04-03) + +- [Feature] Enable esm for RLC generation from TypeSpec. Please refer to [#2338](https://github.com/Azure/autorest.typescript/pull/2338). +- [Feature] Support usage and access. Please refer to [#2356](https://github.com/Azure/autorest.typescript/pull/2356). +- [Feature] Support server versions in modular. Please refer to [#2261](https://github.com/Azure/autorest.typescript/pull/2261). +- [Feature] Deprecate baseurl in favor of endpoint in RLC. Please refer to [#2246](https://github.com/Azure/autorest.typescript/pull/2246). +- [Bugfix] Fix error model rename issue. Please refer to [#2379](https://github.com/Azure/autorest.typescript/pull/2379). +- [Bugfix] Fix issues: anonymous array model import and sample mock value for credential. Please refer to [#2342](https://github.com/Azure/autorest.typescript/pull/2342). + ## 6.0.18 (2024-03-07) - [Feature] Upgrade TypeSpec compiler to 0.54.0. Please refer to [#2334](https://github.com/Azure/autorest.typescript/pull/2334). diff --git a/packages/autorest.typescript/README.md b/packages/autorest.typescript/README.md index 642b5e9f03..50ca5a50f9 100644 --- a/packages/autorest.typescript/README.md +++ b/packages/autorest.typescript/README.md @@ -152,6 +152,9 @@ help-content: - key: package-name type: string description: The name of your package. This is the name your package will be published under. + - key: package-version + type: string + description: The version of your package. - key: source-code-folder-path type: string description: Where to output the generated code inside the output-folder. Defaults to src. diff --git a/packages/autorest.typescript/package.json b/packages/autorest.typescript/package.json index fce4273d4b..6c9ba40376 100644 --- a/packages/autorest.typescript/package.json +++ b/packages/autorest.typescript/package.json @@ -1,6 +1,6 @@ { "name": "@autorest/typescript", - "version": "6.0.18", + "version": "6.0.21", "scripts": { "build": "tsc -p . && npm run copyFiles", "build:test:browser:rlc": "tsc -p tsconfig.browser-test.json && ts-node test/commands/prepare-deps.ts --browser && webpack --config webpack.config.test.js --env mode=rlc", @@ -57,7 +57,7 @@ "@autorest/codemodel": "~4.19.2", "@autorest/extension-base": "^3.5.0", "@autorest/testmodeler": "^2.4.0", - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure-tools/codegen": "^2.9.1", "@azure/core-client": "^1.6.1", "@azure/core-http": "^3.0.0", @@ -76,7 +76,7 @@ "source-map-support": "^0.5.16", "ts-morph": "^15.1.0", "@azure/core-auth": "^1.6.0", - "@azure-tools/rlc-common": "workspace:^0.25.0" + "@azure-tools/rlc-common": "workspace:^0.27.0" }, "devDependencies": { "@azure-tools/test-recorder": "^3.0.0", @@ -115,7 +115,7 @@ "sinon": "^10.0.0", "source-map-loader": "^1.0.0", "ts-node": "^8.5.2", - "typescript": "~5.2.0", + "typescript": "~5.4.5", "wait-port": "^0.2.6", "webpack": "^5.72.0", "webpack-cli": "^4.9.2", diff --git a/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts b/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts index 6197403b7b..50ccc3a0a9 100644 --- a/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts +++ b/packages/autorest.typescript/src/generators/static/packageFileGenerator.ts @@ -109,8 +109,8 @@ function regularAutorestPackage( types: `./types/${packageDetails.nameWithoutScope}.d.ts`, devDependencies: { "@microsoft/api-extractor": "^7.31.1", - mkdirp: "^2.1.2", - typescript: "~5.3.3", + mkdirp: "^3.0.1", + typescript: "~5.4.5", "uglify-js": "^3.4.9", rimraf: "^5.0.0", dotenv: "^16.0.0" @@ -185,6 +185,7 @@ function regularAutorestPackage( packageInfo.devDependencies["@azure/dev-tool"] = "^1.0.0"; packageInfo.scripts["build"] = "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api"; + packageInfo.scripts["extract-api"] = "dev-tool run extract-api"; } else { packageInfo.devDependencies["@rollup/plugin-commonjs"] = "^24.0.0"; packageInfo.devDependencies["@rollup/plugin-json"] = "^6.0.0"; @@ -201,7 +202,7 @@ function regularAutorestPackage( packageInfo.devDependencies["@azure-tools/test-credential"] = "^1.0.0"; packageInfo.devDependencies["mocha"] = "^10.0.0"; packageInfo.devDependencies["@types/mocha"] = "^10.0.0"; - packageInfo.devDependencies["esm"] = "^3.2.18"; + packageInfo.devDependencies["tsx"] = "^4.7.1"; packageInfo.devDependencies["@types/chai"] = "^4.2.8"; packageInfo.devDependencies["chai"] = "^4.2.0"; packageInfo.devDependencies["cross-env"] = "^7.0.2"; diff --git a/packages/autorest.typescript/test/integration/generated/additionalProperties/package.json b/packages/autorest.typescript/test/integration/generated/additionalProperties/package.json index 7092c32a90..3e60a16261 100644 --- a/packages/autorest.typescript/test/integration/generated/additionalProperties/package.json +++ b/packages/autorest.typescript/test/integration/generated/additionalProperties/package.json @@ -17,8 +17,8 @@ "types": "./types/additional-properties.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -33,7 +33,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/integration/generated/appconfiguration/package.json b/packages/autorest.typescript/test/integration/generated/appconfiguration/package.json index 5b8d4886e9..ebdafe328b 100644 --- a/packages/autorest.typescript/test/integration/generated/appconfiguration/package.json +++ b/packages/autorest.typescript/test/integration/generated/appconfiguration/package.json @@ -18,8 +18,8 @@ "types": "./types/appconfiguration.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/appconfigurationexport/package.json b/packages/autorest.typescript/test/integration/generated/appconfigurationexport/package.json index 5b8d4886e9..ebdafe328b 100644 --- a/packages/autorest.typescript/test/integration/generated/appconfigurationexport/package.json +++ b/packages/autorest.typescript/test/integration/generated/appconfigurationexport/package.json @@ -18,8 +18,8 @@ "types": "./types/appconfiguration.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/arrayConstraints/package.json b/packages/autorest.typescript/test/integration/generated/arrayConstraints/package.json index ee7189d5d1..8daf50b481 100644 --- a/packages/autorest.typescript/test/integration/generated/arrayConstraints/package.json +++ b/packages/autorest.typescript/test/integration/generated/arrayConstraints/package.json @@ -17,8 +17,8 @@ "types": "./types/array-constraints-client.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/attestation/package.json b/packages/autorest.typescript/test/integration/generated/attestation/package.json index b2a4890693..0e8e30a13a 100644 --- a/packages/autorest.typescript/test/integration/generated/attestation/package.json +++ b/packages/autorest.typescript/test/integration/generated/attestation/package.json @@ -17,8 +17,8 @@ "types": "./types/attestation.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/azureParameterGrouping/package.json b/packages/autorest.typescript/test/integration/generated/azureParameterGrouping/package.json index 0c15ab1e0b..9a845830de 100644 --- a/packages/autorest.typescript/test/integration/generated/azureParameterGrouping/package.json +++ b/packages/autorest.typescript/test/integration/generated/azureParameterGrouping/package.json @@ -17,8 +17,8 @@ "types": "./types/azure-parameter-grouping.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/azureReport/package.json b/packages/autorest.typescript/test/integration/generated/azureReport/package.json index edb8d24f82..6692c1ad1f 100644 --- a/packages/autorest.typescript/test/integration/generated/azureReport/package.json +++ b/packages/autorest.typescript/test/integration/generated/azureReport/package.json @@ -17,8 +17,8 @@ "types": "./types/zzzAzureReport.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/azureSpecialProperties/package.json b/packages/autorest.typescript/test/integration/generated/azureSpecialProperties/package.json index 754398e75f..966d8f0124 100644 --- a/packages/autorest.typescript/test/integration/generated/azureSpecialProperties/package.json +++ b/packages/autorest.typescript/test/integration/generated/azureSpecialProperties/package.json @@ -18,8 +18,8 @@ "types": "./types/azure-special-properties.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyArray/package.json b/packages/autorest.typescript/test/integration/generated/bodyArray/package.json index b6827cf149..86b63df92d 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyArray/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyArray/package.json @@ -17,8 +17,8 @@ "types": "./types/body-array.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyBoolean/package.json b/packages/autorest.typescript/test/integration/generated/bodyBoolean/package.json index f35658196a..15254787b6 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyBoolean/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyBoolean/package.json @@ -17,8 +17,8 @@ "types": "./types/body-boolean.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyBooleanQuirks/package.json b/packages/autorest.typescript/test/integration/generated/bodyBooleanQuirks/package.json index ef442515eb..c6fe8c47c9 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyBooleanQuirks/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyBooleanQuirks/package.json @@ -17,8 +17,8 @@ "types": "./types/body-boolean-quirks.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyByte/package.json b/packages/autorest.typescript/test/integration/generated/bodyByte/package.json index f16a297b1c..0bbebc77f8 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyByte/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyByte/package.json @@ -17,8 +17,8 @@ "types": "./types/body-byte.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyComplex/package.json b/packages/autorest.typescript/test/integration/generated/bodyComplex/package.json index fd26e2aae8..6843c882d9 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyComplex/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyComplex/package.json @@ -17,8 +17,8 @@ "types": "./types/body-complex.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyComplexWithTracing/package.json b/packages/autorest.typescript/test/integration/generated/bodyComplexWithTracing/package.json index 08c3fb196b..2269b04eec 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyComplexWithTracing/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyComplexWithTracing/package.json @@ -18,8 +18,8 @@ "types": "./types/body-complex-tracing.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyDate/package.json b/packages/autorest.typescript/test/integration/generated/bodyDate/package.json index 9a859274e1..391c84f5ef 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyDate/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyDate/package.json @@ -17,8 +17,8 @@ "types": "./types/body-date.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyDateTime/package.json b/packages/autorest.typescript/test/integration/generated/bodyDateTime/package.json index 041fd1ecb0..dfb5b2e65e 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyDateTime/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyDateTime/package.json @@ -17,8 +17,8 @@ "types": "./types/body-datetime.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyDateTimeRfc1123/package.json b/packages/autorest.typescript/test/integration/generated/bodyDateTimeRfc1123/package.json index 9a34c1a559..5619df155e 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyDateTimeRfc1123/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyDateTimeRfc1123/package.json @@ -17,8 +17,8 @@ "types": "./types/body-datetime-rfc1123.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyDictionary/package.json b/packages/autorest.typescript/test/integration/generated/bodyDictionary/package.json index d2363e1d79..edaff9e7f3 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyDictionary/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyDictionary/package.json @@ -17,8 +17,8 @@ "types": "./types/body-dictionary.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyDuration/package.json b/packages/autorest.typescript/test/integration/generated/bodyDuration/package.json index 14bb672d07..675651d255 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyDuration/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyDuration/package.json @@ -17,8 +17,8 @@ "types": "./types/body-duration.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyFile/package.json b/packages/autorest.typescript/test/integration/generated/bodyFile/package.json index 2d559a4d20..5356a17120 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyFile/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyFile/package.json @@ -17,8 +17,8 @@ "types": "./types/body-file.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyFormData/package.json b/packages/autorest.typescript/test/integration/generated/bodyFormData/package.json index e2ea1499cc..3a9aea68a7 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyFormData/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyFormData/package.json @@ -17,8 +17,8 @@ "types": "./types/body-formdata.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyInteger/package.json b/packages/autorest.typescript/test/integration/generated/bodyInteger/package.json index 8078bb14bf..18addf97ab 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyInteger/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyInteger/package.json @@ -17,8 +17,8 @@ "types": "./types/body-integer.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyNumber/package.json b/packages/autorest.typescript/test/integration/generated/bodyNumber/package.json index 691801e7db..42b91fe2ab 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyNumber/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyNumber/package.json @@ -17,8 +17,8 @@ "types": "./types/body-number.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyString/package.json b/packages/autorest.typescript/test/integration/generated/bodyString/package.json index c9346028a3..418b76faa3 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyString/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyString/package.json @@ -17,8 +17,8 @@ "types": "./types/body-string.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/bodyTime/package.json b/packages/autorest.typescript/test/integration/generated/bodyTime/package.json index 1fad630f4e..262fd857fc 100644 --- a/packages/autorest.typescript/test/integration/generated/bodyTime/package.json +++ b/packages/autorest.typescript/test/integration/generated/bodyTime/package.json @@ -17,8 +17,8 @@ "types": "./types/body-time.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/constantParam/package.json b/packages/autorest.typescript/test/integration/generated/constantParam/package.json index 8c31dcb562..ac8e5df6ab 100644 --- a/packages/autorest.typescript/test/integration/generated/constantParam/package.json +++ b/packages/autorest.typescript/test/integration/generated/constantParam/package.json @@ -17,8 +17,8 @@ "types": "./types/constantParam.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/corecompattest/package.json b/packages/autorest.typescript/test/integration/generated/corecompattest/package.json index aff67b314b..2539ea0415 100644 --- a/packages/autorest.typescript/test/integration/generated/corecompattest/package.json +++ b/packages/autorest.typescript/test/integration/generated/corecompattest/package.json @@ -19,8 +19,8 @@ "types": "./types/petstore.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -53,7 +53,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/customUrl/package.json b/packages/autorest.typescript/test/integration/generated/customUrl/package.json index 4716999143..39d4bb12c5 100644 --- a/packages/autorest.typescript/test/integration/generated/customUrl/package.json +++ b/packages/autorest.typescript/test/integration/generated/customUrl/package.json @@ -17,8 +17,8 @@ "types": "./types/custom-url.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/customUrlMoreOptions/package.json b/packages/autorest.typescript/test/integration/generated/customUrlMoreOptions/package.json index ffaa668d1a..3862191516 100644 --- a/packages/autorest.typescript/test/integration/generated/customUrlMoreOptions/package.json +++ b/packages/autorest.typescript/test/integration/generated/customUrlMoreOptions/package.json @@ -17,8 +17,8 @@ "types": "./types/custom-url-MoreOptions.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/customUrlPaging/package.json b/packages/autorest.typescript/test/integration/generated/customUrlPaging/package.json index 78850ca3c4..50783c8838 100644 --- a/packages/autorest.typescript/test/integration/generated/customUrlPaging/package.json +++ b/packages/autorest.typescript/test/integration/generated/customUrlPaging/package.json @@ -18,8 +18,8 @@ "types": "./types/custom-url-paging.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/datafactory/package.json b/packages/autorest.typescript/test/integration/generated/datafactory/package.json index f73a960d32..352eb7ecb0 100644 --- a/packages/autorest.typescript/test/integration/generated/datafactory/package.json +++ b/packages/autorest.typescript/test/integration/generated/datafactory/package.json @@ -20,8 +20,8 @@ "types": "./types/datafactory.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -54,7 +54,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/datalakestorage/package.json b/packages/autorest.typescript/test/integration/generated/datalakestorage/package.json index 18d23edffd..31ca41d5af 100644 --- a/packages/autorest.typescript/test/integration/generated/datalakestorage/package.json +++ b/packages/autorest.typescript/test/integration/generated/datalakestorage/package.json @@ -17,8 +17,8 @@ "types": "./types/datalakestorage.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/datasearch/package.json b/packages/autorest.typescript/test/integration/generated/datasearch/package.json index 9c40923e46..a9a146d07d 100644 --- a/packages/autorest.typescript/test/integration/generated/datasearch/package.json +++ b/packages/autorest.typescript/test/integration/generated/datasearch/package.json @@ -18,8 +18,8 @@ "types": "./types/data-search.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -34,7 +34,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/integration/generated/deviceprovisioningservice/package.json b/packages/autorest.typescript/test/integration/generated/deviceprovisioningservice/package.json index 3bfce88420..49f60fec67 100644 --- a/packages/autorest.typescript/test/integration/generated/deviceprovisioningservice/package.json +++ b/packages/autorest.typescript/test/integration/generated/deviceprovisioningservice/package.json @@ -20,8 +20,8 @@ "types": "./types/deviceprovisioning.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -54,7 +54,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/domainservices/package.json b/packages/autorest.typescript/test/integration/generated/domainservices/package.json index 97a52038c6..1881844a53 100644 --- a/packages/autorest.typescript/test/integration/generated/domainservices/package.json +++ b/packages/autorest.typescript/test/integration/generated/domainservices/package.json @@ -20,8 +20,8 @@ "types": "./types/domainservices.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -54,7 +54,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/extensibleEnums/package.json b/packages/autorest.typescript/test/integration/generated/extensibleEnums/package.json index 969fe3e14b..e3e185e05e 100644 --- a/packages/autorest.typescript/test/integration/generated/extensibleEnums/package.json +++ b/packages/autorest.typescript/test/integration/generated/extensibleEnums/package.json @@ -17,8 +17,8 @@ "types": "./types/extensible-enums.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/header/package.json b/packages/autorest.typescript/test/integration/generated/header/package.json index 2d2ea7fb8e..c0a0ad1f92 100644 --- a/packages/autorest.typescript/test/integration/generated/header/package.json +++ b/packages/autorest.typescript/test/integration/generated/header/package.json @@ -17,8 +17,8 @@ "types": "./types/header.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/headerprefix/package.json b/packages/autorest.typescript/test/integration/generated/headerprefix/package.json index 0adc50c5ac..64fbf34fd2 100644 --- a/packages/autorest.typescript/test/integration/generated/headerprefix/package.json +++ b/packages/autorest.typescript/test/integration/generated/headerprefix/package.json @@ -17,8 +17,8 @@ "types": "./types/headerprefix.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/healthcareapis/package.json b/packages/autorest.typescript/test/integration/generated/healthcareapis/package.json index e075f974e8..9120121a40 100644 --- a/packages/autorest.typescript/test/integration/generated/healthcareapis/package.json +++ b/packages/autorest.typescript/test/integration/generated/healthcareapis/package.json @@ -20,8 +20,8 @@ "types": "./types/healthcareapis.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -54,7 +54,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/httpInfrastructure/package.json b/packages/autorest.typescript/test/integration/generated/httpInfrastructure/package.json index 811952c74a..39b60e02c7 100644 --- a/packages/autorest.typescript/test/integration/generated/httpInfrastructure/package.json +++ b/packages/autorest.typescript/test/integration/generated/httpInfrastructure/package.json @@ -17,8 +17,8 @@ "types": "./types/httpInfrastructure.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/iotspaces/package.json b/packages/autorest.typescript/test/integration/generated/iotspaces/package.json index 584424ef60..90cc1a2737 100644 --- a/packages/autorest.typescript/test/integration/generated/iotspaces/package.json +++ b/packages/autorest.typescript/test/integration/generated/iotspaces/package.json @@ -18,8 +18,8 @@ "types": "./types/iotspaces.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/licenseHeader/package.json b/packages/autorest.typescript/test/integration/generated/licenseHeader/package.json index bc71db5e9a..f935dbcaf7 100644 --- a/packages/autorest.typescript/test/integration/generated/licenseHeader/package.json +++ b/packages/autorest.typescript/test/integration/generated/licenseHeader/package.json @@ -17,8 +17,8 @@ "types": "./types/license-header.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/lro/package.json b/packages/autorest.typescript/test/integration/generated/lro/package.json index ead0d6b313..e5d392c143 100644 --- a/packages/autorest.typescript/test/integration/generated/lro/package.json +++ b/packages/autorest.typescript/test/integration/generated/lro/package.json @@ -20,8 +20,8 @@ "types": "./types/lro.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -54,7 +54,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/lroParametrizedEndpoints/package.json b/packages/autorest.typescript/test/integration/generated/lroParametrizedEndpoints/package.json index 8a22f628aa..ff8cf848ae 100644 --- a/packages/autorest.typescript/test/integration/generated/lroParametrizedEndpoints/package.json +++ b/packages/autorest.typescript/test/integration/generated/lroParametrizedEndpoints/package.json @@ -19,8 +19,8 @@ "types": "./types/lro-parameterized-endpoints.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -53,7 +53,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/mapperrequired/package.json b/packages/autorest.typescript/test/integration/generated/mapperrequired/package.json index ce1051d06b..32839e8e98 100644 --- a/packages/autorest.typescript/test/integration/generated/mapperrequired/package.json +++ b/packages/autorest.typescript/test/integration/generated/mapperrequired/package.json @@ -17,8 +17,8 @@ "types": "./types/mapperrequired.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/mediaTypes/package.json b/packages/autorest.typescript/test/integration/generated/mediaTypes/package.json index f7cc386aaf..1e8d9065ba 100644 --- a/packages/autorest.typescript/test/integration/generated/mediaTypes/package.json +++ b/packages/autorest.typescript/test/integration/generated/mediaTypes/package.json @@ -17,8 +17,8 @@ "types": "./types/media-types-service.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/mediaTypesV3/package.json b/packages/autorest.typescript/test/integration/generated/mediaTypesV3/package.json index 9c29f93d63..807c8b68eb 100644 --- a/packages/autorest.typescript/test/integration/generated/mediaTypesV3/package.json +++ b/packages/autorest.typescript/test/integration/generated/mediaTypesV3/package.json @@ -17,8 +17,8 @@ "types": "./types/media-types-v3-client.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/mediaTypesV3Lro/package.json b/packages/autorest.typescript/test/integration/generated/mediaTypesV3Lro/package.json index 009b73637a..85d048e07b 100644 --- a/packages/autorest.typescript/test/integration/generated/mediaTypesV3Lro/package.json +++ b/packages/autorest.typescript/test/integration/generated/mediaTypesV3Lro/package.json @@ -19,8 +19,8 @@ "types": "./types/media-types-v3-lro-client.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -53,7 +53,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/mediaTypesWithTracing/package.json b/packages/autorest.typescript/test/integration/generated/mediaTypesWithTracing/package.json index 2da1810659..360d539e62 100644 --- a/packages/autorest.typescript/test/integration/generated/mediaTypesWithTracing/package.json +++ b/packages/autorest.typescript/test/integration/generated/mediaTypesWithTracing/package.json @@ -18,8 +18,8 @@ "types": "./types/media-types-service-tracing.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/modelFlattening/package.json b/packages/autorest.typescript/test/integration/generated/modelFlattening/package.json index 1ea07d736b..c6e4b106ce 100644 --- a/packages/autorest.typescript/test/integration/generated/modelFlattening/package.json +++ b/packages/autorest.typescript/test/integration/generated/modelFlattening/package.json @@ -17,8 +17,8 @@ "types": "./types/model-flattening.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/multipleInheritance/package.json b/packages/autorest.typescript/test/integration/generated/multipleInheritance/package.json index 97cb4d5f9a..aab1973467 100644 --- a/packages/autorest.typescript/test/integration/generated/multipleInheritance/package.json +++ b/packages/autorest.typescript/test/integration/generated/multipleInheritance/package.json @@ -17,8 +17,8 @@ "types": "./types/multiple-inheritance.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/nameChecker/package.json b/packages/autorest.typescript/test/integration/generated/nameChecker/package.json index 78ce02cabd..b991a3b966 100644 --- a/packages/autorest.typescript/test/integration/generated/nameChecker/package.json +++ b/packages/autorest.typescript/test/integration/generated/nameChecker/package.json @@ -17,8 +17,8 @@ "types": "./types/search-documents.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/noLicenseHeader/package.json b/packages/autorest.typescript/test/integration/generated/noLicenseHeader/package.json index 3459b20e53..62b322681c 100644 --- a/packages/autorest.typescript/test/integration/generated/noLicenseHeader/package.json +++ b/packages/autorest.typescript/test/integration/generated/noLicenseHeader/package.json @@ -17,8 +17,8 @@ "types": "./types/nolicense-header.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/noMappers/package.json b/packages/autorest.typescript/test/integration/generated/noMappers/package.json index 5d3471c91a..d08fda8996 100644 --- a/packages/autorest.typescript/test/integration/generated/noMappers/package.json +++ b/packages/autorest.typescript/test/integration/generated/noMappers/package.json @@ -17,8 +17,8 @@ "types": "./types/no-mappers.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/noOperation/package.json b/packages/autorest.typescript/test/integration/generated/noOperation/package.json index aa0da27619..331a714a45 100644 --- a/packages/autorest.typescript/test/integration/generated/noOperation/package.json +++ b/packages/autorest.typescript/test/integration/generated/noOperation/package.json @@ -17,8 +17,8 @@ "types": "./types/no-operation.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/nonStringEnum/package.json b/packages/autorest.typescript/test/integration/generated/nonStringEnum/package.json index f3eb84e62f..f6d01916ac 100644 --- a/packages/autorest.typescript/test/integration/generated/nonStringEnum/package.json +++ b/packages/autorest.typescript/test/integration/generated/nonStringEnum/package.json @@ -17,8 +17,8 @@ "types": "./types/non-string-num.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/objectType/package.json b/packages/autorest.typescript/test/integration/generated/objectType/package.json index 5342fb3fe6..fc3f06784c 100644 --- a/packages/autorest.typescript/test/integration/generated/objectType/package.json +++ b/packages/autorest.typescript/test/integration/generated/objectType/package.json @@ -17,8 +17,8 @@ "types": "./types/object-type.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/odataDiscriminator/package.json b/packages/autorest.typescript/test/integration/generated/odataDiscriminator/package.json index 0bbf90addb..7eb4005cee 100644 --- a/packages/autorest.typescript/test/integration/generated/odataDiscriminator/package.json +++ b/packages/autorest.typescript/test/integration/generated/odataDiscriminator/package.json @@ -17,8 +17,8 @@ "types": "./types/odata-discriminator.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/operationgroupclash/package.json b/packages/autorest.typescript/test/integration/generated/operationgroupclash/package.json index a1f28213fe..3d24dcf683 100644 --- a/packages/autorest.typescript/test/integration/generated/operationgroupclash/package.json +++ b/packages/autorest.typescript/test/integration/generated/operationgroupclash/package.json @@ -17,8 +17,8 @@ "types": "./types/operationgroupclash.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/optionalnull/package.json b/packages/autorest.typescript/test/integration/generated/optionalnull/package.json index 3326cae024..a28c23abe1 100644 --- a/packages/autorest.typescript/test/integration/generated/optionalnull/package.json +++ b/packages/autorest.typescript/test/integration/generated/optionalnull/package.json @@ -17,8 +17,8 @@ "types": "./types/optionalnull.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/paging/package.json b/packages/autorest.typescript/test/integration/generated/paging/package.json index 154acf0691..d36266dc28 100644 --- a/packages/autorest.typescript/test/integration/generated/paging/package.json +++ b/packages/autorest.typescript/test/integration/generated/paging/package.json @@ -21,8 +21,8 @@ "types": "./types/paging-service.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -55,7 +55,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/pagingNoIterators/package.json b/packages/autorest.typescript/test/integration/generated/pagingNoIterators/package.json index 6c2813ed3a..811c72b2d8 100644 --- a/packages/autorest.typescript/test/integration/generated/pagingNoIterators/package.json +++ b/packages/autorest.typescript/test/integration/generated/pagingNoIterators/package.json @@ -19,8 +19,8 @@ "types": "./types/paging-no-iterators.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -53,7 +53,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/patterntest/package.json b/packages/autorest.typescript/test/integration/generated/patterntest/package.json index 0977046969..bb20673425 100644 --- a/packages/autorest.typescript/test/integration/generated/patterntest/package.json +++ b/packages/autorest.typescript/test/integration/generated/patterntest/package.json @@ -18,8 +18,8 @@ "types": "./types/pattern-test.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -34,7 +34,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/integration/generated/petstore/package.json b/packages/autorest.typescript/test/integration/generated/petstore/package.json index 14eab4bf80..50f3e67946 100644 --- a/packages/autorest.typescript/test/integration/generated/petstore/package.json +++ b/packages/autorest.typescript/test/integration/generated/petstore/package.json @@ -17,8 +17,8 @@ "types": "./types/petstore.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/readmeFileChecker/package.json b/packages/autorest.typescript/test/integration/generated/readmeFileChecker/package.json index 855c37f2ae..2be4323f6f 100644 --- a/packages/autorest.typescript/test/integration/generated/readmeFileChecker/package.json +++ b/packages/autorest.typescript/test/integration/generated/readmeFileChecker/package.json @@ -17,8 +17,8 @@ "types": "./types/keyvault-secrets.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/regexConstraint/package.json b/packages/autorest.typescript/test/integration/generated/regexConstraint/package.json index 11bb37d7b3..e89616a176 100644 --- a/packages/autorest.typescript/test/integration/generated/regexConstraint/package.json +++ b/packages/autorest.typescript/test/integration/generated/regexConstraint/package.json @@ -17,8 +17,8 @@ "types": "./types/regex-constraint.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/report/package.json b/packages/autorest.typescript/test/integration/generated/report/package.json index 4f129567b5..2fd0b9546e 100644 --- a/packages/autorest.typescript/test/integration/generated/report/package.json +++ b/packages/autorest.typescript/test/integration/generated/report/package.json @@ -17,8 +17,8 @@ "types": "./types/zzzReport.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/requiredOptional/package.json b/packages/autorest.typescript/test/integration/generated/requiredOptional/package.json index 8d75408e90..7a0c84d689 100644 --- a/packages/autorest.typescript/test/integration/generated/requiredOptional/package.json +++ b/packages/autorest.typescript/test/integration/generated/requiredOptional/package.json @@ -17,8 +17,8 @@ "types": "./types/required-optional.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/resources/package.json b/packages/autorest.typescript/test/integration/generated/resources/package.json index a0b91aed6a..eb27d75ca2 100644 --- a/packages/autorest.typescript/test/integration/generated/resources/package.json +++ b/packages/autorest.typescript/test/integration/generated/resources/package.json @@ -18,8 +18,8 @@ "types": "./types/resources.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -52,7 +52,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/sealedchoice/package.json b/packages/autorest.typescript/test/integration/generated/sealedchoice/package.json index 4f4b8e4f88..8f089f1a5d 100644 --- a/packages/autorest.typescript/test/integration/generated/sealedchoice/package.json +++ b/packages/autorest.typescript/test/integration/generated/sealedchoice/package.json @@ -17,8 +17,8 @@ "types": "./types/sealedchoice.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/storageblob/package.json b/packages/autorest.typescript/test/integration/generated/storageblob/package.json index 7463824aa0..882f69f502 100644 --- a/packages/autorest.typescript/test/integration/generated/storageblob/package.json +++ b/packages/autorest.typescript/test/integration/generated/storageblob/package.json @@ -17,8 +17,8 @@ "types": "./types/storageblob.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/storagefileshare/package.json b/packages/autorest.typescript/test/integration/generated/storagefileshare/package.json index 7067a47463..32b3990121 100644 --- a/packages/autorest.typescript/test/integration/generated/storagefileshare/package.json +++ b/packages/autorest.typescript/test/integration/generated/storagefileshare/package.json @@ -17,8 +17,8 @@ "types": "./types/storagefileshare.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/subscriptionIdApiVersion/package.json b/packages/autorest.typescript/test/integration/generated/subscriptionIdApiVersion/package.json index df5d68253b..2b18a94798 100644 --- a/packages/autorest.typescript/test/integration/generated/subscriptionIdApiVersion/package.json +++ b/packages/autorest.typescript/test/integration/generated/subscriptionIdApiVersion/package.json @@ -17,8 +17,8 @@ "types": "./types/subscriptionid-apiversion.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/textanalytics/package.json b/packages/autorest.typescript/test/integration/generated/textanalytics/package.json index 29c9136e09..787b8de11d 100644 --- a/packages/autorest.typescript/test/integration/generated/textanalytics/package.json +++ b/packages/autorest.typescript/test/integration/generated/textanalytics/package.json @@ -17,8 +17,8 @@ "types": "./types/textanalytics.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/url/package.json b/packages/autorest.typescript/test/integration/generated/url/package.json index 43eccfffee..29c58aa40d 100644 --- a/packages/autorest.typescript/test/integration/generated/url/package.json +++ b/packages/autorest.typescript/test/integration/generated/url/package.json @@ -17,8 +17,8 @@ "types": "./types/url.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/url2/package.json b/packages/autorest.typescript/test/integration/generated/url2/package.json index 43eccfffee..29c58aa40d 100644 --- a/packages/autorest.typescript/test/integration/generated/url2/package.json +++ b/packages/autorest.typescript/test/integration/generated/url2/package.json @@ -17,8 +17,8 @@ "types": "./types/url.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/urlMulti/package.json b/packages/autorest.typescript/test/integration/generated/urlMulti/package.json index c8f2cf9bc4..faf50c1a39 100644 --- a/packages/autorest.typescript/test/integration/generated/urlMulti/package.json +++ b/packages/autorest.typescript/test/integration/generated/urlMulti/package.json @@ -17,8 +17,8 @@ "types": "./types/url-multi.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json b/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json index ab1a4034b5..22759f6158 100644 --- a/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json +++ b/packages/autorest.typescript/test/integration/generated/useragentcorev1/package.json @@ -13,8 +13,8 @@ "types": "./types/useragent-corev1.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -47,7 +47,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/useragentcorev2/package.json b/packages/autorest.typescript/test/integration/generated/useragentcorev2/package.json index d32f085a24..486ed829b5 100644 --- a/packages/autorest.typescript/test/integration/generated/useragentcorev2/package.json +++ b/packages/autorest.typescript/test/integration/generated/useragentcorev2/package.json @@ -17,8 +17,8 @@ "types": "./types/useragent-corev2.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/uuid/package.json b/packages/autorest.typescript/test/integration/generated/uuid/package.json index d6df5dcd2e..bdf14028ab 100644 --- a/packages/autorest.typescript/test/integration/generated/uuid/package.json +++ b/packages/autorest.typescript/test/integration/generated/uuid/package.json @@ -17,8 +17,8 @@ "types": "./types/uuid.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/validation/package.json b/packages/autorest.typescript/test/integration/generated/validation/package.json index 90bbedfefb..65b4fad32f 100644 --- a/packages/autorest.typescript/test/integration/generated/validation/package.json +++ b/packages/autorest.typescript/test/integration/generated/validation/package.json @@ -17,8 +17,8 @@ "types": "./types/validation.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/xmlservice/package.json b/packages/autorest.typescript/test/integration/generated/xmlservice/package.json index ed9825b5c6..2cae635d23 100644 --- a/packages/autorest.typescript/test/integration/generated/xmlservice/package.json +++ b/packages/autorest.typescript/test/integration/generated/xmlservice/package.json @@ -17,8 +17,8 @@ "types": "./types/xml-service.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/integration/generated/xmsErrorResponses/package.json b/packages/autorest.typescript/test/integration/generated/xmsErrorResponses/package.json index dffaf0217f..0ecd133cb2 100644 --- a/packages/autorest.typescript/test/integration/generated/xmsErrorResponses/package.json +++ b/packages/autorest.typescript/test/integration/generated/xmsErrorResponses/package.json @@ -17,8 +17,8 @@ "types": "./types/xms-error-responses.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/azureReport/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/azureReport/package.json index edb8d24f82..6692c1ad1f 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/azureReport/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/azureReport/package.json @@ -17,8 +17,8 @@ "types": "./types/zzzAzureReport.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -51,7 +51,7 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "prepack": "npm run build", "pack": "npm pack 2>&1", - "extract-api": "api-extractor run --local", + "extract-api": "dev-tool run extract-api", "lint": "echo skipped", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/package.json index 7f85e5ad7a..43cf250902 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyComplexRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/package.json index b9bdbaedb8..1d9b19cd5a 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFileRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/package.json index dadf956d25..456b178904 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyFormDataRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/package.json index e2559051d2..534f244613 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/bodyStringRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,14 +35,14 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", "@azure/identity": "^4.0.1", "@azure-tools/test-recorder": "^3.0.0", "autorest": "latest", - "c8": "^8.0.0", + "nyc": "^15.1.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/package.json index 78ac4a1398..f357c3838b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/customUrlRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json index eff97a7952..4ad5c0408c 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/dpgCustomization/package.json @@ -40,7 +40,7 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", @@ -65,6 +65,11 @@ "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "dev-tool samples publish --force", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", @@ -74,13 +79,11 @@ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", "generate:client": "echo skipped", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local", + "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", "build:test": "tsc -p . && dev-tool run bundle", - "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local", + "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api", "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", "unit-test:browser": "dev-tool run test:browser" }, diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/package.json index 8ad80350b1..91a25919c5 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/headerRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/package.json index b481fb3a85..154f276613 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/httpInfrastructureRest/package.json @@ -40,7 +40,7 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", @@ -62,6 +62,11 @@ "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "dev-tool samples publish --force", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", @@ -71,13 +76,11 @@ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", "generate:client": "echo skipped", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local", + "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", "build:test": "tsc -p . && dev-tool run bundle", - "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local", + "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api", "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", "unit-test:browser": "dev-tool run test:browser" } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/package.json index 357f0c0df3..2b0572b1e4 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/lroRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/package.json index 647145adef..339fea1e37 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/mediaTypesRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/package.json index 49aedf154f..7a44143847 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleInheritanceRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/package.json index ff5a272414..0ef88c7596 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/multipleUrlParameters/package.json @@ -40,7 +40,7 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", @@ -62,6 +62,11 @@ "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "dev-tool samples publish --force", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", @@ -71,13 +76,11 @@ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", "generate:client": "echo skipped", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local", + "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", "build:test": "tsc -p . && dev-tool run bundle", - "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local", + "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api", "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", "unit-test:browser": "dev-tool run test:browser" } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/package.json index e8ae5aa7cf..94db503861 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/pagingRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -38,8 +38,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/report/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/report/package.json index 621e0e8f20..27acf0e404 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/report/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/report/package.json @@ -17,8 +17,8 @@ "types": "./types/zzzReport.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/package.json index 9c8a14d6cc..248c1f7b84 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityAADRest/package.json @@ -40,7 +40,7 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", @@ -62,6 +62,11 @@ "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "dev-tool samples publish --force", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", @@ -71,13 +76,11 @@ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", "generate:client": "echo skipped", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local", + "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", "build:test": "tsc -p . && dev-tool run bundle", - "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local", + "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api", "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", "unit-test:browser": "dev-tool run test:browser" } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/package.json index ee5e61cbfa..9c00bb40c0 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/securityKeyRest/package.json @@ -40,7 +40,7 @@ ] }, "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", @@ -62,6 +62,11 @@ "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", + "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "dev-tool samples publish --force", "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", @@ -71,13 +76,11 @@ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", "generate:client": "echo skipped", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json api-extractor.json src test --ext .ts --ext .cts --ext .mts", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local", + "build": "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", "build:test": "tsc -p . && dev-tool run bundle", - "build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local", + "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api", "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", "unit-test:browser": "dev-tool run test:browser" } diff --git a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/package.json b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/package.json index 9820f8832e..1063737c6b 100644 --- a/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/package.json +++ b/packages/autorest.typescript/test/rlcIntegration/generated/urlRest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/package.json b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/package.json index 32434b7b95..b408cd8136 100644 --- a/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/package.json +++ b/packages/autorest.typescript/test/smoke/generated/agrifood-data-plane/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -38,14 +38,14 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", "@azure/identity": "^4.0.1", "@azure-tools/test-recorder": "^3.0.0", "autorest": "latest", - "c8": "^8.0.0", + "nyc": "^15.1.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/package.json b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/package.json index 54e2223678..82890f6f6c 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/package.json +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-mv-rest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -36,8 +36,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/package.json b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/package.json index 047bc7b259..b87f62622b 100644 --- a/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/package.json +++ b/packages/autorest.typescript/test/smoke/generated/anomaly-detector-rest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -38,14 +38,14 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", "@azure/identity": "^4.0.1", "@azure-tools/test-recorder": "^3.0.0", "autorest": "latest", - "c8": "^8.0.0", + "nyc": "^15.1.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-deploymentscripts-2019-10-preview/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-deploymentscripts-2019-10-preview/package.json index d26e64cf66..ce4ba19eb2 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-deploymentscripts-2019-10-preview/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-deploymentscripts-2019-10-preview/package.json @@ -21,8 +21,8 @@ "types": "./types/arm-package-deploymentscripts-2019-10-preview.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-features-2015-12/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-features-2015-12/package.json index 8a6c27fbdc..c88951c4f2 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-features-2015-12/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-features-2015-12/package.json @@ -19,8 +19,8 @@ "types": "./types/arm-package-features-2015-12.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-links-2016-09/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-links-2016-09/package.json index e0659f85b2..b18ab08eeb 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-links-2016-09/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-links-2016-09/package.json @@ -19,8 +19,8 @@ "types": "./types/arm-package-links-2016-09.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-locks-2016-09/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-locks-2016-09/package.json index 4c68120b40..b0025f3782 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-locks-2016-09/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-locks-2016-09/package.json @@ -19,8 +19,8 @@ "types": "./types/arm-package-locks-2016-09.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-managedapplications-2018-06/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-managedapplications-2018-06/package.json index 5a235b313a..7ab6d104d8 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-managedapplications-2018-06/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-managedapplications-2018-06/package.json @@ -21,8 +21,8 @@ "types": "./types/arm-package-managedapplications-2018-06.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-policy-2019-09/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-policy-2019-09/package.json index a1365b43ab..448fb24769 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-policy-2019-09/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-policy-2019-09/package.json @@ -19,8 +19,8 @@ "types": "./types/arm-package-policy-2019-09.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-resources-2019-08/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-resources-2019-08/package.json index 5941f7cb77..f68d9dbdf3 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-resources-2019-08/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-resources-2019-08/package.json @@ -21,8 +21,8 @@ "types": "./types/arm-package-resources-2019-08.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/arm-package-subscriptions-2019-06/package.json b/packages/autorest.typescript/test/smoke/generated/arm-package-subscriptions-2019-06/package.json index 276761a208..67dd3fbb27 100644 --- a/packages/autorest.typescript/test/smoke/generated/arm-package-subscriptions-2019-06/package.json +++ b/packages/autorest.typescript/test/smoke/generated/arm-package-subscriptions-2019-06/package.json @@ -19,8 +19,8 @@ "types": "./types/arm-package-subscriptions-2019-06.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -35,7 +35,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/compute-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/compute-resource-manager/package.json index 176def25a2..5305b6fb10 100644 --- a/packages/autorest.typescript/test/smoke/generated/compute-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/compute-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/compute-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -37,7 +37,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/cosmos-db-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/cosmos-db-resource-manager/package.json index 886ec3747c..a16a2e79d9 100644 --- a/packages/autorest.typescript/test/smoke/generated/cosmos-db-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/cosmos-db-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/cosmos-db-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/graphrbac-data-plane/package.json b/packages/autorest.typescript/test/smoke/generated/graphrbac-data-plane/package.json index ec4277683b..e2385e5827 100644 --- a/packages/autorest.typescript/test/smoke/generated/graphrbac-data-plane/package.json +++ b/packages/autorest.typescript/test/smoke/generated/graphrbac-data-plane/package.json @@ -19,8 +19,8 @@ "types": "./types/graphrbac-data-plane.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/keyvault-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/keyvault-resource-manager/package.json index d57a79c0f9..97f129754b 100644 --- a/packages/autorest.typescript/test/smoke/generated/keyvault-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/keyvault-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/keyvault-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -37,7 +37,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/monitor-data-plane/package.json b/packages/autorest.typescript/test/smoke/generated/monitor-data-plane/package.json index c617163e4d..7efdc041ad 100644 --- a/packages/autorest.typescript/test/smoke/generated/monitor-data-plane/package.json +++ b/packages/autorest.typescript/test/smoke/generated/monitor-data-plane/package.json @@ -18,8 +18,8 @@ "types": "./types/monitor-data-plane.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/msi-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/msi-resource-manager/package.json index 4752524293..0ee9643ddc 100644 --- a/packages/autorest.typescript/test/smoke/generated/msi-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/msi-resource-manager/package.json @@ -19,8 +19,8 @@ "types": "./types/msi-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -35,7 +35,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/network-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/network-resource-manager/package.json index c01f1dee4d..04502190fe 100644 --- a/packages/autorest.typescript/test/smoke/generated/network-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/network-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/network-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -37,7 +37,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/networkcloud-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/networkcloud-resource-manager/package.json index 4a8f1872ca..a9086b19fc 100644 --- a/packages/autorest.typescript/test/smoke/generated/networkcloud-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/networkcloud-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/networkcloud-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", diff --git a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/package.json b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/package.json index d7ec8013a7..c3b26580aa 100644 --- a/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/package.json +++ b/packages/autorest.typescript/test/smoke/generated/purview-administration-rest/package.json @@ -22,7 +22,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -36,8 +36,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "autorest": "latest", "source-map-support": "^0.5.9", "uglify-js": "^3.4.9", diff --git a/packages/autorest.typescript/test/smoke/generated/sql-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/sql-resource-manager/package.json index c8229f15f3..962e223eab 100644 --- a/packages/autorest.typescript/test/smoke/generated/sql-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/sql-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/sql-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -37,7 +37,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/storage-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/storage-resource-manager/package.json index e8f8519a08..c0ce25167f 100644 --- a/packages/autorest.typescript/test/smoke/generated/storage-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/storage-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/storage-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -37,7 +37,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/smoke/generated/web-resource-manager/package.json b/packages/autorest.typescript/test/smoke/generated/web-resource-manager/package.json index a7af121a0b..e57a4a4377 100644 --- a/packages/autorest.typescript/test/smoke/generated/web-resource-manager/package.json +++ b/packages/autorest.typescript/test/smoke/generated/web-resource-manager/package.json @@ -21,8 +21,8 @@ "types": "./types/web-resource-manager.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.31.1", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "uglify-js": "^3.4.9", "rimraf": "^5.0.0", "dotenv": "^16.0.0", @@ -37,7 +37,7 @@ "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", "@types/mocha": "^10.0.0", - "esm": "^3.2.18", + "tsx": "^4.7.1", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/package.json b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/package.json index f70fd00c3a..fe5354a88d 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/package.json +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-initial/package.json @@ -69,12 +69,12 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^7.15.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", "typedoc": "0.15.2", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", diff --git a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/package.json b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/package.json index f70fd00c3a..fe5354a88d 100644 --- a/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/package.json +++ b/packages/autorest.typescript/test/version-tolerance/generated/rlc-updated/package.json @@ -69,12 +69,12 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^7.15.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", "typedoc": "0.15.2", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", diff --git a/packages/rlc-common/CHANGELOG.md b/packages/rlc-common/CHANGELOG.md index d2d1be58a0..01a0198a95 100644 --- a/packages/rlc-common/CHANGELOG.md +++ b/packages/rlc-common/CHANGELOG.md @@ -1,3 +1,32 @@ +## 0.27.0 (2024-04-18) + +- [Feature] Support server parameter in modular. Please refer to [#2424](https://github.com/Azure/autorest.typescript/pull/2424). +- [Feature] Support special words. Please refer to [#2387](https://github.com/Azure/autorest.typescript/pull/2387). +- [Feature] Support additional properties full cases in RLC. Please refer to [#2445](https://github.com/Azure/autorest.typescript/pull/2445). +- [Feature] Support the change for union and enums in modular and RLC. Please refer to [#2380](https://github.com/Azure/autorest.typescript/pull/2380). +- [Feature] Upgrade typespec compiler to 0.55.0. Please refer to [#2380](https://github.com/Azure/autorest.typescript/pull/2380). +- [Feature] Bump typescript version to typescript@~5.4.5. Please refer to [#2442](https://github.com/Azure/autorest.typescript/pull/2442). +- [Feature] Update @azure-rest/core-client to 1.4.0.. Please refer to [#2441](https://github.com/Azure/autorest.typescript/pull/2441). +- [Feature] Upgrade mkdirp to ^3.0.1. Please refer to [#2436](https://github.com/Azure/autorest.typescript/pull/2436). +- [Bugfix] Fix missing `pack` scripts in package.json. Please refer to [#2426](https://github.com/Azure/autorest.typescript/pull/2426). + +## 0.26.1 (2024-04-04) + +- [Bugfix] Fix missing scripts in package.json file. Please refer to [#2402](https://github.com/Azure/autorest.typescript/pull/2402). + +## 0.26.0 (2024-04-03) + +- [Feature] Enable esm for RLC generation from TypeSpec. Please refer to [#2338](https://github.com/Azure/autorest.typescript/pull/2338). +- [Feature] Support usage and access. Please refer to [#2356](https://github.com/Azure/autorest.typescript/pull/2356). +- [Feature] Support server versions in modular. Please refer to [#2261](https://github.com/Azure/autorest.typescript/pull/2261). +- [Feature] Deprecate baseurl in favor of endpoint in RLC. Please refer to [#2246](https://github.com/Azure/autorest.typescript/pull/2246). +- [Bugfix] Fix error model rename issue. Please refer to [#2379](https://github.com/Azure/autorest.typescript/pull/2379). +- [Bugfix] Fix issues: anonymous array model import and sample mock value for credential. Please refer to [#2342](https://github.com/Azure/autorest.typescript/pull/2342). + +## 0.25.0 (2024-03-08) + +- [Feature] Upgrade @azure-tools/typespec-client-generator-core to 0.40.0. Please refer to [#2341](https://github.com/Azure/autorest.typescript/pull/2341). + ## 0.24.0 (2024-03-07) - [Feature] Upgrade TypeSpec compiler to 0.54.0. Please refer to [#2334](https://github.com/Azure/autorest.typescript/pull/2334). diff --git a/packages/rlc-common/package.json b/packages/rlc-common/package.json index f9152e5480..97ebb65633 100644 --- a/packages/rlc-common/package.json +++ b/packages/rlc-common/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/rlc-common", - "version": "0.25.0", + "version": "0.27.0", "description": "", "type": "module", "main": "dist/index.js", @@ -37,7 +37,7 @@ "@types/node": "^18.0.0", "eslint": "^8.9.0", "prettier": "^3.1.0", - "typescript": "~5.2.0", + "typescript": "~5.4.5", "rimraf": "^5.0.0", "@types/lodash": "^4.14.182", "fs-extra": "^10.0.0", @@ -56,4 +56,4 @@ "url": "https://github.com/Azure/autorest.typescript/issues" }, "homepage": "https://github.com/Azure/autorest.typescript/tree/main/packages/rlc-common/" -} \ No newline at end of file +} diff --git a/packages/rlc-common/src/buildClient.ts b/packages/rlc-common/src/buildClient.ts index c946b88f89..6678df62d1 100644 --- a/packages/rlc-common/src/buildClient.ts +++ b/packages/rlc-common/src/buildClient.ts @@ -223,6 +223,25 @@ export function buildClient(model: RLCModel): File | undefined { ) } ]); + if ( + (model.importInfo.internalImports?.rlcClientFactory?.importsSet?.size ?? + 0) > 0 + ) { + clientFile.addImportDeclarations([ + { + namedImports: Array.from( + model.importInfo.internalImports.rlcClientFactory.importsSet! + ), + moduleSpecifier: getImportModuleName( + { + cjsName: `./models`, + esModulesName: `./models.js` + }, + model + ) + } + ]); + } return { path: filePath, content: clientFile.getFullText() }; } diff --git a/packages/rlc-common/src/buildObjectTypes.ts b/packages/rlc-common/src/buildObjectTypes.ts index 489f65fa1f..651dfcb001 100644 --- a/packages/rlc-common/src/buildObjectTypes.ts +++ b/packages/rlc-common/src/buildObjectTypes.ts @@ -397,11 +397,19 @@ export function getImmediateParentsNames( ? "Output" : ""; const name = isDictionarySchema(parent) - ? `${ - (schemaUsage.includes(SchemaContext.Output) - ? parent.outputTypeName - : parent.typeName) ?? parent.name - }` + ? Object.entries(objectSchema.properties!)?.some( + (prop) => + `Record` !== + parent.typeName + ) + ? schemaUsage.includes(SchemaContext.Output) + ? "Record" + : "Record" + : `${ + (schemaUsage.includes(SchemaContext.Output) + ? parent.outputTypeName + : parent.typeName) ?? parent.name + }` : `${normalizeName( parent.name, NameType.Interface, diff --git a/packages/rlc-common/src/helpers/importsUtil.ts b/packages/rlc-common/src/helpers/importsUtil.ts index 8cfe20dce1..328fb7a00f 100644 --- a/packages/rlc-common/src/helpers/importsUtil.ts +++ b/packages/rlc-common/src/helpers/importsUtil.ts @@ -12,7 +12,7 @@ export function buildRuntimeImports(flavor?: PackageFlavor): Imports { restClient: { type: "restClient", specifier: "@azure-rest/core-client", - version: "^1.2.0" + version: "^1.4.0" }, coreAuth: { type: "coreAuth", @@ -83,6 +83,10 @@ export function initInternalImports(): Imports { modularModel: { type: "modularModel", importsSet: new Set() + }, + rlcClientFactory: { + type: "rlcClientFactory", + importsSet: new Set() } } as Imports; } diff --git a/packages/rlc-common/src/helpers/nameUtils.ts b/packages/rlc-common/src/helpers/nameUtils.ts index 6664cc842d..57ecb6b17a 100644 --- a/packages/rlc-common/src/helpers/nameUtils.ts +++ b/packages/rlc-common/src/helpers/nameUtils.ts @@ -22,6 +22,9 @@ const Newable = [NameType.Class, NameType.Interface, NameType.OperationGroup]; export const ReservedModelNames: ReservedName[] = [ { name: "any", reservedFor: [NameType.Parameter] }, { name: "as", reservedFor: [NameType.Parameter] }, + { name: "assert", reservedFor: [NameType.Parameter] }, + { name: "async", reservedFor: [NameType.Parameter] }, + { name: "await", reservedFor: [NameType.Parameter] }, { name: "boolean", reservedFor: [NameType.Parameter, ...Newable] }, { name: "break", reservedFor: [NameType.Parameter] }, { name: "case", reservedFor: [NameType.Parameter] }, @@ -110,10 +113,10 @@ export function guardReservedNames( function getSuffix(nameType?: NameType) { switch (nameType) { case NameType.File: - case NameType.Property: - return ""; case NameType.Operation: - return "Operation"; + return ""; + case NameType.Property: + return "Property"; case NameType.OperationGroup: return "Operations"; case NameType.Parameter: diff --git a/packages/rlc-common/src/index.ts b/packages/rlc-common/src/index.ts index 3497f5503e..eea8f9c5fe 100644 --- a/packages/rlc-common/src/index.ts +++ b/packages/rlc-common/src/index.ts @@ -36,3 +36,4 @@ export * from "./buildLogger.js"; export * from "./buildSamples.js"; export * from "./transformSampleGroups.js"; export * from "./helpers/importsUtil.js"; +export * from "./metadata/buildBrowserConfig.js"; diff --git a/packages/rlc-common/src/interfaces.ts b/packages/rlc-common/src/interfaces.ts index ba254b4a7e..b21121839d 100644 --- a/packages/rlc-common/src/interfaces.ts +++ b/packages/rlc-common/src/interfaces.ts @@ -29,6 +29,7 @@ export type ImportType = | "response" | "rlcIndex" | "modularModel" + | "rlcClientFactory" /**common third party imports */ | "restClient" | "coreAuth" diff --git a/packages/rlc-common/src/metadata/buildBrowserConfig.ts b/packages/rlc-common/src/metadata/buildBrowserConfig.ts new file mode 100644 index 0000000000..e0aef3bad5 --- /dev/null +++ b/packages/rlc-common/src/metadata/buildBrowserConfig.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Project } from "ts-morph"; +import { RLCModel } from "../interfaces.js"; + +export function buildTsTestBrowserConfig(model: RLCModel) { + const isAzureSdkForJs = model.options?.azureSdkForJs ?? false; + if ( + model.options?.generateMetadata === false || + model.options?.generateTest === false || + isAzureSdkForJs !== true + ) { + return; + } + + const filePath = "tsconfig.browser.config.json"; + const project = new Project(); + + const content = { + extends: "./.tshy/build.json", + include: ["./src/**/*.ts", "./src/**/*.mts", "./test/**/*.spec.ts"], + exclude: ["./test/**/node/**/*.ts"], + compilerOptions: { + outDir: "./dist-test/browser", + rootDir: ".", + skipLibCheck: true + } + }; + + const configFile = project.createSourceFile( + filePath, + JSON.stringify(content), + { + overwrite: true + } + ); + return { + path: filePath, + content: configFile.getFullText() + }; +} diff --git a/packages/rlc-common/src/metadata/buildVitestConfig.ts b/packages/rlc-common/src/metadata/buildVitestConfig.ts index 399d365a5f..b1fdf4abe3 100644 --- a/packages/rlc-common/src/metadata/buildVitestConfig.ts +++ b/packages/rlc-common/src/metadata/buildVitestConfig.ts @@ -37,7 +37,6 @@ const browserConfig = (options: { "define": { "process.env": process.env }, - ${options.isAzureSdkForJs ? `plugins: [browserMap()],` : ""} "test": { "reporters": ["basic", "junit"], "outputFile": { @@ -104,13 +103,6 @@ export function buildVitestConfig( namedImports: ["defineConfig"] }); - if (platform === "browser" && isAzureSdkForJs) { - configFile.addImportDeclaration({ - moduleSpecifier: "@azure-tools/vite-plugin-browser-test-map", - defaultImport: "browserMap" - }); - } - return { path: filePath, content: configFile.getFullText() diff --git a/packages/rlc-common/src/metadata/packageJson/azurePackageCommon.ts b/packages/rlc-common/src/metadata/packageJson/azurePackageCommon.ts index b275994d10..3bc729df96 100644 --- a/packages/rlc-common/src/metadata/packageJson/azurePackageCommon.ts +++ b/packages/rlc-common/src/metadata/packageJson/azurePackageCommon.ts @@ -33,7 +33,7 @@ export function getAzurePackageDependencies({ hasPaging }: AzurePackageInfoConfig) { let dependencies: Record = { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -98,7 +98,7 @@ function getAzurePackageCjsDevDependencies({ return {}; } const testDevDependencies = { - c8: "^8.0.0", + nyc: "^15.1.0", mocha: "^10.0.0", "@types/mocha": "^10.0.0", "cross-env": "^7.0.2", diff --git a/packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts b/packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts index dd11c4fc93..0fb2cb009a 100644 --- a/packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts +++ b/packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts @@ -1,7 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getPackageCommonInfo } from "./packageCommon.js"; +import { + getCommonPackageScripts, + getPackageCommonInfo +} from "./packageCommon.js"; import { getAzurePackageDevDependencies, @@ -160,8 +163,8 @@ function getCjsDevDependencies({ "karma-source-map-support": "~1.4.0", "karma-sourcemap-loader": "^0.3.8", karma: "^6.2.0", - c8: "^8.0.0", - esm: "^3.2.18" + nyc: "^15.1.0", + tsx: "^4.7.1" }; } @@ -188,12 +191,15 @@ function getAzureMonorepoScripts(config: AzureMonorepoInfoConfig) { const esmScripts = getEsmScripts(config); const cjsScripts = getCjsScripts(config); return { + ...getCommonPackageScripts(config), audit: "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build:samples": "dev-tool samples publish --force", "check-format": 'dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore "src/**/*.{ts,cts,mts}" "test/**/*.{ts,cts,mts}" "*.{js,cjs,mjs,json}"', "execute:samples": "dev-tool samples run samples-dev", + "extract-api": + "rimraf review && mkdirp ./review && dev-tool run extract-api", format: 'dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore "src/**/*.{ts,cts,mts}" "test/**/*.{ts,cts,mts}" "*.{js,cjs,mjs,json}"', "integration-test:browser": "echo skipped", @@ -218,7 +224,8 @@ function getEsmScripts({ moduleKind }: AzureMonorepoInfoConfig) { return { "build:test": "npm run clean && tshy && dev-tool run build-test", - build: "npm run clean && tshy && api-extractor run --local", + build: + "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api", "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", test: "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", @@ -235,11 +242,11 @@ function getCjsScripts({ moduleKind }: AzureMonorepoInfoConfig) { return { build: - "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local", + "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api", "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", "build:test": "tsc -p . && dev-tool run bundle", "build:debug": - "tsc -p . && dev-tool run bundle && api-extractor run --local", + "tsc -p . && dev-tool run bundle && dev-tool run extract-api", "integration-test:browser": "dev-tool run test:browser", "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'", diff --git a/packages/rlc-common/src/metadata/packageJson/packageCommon.ts b/packages/rlc-common/src/metadata/packageJson/packageCommon.ts index 33434be462..767d28e4ca 100644 --- a/packages/rlc-common/src/metadata/packageJson/packageCommon.ts +++ b/packages/rlc-common/src/metadata/packageJson/packageCommon.ts @@ -44,8 +44,8 @@ export function getCommonPackageDevDependencies( eslint: "^8.55.0", prettier: "^3.2.5", rimraf: "^5.0.5", - mkdirp: "^2.1.2", - typescript: "~5.3.3", + mkdirp: "^3.0.1", + typescript: "~5.4.5", ...getEsmDevDependencies(config) }; } diff --git a/packages/rlc-common/test/helpers/importsUtil.spec.ts b/packages/rlc-common/test/helpers/importsUtil.spec.ts index d837ff9f4e..ab0815369e 100644 --- a/packages/rlc-common/test/helpers/importsUtil.spec.ts +++ b/packages/rlc-common/test/helpers/importsUtil.spec.ts @@ -12,7 +12,7 @@ describe("#buildRuntimeImports", () => { expect(imports.restClient).to.deep.equal({ type: "restClient", specifier: "@azure-rest/core-client", - version: "^1.2.0" + version: "^1.4.0" }); }); diff --git a/packages/rlc-common/test/helpers/nameUtils.spec.ts b/packages/rlc-common/test/helpers/nameUtils.spec.ts index a12b3bb7c5..33ef9c7939 100644 --- a/packages/rlc-common/test/helpers/nameUtils.spec.ts +++ b/packages/rlc-common/test/helpers/nameUtils.spec.ts @@ -23,7 +23,7 @@ describe("#normalizeName", () => { describe("for operation", () => { it("should return the name with the suffix 'Operation' if the name is a reserved name", () => { expect(normalizeName("export", NameType.Operation, true)).to.equal( - "exportOperation" + "export" ); }); diff --git a/packages/rlc-common/test/integration/mockHelper.ts b/packages/rlc-common/test/integration/mockHelper.ts new file mode 100644 index 0000000000..c521442dc6 --- /dev/null +++ b/packages/rlc-common/test/integration/mockHelper.ts @@ -0,0 +1,50 @@ +import { + buildRuntimeImports, + initInternalImports +} from "../../src/helpers/importsUtil"; +import { PackageFlavor, RLCModel } from "../../src/interfaces"; + +export type TestModelConfig = { + moduleKind?: "esm" | "cjs"; + description?: string; + withTests?: boolean; + withSamples?: boolean; + isMonorepo?: boolean; + libraryName?: string; + version?: string; + flavor?: PackageFlavor; + srcPath?: string; + source?: "TypeSpec" | "Swagger"; + monorepoPackageDirectory?: string; +}; + +export function createMockModel(config: TestModelConfig = {}): RLCModel { + return { + importInfo: { + runtimeImports: buildRuntimeImports(config.flavor), + internalImports: initInternalImports() + }, + libraryName: config.libraryName ?? "@msinternal/test", + // Package json file generation doesn't need paths information + paths: {}, + // Package json file generation doesn't need schemas information + schemas: [], + srcPath: config.srcPath ?? "src", + options: { + azureOutputDirectory: config.monorepoPackageDirectory, + packageDetails: { + name: config.libraryName ?? "@msinternal/test", + version: config.version ?? "1.0.0", + description: config.description ?? "A test package", + nameWithoutScope: "test", + scopeName: "msinternal" + }, + azureSdkForJs: config.isMonorepo ?? false, + flavor: config.flavor, + generateTest: config.withTests ?? false, + generateSample: config.withSamples ?? false, + moduleKind: config.moduleKind, + sourceFrom: config.source ?? "TypeSpec" + } + }; +} diff --git a/packages/rlc-common/test/integration/packageJson.spec.ts b/packages/rlc-common/test/integration/packageJson.spec.ts index a2cb77d689..09113d086c 100644 --- a/packages/rlc-common/test/integration/packageJson.spec.ts +++ b/packages/rlc-common/test/integration/packageJson.spec.ts @@ -4,56 +4,7 @@ import { expect } from "chai"; import { buildPackageFile } from "../../src/metadata/buildPackageFile.js"; import "mocha"; -import { PackageFlavor, RLCModel } from "../../src/interfaces.js"; -import { - buildRuntimeImports, - initInternalImports -} from "../../src/helpers/importsUtil.js"; - -type TestModelConfig = { - moduleKind?: "esm" | "cjs"; - description?: string; - withTests?: boolean; - withSamples?: boolean; - isMonorepo?: boolean; - libraryName?: string; - version?: string; - flavor?: PackageFlavor; - srcPath?: string; - source?: "TypeSpec" | "Swagger"; - monorepoPackageDirectory?: string; -}; - -function createMockModel(config: TestModelConfig = {}): RLCModel { - return { - importInfo: { - runtimeImports: buildRuntimeImports(config.flavor), - internalImports: initInternalImports() - }, - libraryName: config.libraryName ?? "@msinternal/test", - // Package json file generation doesn't need paths information - paths: {}, - // Package json file generation doesn't need schemas information - schemas: [], - srcPath: config.srcPath ?? "src", - options: { - azureOutputDirectory: config.monorepoPackageDirectory, - packageDetails: { - name: config.libraryName ?? "@msinternal/test", - version: config.version ?? "1.0.0", - description: config.description ?? "A test package", - nameWithoutScope: "test", - scopeName: "msinternal" - }, - azureSdkForJs: config.isMonorepo ?? false, - flavor: config.flavor, - generateTest: config.withTests ?? false, - generateSample: config.withSamples ?? false, - moduleKind: config.moduleKind, - sourceFrom: config.source ?? "TypeSpec" - } - }; -} +import { createMockModel, TestModelConfig } from "./mockHelper.js"; describe("Package file generation", () => { describe("Flavor agnostic config", () => { @@ -344,7 +295,7 @@ describe("Package file generation", () => { ); expect(packageFile.scripts).to.have.property( "build", - "npm run clean && tshy && api-extractor run --local" + "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api" ); expect(packageFile.scripts).to.have.property( "test:node", @@ -362,6 +313,27 @@ describe("Package file generation", () => { "unit-test:node", "dev-tool run test:vitest --no-test-proxy" ); + expect(packageFile.scripts).to.have.property( + "clean", + "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log" + ); + expect(packageFile.scripts).to.have.property( + "extract-api", + "rimraf review && mkdirp ./review && dev-tool run extract-api" + ); + expect(packageFile.scripts).to.have.property( + "integration-test", + "npm run integration-test:node && npm run integration-test:browser" + ); + expect(packageFile.scripts).to.have.property("pack", "npm pack 2>&1"); + expect(packageFile.scripts).to.have.property( + "unit-test", + "npm run unit-test:node && npm run unit-test:browser" + ); + expect(packageFile.scripts).to.have.property( + "format", + 'dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore "src/**/*.{ts,cts,mts}" "test/**/*.{ts,cts,mts}" "*.{js,cjs,mjs,json}"' + ); }); it("[cjs] should include correct test devCependencies with tests", () => { @@ -403,8 +375,8 @@ describe("Package file generation", () => { "karma-sourcemap-loader" ); expect(packageFile.devDependencies).to.have.property("karma"); - expect(packageFile.devDependencies).to.have.property("c8"); - expect(packageFile.devDependencies).to.have.property("esm"); + expect(packageFile.devDependencies).to.have.property("nyc"); + expect(packageFile.devDependencies).to.have.property("tsx"); }); it("[cjs] should include correct scripts with tests", () => { @@ -418,7 +390,7 @@ describe("Package file generation", () => { expect(packageFile.scripts).to.have.property( "build", - "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && api-extractor run --local" + "npm run clean && tsc -p . && dev-tool run bundle && mkdirp ./review && dev-tool run extract-api" ); expect(packageFile.scripts).to.have.property( "build:node", @@ -430,7 +402,7 @@ describe("Package file generation", () => { ); expect(packageFile.scripts).to.have.property( "build:debug", - "tsc -p . && dev-tool run bundle && api-extractor run --local" + "tsc -p . && dev-tool run bundle && dev-tool run extract-api" ); expect(packageFile.scripts).to.have.property( "integration-test:browser", @@ -448,6 +420,27 @@ describe("Package file generation", () => { "unit-test:browser", "dev-tool run test:browser" ); + expect(packageFile.scripts).to.have.property( + "clean", + "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log" + ); + expect(packageFile.scripts).to.have.property( + "extract-api", + "rimraf review && mkdirp ./review && dev-tool run extract-api" + ); + expect(packageFile.scripts).to.have.property( + "integration-test", + "npm run integration-test:node && npm run integration-test:browser" + ); + expect(packageFile.scripts).to.have.property("pack", "npm pack 2>&1"); + expect(packageFile.scripts).to.have.property( + "unit-test", + "npm run unit-test:node && npm run unit-test:browser" + ); + expect(packageFile.scripts).to.have.property( + "format", + 'dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore "src/**/*.{ts,cts,mts}" "test/**/*.{ts,cts,mts}" "*.{js,cjs,mjs,json}"' + ); }); }); @@ -490,7 +483,7 @@ describe("Package file generation", () => { const packageFileContent = buildPackageFile(model); const packageFile = JSON.parse(packageFileContent?.content ?? "{}"); - expect(packageFile.devDependencies).to.have.property("c8"); + expect(packageFile.devDependencies).to.have.property("nyc"); expect(packageFile.devDependencies).to.have.property("mocha"); expect(packageFile.devDependencies).to.have.property("@types/mocha"); expect(packageFile.devDependencies).to.have.property("cross-env"); diff --git a/packages/rlc-common/test/integration/vitestConfig.spec.ts b/packages/rlc-common/test/integration/vitestConfig.spec.ts new file mode 100644 index 0000000000..ec157c5cdb --- /dev/null +++ b/packages/rlc-common/test/integration/vitestConfig.spec.ts @@ -0,0 +1,20 @@ +import { expect } from "chai"; +import { buildVitestConfig } from "../../src/metadata/buildVitestConfig.js"; +import "mocha"; +import { createMockModel } from "./mockHelper.js"; + +describe("vitest.config", () => { + describe("azure monorepo", () => { + it("vitest.browser.config.ts", () => { + const model = createMockModel({ + withTests: true, + isMonorepo: true + }); + + const result = buildVitestConfig(model, "browser"); + expect(result?.content).includes( + `"include": ["dist-test/browser/**/*.spec.js"]` + ); + }); + }); +}); diff --git a/packages/typespec-test/package.json b/packages/typespec-test/package.json index 20507ee694..bb5a4e7871 100644 --- a/packages/typespec-test/package.json +++ b/packages/typespec-test/package.json @@ -3,22 +3,22 @@ "version": "1.0.0", "type": "module", "dependencies": { - "@azure-tools/typespec-ts": "workspace:^0.25.0", - "@typespec/openapi": ">=0.54.0 <1.0.0", - "@azure-tools/typespec-autorest": ">=0.40.0 <1.0.0", - "@typespec/openapi3": ">=0.54.0 <1.0.0", - "@azure-tools/typespec-azure-core": ">=0.40.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.40.0 <1.0.0", - "@typespec/compiler": ">=0.54.0 <1.0.0", - "@typespec/http": ">=0.54.0 <1.0.0", - "@typespec/rest": ">=0.54.0 <1.0.0", - "@typespec/versioning": ">=0.54.0 <1.0.0", + "@azure-tools/typespec-ts": "workspace:^0.27.0", + "@typespec/openapi": ">=0.55.0 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.41.0 <1.0.0", + "@typespec/openapi3": ">=0.55.0 <1.0.0", + "@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.41.3 <1.0.0", + "@typespec/compiler": ">=0.55.0 <1.0.0", + "@typespec/http": ">=0.55.0 <1.0.0", + "@typespec/rest": ">=0.55.0 <1.0.0", + "@typespec/versioning": ">=0.55.0 <1.0.0", "prettier": "^3.1.0" }, "devDependencies": { "ts-node": "^8.5.2", "@types/node": "^18.0.0", - "typescript": "~5.2.0", + "typescript": "~5.4.5", "@types/mocha": "^5.2.7" }, "scripts": { @@ -28,4 +28,4 @@ "check:tree": "node ./eng/check-clean-tree.js" }, "private": true -} \ No newline at end of file +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json index 71487c86b4..c2e87e4183 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/package.json @@ -10,7 +10,11 @@ "tshy": { "exports": { "./package.json": "./package.json", - ".": "./src/index.ts" + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./models": "./src/models/index.ts", + "./api/univariate": "./src/api/univariate/index.ts", + "./api/multivariate": "./src/api/multivariate/index.ts" }, "dialects": [ "esm", @@ -40,7 +44,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -54,8 +58,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -104,6 +108,78 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + }, + "./api/univariate": { + "browser": { + "types": "./dist/browser/api/univariate/index.d.ts", + "default": "./dist/browser/api/univariate/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/univariate/index.d.ts", + "default": "./dist/react-native/api/univariate/index.js" + }, + "import": { + "types": "./dist/esm/api/univariate/index.d.ts", + "default": "./dist/esm/api/univariate/index.js" + }, + "require": { + "types": "./dist/commonjs/api/univariate/index.d.ts", + "default": "./dist/commonjs/api/univariate/index.js" + } + }, + "./api/multivariate": { + "browser": { + "types": "./dist/browser/api/multivariate/index.d.ts", + "default": "./dist/browser/api/multivariate/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/multivariate/index.d.ts", + "default": "./dist/react-native/api/multivariate/index.js" + }, + "import": { + "types": "./dist/esm/api/multivariate/index.d.ts", + "default": "./dist/esm/api/multivariate/index.js" + }, + "require": { + "types": "./dist/commonjs/api/multivariate/index.d.ts", + "default": "./dist/commonjs/api/multivariate/index.js" + } } }, "main": "./dist/commonjs/index.js", diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index 9752378582..4d37ac9687 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -4,488 +4,149 @@ ```ts -import { Client } from '@azure-rest/core-client'; import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; import { KeyCredential } from '@azure/core-auth'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; // @public (undocumented) -export type AnomalyDetectorClient = Client & { - path: Routes; -}; - -// @public (undocumented) -export interface AnomalyDetectorClientOptions extends ClientOptions { - // (undocumented) - apiVersion?: string; -} - -// @public -function createClient(endpointParam: string, credentials: KeyCredential, options?: AnomalyDetectorClientOptions): AnomalyDetectorClient; -export default createClient; - -// @public (undocumented) -export interface DeleteMultivariateModel { - delete(options?: DeleteMultivariateModelParameters): StreamableMethod; - get(options?: GetMultivariateModelParameters): StreamableMethod; -} - -// @public -export interface DeleteMultivariateModel204Response extends HttpResponse { - // (undocumented) - status: "204"; -} - -// @public (undocumented) -export interface DeleteMultivariateModelDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface DeleteMultivariateModelDefaultResponse extends HttpResponse { - // (undocumented) - body: MultivariateResponseErrorOutput; - // (undocumented) - headers: RawHttpHeaders & DeleteMultivariateModelDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type DeleteMultivariateModelParameters = RequestParameters; - -// @public (undocumented) -export interface DetectMultivariateBatchAnomaly { - post(options: DetectMultivariateBatchAnomalyParameters): StreamableMethod; -} - -// @public (undocumented) -export interface DetectMultivariateBatchAnomaly202Headers { - "operation-id": string; - "operation-location": string; -} - -// @public -export interface DetectMultivariateBatchAnomaly202Response extends HttpResponse { - // (undocumented) - body: MultivariateMultivariateDetectionResultOutput; - // (undocumented) - headers: RawHttpHeaders & DetectMultivariateBatchAnomaly202Headers; - // (undocumented) - status: "202"; -} +export type AlignMode = "Inner" | "Outer"; // @public (undocumented) -export interface DetectMultivariateBatchAnomalyBodyParam { - body: MultivariateMultivariateBatchDetectionOptions; +export class AnomalyDetectorClient { + constructor(endpointParam: string, credential: KeyCredential, options?: AnomalyDetectorClientOptions); + readonly multivariate: MultivariateOperations; + readonly pipeline: Pipeline; + readonly univariate: UnivariateOperations; } // @public (undocumented) -export interface DetectMultivariateBatchAnomalyDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface DetectMultivariateBatchAnomalyDefaultResponse extends HttpResponse { - // (undocumented) - body: MultivariateResponseErrorOutput; - // (undocumented) - headers: RawHttpHeaders & DetectMultivariateBatchAnomalyDefaultHeaders; - // (undocumented) - status: string; +export interface AnomalyDetectorClientOptions extends ClientOptions { + apiVersion?: string; } // @public (undocumented) -export type DetectMultivariateBatchAnomalyParameters = DetectMultivariateBatchAnomalyBodyParam & RequestParameters; - -// @public (undocumented) -export interface DetectMultivariateLastAnomaly { - post(options: DetectMultivariateLastAnomalyParameters): StreamableMethod; -} +export type AnomalyDetectorErrorCodes = "InvalidCustomInterval" | "BadArgument" | "InvalidGranularity" | "InvalidPeriod" | "InvalidModelArgument" | "InvalidSeries" | "InvalidJsonFormat" | "RequiredGranularity" | "RequiredSeries" | "InvalidImputeMode" | "InvalidImputeFixedValue"; // @public -export interface DetectMultivariateLastAnomaly200Response extends HttpResponse { - // (undocumented) - body: MultivariateMultivariateLastDetectionResultOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface DetectMultivariateLastAnomalyBodyParam { - body: MultivariateMultivariateLastDetectionOptions; -} +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public (undocumented) -export interface DetectMultivariateLastAnomalyDefaultHeaders { - "x-ms-error-code"?: string; -} +export type DataSchema = "OneTable" | "MultiTable"; // @public (undocumented) -export interface DetectMultivariateLastAnomalyDefaultResponse extends HttpResponse { - // (undocumented) - body: MultivariateResponseErrorOutput; - // (undocumented) - headers: RawHttpHeaders & DetectMultivariateLastAnomalyDefaultHeaders; - // (undocumented) - status: string; -} +export type FillNAMethod = "Previous" | "Subsequent" | "Linear" | "Zero" | "Fixed"; // @public (undocumented) -export type DetectMultivariateLastAnomalyParameters = DetectMultivariateLastAnomalyBodyParam & RequestParameters; +export type ImputeMode = "auto" | "previous" | "linear" | "fixed" | "zero" | "notFill"; // @public (undocumented) -export interface DetectUnivariateChangePoint { - post(options: DetectUnivariateChangePointParameters): StreamableMethod; -} +export type ModelStatus = "CREATED" | "RUNNING" | "READY" | "FAILED"; // @public -export interface DetectUnivariateChangePoint200Response extends HttpResponse { - // (undocumented) - body: UnivariateUnivariateChangePointDetectionResultOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface DetectUnivariateChangePointBodyParam { - body: UnivariateUnivariateChangePointDetectionOptions; -} - -// @public (undocumented) -export interface DetectUnivariateChangePointDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface DetectUnivariateChangePointDefaultResponse extends HttpResponse { - // (undocumented) - body: UnivariateAnomalyDetectorErrorOutput; - // (undocumented) - headers: RawHttpHeaders & DetectUnivariateChangePointDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type DetectUnivariateChangePointParameters = DetectUnivariateChangePointBodyParam & RequestParameters; - -// @public (undocumented) -export interface DetectUnivariateEntireSeries { - post(options: DetectUnivariateEntireSeriesParameters): StreamableMethod; +export interface MultivariateAlignPolicy { + alignMode?: AlignMode; + fillNAMethod?: FillNAMethod; + paddingValue?: number; } // @public -export interface DetectUnivariateEntireSeries200Response extends HttpResponse { - // (undocumented) - body: UnivariateUnivariateEntireDetectionResultOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface DetectUnivariateEntireSeriesBodyParam { - body: UnivariateUnivariateDetectionOptions; -} - -// @public (undocumented) -export interface DetectUnivariateEntireSeriesDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface DetectUnivariateEntireSeriesDefaultResponse extends HttpResponse { - // (undocumented) - body: UnivariateAnomalyDetectorErrorOutput; - // (undocumented) - headers: RawHttpHeaders & DetectUnivariateEntireSeriesDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type DetectUnivariateEntireSeriesParameters = DetectUnivariateEntireSeriesBodyParam & RequestParameters; - -// @public (undocumented) -export interface DetectUnivariateLastPoint { - post(options: DetectUnivariateLastPointParameters): StreamableMethod; +export interface MultivariateAnomalyDetectionModel { + createdTime: Date; + lastUpdatedTime: Date; + readonly modelId: string; + modelInfo?: MultivariateModelInfo; } // @public -export interface DetectUnivariateLastPoint200Response extends HttpResponse { - // (undocumented) - body: UnivariateUnivariateLastDetectionResultOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface DetectUnivariateLastPointBodyParam { - body: UnivariateUnivariateDetectionOptions; -} - -// @public (undocumented) -export interface DetectUnivariateLastPointDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface DetectUnivariateLastPointDefaultResponse extends HttpResponse { - // (undocumented) - body: UnivariateAnomalyDetectorErrorOutput; - // (undocumented) - headers: RawHttpHeaders & DetectUnivariateLastPointDefaultHeaders; - // (undocumented) - status: string; +export interface MultivariateAnomalyInterpretation { + contributionScore?: number; + correlationChanges?: MultivariateCorrelationChanges; + variable?: string; } -// @public (undocumented) -export type DetectUnivariateLastPointParameters = DetectUnivariateLastPointBodyParam & RequestParameters; - // @public -export type GetArrayType = T extends Array ? TData : never; - -// @public (undocumented) -export interface GetMultivariateBatchDetectionResult { - get(options?: GetMultivariateBatchDetectionResultParameters): StreamableMethod; +export interface MultivariateAnomalyState { + errors?: MultivariateErrorResponse[]; + timestamp: Date; + value?: MultivariateAnomalyValue; } // @public -export interface GetMultivariateBatchDetectionResult200Response extends HttpResponse { - // (undocumented) - body: MultivariateMultivariateDetectionResultOutput; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface GetMultivariateBatchDetectionResultDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface GetMultivariateBatchDetectionResultDefaultResponse extends HttpResponse { - // (undocumented) - body: MultivariateResponseErrorOutput; - // (undocumented) - headers: RawHttpHeaders & GetMultivariateBatchDetectionResultDefaultHeaders; - // (undocumented) - status: string; +export interface MultivariateAnomalyValue { + interpretation?: MultivariateAnomalyInterpretation[]; + isAnomaly: boolean; + score: number; + severity: number; } // @public (undocumented) -export type GetMultivariateBatchDetectionResultParameters = RequestParameters; +export type MultivariateBatchDetectionStatus = "CREATED" | "RUNNING" | "READY" | "FAILED"; // @public -export interface GetMultivariateModel200Response extends HttpResponse { - // (undocumented) - body: MultivariateAnomalyDetectionModelOutput; - // (undocumented) - status: "200"; +export interface MultivariateCorrelationChanges { + changedVariables?: string[]; } // @public (undocumented) -export interface GetMultivariateModelDefaultHeaders { - "x-ms-error-code"?: string; +export interface MultivariateDeleteMultivariateModelOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetMultivariateModelDefaultResponse extends HttpResponse { - // (undocumented) - body: MultivariateResponseErrorOutput; - // (undocumented) - headers: RawHttpHeaders & GetMultivariateModelDefaultHeaders; - // (undocumented) - status: string; +export interface MultivariateDetectMultivariateBatchAnomalyOptionalParams extends OperationOptions { } // @public (undocumented) -export type GetMultivariateModelParameters = RequestParameters; - -// @public -export type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ - page: TPage; - nextPageLink?: string; -}>; - -// @public (undocumented) -export function isUnexpected(response: DetectUnivariateEntireSeries200Response | DetectUnivariateEntireSeriesDefaultResponse): response is DetectUnivariateEntireSeriesDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: DetectUnivariateLastPoint200Response | DetectUnivariateLastPointDefaultResponse): response is DetectUnivariateLastPointDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: DetectUnivariateChangePoint200Response | DetectUnivariateChangePointDefaultResponse): response is DetectUnivariateChangePointDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: GetMultivariateBatchDetectionResult200Response | GetMultivariateBatchDetectionResultDefaultResponse): response is GetMultivariateBatchDetectionResultDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse): response is TrainMultivariateModelDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse): response is ListMultivariateModelsDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse): response is DeleteMultivariateModelDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse): response is GetMultivariateModelDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: DetectMultivariateBatchAnomaly202Response | DetectMultivariateBatchAnomalyDefaultResponse): response is DetectMultivariateBatchAnomalyDefaultResponse; - -// @public (undocumented) -export function isUnexpected(response: DetectMultivariateLastAnomaly200Response | DetectMultivariateLastAnomalyDefaultResponse): response is DetectMultivariateLastAnomalyDefaultResponse; +export interface MultivariateDetectMultivariateLastAnomalyOptionalParams extends OperationOptions { +} // @public -export interface ListMultivariateModels200Response extends HttpResponse { - // (undocumented) - body: MultivariateModelListOutput; - // (undocumented) - status: "200"; +export interface MultivariateDiagnosticsInfo { + modelState?: MultivariateModelState; + variableStates?: MultivariateVariableState[]; } -// @public (undocumented) -export interface ListMultivariateModelsDefaultHeaders { - "x-ms-error-code"?: string; +// @public +export interface MultivariateErrorResponse { + code: string; + message: string; } // @public (undocumented) -export interface ListMultivariateModelsDefaultResponse extends HttpResponse { - // (undocumented) - body: MultivariateResponseErrorOutput; - // (undocumented) - headers: RawHttpHeaders & ListMultivariateModelsDefaultHeaders; - // (undocumented) - status: string; +export interface MultivariateGetMultivariateBatchDetectionResultOptionalParams extends OperationOptions { } // @public (undocumented) -export type ListMultivariateModelsParameters = ListMultivariateModelsQueryParam & RequestParameters; - -// @public (undocumented) -export interface ListMultivariateModelsQueryParam { - // (undocumented) - queryParameters?: ListMultivariateModelsQueryParamProperties; +export interface MultivariateGetMultivariateModelOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ListMultivariateModelsQueryParamProperties { +export interface MultivariateListMultivariateModelsOptionalParams extends OperationOptions { skip?: number; top?: number; } -// @public -export interface MultivariateAlignPolicy { - alignMode?: "Inner" | "Outer"; - fillNAMethod?: string; - paddingValue?: number; -} - -// @public -export interface MultivariateAlignPolicyOutput { - alignMode?: "Inner" | "Outer"; - fillNAMethod?: string; - paddingValue?: number; -} - -// @public -export interface MultivariateAnomalyDetectionModelOutput { - createdTime: string; - lastUpdatedTime: string; - readonly modelId: string; - modelInfo?: MultivariateModelInfoOutput; -} - -// @public -export interface MultivariateAnomalyInterpretationOutput { - contributionScore?: number; - correlationChanges?: MultivariateCorrelationChangesOutput; - variable?: string; -} - -// @public -export interface MultivariateAnomalyStateOutput { - errors?: Array; - timestamp: string; - value?: MultivariateAnomalyValueOutput; -} - -// @public -export interface MultivariateAnomalyValueOutput { - interpretation?: Array; - isAnomaly: boolean; - score: number; - severity: number; -} - -// @public -export interface MultivariateCorrelationChangesOutput { - changedVariables?: string[]; -} - -// @public -export interface MultivariateDiagnosticsInfo { - modelState?: MultivariateModelState; - variableStates?: Array; -} - -// @public -export interface MultivariateDiagnosticsInfoOutput { - modelState?: MultivariateModelStateOutput; - variableStates?: Array; -} - -// @public -export interface MultivariateErrorResponse { - code: string; - message: string; -} - -// @public -export interface MultivariateErrorResponseOutput { - code: string; - message: string; -} - // @public export interface MultivariateModelInfo { alignPolicy?: MultivariateAlignPolicy; - dataSchema?: string; + dataSchema?: DataSchema; dataSource: string; diagnosticsInfo?: MultivariateDiagnosticsInfo; displayName?: string; - endTime: Date | string; - slidingWindow?: number; - startTime: Date | string; - status?: "CREATED" | "RUNNING" | "READY" | "FAILED"; -} - -// @public -export interface MultivariateModelInfoOutput { - alignPolicy?: MultivariateAlignPolicyOutput; - dataSchema?: string; - dataSource: string; - diagnosticsInfo?: MultivariateDiagnosticsInfoOutput; - displayName?: string; - endTime: string; - readonly errors?: Array; + endTime: Date; + readonly errors?: MultivariateErrorResponse[]; slidingWindow?: number; - startTime: string; - status?: "CREATED" | "RUNNING" | "READY" | "FAILED"; + startTime: Date; + status?: ModelStatus; } // @public -export interface MultivariateModelListOutput { +export interface MultivariateModelList { currentCount: number; maxCount: number; - models: Array; + models: MultivariateAnomalyDetectionModel[]; nextLink?: string; } @@ -497,78 +158,69 @@ export interface MultivariateModelState { validationLosses?: number[]; } -// @public -export interface MultivariateModelStateOutput { - epochIds?: number[]; - latenciesInSeconds?: number[]; - trainLosses?: number[]; - validationLosses?: number[]; -} - // @public export interface MultivariateMultivariateBatchDetectionOptions { dataSource: string; - endTime: Date | string; - startTime: Date | string; + endTime: Date; + startTime: Date; topContributorCount: number; } // @public -export interface MultivariateMultivariateBatchDetectionOptionsOutput { - dataSource: string; - endTime: string; - startTime: string; - topContributorCount: number; +export interface MultivariateMultivariateBatchDetectionResultSummary { + errors?: MultivariateErrorResponse[]; + setupInfo: MultivariateMultivariateBatchDetectionOptions; + status: MultivariateBatchDetectionStatus; + variableStates?: MultivariateVariableState[]; } // @public -export interface MultivariateMultivariateBatchDetectionResultSummaryOutput { - errors?: Array; - setupInfo: MultivariateMultivariateBatchDetectionOptionsOutput; - status: "CREATED" | "RUNNING" | "READY" | "FAILED"; - variableStates?: Array; -} - -// @public -export interface MultivariateMultivariateDetectionResultOutput { +export interface MultivariateMultivariateDetectionResult { readonly resultId: string; - results: Array; - summary: MultivariateMultivariateBatchDetectionResultSummaryOutput; + results: MultivariateAnomalyState[]; + summary: MultivariateMultivariateBatchDetectionResultSummary; } // @public export interface MultivariateMultivariateLastDetectionOptions { topContributorCount: number; - variables: Array; + variables: MultivariateVariableValues[]; } // @public -export interface MultivariateMultivariateLastDetectionResultOutput { - results?: Array; - variableStates?: Array; +export interface MultivariateMultivariateLastDetectionResult { + results?: MultivariateAnomalyState[]; + variableStates?: MultivariateVariableState[]; } -// @public -export interface MultivariateResponseErrorOutput { - code: string; - message: string; +// @public (undocumented) +export interface MultivariateOperations { + // (undocumented) + deleteMultivariateModel: (modelId: string, options?: MultivariateDeleteMultivariateModelOptionalParams) => Promise; + // (undocumented) + detectMultivariateBatchAnomaly: (modelId: string, options: MultivariateMultivariateBatchDetectionOptions, optionalParams?: MultivariateDetectMultivariateBatchAnomalyOptionalParams) => Promise; + // (undocumented) + detectMultivariateLastAnomaly: (modelId: string, options: MultivariateMultivariateLastDetectionOptions, optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams) => Promise; + // (undocumented) + getMultivariateBatchDetectionResult: (resultId: string, options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams) => Promise; + // (undocumented) + getMultivariateModel: (modelId: string, options?: MultivariateGetMultivariateModelOptionalParams) => Promise; + // (undocumented) + listMultivariateModels: (options?: MultivariateListMultivariateModelsOptionalParams) => PagedAsyncIterableIterator; + // (undocumented) + trainMultivariateModel: (modelInfo: MultivariateModelInfo, options?: MultivariateTrainMultivariateModelOptionalParams) => Promise; } -// @public -export interface MultivariateVariableState { - effectiveCount?: number; - filledNARatio?: number; - firstTimestamp?: Date | string; - lastTimestamp?: Date | string; - variable?: string; +// @public (undocumented) +export interface MultivariateTrainMultivariateModelOptionalParams extends OperationOptions { } // @public -export interface MultivariateVariableStateOutput { +export interface MultivariateVariableState { effectiveCount?: number; filledNARatio?: number; - firstTimestamp?: string; - lastTimestamp?: string; + firstTimestamp?: Date; + lastTimestamp?: Date; variable?: string; } @@ -580,104 +232,60 @@ export interface MultivariateVariableValues { } // @public -export function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; - -// @public -export type PaginateReturn = TResult extends { - body: { - value?: infer TPage; - }; -} | { - body: { - models?: infer TPage; - }; -} ? GetArrayType : Array; - -// @public -export interface PagingOptions { - customGetPage?: GetPage[]>; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } -// @public (undocumented) -export interface Routes { - (path: "/timeseries/entire/detect"): DetectUnivariateEntireSeries; - (path: "/timeseries/last/detect"): DetectUnivariateLastPoint; - (path: "/timeseries/changepoint/detect"): DetectUnivariateChangePoint; - (path: "/multivariate/detect-batch/{resultId}", resultId: string): GetMultivariateBatchDetectionResult; - (path: "/multivariate/models"): TrainMultivariateModel; - (path: "/multivariate/models/{modelId}", modelId: string): DeleteMultivariateModel; - (path: "/multivariate/models/{modelId}:detect-batch", modelId: string): DetectMultivariateBatchAnomaly; - (path: "/multivariate/models/{modelId}:detect-last", modelId: string): DetectMultivariateLastAnomaly; +// @public +export interface PageSettings { + continuationToken?: string; } // @public (undocumented) -export interface TrainMultivariateModel { - get(options?: ListMultivariateModelsParameters): StreamableMethod; - post(options: TrainMultivariateModelParameters): StreamableMethod; -} +export type TimeGranularity = "yearly" | "monthly" | "weekly" | "daily" | "hourly" | "minutely" | "secondly" | "microsecond" | "none"; // @public (undocumented) -export interface TrainMultivariateModel201Headers { - location: string; -} - -// @public -export interface TrainMultivariateModel201Response extends HttpResponse { - // (undocumented) - body: MultivariateAnomalyDetectionModelOutput; - // (undocumented) - headers: RawHttpHeaders & TrainMultivariateModel201Headers; - // (undocumented) - status: "201"; +export interface UnivariateDetectUnivariateChangePointOptionalParams extends OperationOptions { } // @public (undocumented) -export interface TrainMultivariateModelBodyParam { - body: MultivariateModelInfo; +export interface UnivariateDetectUnivariateEntireSeriesOptionalParams extends OperationOptions { } // @public (undocumented) -export interface TrainMultivariateModelDefaultHeaders { - "x-ms-error-code"?: string; +export interface UnivariateDetectUnivariateLastPointOptionalParams extends OperationOptions { } // @public (undocumented) -export interface TrainMultivariateModelDefaultResponse extends HttpResponse { +export interface UnivariateOperations { // (undocumented) - body: MultivariateResponseErrorOutput; + detectUnivariateChangePoint: (options: UnivariateUnivariateChangePointDetectionOptions, optionalParams?: UnivariateDetectUnivariateChangePointOptionalParams) => Promise; // (undocumented) - headers: RawHttpHeaders & TrainMultivariateModelDefaultHeaders; + detectUnivariateEntireSeries: (options: UnivariateUnivariateDetectionOptions, optionalParams?: UnivariateDetectUnivariateEntireSeriesOptionalParams) => Promise; // (undocumented) - status: string; -} - -// @public (undocumented) -export type TrainMultivariateModelParameters = TrainMultivariateModelBodyParam & RequestParameters; - -// @public -export interface UnivariateAnomalyDetectorErrorOutput { - code?: string; - message?: string; + detectUnivariateLastPoint: (options: UnivariateUnivariateDetectionOptions, optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams) => Promise; } // @public export interface UnivariateTimeSeriesPoint { - timestamp?: Date | string; + timestamp?: Date; value: number; } // @public export interface UnivariateUnivariateChangePointDetectionOptions { customInterval?: number; - granularity: "yearly" | "monthly" | "weekly" | "daily" | "hourly" | "minutely" | "secondly" | "microsecond" | "none"; + granularity: TimeGranularity; period?: number; - series: Array; + series: UnivariateTimeSeriesPoint[]; stableTrendWindow?: number; threshold?: number; } // @public -export interface UnivariateUnivariateChangePointDetectionResultOutput { +export interface UnivariateUnivariateChangePointDetectionResult { confidenceScores?: number[]; isChangePoint?: boolean[]; readonly period?: number; @@ -686,17 +294,17 @@ export interface UnivariateUnivariateChangePointDetectionResultOutput { // @public export interface UnivariateUnivariateDetectionOptions { customInterval?: number; - granularity?: "yearly" | "monthly" | "weekly" | "daily" | "hourly" | "minutely" | "secondly" | "microsecond" | "none"; + granularity?: TimeGranularity; imputeFixedValue?: number; - imputeMode?: string; + imputeMode?: ImputeMode; maxAnomalyRatio?: number; period?: number; sensitivity?: number; - series: Array; + series: UnivariateTimeSeriesPoint[]; } // @public -export interface UnivariateUnivariateEntireDetectionResultOutput { +export interface UnivariateUnivariateEntireDetectionResult { expectedValues: number[]; isAnomaly: boolean[]; isNegativeAnomaly: boolean[]; @@ -708,7 +316,7 @@ export interface UnivariateUnivariateEntireDetectionResultOutput { } // @public -export interface UnivariateUnivariateLastDetectionResultOutput { +export interface UnivariateUnivariateLastDetectionResult { expectedValue: number; isAnomaly: boolean; isNegativeAnomaly: boolean; @@ -720,6 +328,9 @@ export interface UnivariateUnivariateLastDetectionResultOutput { upperMargin: number; } +// @public (undocumented) +export type Versions = "v1.1"; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/deleteMultivariateModelSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/deleteMultivariateModelSample.ts deleted file mode 100644 index 17b6914fde..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/deleteMultivariateModelSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation DeleteMultivariateModel - * - * @summary call operation DeleteMultivariateModel - */ -async function deleteMultivariateModelSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const modelId = "{Your modelId}"; - const result = await client - .path("/multivariate/models/{modelId}", modelId) - .delete(); - console.log(result); -} - -async function main() { - deleteMultivariateModelSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateBatchAnomalySample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateBatchAnomalySample.ts deleted file mode 100644 index 9b010bbc33..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateBatchAnomalySample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation DetectMultivariateBatchAnomaly - * - * @summary call operation DetectMultivariateBatchAnomaly - */ -async function detectMultivariateBatchAnomalySample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const modelId = "{Your modelId}"; - const result = await client - .path("/multivariate/models/{modelId}:detect-batch", modelId) - .post({ - body: { - dataSource: "{Your dataSource}", - topContributorCount: 123, - startTime: new Date(), - endTime: new Date(), - }, - }); - console.log(result); -} - -async function main() { - detectMultivariateBatchAnomalySample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateLastAnomalySample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateLastAnomalySample.ts deleted file mode 100644 index a54536d385..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectMultivariateLastAnomalySample.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation DetectMultivariateLastAnomaly - * - * @summary call operation DetectMultivariateLastAnomaly - */ -async function detectMultivariateLastAnomalySample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const modelId = "{Your modelId}"; - const result = await client - .path("/multivariate/models/{modelId}:detect-last", modelId) - .post({ - body: { - variables: [ - { - variable: "{Your variable}", - timestamps: ["{Your timestamps}"], - values: [123], - }, - ], - topContributorCount: 123, - }, - }); - console.log(result); -} - -async function main() { - detectMultivariateLastAnomalySample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateChangePointSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateChangePointSample.ts deleted file mode 100644 index b3f0d9f06a..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateChangePointSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation DetectUnivariateChangePoint - * - * @summary call operation DetectUnivariateChangePoint - */ -async function detectUnivariateChangePointSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const result = await client - .path("/timeseries/changepoint/detect") - .post({ - body: { - series: [{ timestamp: new Date(), value: 123 }], - granularity: "yearly", - customInterval: 123, - period: 123, - stableTrendWindow: 123, - threshold: 123, - }, - }); - console.log(result); -} - -async function main() { - detectUnivariateChangePointSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateEntireSeriesSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateEntireSeriesSample.ts deleted file mode 100644 index 61df53a748..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateEntireSeriesSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation DetectUnivariateEntireSeries - * - * @summary call operation DetectUnivariateEntireSeries - */ -async function detectUnivariateEntireSeriesSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const result = await client - .path("/timeseries/entire/detect") - .post({ - body: { - series: [{ timestamp: new Date(), value: 123 }], - granularity: "yearly", - customInterval: 123, - period: 123, - maxAnomalyRatio: 123, - sensitivity: 123, - imputeMode: "auto", - imputeFixedValue: 123, - }, - }); - console.log(result); -} - -async function main() { - detectUnivariateEntireSeriesSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateLastPointSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateLastPointSample.ts deleted file mode 100644 index 5ffcd98ac3..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/detectUnivariateLastPointSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation DetectUnivariateLastPoint - * - * @summary call operation DetectUnivariateLastPoint - */ -async function detectUnivariateLastPointSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const result = await client - .path("/timeseries/last/detect") - .post({ - body: { - series: [{ timestamp: new Date(), value: 123 }], - granularity: "yearly", - customInterval: 123, - period: 123, - maxAnomalyRatio: 123, - sensitivity: 123, - imputeMode: "auto", - imputeFixedValue: 123, - }, - }); - console.log(result); -} - -async function main() { - detectUnivariateLastPointSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateBatchDetectionResultSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateBatchDetectionResultSample.ts deleted file mode 100644 index 92f0fb83a6..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateBatchDetectionResultSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation GetMultivariateBatchDetectionResult - * - * @summary call operation GetMultivariateBatchDetectionResult - */ -async function getMultivariateBatchDetectionResultSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const resultId = "{Your resultId}"; - const result = await client - .path("/multivariate/detect-batch/{resultId}", resultId) - .get(); - console.log(result); -} - -async function main() { - getMultivariateBatchDetectionResultSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateModelSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateModelSample.ts deleted file mode 100644 index e80d18a0c5..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/getMultivariateModelSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation GetMultivariateModel - * - * @summary call operation GetMultivariateModel - */ -async function getMultivariateModelSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const modelId = "{Your modelId}"; - const result = await client - .path("/multivariate/models/{modelId}", modelId) - .get(); - console.log(result); -} - -async function main() { - getMultivariateModelSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/listMultivariateModelsSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/listMultivariateModelsSample.ts deleted file mode 100644 index c5cd50368d..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/listMultivariateModelsSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { AzureKeyCredential } from "@azure/core-auth"; -import createAnomalyDetectorClient, { - paginate, -} from "@msinternal/ai-anomaly-detector"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation ListMultivariateModels - * - * @summary call operation ListMultivariateModels - */ -async function listMultivariateModelsSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const initialResponse = await client - .path("/multivariate/models") - .get({ queryParameters: { skip: 123, top: 123 } }); - const pageData = paginate(client, initialResponse); - const result = []; - for await (const item of pageData) { - result.push(item); - } - console.log(result); -} - -async function main() { - listMultivariateModelsSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/trainMultivariateModelSample.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/trainMultivariateModelSample.ts deleted file mode 100644 index f25d7fd2c2..0000000000 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/samples-dev/trainMultivariateModelSample.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import createAnomalyDetectorClient from "@msinternal/ai-anomaly-detector"; -import { AzureKeyCredential } from "@azure/core-auth"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to call operation TrainMultivariateModel - * - * @summary call operation TrainMultivariateModel - */ -async function trainMultivariateModelSample() { - const endpointParam = "{Your endpointParam}"; - const credential = new AzureKeyCredential("{Your API key}"); - const client = createAnomalyDetectorClient(endpointParam, credential); - const result = await client - .path("/multivariate/models") - .post({ - body: { - dataSource: "{Your dataSource}", - dataSchema: "OneTable", - startTime: new Date(), - endTime: new Date(), - displayName: "{Your displayName}", - slidingWindow: 123, - alignPolicy: { - alignMode: "Inner", - fillNAMethod: "Previous", - paddingValue: 123, - }, - status: "CREATED", - diagnosticsInfo: { - modelState: { - epochIds: [123], - trainLosses: [123], - validationLosses: [123], - latenciesInSeconds: [123], - }, - variableStates: [ - { - variable: "{Your variable}", - filledNARatio: 123, - effectiveCount: 123, - firstTimestamp: new Date(), - lastTimestamp: new Date(), - }, - ], - }, - }, - }); - console.log(result); -} - -async function main() { - trainMultivariateModelSample(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts index 35b5af7a97..83a4b3d868 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/anomalyDetectorClient.ts @@ -1,59 +1,60 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger.js"; import { KeyCredential } from "@azure/core-auth"; -import { AnomalyDetectorClient } from "./clientDefinitions.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { + getUnivariateOperations, + UnivariateOperations, +} from "./classic/univariate/index.js"; +import { + getMultivariateOperations, + MultivariateOperations, +} from "./classic/multivariate/index.js"; +import { + createAnomalyDetector, + AnomalyDetectorClientOptions, + AnomalyDetectorContext, +} from "./api/index.js"; -export interface AnomalyDetectorClientOptions extends ClientOptions { - apiVersion?: string; -} - -/** - * Initialize a new instance of `AnomalyDetectorClient` - * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: - * https://westus2.api.cognitive.microsoft.com). - * @param credentials - uniquely identify client credential - * @param options - the parameter for all optional parameters - */ -export default function createClient( - endpointParam: string, - credentials: KeyCredential, - options: AnomalyDetectorClientOptions = {}, -): AnomalyDetectorClient { - const apiVersion = options.apiVersion ?? "v1.1"; - const endpointUrl = - options.endpoint ?? - options.baseUrl ?? - `${endpointParam}/anomalydetector/${apiVersion}`; - - const userAgentInfo = `azsdk-js-ai-anomaly-detector-rest/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - credentials: { - apiKeyHeaderName: - options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key", - }, - }; +export { AnomalyDetectorClientOptions } from "./api/anomalyDetectorContext.js"; - const client = getClient( - endpointUrl, - credentials, - options, - ) as AnomalyDetectorClient; +export class AnomalyDetectorClient { + private _client: AnomalyDetectorContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + /** + * The Anomaly Detector API detects anomalies automatically in time series data. + * It supports two kinds of mode, one is for stateless using, another is for + * stateful using. In stateless mode, there are three functionalities. Entire + * Detect is for detecting the whole series with model trained by the time series, + * Last Detect is detecting last point with model trained by points before. + * ChangePoint Detect is for detecting trend changes in time series. In stateful + * mode, user can store time series, the stored time series will be used for + * detection anomalies. Under this mode, user can still use the above three + * functionalities by only giving a time range without preparing time series in + * client side. Besides the above three functionalities, stateful model also + * provide group based detection and labeling service. By leveraging labeling + * service user can provide labels for each detection result, these labels will be + * used for retuning or regenerating detection models. Inconsistency detection is + * a kind of group based detection, this detection will find inconsistency ones in + * a set of time series. By using anomaly detector service, business customers can + * discover incidents and establish a logic flow for root cause analysis. + */ + constructor( + endpointParam: string, + credential: KeyCredential, + options: AnomalyDetectorClientOptions = {}, + ) { + this._client = createAnomalyDetector(endpointParam, credential, options); + this.pipeline = this._client.pipeline; + this.univariate = getUnivariateOperations(this._client); + this.multivariate = getMultivariateOperations(this._client); + } - return client; + /** The operation groups for Univariate */ + public readonly univariate: UnivariateOperations; + /** The operation groups for Multivariate */ + public readonly multivariate: MultivariateOperations; } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts new file mode 100644 index 0000000000..6c764378b7 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/anomalyDetectorContext.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyCredential } from "@azure/core-auth"; +import { ClientOptions } from "@azure-rest/core-client"; +import { AnomalyDetectorContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface AnomalyDetectorClientOptions extends ClientOptions { + /** Api Version */ + apiVersion?: string; +} + +export { AnomalyDetectorContext } from "../rest/index.js"; + +/** + * The Anomaly Detector API detects anomalies automatically in time series data. + * It supports two kinds of mode, one is for stateless using, another is for + * stateful using. In stateless mode, there are three functionalities. Entire + * Detect is for detecting the whole series with model trained by the time series, + * Last Detect is detecting last point with model trained by points before. + * ChangePoint Detect is for detecting trend changes in time series. In stateful + * mode, user can store time series, the stored time series will be used for + * detection anomalies. Under this mode, user can still use the above three + * functionalities by only giving a time range without preparing time series in + * client side. Besides the above three functionalities, stateful model also + * provide group based detection and labeling service. By leveraging labeling + * service user can provide labels for each detection result, these labels will be + * used for retuning or regenerating detection models. Inconsistency detection is + * a kind of group based detection, this detection will find inconsistency ones in + * a set of time series. By using anomaly detector service, business customers can + * discover incidents and establish a logic flow for root cause analysis. + */ +export function createAnomalyDetector( + endpointParam: string, + credential: KeyCredential, + options: AnomalyDetectorClientOptions = {}, +): AnomalyDetectorContext { + const clientContext = getClient(endpointParam, credential, options); + return clientContext; +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts new file mode 100644 index 0000000000..386f9c6a29 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createAnomalyDetector, + AnomalyDetectorClientOptions, + AnomalyDetectorContext, +} from "./anomalyDetectorContext.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts new file mode 100644 index 0000000000..30d080cf87 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/multivariate/index.ts @@ -0,0 +1,833 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + MultivariateMultivariateDetectionResult, + MultivariateMultivariateBatchDetectionOptions, + MultivariateModelInfo, + MultivariateAnomalyDetectionModel, + MultivariateModelList, + MultivariateMultivariateLastDetectionOptions, + MultivariateMultivariateLastDetectionResult, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { buildPagedAsyncIterator } from "../pagingHelpers.js"; +import { + isUnexpected, + AnomalyDetectorContext as Client, + DeleteMultivariateModel204Response, + DeleteMultivariateModelDefaultResponse, + DetectMultivariateBatchAnomaly202Response, + DetectMultivariateBatchAnomalyDefaultResponse, + DetectMultivariateLastAnomaly200Response, + DetectMultivariateLastAnomalyDefaultResponse, + GetMultivariateBatchDetectionResult200Response, + GetMultivariateBatchDetectionResultDefaultResponse, + GetMultivariateModel200Response, + GetMultivariateModelDefaultResponse, + ListMultivariateModels200Response, + ListMultivariateModelsDefaultResponse, + TrainMultivariateModel201Response, + TrainMultivariateModelDefaultResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + MultivariateGetMultivariateBatchDetectionResultOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateDetectMultivariateLastAnomalyOptionalParams, +} from "../../models/options.js"; + +export function _getMultivariateBatchDetectionResultSend( + context: Client, + resultId: string, + options: MultivariateGetMultivariateBatchDetectionResultOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | GetMultivariateBatchDetectionResult200Response + | GetMultivariateBatchDetectionResultDefaultResponse +> { + return context + .path("/multivariate/detect-batch/{resultId}", resultId) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getMultivariateBatchDetectionResultDeserialize( + result: + | GetMultivariateBatchDetectionResult200Response + | GetMultivariateBatchDetectionResultDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + resultId: result.body["resultId"], + summary: { + status: result.body.summary["status"], + errors: + result.body.summary["errors"] === undefined + ? result.body.summary["errors"] + : result.body.summary["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + variableStates: + result.body.summary["variableStates"] === undefined + ? result.body.summary["variableStates"] + : result.body.summary["variableStates"].map((p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: + p["firstTimestamp"] !== undefined + ? new Date(p["firstTimestamp"]) + : undefined, + lastTimestamp: + p["lastTimestamp"] !== undefined + ? new Date(p["lastTimestamp"]) + : undefined, + })), + setupInfo: { + dataSource: result.body.summary.setupInfo["dataSource"], + topContributorCount: + result.body.summary.setupInfo["topContributorCount"], + startTime: new Date(result.body.summary.setupInfo["startTime"]), + endTime: new Date(result.body.summary.setupInfo["endTime"]), + }, + }, + results: result.body["results"].map((p) => ({ + timestamp: new Date(p["timestamp"]), + value: !p.value + ? undefined + : { + isAnomaly: p.value?.["isAnomaly"], + severity: p.value?.["severity"], + score: p.value?.["score"], + interpretation: + p.value?.["interpretation"] === undefined + ? p.value?.["interpretation"] + : p.value?.["interpretation"].map((p) => ({ + variable: p["variable"], + contributionScore: p["contributionScore"], + correlationChanges: !p.correlationChanges + ? undefined + : { + changedVariables: + p.correlationChanges?.["changedVariables"], + }, + })), + }, + errors: + p["errors"] === undefined + ? p["errors"] + : p["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + })), + }; +} + +/** + * For asynchronous inference, get multivariate anomaly detection result based on + * resultId returned by the BatchDetectAnomaly api. + */ +export async function getMultivariateBatchDetectionResult( + context: Client, + resultId: string, + options: MultivariateGetMultivariateBatchDetectionResultOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getMultivariateBatchDetectionResultSend( + context, + resultId, + options, + ); + return _getMultivariateBatchDetectionResultDeserialize(result); +} + +export function _trainMultivariateModelSend( + context: Client, + modelInfo: MultivariateModelInfo, + options: MultivariateTrainMultivariateModelOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + TrainMultivariateModel201Response | TrainMultivariateModelDefaultResponse +> { + return context + .path("/multivariate/models") + .post({ + ...operationOptionsToRequestParameters(options), + body: { + dataSource: modelInfo["dataSource"], + dataSchema: modelInfo["dataSchema"], + startTime: modelInfo["startTime"].toISOString(), + endTime: modelInfo["endTime"].toISOString(), + displayName: modelInfo["displayName"], + slidingWindow: modelInfo["slidingWindow"], + alignPolicy: !modelInfo.alignPolicy + ? undefined + : { + alignMode: modelInfo.alignPolicy?.["alignMode"], + fillNAMethod: modelInfo.alignPolicy?.["fillNAMethod"], + paddingValue: modelInfo.alignPolicy?.["paddingValue"], + }, + status: modelInfo["status"], + diagnosticsInfo: !modelInfo.diagnosticsInfo + ? undefined + : { + modelState: !modelInfo.diagnosticsInfo?.modelState + ? undefined + : { + epochIds: + modelInfo.diagnosticsInfo?.modelState?.["epochIds"], + trainLosses: + modelInfo.diagnosticsInfo?.modelState?.["trainLosses"], + validationLosses: + modelInfo.diagnosticsInfo?.modelState?.[ + "validationLosses" + ], + latenciesInSeconds: + modelInfo.diagnosticsInfo?.modelState?.[ + "latenciesInSeconds" + ], + }, + variableStates: + modelInfo.diagnosticsInfo?.["variableStates"] === undefined + ? modelInfo.diagnosticsInfo?.["variableStates"] + : modelInfo.diagnosticsInfo?.["variableStates"].map((p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: p["firstTimestamp"]?.toISOString(), + lastTimestamp: p["lastTimestamp"]?.toISOString(), + })), + }, + }, + }); +} + +export async function _trainMultivariateModelDeserialize( + result: + | TrainMultivariateModel201Response + | TrainMultivariateModelDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + modelId: result.body["modelId"], + createdTime: new Date(result.body["createdTime"]), + lastUpdatedTime: new Date(result.body["lastUpdatedTime"]), + modelInfo: !result.body.modelInfo + ? undefined + : { + dataSource: result.body.modelInfo?.["dataSource"], + dataSchema: result.body.modelInfo?.["dataSchema"], + startTime: new Date(result.body.modelInfo?.["startTime"]), + endTime: new Date(result.body.modelInfo?.["endTime"]), + displayName: result.body.modelInfo?.["displayName"], + slidingWindow: result.body.modelInfo?.["slidingWindow"], + alignPolicy: !result.body.modelInfo?.alignPolicy + ? undefined + : { + alignMode: result.body.modelInfo?.alignPolicy?.["alignMode"], + fillNAMethod: + result.body.modelInfo?.alignPolicy?.["fillNAMethod"], + paddingValue: + result.body.modelInfo?.alignPolicy?.["paddingValue"], + }, + status: result.body.modelInfo?.["status"], + errors: + result.body.modelInfo?.["errors"] === undefined + ? result.body.modelInfo?.["errors"] + : result.body.modelInfo?.["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + diagnosticsInfo: !result.body.modelInfo?.diagnosticsInfo + ? undefined + : { + modelState: !result.body.modelInfo?.diagnosticsInfo?.modelState + ? undefined + : { + epochIds: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "epochIds" + ], + trainLosses: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "trainLosses" + ], + validationLosses: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "validationLosses" + ], + latenciesInSeconds: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "latenciesInSeconds" + ], + }, + variableStates: + result.body.modelInfo?.diagnosticsInfo?.["variableStates"] === + undefined + ? result.body.modelInfo?.diagnosticsInfo?.["variableStates"] + : result.body.modelInfo?.diagnosticsInfo?.[ + "variableStates" + ].map((p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: + p["firstTimestamp"] !== undefined + ? new Date(p["firstTimestamp"]) + : undefined, + lastTimestamp: + p["lastTimestamp"] !== undefined + ? new Date(p["lastTimestamp"]) + : undefined, + })), + }, + }, + }; +} + +/** + * Create and train a multivariate anomaly detection model. The request must + * include a source parameter to indicate an externally accessible Azure blob + * storage URI.There are two types of data input: An URI pointed to an Azure blob + * storage folder which contains multiple CSV files, and each CSV file contains + * two columns, timestamp and variable. Another type of input is an URI pointed to + * a CSV file in Azure blob storage, which contains all the variables and a + * timestamp column. + */ +export async function trainMultivariateModel( + context: Client, + modelInfo: MultivariateModelInfo, + options: MultivariateTrainMultivariateModelOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _trainMultivariateModelSend(context, modelInfo, options); + return _trainMultivariateModelDeserialize(result); +} + +export function _listMultivariateModelsSend( + context: Client, + options: MultivariateListMultivariateModelsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + ListMultivariateModels200Response | ListMultivariateModelsDefaultResponse +> { + return context + .path("/multivariate/models") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { skip: options?.skip, top: options?.top }, + }); +} + +export async function _listMultivariateModelsDeserialize( + result: + | ListMultivariateModels200Response + | ListMultivariateModelsDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + models: result.body["models"].map((p) => ({ + modelId: p["modelId"], + createdTime: new Date(p["createdTime"]), + lastUpdatedTime: new Date(p["lastUpdatedTime"]), + modelInfo: !p.modelInfo + ? undefined + : { + dataSource: p.modelInfo?.["dataSource"], + dataSchema: p.modelInfo?.["dataSchema"], + startTime: new Date(p.modelInfo?.["startTime"]), + endTime: new Date(p.modelInfo?.["endTime"]), + displayName: p.modelInfo?.["displayName"], + slidingWindow: p.modelInfo?.["slidingWindow"], + alignPolicy: !p.modelInfo?.alignPolicy + ? undefined + : { + alignMode: p.modelInfo?.alignPolicy?.["alignMode"], + fillNAMethod: p.modelInfo?.alignPolicy?.["fillNAMethod"], + paddingValue: p.modelInfo?.alignPolicy?.["paddingValue"], + }, + status: p.modelInfo?.["status"], + errors: + p.modelInfo?.["errors"] === undefined + ? p.modelInfo?.["errors"] + : p.modelInfo?.["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + diagnosticsInfo: !p.modelInfo?.diagnosticsInfo + ? undefined + : { + modelState: !p.modelInfo?.diagnosticsInfo?.modelState + ? undefined + : { + epochIds: + p.modelInfo?.diagnosticsInfo?.modelState?.[ + "epochIds" + ], + trainLosses: + p.modelInfo?.diagnosticsInfo?.modelState?.[ + "trainLosses" + ], + validationLosses: + p.modelInfo?.diagnosticsInfo?.modelState?.[ + "validationLosses" + ], + latenciesInSeconds: + p.modelInfo?.diagnosticsInfo?.modelState?.[ + "latenciesInSeconds" + ], + }, + variableStates: + p.modelInfo?.diagnosticsInfo?.["variableStates"] === + undefined + ? p.modelInfo?.diagnosticsInfo?.["variableStates"] + : p.modelInfo?.diagnosticsInfo?.["variableStates"].map( + (p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: + p["firstTimestamp"] !== undefined + ? new Date(p["firstTimestamp"]) + : undefined, + lastTimestamp: + p["lastTimestamp"] !== undefined + ? new Date(p["lastTimestamp"]) + : undefined, + }), + ), + }, + }, + })), + currentCount: result.body["currentCount"], + maxCount: result.body["maxCount"], + nextLink: result.body["nextLink"], + }; +} + +/** List models of a resource. */ +export function listMultivariateModels( + context: Client, + options: MultivariateListMultivariateModelsOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listMultivariateModelsSend(context, options), + _listMultivariateModelsDeserialize, + { itemName: "models", nextLinkName: "nextLink" }, + ); +} + +export function _deleteMultivariateModelSend( + context: Client, + modelId: string, + options: MultivariateDeleteMultivariateModelOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + DeleteMultivariateModel204Response | DeleteMultivariateModelDefaultResponse +> { + return context + .path("/multivariate/models/{modelId}", modelId) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteMultivariateModelDeserialize( + result: + | DeleteMultivariateModel204Response + | DeleteMultivariateModelDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return; +} + +/** Delete an existing multivariate model according to the modelId */ +export async function deleteMultivariateModel( + context: Client, + modelId: string, + options: MultivariateDeleteMultivariateModelOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _deleteMultivariateModelSend(context, modelId, options); + return _deleteMultivariateModelDeserialize(result); +} + +export function _getMultivariateModelSend( + context: Client, + modelId: string, + options: MultivariateGetMultivariateModelOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + GetMultivariateModel200Response | GetMultivariateModelDefaultResponse +> { + return context + .path("/multivariate/models/{modelId}", modelId) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getMultivariateModelDeserialize( + result: GetMultivariateModel200Response | GetMultivariateModelDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + modelId: result.body["modelId"], + createdTime: new Date(result.body["createdTime"]), + lastUpdatedTime: new Date(result.body["lastUpdatedTime"]), + modelInfo: !result.body.modelInfo + ? undefined + : { + dataSource: result.body.modelInfo?.["dataSource"], + dataSchema: result.body.modelInfo?.["dataSchema"], + startTime: new Date(result.body.modelInfo?.["startTime"]), + endTime: new Date(result.body.modelInfo?.["endTime"]), + displayName: result.body.modelInfo?.["displayName"], + slidingWindow: result.body.modelInfo?.["slidingWindow"], + alignPolicy: !result.body.modelInfo?.alignPolicy + ? undefined + : { + alignMode: result.body.modelInfo?.alignPolicy?.["alignMode"], + fillNAMethod: + result.body.modelInfo?.alignPolicy?.["fillNAMethod"], + paddingValue: + result.body.modelInfo?.alignPolicy?.["paddingValue"], + }, + status: result.body.modelInfo?.["status"], + errors: + result.body.modelInfo?.["errors"] === undefined + ? result.body.modelInfo?.["errors"] + : result.body.modelInfo?.["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + diagnosticsInfo: !result.body.modelInfo?.diagnosticsInfo + ? undefined + : { + modelState: !result.body.modelInfo?.diagnosticsInfo?.modelState + ? undefined + : { + epochIds: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "epochIds" + ], + trainLosses: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "trainLosses" + ], + validationLosses: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "validationLosses" + ], + latenciesInSeconds: + result.body.modelInfo?.diagnosticsInfo?.modelState?.[ + "latenciesInSeconds" + ], + }, + variableStates: + result.body.modelInfo?.diagnosticsInfo?.["variableStates"] === + undefined + ? result.body.modelInfo?.diagnosticsInfo?.["variableStates"] + : result.body.modelInfo?.diagnosticsInfo?.[ + "variableStates" + ].map((p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: + p["firstTimestamp"] !== undefined + ? new Date(p["firstTimestamp"]) + : undefined, + lastTimestamp: + p["lastTimestamp"] !== undefined + ? new Date(p["lastTimestamp"]) + : undefined, + })), + }, + }, + }; +} + +/** + * Get detailed information of multivariate model, including the training status + * and variables used in the model. + */ +export async function getMultivariateModel( + context: Client, + modelId: string, + options: MultivariateGetMultivariateModelOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getMultivariateModelSend(context, modelId, options); + return _getMultivariateModelDeserialize(result); +} + +export function _detectMultivariateBatchAnomalySend( + context: Client, + modelId: string, + options: MultivariateMultivariateBatchDetectionOptions, + optionalParams: MultivariateDetectMultivariateBatchAnomalyOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | DetectMultivariateBatchAnomaly202Response + | DetectMultivariateBatchAnomalyDefaultResponse +> { + return context + .path("/multivariate/models/{modelId}:detect-batch", modelId) + .post({ + ...operationOptionsToRequestParameters(optionalParams), + body: { + dataSource: options["dataSource"], + topContributorCount: options["topContributorCount"], + startTime: options["startTime"].toISOString(), + endTime: options["endTime"].toISOString(), + }, + }); +} + +export async function _detectMultivariateBatchAnomalyDeserialize( + result: + | DetectMultivariateBatchAnomaly202Response + | DetectMultivariateBatchAnomalyDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + resultId: result.body["resultId"], + summary: { + status: result.body.summary["status"], + errors: + result.body.summary["errors"] === undefined + ? result.body.summary["errors"] + : result.body.summary["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + variableStates: + result.body.summary["variableStates"] === undefined + ? result.body.summary["variableStates"] + : result.body.summary["variableStates"].map((p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: + p["firstTimestamp"] !== undefined + ? new Date(p["firstTimestamp"]) + : undefined, + lastTimestamp: + p["lastTimestamp"] !== undefined + ? new Date(p["lastTimestamp"]) + : undefined, + })), + setupInfo: { + dataSource: result.body.summary.setupInfo["dataSource"], + topContributorCount: + result.body.summary.setupInfo["topContributorCount"], + startTime: new Date(result.body.summary.setupInfo["startTime"]), + endTime: new Date(result.body.summary.setupInfo["endTime"]), + }, + }, + results: result.body["results"].map((p) => ({ + timestamp: new Date(p["timestamp"]), + value: !p.value + ? undefined + : { + isAnomaly: p.value?.["isAnomaly"], + severity: p.value?.["severity"], + score: p.value?.["score"], + interpretation: + p.value?.["interpretation"] === undefined + ? p.value?.["interpretation"] + : p.value?.["interpretation"].map((p) => ({ + variable: p["variable"], + contributionScore: p["contributionScore"], + correlationChanges: !p.correlationChanges + ? undefined + : { + changedVariables: + p.correlationChanges?.["changedVariables"], + }, + })), + }, + errors: + p["errors"] === undefined + ? p["errors"] + : p["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + })), + }; +} + +/** + * Submit multivariate anomaly detection task with the modelId of trained model + * and inference data, the input schema should be the same with the training + * request. The request will complete asynchronously and return a resultId to + * query the detection result.The request should be a source link to indicate an + * externally accessible Azure storage Uri, either pointed to an Azure blob + * storage folder, or pointed to a CSV file in Azure blob storage. + */ +export async function detectMultivariateBatchAnomaly( + context: Client, + modelId: string, + options: MultivariateMultivariateBatchDetectionOptions, + optionalParams: MultivariateDetectMultivariateBatchAnomalyOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _detectMultivariateBatchAnomalySend( + context, + modelId, + options, + optionalParams, + ); + return _detectMultivariateBatchAnomalyDeserialize(result); +} + +export function _detectMultivariateLastAnomalySend( + context: Client, + modelId: string, + options: MultivariateMultivariateLastDetectionOptions, + optionalParams: MultivariateDetectMultivariateLastAnomalyOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | DetectMultivariateLastAnomaly200Response + | DetectMultivariateLastAnomalyDefaultResponse +> { + return context + .path("/multivariate/models/{modelId}:detect-last", modelId) + .post({ + ...operationOptionsToRequestParameters(optionalParams), + body: { + variables: options["variables"].map((p) => ({ + variable: p["variable"], + timestamps: p["timestamps"], + values: p["values"], + })), + topContributorCount: options["topContributorCount"], + }, + }); +} + +export async function _detectMultivariateLastAnomalyDeserialize( + result: + | DetectMultivariateLastAnomaly200Response + | DetectMultivariateLastAnomalyDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + variableStates: + result.body["variableStates"] === undefined + ? result.body["variableStates"] + : result.body["variableStates"].map((p) => ({ + variable: p["variable"], + filledNARatio: p["filledNARatio"], + effectiveCount: p["effectiveCount"], + firstTimestamp: + p["firstTimestamp"] !== undefined + ? new Date(p["firstTimestamp"]) + : undefined, + lastTimestamp: + p["lastTimestamp"] !== undefined + ? new Date(p["lastTimestamp"]) + : undefined, + })), + results: + result.body["results"] === undefined + ? result.body["results"] + : result.body["results"].map((p) => ({ + timestamp: new Date(p["timestamp"]), + value: !p.value + ? undefined + : { + isAnomaly: p.value?.["isAnomaly"], + severity: p.value?.["severity"], + score: p.value?.["score"], + interpretation: + p.value?.["interpretation"] === undefined + ? p.value?.["interpretation"] + : p.value?.["interpretation"].map((p) => ({ + variable: p["variable"], + contributionScore: p["contributionScore"], + correlationChanges: !p.correlationChanges + ? undefined + : { + changedVariables: + p.correlationChanges?.["changedVariables"], + }, + })), + }, + errors: + p["errors"] === undefined + ? p["errors"] + : p["errors"].map((p) => ({ + code: p["code"], + message: p["message"], + })), + })), + }; +} + +/** + * Submit multivariate anomaly detection task with the modelId of trained model + * and inference data, and the inference data should be put into request body in a + * JSON format. The request will complete synchronously and return the detection + * immediately in the response body. + */ +export async function detectMultivariateLastAnomaly( + context: Client, + modelId: string, + options: MultivariateMultivariateLastDetectionOptions, + optionalParams: MultivariateDetectMultivariateLastAnomalyOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _detectMultivariateLastAnomalySend( + context, + modelId, + options, + optionalParams, + ); + return _detectMultivariateLastAnomalyDeserialize(result); +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/pagingHelpers.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/pagingHelpers.ts new file mode 100644 index 0000000000..9780e76e04 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/pagingHelpers.ts @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; +import { + BuildPagedAsyncIteratorOptions, + ContinuablePage, + PageSettings, + PagedAsyncIterableIterator, + PagedResult, +} from "../models/pagingTypes.js"; +import { isUnexpected } from "../rest/index.js"; + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator( + pagedResult, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if ( + typeof nextLink !== "string" && + typeof nextLink !== "undefined" && + nextLink !== null + ) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse): void { + if (isUnexpected(response)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts new file mode 100644 index 0000000000..e15afbda0c --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/api/univariate/index.ts @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + UnivariateUnivariateDetectionOptions, + UnivariateUnivariateEntireDetectionResult, + UnivariateUnivariateLastDetectionResult, + UnivariateUnivariateChangePointDetectionOptions, + UnivariateUnivariateChangePointDetectionResult, +} from "../../models/models.js"; +import { + isUnexpected, + AnomalyDetectorContext as Client, + DetectUnivariateChangePoint200Response, + DetectUnivariateChangePointDefaultResponse, + DetectUnivariateEntireSeries200Response, + DetectUnivariateEntireSeriesDefaultResponse, + DetectUnivariateLastPoint200Response, + DetectUnivariateLastPointDefaultResponse, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + UnivariateDetectUnivariateEntireSeriesOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateChangePointOptionalParams, +} from "../../models/options.js"; + +export function _detectUnivariateEntireSeriesSend( + context: Client, + options: UnivariateUnivariateDetectionOptions, + optionalParams: UnivariateDetectUnivariateEntireSeriesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | DetectUnivariateEntireSeries200Response + | DetectUnivariateEntireSeriesDefaultResponse +> { + return context + .path("/timeseries/entire/detect") + .post({ + ...operationOptionsToRequestParameters(optionalParams), + body: { + series: options["series"].map((p) => ({ + timestamp: p["timestamp"]?.toISOString(), + value: p["value"], + })), + granularity: options["granularity"], + customInterval: options["customInterval"], + period: options["period"], + maxAnomalyRatio: options["maxAnomalyRatio"], + sensitivity: options["sensitivity"], + imputeMode: options["imputeMode"], + imputeFixedValue: options["imputeFixedValue"], + }, + }); +} + +export async function _detectUnivariateEntireSeriesDeserialize( + result: + | DetectUnivariateEntireSeries200Response + | DetectUnivariateEntireSeriesDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + period: result.body["period"], + expectedValues: result.body["expectedValues"], + upperMargins: result.body["upperMargins"], + lowerMargins: result.body["lowerMargins"], + isAnomaly: result.body["isAnomaly"], + isNegativeAnomaly: result.body["isNegativeAnomaly"], + isPositiveAnomaly: result.body["isPositiveAnomaly"], + severity: result.body["severity"], + }; +} + +/** + * This operation generates a model with an entire series, each point is detected + * with the same model. With this method, points before and after a certain point + * are used to determine whether it is an anomaly. The entire detection can give + * user an overall status of the time series. + */ +export async function detectUnivariateEntireSeries( + context: Client, + options: UnivariateUnivariateDetectionOptions, + optionalParams: UnivariateDetectUnivariateEntireSeriesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _detectUnivariateEntireSeriesSend( + context, + options, + optionalParams, + ); + return _detectUnivariateEntireSeriesDeserialize(result); +} + +export function _detectUnivariateLastPointSend( + context: Client, + options: UnivariateUnivariateDetectionOptions, + optionalParams: UnivariateDetectUnivariateLastPointOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | DetectUnivariateLastPoint200Response + | DetectUnivariateLastPointDefaultResponse +> { + return context + .path("/timeseries/last/detect") + .post({ + ...operationOptionsToRequestParameters(optionalParams), + body: { + series: options["series"].map((p) => ({ + timestamp: p["timestamp"]?.toISOString(), + value: p["value"], + })), + granularity: options["granularity"], + customInterval: options["customInterval"], + period: options["period"], + maxAnomalyRatio: options["maxAnomalyRatio"], + sensitivity: options["sensitivity"], + imputeMode: options["imputeMode"], + imputeFixedValue: options["imputeFixedValue"], + }, + }); +} + +export async function _detectUnivariateLastPointDeserialize( + result: + | DetectUnivariateLastPoint200Response + | DetectUnivariateLastPointDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + period: result.body["period"], + suggestedWindow: result.body["suggestedWindow"], + expectedValue: result.body["expectedValue"], + upperMargin: result.body["upperMargin"], + lowerMargin: result.body["lowerMargin"], + isAnomaly: result.body["isAnomaly"], + isNegativeAnomaly: result.body["isNegativeAnomaly"], + isPositiveAnomaly: result.body["isPositiveAnomaly"], + severity: result.body["severity"], + }; +} + +/** + * This operation generates a model using the points that you sent into the API, + * and based on all data to determine whether the last point is anomalous. + */ +export async function detectUnivariateLastPoint( + context: Client, + options: UnivariateUnivariateDetectionOptions, + optionalParams: UnivariateDetectUnivariateLastPointOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _detectUnivariateLastPointSend( + context, + options, + optionalParams, + ); + return _detectUnivariateLastPointDeserialize(result); +} + +export function _detectUnivariateChangePointSend( + context: Client, + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams: UnivariateDetectUnivariateChangePointOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + | DetectUnivariateChangePoint200Response + | DetectUnivariateChangePointDefaultResponse +> { + return context + .path("/timeseries/changepoint/detect") + .post({ + ...operationOptionsToRequestParameters(optionalParams), + body: { + series: options["series"].map((p) => ({ + timestamp: p["timestamp"]?.toISOString(), + value: p["value"], + })), + granularity: options["granularity"], + customInterval: options["customInterval"], + period: options["period"], + stableTrendWindow: options["stableTrendWindow"], + threshold: options["threshold"], + }, + }); +} + +export async function _detectUnivariateChangePointDeserialize( + result: + | DetectUnivariateChangePoint200Response + | DetectUnivariateChangePointDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return { + period: result.body["period"], + isChangePoint: result.body["isChangePoint"], + confidenceScores: result.body["confidenceScores"], + }; +} + +/** Evaluate change point score of every series point */ +export async function detectUnivariateChangePoint( + context: Client, + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams: UnivariateDetectUnivariateChangePointOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _detectUnivariateChangePointSend( + context, + options, + optionalParams, + ); + return _detectUnivariateChangePointDeserialize(result); +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/index.ts new file mode 100644 index 0000000000..7cb9cc4cea --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { MultivariateOperations } from "./multivariate/index.js"; +export { UnivariateOperations } from "./univariate/index.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts new file mode 100644 index 0000000000..0f0a7c209c --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/multivariate/index.ts @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AnomalyDetectorContext } from "../../api/anomalyDetectorContext.js"; +import { + MultivariateMultivariateDetectionResult, + MultivariateMultivariateBatchDetectionOptions, + MultivariateModelInfo, + MultivariateAnomalyDetectionModel, + MultivariateMultivariateLastDetectionOptions, + MultivariateMultivariateLastDetectionResult, +} from "../../models/models.js"; +import { + getMultivariateBatchDetectionResult, + trainMultivariateModel, + listMultivariateModels, + deleteMultivariateModel, + getMultivariateModel, + detectMultivariateBatchAnomaly, + detectMultivariateLastAnomaly, +} from "../../api/multivariate/index.js"; +import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { + MultivariateGetMultivariateBatchDetectionResultOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateDetectMultivariateLastAnomalyOptionalParams, +} from "../../models/options.js"; + +export interface MultivariateOperations { + getMultivariateBatchDetectionResult: ( + resultId: string, + options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams, + ) => Promise; + trainMultivariateModel: ( + modelInfo: MultivariateModelInfo, + options?: MultivariateTrainMultivariateModelOptionalParams, + ) => Promise; + listMultivariateModels: ( + options?: MultivariateListMultivariateModelsOptionalParams, + ) => PagedAsyncIterableIterator; + deleteMultivariateModel: ( + modelId: string, + options?: MultivariateDeleteMultivariateModelOptionalParams, + ) => Promise; + getMultivariateModel: ( + modelId: string, + options?: MultivariateGetMultivariateModelOptionalParams, + ) => Promise; + detectMultivariateBatchAnomaly: ( + modelId: string, + options: MultivariateMultivariateBatchDetectionOptions, + optionalParams?: MultivariateDetectMultivariateBatchAnomalyOptionalParams, + ) => Promise; + detectMultivariateLastAnomaly: ( + modelId: string, + options: MultivariateMultivariateLastDetectionOptions, + optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams, + ) => Promise; +} + +export function getMultivariate(context: AnomalyDetectorContext) { + return { + getMultivariateBatchDetectionResult: ( + resultId: string, + options?: MultivariateGetMultivariateBatchDetectionResultOptionalParams, + ) => getMultivariateBatchDetectionResult(context, resultId, options), + trainMultivariateModel: ( + modelInfo: MultivariateModelInfo, + options?: MultivariateTrainMultivariateModelOptionalParams, + ) => trainMultivariateModel(context, modelInfo, options), + listMultivariateModels: ( + options?: MultivariateListMultivariateModelsOptionalParams, + ) => listMultivariateModels(context, options), + deleteMultivariateModel: ( + modelId: string, + options?: MultivariateDeleteMultivariateModelOptionalParams, + ) => deleteMultivariateModel(context, modelId, options), + getMultivariateModel: ( + modelId: string, + options?: MultivariateGetMultivariateModelOptionalParams, + ) => getMultivariateModel(context, modelId, options), + detectMultivariateBatchAnomaly: ( + modelId: string, + options: MultivariateMultivariateBatchDetectionOptions, + optionalParams?: MultivariateDetectMultivariateBatchAnomalyOptionalParams, + ) => + detectMultivariateBatchAnomaly(context, modelId, options, optionalParams), + detectMultivariateLastAnomaly: ( + modelId: string, + options: MultivariateMultivariateLastDetectionOptions, + optionalParams?: MultivariateDetectMultivariateLastAnomalyOptionalParams, + ) => + detectMultivariateLastAnomaly(context, modelId, options, optionalParams), + }; +} + +export function getMultivariateOperations( + context: AnomalyDetectorContext, +): MultivariateOperations { + return { + ...getMultivariate(context), + }; +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts new file mode 100644 index 0000000000..26ced34240 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/classic/univariate/index.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AnomalyDetectorContext } from "../../api/anomalyDetectorContext.js"; +import { + UnivariateUnivariateDetectionOptions, + UnivariateUnivariateEntireDetectionResult, + UnivariateUnivariateLastDetectionResult, + UnivariateUnivariateChangePointDetectionOptions, + UnivariateUnivariateChangePointDetectionResult, +} from "../../models/models.js"; +import { + detectUnivariateEntireSeries, + detectUnivariateLastPoint, + detectUnivariateChangePoint, +} from "../../api/univariate/index.js"; +import { + UnivariateDetectUnivariateEntireSeriesOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateChangePointOptionalParams, +} from "../../models/options.js"; + +export interface UnivariateOperations { + detectUnivariateEntireSeries: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateEntireSeriesOptionalParams, + ) => Promise; + detectUnivariateLastPoint: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams, + ) => Promise; + detectUnivariateChangePoint: ( + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams?: UnivariateDetectUnivariateChangePointOptionalParams, + ) => Promise; +} + +export function getUnivariate(context: AnomalyDetectorContext) { + return { + detectUnivariateEntireSeries: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateEntireSeriesOptionalParams, + ) => detectUnivariateEntireSeries(context, options, optionalParams), + detectUnivariateLastPoint: ( + options: UnivariateUnivariateDetectionOptions, + optionalParams?: UnivariateDetectUnivariateLastPointOptionalParams, + ) => detectUnivariateLastPoint(context, options, optionalParams), + detectUnivariateChangePoint: ( + options: UnivariateUnivariateChangePointDetectionOptions, + optionalParams?: UnivariateDetectUnivariateChangePointOptionalParams, + ) => detectUnivariateChangePoint(context, options, optionalParams), + }; +} + +export function getUnivariateOperations( + context: AnomalyDetectorContext, +): UnivariateOperations { + return { + ...getUnivariate(context), + }; +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts index ee1b21aa69..f6c06bc747 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts @@ -1,15 +1,59 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import AnomalyDetectorClient from "./anomalyDetectorClient.js"; - -export * from "./anomalyDetectorClient.js"; -export * from "./parameters.js"; -export * from "./responses.js"; -export * from "./clientDefinitions.js"; -export * from "./isUnexpected.js"; -export * from "./models.js"; -export * from "./outputModels.js"; -export * from "./paginateHelper.js"; - -export default AnomalyDetectorClient; +export { + AnomalyDetectorClient, + AnomalyDetectorClientOptions, +} from "./anomalyDetectorClient.js"; +export { + MultivariateMultivariateDetectionResult, + MultivariateMultivariateBatchDetectionResultSummary, + MultivariateBatchDetectionStatus, + MultivariateErrorResponse, + MultivariateVariableState, + MultivariateMultivariateBatchDetectionOptions, + MultivariateAnomalyState, + MultivariateAnomalyValue, + MultivariateAnomalyInterpretation, + MultivariateCorrelationChanges, + MultivariateModelInfo, + DataSchema, + MultivariateAlignPolicy, + AlignMode, + FillNAMethod, + ModelStatus, + MultivariateDiagnosticsInfo, + MultivariateModelState, + MultivariateAnomalyDetectionModel, + MultivariateModelList, + MultivariateMultivariateLastDetectionOptions, + MultivariateVariableValues, + MultivariateMultivariateLastDetectionResult, + UnivariateUnivariateDetectionOptions, + UnivariateTimeSeriesPoint, + TimeGranularity, + ImputeMode, + UnivariateUnivariateEntireDetectionResult, + AnomalyDetectorErrorCodes, + UnivariateUnivariateLastDetectionResult, + UnivariateUnivariateChangePointDetectionOptions, + UnivariateUnivariateChangePointDetectionResult, + Versions, + UnivariateDetectUnivariateEntireSeriesOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateChangePointOptionalParams, + MultivariateGetMultivariateBatchDetectionResultOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateDetectMultivariateLastAnomalyOptionalParams, + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./models/index.js"; +export { + MultivariateOperations, + UnivariateOperations, +} from "./classic/index.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts new file mode 100644 index 0000000000..88987de81e --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + MultivariateMultivariateDetectionResult, + MultivariateMultivariateBatchDetectionResultSummary, + MultivariateBatchDetectionStatus, + MultivariateErrorResponse, + MultivariateVariableState, + MultivariateMultivariateBatchDetectionOptions, + MultivariateAnomalyState, + MultivariateAnomalyValue, + MultivariateAnomalyInterpretation, + MultivariateCorrelationChanges, + MultivariateModelInfo, + DataSchema, + MultivariateAlignPolicy, + AlignMode, + FillNAMethod, + ModelStatus, + MultivariateDiagnosticsInfo, + MultivariateModelState, + MultivariateAnomalyDetectionModel, + MultivariateModelList, + MultivariateMultivariateLastDetectionOptions, + MultivariateVariableValues, + MultivariateMultivariateLastDetectionResult, + UnivariateUnivariateDetectionOptions, + UnivariateTimeSeriesPoint, + TimeGranularity, + ImputeMode, + UnivariateUnivariateEntireDetectionResult, + AnomalyDetectorErrorCodes, + UnivariateUnivariateLastDetectionResult, + UnivariateUnivariateChangePointDetectionOptions, + UnivariateUnivariateChangePointDetectionResult, + Versions, +} from "./models.js"; +export { + UnivariateDetectUnivariateEntireSeriesOptionalParams, + UnivariateDetectUnivariateLastPointOptionalParams, + UnivariateDetectUnivariateChangePointOptionalParams, + MultivariateGetMultivariateBatchDetectionResultOptionalParams, + MultivariateTrainMultivariateModelOptionalParams, + MultivariateListMultivariateModelsOptionalParams, + MultivariateDeleteMultivariateModelOptionalParams, + MultivariateGetMultivariateModelOptionalParams, + MultivariateDetectMultivariateBatchAnomalyOptionalParams, + MultivariateDetectMultivariateLastAnomalyOptionalParams, +} from "./options.js"; +export { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./pagingTypes.js"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts new file mode 100644 index 0000000000..84349a367b --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Detection results for the given resultId. */ +export interface MultivariateMultivariateDetectionResult { + /** Result identifier, which is used to fetch the results of an inference call. */ + readonly resultId: string; + /** Multivariate anomaly detection status. */ + summary: MultivariateMultivariateBatchDetectionResultSummary; + /** Detection result for each timestamp. */ + results: MultivariateAnomalyState[]; +} + +/** Multivariate anomaly detection status. */ +export interface MultivariateMultivariateBatchDetectionResultSummary { + /** Status of detection results. One of CREATED, RUNNING, READY, and FAILED. */ + status: MultivariateBatchDetectionStatus; + /** Error message when detection is failed. */ + errors?: MultivariateErrorResponse[]; + /** Variable Status. */ + variableStates?: MultivariateVariableState[]; + /** + * Detection request for batch inference. This is an asynchronous inference which + * will need another API to get detection results. + */ + setupInfo: MultivariateMultivariateBatchDetectionOptions; +} + +/** */ +export type MultivariateBatchDetectionStatus = + | "CREATED" + | "RUNNING" + | "READY" + | "FAILED"; + +/** ErrorResponse contains code and message that shows the error information. */ +export interface MultivariateErrorResponse { + /** The error code. */ + code: string; + /** The message explaining the error reported by the service. */ + message: string; +} + +/** Variable Status. */ +export interface MultivariateVariableState { + /** Variable name in variable states. */ + variable?: string; + /** Proportion of missing values that need to be filled by fillNAMethod. */ + filledNARatio?: number; + /** Number of effective data points before applying fillNAMethod. */ + effectiveCount?: number; + /** First valid timestamp with value of input data. */ + firstTimestamp?: Date; + /** Last valid timestamp with value of input data. */ + lastTimestamp?: Date; +} + +/** + * Detection request for batch inference. This is an asynchronous inference which + * will need another API to get detection results. + */ +export interface MultivariateMultivariateBatchDetectionOptions { + /** + * Source link to the input data to indicate an accessible Azure storage Uri, + * either pointed to an Azure blob storage folder, or pointed to a CSV file in + * Azure blob storage based on you data schema selection. The data schema should + * be exactly the same with those used in the training phase. + */ + dataSource: string; + /** + * An optional field, which is used to specify the number of top contributed + * variables for one anomalous timestamp in the response. The default number is + * 10. + */ + topContributorCount: number; + /** + * A required field, indicating the start time of data for detection, which should + * be date-time of ISO 8601 format. + */ + startTime: Date; + /** + * A required field, indicating the end time of data for detection, which should + * be date-time of ISO 8601 format. + */ + endTime: Date; +} + +/** Anomaly status and information. */ +export interface MultivariateAnomalyState { + /** The timestamp for this anomaly. */ + timestamp: Date; + /** The detailed value of this anomalous timestamp. */ + value?: MultivariateAnomalyValue; + /** Error message for the current timestamp. */ + errors?: MultivariateErrorResponse[]; +} + +/** Detailed information of the anomalous timestamp. */ +export interface MultivariateAnomalyValue { + /** True if an anomaly is detected at the current timestamp. */ + isAnomaly: boolean; + /** + * Indicates the significance of the anomaly. The higher the severity, the more + * significant the anomaly is. + */ + severity: number; + /** + * Raw anomaly score of severity, will help indicate the degree of abnormality as + * well. + */ + score: number; + /** Interpretation of this anomalous timestamp. */ + interpretation?: MultivariateAnomalyInterpretation[]; +} + +/** Interpretation of the anomalous timestamp. */ +export interface MultivariateAnomalyInterpretation { + /** Variable. */ + variable?: string; + /** + * This score shows the percentage contributing to the anomalous timestamp. A + * number between 0 and 1. + */ + contributionScore?: number; + /** Correlation changes among the anomalous variables */ + correlationChanges?: MultivariateCorrelationChanges; +} + +/** Correlation changes among the anomalous variables */ +export interface MultivariateCorrelationChanges { + /** The correlated variables that have correlation changes under an anomaly. */ + changedVariables?: string[]; +} + +/** + * Training result of a model including its status, errors and diagnostics + * information. + */ +export interface MultivariateModelInfo { + /** + * Source link to the input data to indicate an accessible Azure storage Uri, + * either pointed to an Azure blob storage folder, or pointed to a CSV file in + * Azure blob storage based on you data schema selection. + */ + dataSource: string; + /** + * Data schema of input data source: OneTable or MultiTable. The default + * DataSchema is OneTable. + */ + dataSchema?: DataSchema; + /** + * A required field, indicating the start time of training data, which should be + * date-time of ISO 8601 format. + */ + startTime: Date; + /** + * A required field, indicating the end time of training data, which should be + * date-time of ISO 8601 format. + */ + endTime: Date; + /** + * An optional field. The display name of the model whose maximum length is 24 + * characters. + */ + displayName?: string; + /** + * An optional field, indicating how many previous timestamps will be used to + * detect whether the timestamp is anomaly or not. + */ + slidingWindow?: number; + /** An optional field, indicating the manner to align multiple variables. */ + alignPolicy?: MultivariateAlignPolicy; + /** Model status. One of CREATED, RUNNING, READY, and FAILED. */ + status?: ModelStatus; + /** Error messages when failed to create a model. */ + readonly errors?: MultivariateErrorResponse[]; + /** Diagnostics information to help inspect the states of model or variable. */ + diagnosticsInfo?: MultivariateDiagnosticsInfo; +} + +/** Data schema of input data source: OneTable or MultiTable. The default DataSchema is OneTable. */ +/** */ +export type DataSchema = "OneTable" | "MultiTable"; + +/** An optional field, indicating the manner to align multiple variables. */ +export interface MultivariateAlignPolicy { + /** + * An optional field, indicating how to align different variables to the same + * time-range. Either Inner or Outer. + */ + alignMode?: AlignMode; + /** + * An optional field, indicating how missing values will be filled. One of + * Previous, Subsequent, Linear, Zero, Fixed. + */ + fillNAMethod?: FillNAMethod; + /** An optional field. Required when fillNAMethod is Fixed. */ + paddingValue?: number; +} + +/** */ +export type AlignMode = "Inner" | "Outer"; +/** An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. */ +/** */ +export type FillNAMethod = + | "Previous" + | "Subsequent" + | "Linear" + | "Zero" + | "Fixed"; +/** */ +export type ModelStatus = "CREATED" | "RUNNING" | "READY" | "FAILED"; + +/** Diagnostics information to help inspect the states of model or variable. */ +export interface MultivariateDiagnosticsInfo { + /** Model status. */ + modelState?: MultivariateModelState; + /** Variable Status. */ + variableStates?: MultivariateVariableState[]; +} + +/** Model status. */ +export interface MultivariateModelState { + /** + * This indicates the number of passes of the entire training dataset the + * algorithm has completed. + */ + epochIds?: number[]; + /** + * List of metrics used to assess how the model fits the training data for each + * epoch. + */ + trainLosses?: number[]; + /** + * List of metrics used to assess how the model fits the validation set for each + * epoch. + */ + validationLosses?: number[]; + /** Latency for each epoch. */ + latenciesInSeconds?: number[]; +} + +/** Response of getting a model. */ +export interface MultivariateAnomalyDetectionModel { + /** Model identifier. */ + readonly modelId: string; + /** Date and time (UTC) when the model was created. */ + createdTime: Date; + /** Date and time (UTC) when the model was last updated. */ + lastUpdatedTime: Date; + /** + * Training result of a model including its status, errors and diagnostics + * information. + */ + modelInfo?: MultivariateModelInfo; +} + +/** Response of listing models. */ +export interface MultivariateModelList { + /** List of models. */ + models: MultivariateAnomalyDetectionModel[]; + /** Number of trained multivariate models. */ + currentCount: number; + /** Maximum number of models that can be trained for this Anomaly Detector resource. */ + maxCount: number; + /** The link to fetch more models. */ + nextLink?: string; +} + +/** Request of last detection. */ +export interface MultivariateMultivariateLastDetectionOptions { + /** + * This contains the inference data, including the name, timestamps(ISO 8601) and + * values of variables. + */ + variables: MultivariateVariableValues[]; + /** + * An optional field, which is used to specify the number of top contributed + * variables for one anomalous timestamp in the response. The default number is + * 10. + */ + topContributorCount: number; +} + +/** Variable values. */ +export interface MultivariateVariableValues { + /** Variable name of last detection request. */ + variable: string; + /** Timestamps of last detection request */ + timestamps: string[]; + /** Values of variables. */ + values: number[]; +} + +/** Results of last detection. */ +export interface MultivariateMultivariateLastDetectionResult { + /** Variable Status. */ + variableStates?: MultivariateVariableState[]; + /** Anomaly status and information. */ + results?: MultivariateAnomalyState[]; +} + +/** The request of entire or last anomaly detection. */ +export interface UnivariateUnivariateDetectionOptions { + /** + * Time series data points. Points should be sorted by timestamp in ascending + * order to match the anomaly detection result. If the data is not sorted + * correctly or there is duplicated timestamp, the API will not work. In such + * case, an error message will be returned. + */ + series: UnivariateTimeSeriesPoint[]; + /** + * Optional argument, can be one of yearly, monthly, weekly, daily, hourly, + * minutely, secondly, microsecond or none. If granularity is not present, it will + * be none by default. If granularity is none, the timestamp property in time + * series point can be absent. + */ + granularity?: TimeGranularity; + /** + * Custom Interval is used to set non-standard time interval, for example, if the + * series is 5 minutes, request can be set as {"granularity":"minutely", + * "customInterval":5}. + */ + customInterval?: number; + /** + * Optional argument, periodic value of a time series. If the value is null or + * does not present, the API will determine the period automatically. + */ + period?: number; + /** Optional argument, advanced model parameter, max anomaly ratio in a time series. */ + maxAnomalyRatio?: number; + /** + * Optional argument, advanced model parameter, between 0-99, the lower the value + * is, the larger the margin value will be which means less anomalies will be + * accepted. + */ + sensitivity?: number; + /** + * Used to specify how to deal with missing values in the input series, it's used + * when granularity is not "none". + */ + imputeMode?: ImputeMode; + /** + * Used to specify the value to fill, it's used when granularity is not "none" + * and imputeMode is "fixed". + */ + imputeFixedValue?: number; +} + +/** The definition of input timeseries points. */ +export interface UnivariateTimeSeriesPoint { + /** Optional argument, timestamp of a data point (ISO8601 format). */ + timestamp?: Date; + /** The measurement of that point, should be float. */ + value: number; +} + +/** */ +export type TimeGranularity = + | "yearly" + | "monthly" + | "weekly" + | "daily" + | "hourly" + | "minutely" + | "secondly" + | "microsecond" + | "none"; +/** */ +export type ImputeMode = + | "auto" + | "previous" + | "linear" + | "fixed" + | "zero" + | "notFill"; + +/** The response of entire anomaly detection. */ +export interface UnivariateUnivariateEntireDetectionResult { + /** + * Frequency extracted from the series, zero means no recurrent pattern has been + * found. + */ + period: number; + /** + * ExpectedValues contain expected value for each input point. The index of the + * array is consistent with the input series. + */ + expectedValues: number[]; + /** + * UpperMargins contain upper margin of each input point. UpperMargin is used to + * calculate upperBoundary, which equals to expectedValue + (100 - + * marginScale)*upperMargin. Anomalies in response can be filtered by + * upperBoundary and lowerBoundary. By adjusting marginScale value, less + * significant anomalies can be filtered in client side. The index of the array is + * consistent with the input series. + */ + upperMargins: number[]; + /** + * LowerMargins contain lower margin of each input point. LowerMargin is used to + * calculate lowerBoundary, which equals to expectedValue - (100 - + * marginScale)*lowerMargin. Points between the boundary can be marked as normal + * ones in client side. The index of the array is consistent with the input + * series. + */ + lowerMargins: number[]; + /** + * IsAnomaly contains anomaly properties for each input point. True means an + * anomaly either negative or positive has been detected. The index of the array + * is consistent with the input series. + */ + isAnomaly: boolean[]; + /** + * IsNegativeAnomaly contains anomaly status in negative direction for each input + * point. True means a negative anomaly has been detected. A negative anomaly + * means the point is detected as an anomaly and its real value is smaller than + * the expected one. The index of the array is consistent with the input series. + */ + isNegativeAnomaly: boolean[]; + /** + * IsPositiveAnomaly contain anomaly status in positive direction for each input + * point. True means a positive anomaly has been detected. A positive anomaly + * means the point is detected as an anomaly and its real value is larger than the + * expected one. The index of the array is consistent with the input series. + */ + isPositiveAnomaly: boolean[]; + /** + * The severity score for each input point. The larger the value is, the more + * sever the anomaly is. For normal points, the "severity" is always 0. + */ + severity?: number[]; +} + +/** */ +export type AnomalyDetectorErrorCodes = + | "InvalidCustomInterval" + | "BadArgument" + | "InvalidGranularity" + | "InvalidPeriod" + | "InvalidModelArgument" + | "InvalidSeries" + | "InvalidJsonFormat" + | "RequiredGranularity" + | "RequiredSeries" + | "InvalidImputeMode" + | "InvalidImputeFixedValue"; + +/** The response of last anomaly detection. */ +export interface UnivariateUnivariateLastDetectionResult { + /** + * Frequency extracted from the series, zero means no recurrent pattern has been + * found. + */ + period: number; + /** Suggested input series points needed for detecting the latest point. */ + suggestedWindow: number; + /** Expected value of the latest point. */ + expectedValue: number; + /** + * Upper margin of the latest point. UpperMargin is used to calculate + * upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. + * If the value of latest point is between upperBoundary and lowerBoundary, it + * should be treated as normal value. By adjusting marginScale value, anomaly + * status of latest point can be changed. + */ + upperMargin: number; + /** + * Lower margin of the latest point. LowerMargin is used to calculate + * lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. + * + */ + lowerMargin: number; + /** + * Anomaly status of the latest point, true means the latest point is an anomaly + * either in negative direction or positive direction. + */ + isAnomaly: boolean; + /** + * Anomaly status in negative direction of the latest point. True means the latest + * point is an anomaly and its real value is smaller than the expected one. + */ + isNegativeAnomaly: boolean; + /** + * Anomaly status in positive direction of the latest point. True means the latest + * point is an anomaly and its real value is larger than the expected one. + */ + isPositiveAnomaly: boolean; + /** + * The severity score for the last input point. The larger the value is, the more + * sever the anomaly is. For normal points, the "severity" is always 0. + */ + severity?: number; +} + +/** The request of change point detection. */ +export interface UnivariateUnivariateChangePointDetectionOptions { + /** + * Time series data points. Points should be sorted by timestamp in ascending + * order to match the change point detection result. + */ + series: UnivariateTimeSeriesPoint[]; + /** + * Can only be one of yearly, monthly, weekly, daily, hourly, minutely or + * secondly. Granularity is used for verify whether input series is valid. + */ + granularity: TimeGranularity; + /** + * Custom Interval is used to set non-standard time interval, for example, if the + * series is 5 minutes, request can be set as {"granularity":"minutely", + * "customInterval":5}. + */ + customInterval?: number; + /** + * Optional argument, periodic value of a time series. If the value is null or + * does not present, the API will determine the period automatically. + */ + period?: number; + /** + * Optional argument, advanced model parameter, a default stableTrendWindow will + * be used in detection. + */ + stableTrendWindow?: number; + /** + * Optional argument, advanced model parameter, between 0.0-1.0, the lower the + * value is, the larger the trend error will be which means less change point will + * be accepted. + */ + threshold?: number; +} + +/** The response of change point detection. */ +export interface UnivariateUnivariateChangePointDetectionResult { + /** + * Frequency extracted from the series, zero means no recurrent pattern has been + * found. + */ + readonly period?: number; + /** + * isChangePoint contains change point properties for each input point. True means + * an anomaly either negative or positive has been detected. The index of the + * array is consistent with the input series. + */ + isChangePoint?: boolean[]; + /** the change point confidence of each point */ + confidenceScores?: number[]; +} + +/** */ +export type Versions = "v1.1"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/options.ts new file mode 100644 index 0000000000..b46700fcb8 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/options.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface UnivariateDetectUnivariateEntireSeriesOptionalParams + extends OperationOptions {} + +export interface UnivariateDetectUnivariateLastPointOptionalParams + extends OperationOptions {} + +export interface UnivariateDetectUnivariateChangePointOptionalParams + extends OperationOptions {} + +export interface MultivariateGetMultivariateBatchDetectionResultOptionalParams + extends OperationOptions {} + +export interface MultivariateTrainMultivariateModelOptionalParams + extends OperationOptions {} + +export interface MultivariateListMultivariateModelsOptionalParams + extends OperationOptions { + /** Skip indicates how many models will be skipped. */ + skip?: number; + /** Top indicates how many models will be fetched. */ + top?: number; +} + +export interface MultivariateDeleteMultivariateModelOptionalParams + extends OperationOptions {} + +export interface MultivariateGetMultivariateModelOptionalParams + extends OperationOptions {} + +export interface MultivariateDetectMultivariateBatchAnomalyOptionalParams + extends OperationOptions {} + +export interface MultivariateDetectMultivariateLastAnomalyOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/pagingTypes.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/pagingTypes.ts new file mode 100644 index 0000000000..f734b48e62 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/pagingTypes.ts @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: ( + pageLink?: string, + ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/anomalyDetectorClient.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/anomalyDetectorClient.ts new file mode 100644 index 0000000000..73539d2227 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/anomalyDetectorClient.ts @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { KeyCredential } from "@azure/core-auth"; +import { AnomalyDetectorContext } from "./clientDefinitions.js"; + +export interface AnomalyDetectorContextOptions extends ClientOptions { + apiVersion?: string; +} + +/** + * Initialize a new instance of `AnomalyDetectorContext` + * @param endpointParam - Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus2.api.cognitive.microsoft.com). + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + endpointParam: string, + credentials: KeyCredential, + options: AnomalyDetectorContextOptions = {}, +): AnomalyDetectorContext { + const apiVersion = options.apiVersion ?? "v1.1"; + const endpointUrl = + options.endpoint ?? + options.baseUrl ?? + `${endpointParam}/anomalydetector/${apiVersion}`; + + const userAgentInfo = `azsdk-js-ai-anomaly-detector-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + apiKeyHeaderName: + options.credentials?.apiKeyHeaderName ?? "Ocp-Apim-Subscription-Key", + }, + }; + + const client = getClient( + endpointUrl, + credentials, + options, + ) as AnomalyDetectorContext; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + + return client; +} diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/clientDefinitions.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/clientDefinitions.ts similarity index 99% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/clientDefinitions.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/clientDefinitions.ts index 8a3d651d58..a5d185adb8 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/clientDefinitions.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/clientDefinitions.ts @@ -192,6 +192,6 @@ export interface Routes { ): DetectMultivariateLastAnomaly; } -export type AnomalyDetectorClient = Client & { +export type AnomalyDetectorContext = Client & { path: Routes; }; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/index.ts new file mode 100644 index 0000000000..ee1b21aa69 --- /dev/null +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import AnomalyDetectorClient from "./anomalyDetectorClient.js"; + +export * from "./anomalyDetectorClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./isUnexpected.js"; +export * from "./models.js"; +export * from "./outputModels.js"; +export * from "./paginateHelper.js"; + +export default AnomalyDetectorClient; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/isUnexpected.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/isUnexpected.ts similarity index 100% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/isUnexpected.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/isUnexpected.ts diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/models.ts similarity index 89% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/models.ts index 7b5c11e6a0..dcbd69640a 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/models.ts @@ -16,16 +16,7 @@ export interface UnivariateUnivariateDetectionOptions { * be none by default. If granularity is none, the timestamp property in time * series point can be absent. */ - granularity?: - | "yearly" - | "monthly" - | "weekly" - | "daily" - | "hourly" - | "minutely" - | "secondly" - | "microsecond" - | "none"; + granularity?: TimeGranularity; /** * Custom Interval is used to set non-standard time interval, for example, if the * series is 5 minutes, request can be set as {"granularity":"minutely", @@ -48,10 +39,8 @@ export interface UnivariateUnivariateDetectionOptions { /** * Used to specify how to deal with missing values in the input series, it's used * when granularity is not "none". - * - * Possible values: "auto", "previous", "linear", "fixed", "zero", "notFill" */ - imputeMode?: string; + imputeMode?: ImputeMode; /** * Used to specify the value to fill, it's used when granularity is not "none" * and imputeMode is "fixed". @@ -78,16 +67,7 @@ export interface UnivariateUnivariateChangePointDetectionOptions { * Can only be one of yearly, monthly, weekly, daily, hourly, minutely or * secondly. Granularity is used for verify whether input series is valid. */ - granularity: - | "yearly" - | "monthly" - | "weekly" - | "daily" - | "hourly" - | "minutely" - | "secondly" - | "microsecond" - | "none"; + granularity: TimeGranularity; /** * Custom Interval is used to set non-standard time interval, for example, if the * series is 5 minutes, request can be set as {"granularity":"minutely", @@ -178,10 +158,8 @@ export interface MultivariateModelInfo { /** * Data schema of input data source: OneTable or MultiTable. The default * DataSchema is OneTable. - * - * Possible values: "OneTable", "MultiTable" */ - dataSchema?: string; + dataSchema?: DataSchema; /** * A required field, indicating the start time of training data, which should be * date-time of ISO 8601 format. @@ -205,7 +183,7 @@ export interface MultivariateModelInfo { /** An optional field, indicating the manner to align multiple variables. */ alignPolicy?: MultivariateAlignPolicy; /** Model status. One of CREATED, RUNNING, READY, and FAILED. */ - status?: "CREATED" | "RUNNING" | "READY" | "FAILED"; + status?: ModelStatus; /** Diagnostics information to help inspect the states of model or variable. */ diagnosticsInfo?: MultivariateDiagnosticsInfo; } @@ -216,14 +194,12 @@ export interface MultivariateAlignPolicy { * An optional field, indicating how to align different variables to the same * time-range. Either Inner or Outer. */ - alignMode?: "Inner" | "Outer"; + alignMode?: AlignMode; /** * An optional field, indicating how missing values will be filled. One of * Previous, Subsequent, Linear, Zero, Fixed. - * - * Possible values: "Previous", "Subsequent", "Linear", "Zero", "Fixed" */ - fillNAMethod?: string; + fillNAMethod?: FillNAMethod; /** An optional field. Required when fillNAMethod is Fixed. */ paddingValue?: number; } @@ -281,3 +257,36 @@ export interface MultivariateVariableValues { /** Values of variables. */ values: number[]; } + +/** Alias for TimeGranularity */ +export type TimeGranularity = + | "yearly" + | "monthly" + | "weekly" + | "daily" + | "hourly" + | "minutely" + | "secondly" + | "microsecond" + | "none"; +/** Alias for ImputeMode */ +export type ImputeMode = + | "auto" + | "previous" + | "linear" + | "fixed" + | "zero" + | "notFill"; +/** Data schema of input data source: OneTable or MultiTable. The default DataSchema is OneTable. */ +export type DataSchema = "OneTable" | "MultiTable"; +/** Alias for AlignMode */ +export type AlignMode = "Inner" | "Outer"; +/** An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. */ +export type FillNAMethod = + | "Previous" + | "Subsequent" + | "Linear" + | "Zero" + | "Fixed"; +/** Alias for ModelStatus */ +export type ModelStatus = "CREATED" | "RUNNING" | "READY" | "FAILED"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/outputModels.ts similarity index 91% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/outputModels.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/outputModels.ts index 5611e2155f..106d3535a4 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/outputModels.ts @@ -59,12 +59,8 @@ export interface UnivariateUnivariateEntireDetectionResultOutput { /** Error information returned by the API. */ export interface UnivariateAnomalyDetectorErrorOutput { - /** - * The error code. - * - * Possible values: "InvalidCustomInterval", "BadArgument", "InvalidGranularity", "InvalidPeriod", "InvalidModelArgument", "InvalidSeries", "InvalidJsonFormat", "RequiredGranularity", "RequiredSeries", "InvalidImputeMode", "InvalidImputeFixedValue" - */ - code?: string; + /** The error code. */ + code?: AnomalyDetectorErrorCodesOutput; /** A message explaining the error reported by the service. */ message?: string; } @@ -146,7 +142,7 @@ export interface MultivariateMultivariateDetectionResultOutput { /** Multivariate anomaly detection status. */ export interface MultivariateMultivariateBatchDetectionResultSummaryOutput { /** Status of detection results. One of CREATED, RUNNING, READY, and FAILED. */ - status: "CREATED" | "RUNNING" | "READY" | "FAILED"; + status: MultivariateBatchDetectionStatusOutput; /** Error message when detection is failed. */ errors?: Array; /** Variable Status. */ @@ -279,10 +275,8 @@ export interface MultivariateModelInfoOutput { /** * Data schema of input data source: OneTable or MultiTable. The default * DataSchema is OneTable. - * - * Possible values: "OneTable", "MultiTable" */ - dataSchema?: string; + dataSchema?: DataSchemaOutput; /** * A required field, indicating the start time of training data, which should be * date-time of ISO 8601 format. @@ -306,7 +300,7 @@ export interface MultivariateModelInfoOutput { /** An optional field, indicating the manner to align multiple variables. */ alignPolicy?: MultivariateAlignPolicyOutput; /** Model status. One of CREATED, RUNNING, READY, and FAILED. */ - status?: "CREATED" | "RUNNING" | "READY" | "FAILED"; + status?: ModelStatusOutput; /** Error messages when failed to create a model. */ readonly errors?: Array; /** Diagnostics information to help inspect the states of model or variable. */ @@ -319,14 +313,12 @@ export interface MultivariateAlignPolicyOutput { * An optional field, indicating how to align different variables to the same * time-range. Either Inner or Outer. */ - alignMode?: "Inner" | "Outer"; + alignMode?: AlignModeOutput; /** * An optional field, indicating how missing values will be filled. One of * Previous, Subsequent, Linear, Zero, Fixed. - * - * Possible values: "Previous", "Subsequent", "Linear", "Zero", "Fixed" */ - fillNAMethod?: string; + fillNAMethod?: FillNAMethodOutput; /** An optional field. Required when fillNAMethod is Fixed. */ paddingValue?: number; } @@ -394,3 +386,36 @@ export interface MultivariateMultivariateLastDetectionResultOutput { /** Anomaly status and information. */ results?: Array; } + +/** Alias for AnomalyDetectorErrorCodesOutput */ +export type AnomalyDetectorErrorCodesOutput = + | "InvalidCustomInterval" + | "BadArgument" + | "InvalidGranularity" + | "InvalidPeriod" + | "InvalidModelArgument" + | "InvalidSeries" + | "InvalidJsonFormat" + | "RequiredGranularity" + | "RequiredSeries" + | "InvalidImputeMode" + | "InvalidImputeFixedValue"; +/** Alias for MultivariateBatchDetectionStatusOutput */ +export type MultivariateBatchDetectionStatusOutput = + | "CREATED" + | "RUNNING" + | "READY" + | "FAILED"; +/** Data schema of input data source: OneTable or MultiTable. The default DataSchema is OneTable. */ +export type DataSchemaOutput = "OneTable" | "MultiTable"; +/** Alias for AlignModeOutput */ +export type AlignModeOutput = "Inner" | "Outer"; +/** An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. */ +export type FillNAMethodOutput = + | "Previous" + | "Subsequent" + | "Linear" + | "Zero" + | "Fixed"; +/** Alias for ModelStatusOutput */ +export type ModelStatusOutput = "CREATED" | "RUNNING" | "READY" | "FAILED"; diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/paginateHelper.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/paginateHelper.ts similarity index 100% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/paginateHelper.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/paginateHelper.ts diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/parameters.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/parameters.ts similarity index 100% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/parameters.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/parameters.ts diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/responses.ts similarity index 100% rename from packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/responses.ts rename to packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/rest/responses.ts diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/tsconfig.json b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/tsconfig.json index f3971f4141..c295d30216 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/tsconfig.json +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/tsconfig.json @@ -17,8 +17,7 @@ "forceConsistentCasingInFileNames": true, "moduleResolution": "NodeNext", "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "paths": { "@msinternal/ai-anomaly-detector": ["./src/index"] } + "esModuleInterop": true }, - "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"] + "include": ["./src/**/*.ts", "./test/**/*.ts"] } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/anomalyDetector/tspconfig.yaml b/packages/typespec-test/test/anomalyDetector/tspconfig.yaml index 39b94f3703..ca7e9b1e94 100644 --- a/packages/typespec-test/test/anomalyDetector/tspconfig.yaml +++ b/packages/typespec-test/test/anomalyDetector/tspconfig.yaml @@ -4,10 +4,9 @@ emit: options: "@azure-tools/typespec-ts": generateMetadata: true - generateTest: true - generateSample: true azureSdkForJs: false enableModelNamespace: true + isModularLibrary: true "emitter-output-dir": "{project-root}/generated/typespec-ts" packageDetails: name: "@msinternal/ai-anomaly-detector" diff --git a/packages/typespec-test/test/authoring/generated/openapi/2022-05-15-preview/openapi.json b/packages/typespec-test/test/authoring/generated/openapi/2022-05-15-preview/openapi.json index e151ef057d..74e4cf5f82 100644 --- a/packages/typespec-test/test/authoring/generated/openapi/2022-05-15-preview/openapi.json +++ b/packages/typespec-test/test/authoring/generated/openapi/2022-05-15-preview/openapi.json @@ -1144,8 +1144,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -1167,8 +1166,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -1190,8 +1188,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -1213,8 +1210,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/package.json b/packages/typespec-test/test/authoring/generated/typespec-ts/package.json index 290ef6a203..3518250ede 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md b/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md index f29d491579..35a3b2f6df 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/review/authoring.api.md @@ -32,7 +32,7 @@ export default createClient; // @public (undocumented) export interface CreateOrUpdate { - delete(options?: DeleteParameters): StreamableMethod; + delete(options?: DeleteParameters): StreamableMethod; get(options?: GetParameters): StreamableMethod; patch(options: CreateOrUpdateParameters): StreamableMethod; } @@ -103,6 +103,36 @@ export interface CreateOrUpdateMediaTypesParam { // @public (undocumented) export type CreateOrUpdateParameters = CreateOrUpdateMediaTypesParam & CreateOrUpdateBodyParam & RequestParameters; +// @public (undocumented) +export interface Delete202Headers { + "operation-location": string; +} + +// @public +export interface Delete202Response extends HttpResponse { + // (undocumented) + body: OperationStatusOutput; + // (undocumented) + headers: RawHttpHeaders & Delete202Headers; + // (undocumented) + status: "202"; +} + +// @public (undocumented) +export interface DeleteDefaultHeaders { + "x-ms-error-code"?: string; +} + +// @public (undocumented) +export interface DeleteDefaultResponse extends HttpResponse { + // (undocumented) + body: ErrorResponse; + // (undocumented) + headers: RawHttpHeaders & DeleteDefaultHeaders; + // (undocumented) + status: string; +} + // @public (undocumented) export interface DeleteDeployment202Headers { "operation-location": string; @@ -152,36 +182,6 @@ export interface DeleteLogicalResponse extends HttpResponse { status: "200"; } -// @public (undocumented) -export interface DeleteOperation202Headers { - "operation-location": string; -} - -// @public -export interface DeleteOperation202Response extends HttpResponse { - // (undocumented) - body: OperationStatusOutput; - // (undocumented) - headers: RawHttpHeaders & DeleteOperation202Headers; - // (undocumented) - status: "202"; -} - -// @public (undocumented) -export interface DeleteOperationDefaultHeaders { - "x-ms-error-code"?: string; -} - -// @public (undocumented) -export interface DeleteOperationDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; - // (undocumented) - headers: RawHttpHeaders & DeleteOperationDefaultHeaders; - // (undocumented) - status: string; -} - // @public (undocumented) export type DeleteParameters = RequestParameters; @@ -197,7 +197,7 @@ export interface DeploymentJobOutput { readonly id: string; jobId: string; readonly lastUpdatedDateTime: string; - status: "notStarted" | "running" | "succeeded" | "failed" | "cancelled" | "cancelling" | "partiallyCompleted"; + status: JobStatusOutput; warnings: Array; } @@ -269,43 +269,43 @@ export type DeployProjectParameters = DeployProjectBodyParam & RequestParameters // @public (undocumented) export interface Export { - post(options: ExportParameters): StreamableMethod; -} - -// @public -export interface ExportLogicalResponse extends HttpResponse { - // (undocumented) - status: "200"; + post(options: ExportParameters): StreamableMethod; } // @public (undocumented) -export interface ExportOperation202Headers { +export interface Export202Headers { "operation-location": string; } // @public -export interface ExportOperation202Response extends HttpResponse { +export interface Export202Response extends HttpResponse { // (undocumented) - headers: RawHttpHeaders & ExportOperation202Headers; + headers: RawHttpHeaders & Export202Headers; // (undocumented) status: "202"; } // @public (undocumented) -export interface ExportOperationDefaultHeaders { +export interface ExportDefaultHeaders { "x-ms-error-code"?: string; } // @public (undocumented) -export interface ExportOperationDefaultResponse extends HttpResponse { +export interface ExportDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponse; // (undocumented) - headers: RawHttpHeaders & ExportOperationDefaultHeaders; + headers: RawHttpHeaders & ExportDefaultHeaders; // (undocumented) status: string; } +// @public +export interface ExportLogicalResponse extends HttpResponse { + // (undocumented) + status: "200"; +} + // @public (undocumented) export type ExportParameters = ExportQueryParam & RequestParameters; @@ -414,10 +414,10 @@ export type GetDeploymentStatusParameters = RequestParameters; export function getLongRunningPoller(client: Client, initialResponse: CreateOrUpdate200Response | CreateOrUpdate201Response | CreateOrUpdateDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; // @public (undocumented) -export function getLongRunningPoller(client: Client, initialResponse: DeleteOperation202Response | DeleteOperationDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; +export function getLongRunningPoller(client: Client, initialResponse: Delete202Response | DeleteDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; // @public (undocumented) -export function getLongRunningPoller(client: Client, initialResponse: ExportOperation202Response | ExportOperationDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; +export function getLongRunningPoller(client: Client, initialResponse: Export202Response | ExportDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; // @public (undocumented) export function getLongRunningPoller(client: Client, initialResponse: Importx202Response | ImportxDefaultResponse, options?: CreateHttpPollerOptions>): Promise, TResult>>; @@ -567,13 +567,13 @@ export function isUnexpected(response: CreateOrUpdate200Response | CreateOrUpdat export function isUnexpected(response: Get200Response | GetDefaultResponse): response is GetDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeleteOperation202Response | DeleteLogicalResponse | DeleteOperationDefaultResponse): response is DeleteOperationDefaultResponse; +export function isUnexpected(response: Delete202Response | DeleteLogicalResponse | DeleteDefaultResponse): response is DeleteDefaultResponse; // @public (undocumented) export function isUnexpected(response: ListProjects200Response | ListProjectsDefaultResponse): response is ListProjectsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: ExportOperation202Response | ExportLogicalResponse | ExportOperationDefaultResponse): response is ExportOperationDefaultResponse; +export function isUnexpected(response: Export202Response | ExportLogicalResponse | ExportDefaultResponse): response is ExportDefaultResponse; // @public (undocumented) export function isUnexpected(response: Importx202Response | ImportxLogicalResponse | ImportxDefaultResponse): response is ImportxDefaultResponse; @@ -608,6 +608,9 @@ export function isUnexpected(response: GetSupportedLanguages200Response | GetSup // @public (undocumented) export function isUnexpected(response: ListTrainingConfigVersions200Response | ListTrainingConfigVersionsDefaultResponse): response is ListTrainingConfigVersionsDefaultResponse; +// @public +export type JobStatusOutput = "notStarted" | "running" | "succeeded" | "failed" | "cancelled" | "cancelling" | "partiallyCompleted"; + // @public export interface JobWarningOutput { code: string; @@ -720,11 +723,14 @@ export interface ListTrainingConfigVersionsQueryParamProperties { top?: number; } +// @public +export type OperationStateOutput = "NotStarted" | "Running" | "Succeeded" | "Failed" | "Canceled"; + // @public export interface OperationStatusOutput { error?: ErrorModel; id: string; - status: string; + status: OperationStateOutput; } // @public @@ -759,11 +765,17 @@ export interface Project { description?: string; language: string; multilingual?: boolean; - projectKind: "CustomSingleLabelClassification" | "CustomMultiLabelClassification" | "CustomEntityRecognition"; + projectKind: ProjectKind; settings?: ProjectSettings; storageInputContainerName: string; } +// @public +export type ProjectKind = "CustomSingleLabelClassification" | "CustomMultiLabelClassification" | "CustomEntityRecognition"; + +// @public +export type ProjectKindOutput = "CustomSingleLabelClassification" | "CustomMultiLabelClassification" | "CustomEntityRecognition"; + // @public export interface ProjectOutput { readonly createdDateTime: string; @@ -773,7 +785,7 @@ export interface ProjectOutput { readonly lastModifiedDateTime: string; readonly lastTrainedDateTime: string; multilingual?: boolean; - projectKind: "CustomSingleLabelClassification" | "CustomMultiLabelClassification" | "CustomEntityRecognition"; + projectKind: ProjectKindOutput; readonly projectName: string; settings?: ProjectSettingsOutput; storageInputContainerName: string; @@ -879,7 +891,7 @@ export interface SwapDeploymentsJobOutput { readonly id: string; jobId: string; readonly lastUpdatedDateTime: string; - status: "notStarted" | "running" | "succeeded" | "failed" | "cancelled" | "cancelling" | "partiallyCompleted"; + status: JobStatusOutput; warnings: Array; } diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/clientDefinitions.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/clientDefinitions.ts index 09e4900e52..a6fff27275 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/clientDefinitions.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/clientDefinitions.ts @@ -25,12 +25,12 @@ import { CreateOrUpdateDefaultResponse, Get200Response, GetDefaultResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, + Delete202Response, + DeleteDefaultResponse, ListProjects200Response, ListProjectsDefaultResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, + Export202Response, + ExportDefaultResponse, Importx202Response, ImportxDefaultResponse, Train202Response, @@ -73,9 +73,7 @@ export interface CreateOrUpdate { /** Deletes a project. */ delete( options?: DeleteParameters, - ): StreamableMethod< - DeleteOperation202Response | DeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface ListProjects { @@ -89,9 +87,7 @@ export interface Export { /** Triggers a job to export a project's data. */ post( options: ExportParameters, - ): StreamableMethod< - ExportOperation202Response | ExportOperationDefaultResponse - >; + ): StreamableMethod; } export interface Importx { diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/isUnexpected.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/isUnexpected.ts index 46e97d2adb..e2225bbc9a 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/isUnexpected.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/isUnexpected.ts @@ -8,14 +8,14 @@ import { CreateOrUpdateDefaultResponse, Get200Response, GetDefaultResponse, - DeleteOperation202Response, + Delete202Response, DeleteLogicalResponse, - DeleteOperationDefaultResponse, + DeleteDefaultResponse, ListProjects200Response, ListProjectsDefaultResponse, - ExportOperation202Response, + Export202Response, ExportLogicalResponse, - ExportOperationDefaultResponse, + ExportDefaultResponse, Importx202Response, ImportxLogicalResponse, ImportxDefaultResponse, @@ -92,20 +92,14 @@ export function isUnexpected( response: Get200Response | GetDefaultResponse, ): response is GetDefaultResponse; export function isUnexpected( - response: - | DeleteOperation202Response - | DeleteLogicalResponse - | DeleteOperationDefaultResponse, -): response is DeleteOperationDefaultResponse; + response: Delete202Response | DeleteLogicalResponse | DeleteDefaultResponse, +): response is DeleteDefaultResponse; export function isUnexpected( response: ListProjects200Response | ListProjectsDefaultResponse, ): response is ListProjectsDefaultResponse; export function isUnexpected( - response: - | ExportOperation202Response - | ExportLogicalResponse - | ExportOperationDefaultResponse, -): response is ExportOperationDefaultResponse; + response: Export202Response | ExportLogicalResponse | ExportDefaultResponse, +): response is ExportDefaultResponse; export function isUnexpected( response: | Importx202Response @@ -166,14 +160,14 @@ export function isUnexpected( | CreateOrUpdateDefaultResponse | Get200Response | GetDefaultResponse - | DeleteOperation202Response + | Delete202Response | DeleteLogicalResponse - | DeleteOperationDefaultResponse + | DeleteDefaultResponse | ListProjects200Response | ListProjectsDefaultResponse - | ExportOperation202Response + | Export202Response | ExportLogicalResponse - | ExportOperationDefaultResponse + | ExportDefaultResponse | Importx202Response | ImportxLogicalResponse | ImportxDefaultResponse @@ -205,9 +199,9 @@ export function isUnexpected( ): response is | CreateOrUpdateDefaultResponse | GetDefaultResponse - | DeleteOperationDefaultResponse + | DeleteDefaultResponse | ListProjectsDefaultResponse - | ExportOperationDefaultResponse + | ExportDefaultResponse | ImportxDefaultResponse | TrainDefaultResponse | GetDeploymentDefaultResponse diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/models.ts index d762986db1..b7546fd74a 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/models.ts @@ -4,10 +4,7 @@ /** The details of a project. */ export interface Project { /** The project kind. */ - projectKind: - | "CustomSingleLabelClassification" - | "CustomMultiLabelClassification" - | "CustomEntityRecognition"; + projectKind: ProjectKind; /** The storage container name. */ storageInputContainerName: string; /** The project settings. */ @@ -39,3 +36,9 @@ export interface SwapDeploymentsOptions { /** Represents the second deployment name. */ secondDeploymentName: string; } + +/** Represents the project kind. */ +export type ProjectKind = + | "CustomSingleLabelClassification" + | "CustomMultiLabelClassification" + | "CustomEntityRecognition"; diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts index 12ffa94dd3..dc386a6e5c 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/outputModels.ts @@ -9,10 +9,7 @@ export interface ProjectOutput { /** The project name. */ readonly projectName: string; /** The project kind. */ - projectKind: - | "CustomSingleLabelClassification" - | "CustomMultiLabelClassification" - | "CustomEntityRecognition"; + projectKind: ProjectKindOutput; /** The storage container name. */ storageInputContainerName: string; /** The project settings. */ @@ -40,12 +37,8 @@ export interface ProjectSettingsOutput extends Record {} export interface OperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; } @@ -67,14 +60,7 @@ export interface DeploymentJobOutput { /** The expiration date time of the job. */ readonly expirationDateTime: string; /** The job status. */ - status: - | "notStarted" - | "running" - | "succeeded" - | "failed" - | "cancelled" - | "cancelling" - | "partiallyCompleted"; + status: JobStatusOutput; /** The warnings that were encountered while executing the job. */ warnings: Array; /** The errors encountered while executing the job. */ @@ -102,14 +88,7 @@ export interface SwapDeploymentsJobOutput { /** The expiration date time of the job. */ readonly expirationDateTime: string; /** The job status. */ - status: - | "notStarted" - | "running" - | "succeeded" - | "failed" - | "cancelled" - | "cancelling" - | "partiallyCompleted"; + status: JobStatusOutput; /** The warnings that were encountered while executing the job. */ warnings: Array; /** The errors encountered while executing the job. */ @@ -134,10 +113,31 @@ export interface TrainingConfigVersionOutput { modelExpirationDate: string; } +/** Represents the project kind. */ +export type ProjectKindOutput = + | "CustomSingleLabelClassification" + | "CustomMultiLabelClassification" + | "CustomEntityRecognition"; +/** Enum describing allowed operation states. */ +export type OperationStateOutput = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled"; /** Paged collection of Project items */ export type PagedProjectOutput = Paged; /** Paged collection of Deployment items */ export type PagedDeploymentOutput = Paged; +/** Represents the job status. */ +export type JobStatusOutput = + | "notStarted" + | "running" + | "succeeded" + | "failed" + | "cancelled" + | "cancelling" + | "partiallyCompleted"; /** A collection of SupportedLanguage resources. */ export type PagedSupportedLanguageOutput = Paged; /** A collection of TrainingConfigVersion resources. */ diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/pollingHelper.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/pollingHelper.ts index 659586aae4..4f1ab38f07 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/pollingHelper.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/pollingHelper.ts @@ -16,11 +16,11 @@ import { CreateOrUpdate201Response, CreateOrUpdateDefaultResponse, CreateOrUpdateLogicalResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, + Delete202Response, + DeleteDefaultResponse, DeleteLogicalResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, + Export202Response, + ExportDefaultResponse, ExportLogicalResponse, Importx202Response, ImportxDefaultResponse, @@ -127,17 +127,17 @@ export async function getLongRunningPoller< options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< - TResult extends DeleteLogicalResponse | DeleteOperationDefaultResponse, + TResult extends DeleteLogicalResponse | DeleteDefaultResponse, >( client: Client, - initialResponse: DeleteOperation202Response | DeleteOperationDefaultResponse, + initialResponse: Delete202Response | DeleteDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< - TResult extends ExportLogicalResponse | ExportOperationDefaultResponse, + TResult extends ExportLogicalResponse | ExportDefaultResponse, >( client: Client, - initialResponse: ExportOperation202Response | ExportOperationDefaultResponse, + initialResponse: Export202Response | ExportDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts index d01a75d26f..a578494b39 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/src/responses.ts @@ -73,27 +73,27 @@ export interface GetDefaultResponse extends HttpResponse { headers: RawHttpHeaders & GetDefaultHeaders; } -export interface DeleteOperation202Headers { +export interface Delete202Headers { /** The location for monitoring the operation state. */ "operation-location": string; } /** The request has been accepted for processing, but processing has not yet completed. */ -export interface DeleteOperation202Response extends HttpResponse { +export interface Delete202Response extends HttpResponse { status: "202"; body: OperationStatusOutput; - headers: RawHttpHeaders & DeleteOperation202Headers; + headers: RawHttpHeaders & Delete202Headers; } -export interface DeleteOperationDefaultHeaders { +export interface DeleteDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface DeleteOperationDefaultResponse extends HttpResponse { +export interface DeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & DeleteOperationDefaultHeaders; + headers: RawHttpHeaders & DeleteDefaultHeaders; } /** The final response for long-running delete operation */ @@ -119,26 +119,26 @@ export interface ListProjectsDefaultResponse extends HttpResponse { headers: RawHttpHeaders & ListProjectsDefaultHeaders; } -export interface ExportOperation202Headers { +export interface Export202Headers { /** The location for monitoring the operation state. */ "operation-location": string; } /** The request has been accepted for processing, but processing has not yet completed. */ -export interface ExportOperation202Response extends HttpResponse { +export interface Export202Response extends HttpResponse { status: "202"; - headers: RawHttpHeaders & ExportOperation202Headers; + headers: RawHttpHeaders & Export202Headers; } -export interface ExportOperationDefaultHeaders { +export interface ExportDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface ExportOperationDefaultResponse extends HttpResponse { +export interface ExportDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & ExportOperationDefaultHeaders; + headers: RawHttpHeaders & ExportDefaultHeaders; } /** The final response for long-running export operation */ diff --git a/packages/typespec-test/test/authoring/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/authoring/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/authoring/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/authoring/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/batch_modular/generated/typespec-ts/package.json index d728b3000c..0ac90eb46d 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/package.json @@ -42,7 +42,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md index 1487d5de44..b579922d03 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/review/batch.api.md @@ -9,8 +9,8 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; -// @public -export type AccessScope = string; +// @public (undocumented) +export type AccessScope = "job"; // @public export interface AccountListSupportedImagesResult { @@ -23,8 +23,8 @@ export interface AffinityInformation { affinityId: string; } -// @public -export type AllocationState = string; +// @public (undocumented) +export type AllocationState = "steady" | "resizing" | "stopping"; // @public export interface ApplicationListResult { @@ -65,8 +65,8 @@ export interface AutoScaleRunError { values?: NameValuePair[]; } -// @public -export type AutoUserScope = string; +// @public (undocumented) +export type AutoUserScope = "task" | "pool"; // @public export interface AutoUserSpecification { @@ -119,84 +119,84 @@ export interface BatchCertificate { // @public (undocumented) export class BatchClient { - constructor(endpoint: string, credential: TokenCredential, options?: BatchClientOptions); - cancelCertificateDeletion(thumbprintAlgorithm: string, thumbprint: string, options?: CancelCertificateDeletionOptions): Promise; - createCertificate(body: BatchCertificate, options?: CreateCertificateOptions): Promise; - createJob(body: BatchJobCreateOptions, options?: CreateJobOptions): Promise; - createJobSchedule(body: BatchJobScheduleCreateOptions, options?: CreateJobScheduleOptions): Promise; - createNodeUser(poolId: string, nodeId: string, body: BatchNodeUserCreateOptions, options?: CreateNodeUserOptions): Promise; - createPool(body: BatchPoolCreateOptions, options?: CreatePoolOptions): Promise; - createTask(jobId: string, body: BatchTaskCreateOptions, options?: CreateTaskOptions): Promise; - createTaskCollection(jobId: string, collection: BatchTaskCollection, options?: CreateTaskCollectionOptions): Promise; - deleteCertificate(thumbprintAlgorithm: string, thumbprint: string, options?: DeleteCertificateOptions): Promise; - deleteJob(jobId: string, options?: DeleteJobOptions): Promise; - deleteJobSchedule(jobScheduleId: string, options?: DeleteJobScheduleOptions): Promise; - deleteNodeFile(poolId: string, nodeId: string, filePath: string, options?: DeleteNodeFileOptions): Promise; - deleteNodeUser(poolId: string, nodeId: string, userName: string, options?: DeleteNodeUserOptions): Promise; - deletePool(poolId: string, options?: DeletePoolOptions): Promise; - deleteTask(jobId: string, taskId: string, options?: DeleteTaskOptions): Promise; - deleteTaskFile(jobId: string, taskId: string, filePath: string, options?: DeleteTaskFileOptions): Promise; - disableJob(jobId: string, body: BatchJobDisableOptions, options?: DisableJobOptions): Promise; - disableJobSchedule(jobScheduleId: string, options?: DisableJobScheduleOptions): Promise; - disableNodeScheduling(poolId: string, nodeId: string, body?: NodeDisableSchedulingOptions, options?: DisableNodeSchedulingOptions): Promise; - disablePoolAutoScale(poolId: string, options?: DisablePoolAutoScaleOptions): Promise; - enableJob(jobId: string, options?: EnableJobOptions): Promise; - enableJobSchedule(jobScheduleId: string, options?: EnableJobScheduleOptions): Promise; - enableNodeScheduling(poolId: string, nodeId: string, options?: EnableNodeSchedulingOptions): Promise; - enablePoolAutoScale(poolId: string, body: BatchPoolEnableAutoScaleOptions, options?: EnablePoolAutoScaleOptions): Promise; - evaluatePoolAutoScale(poolId: string, body: BatchPoolEvaluateAutoScaleOptions, options?: EvaluatePoolAutoScaleOptions): Promise; - getApplication(applicationId: string, options?: GetApplicationOptions): Promise; - getCertificate(thumbprintAlgorithm: string, thumbprint: string, options?: GetCertificateOptions): Promise; - getJob(jobId: string, options?: GetJobOptions): Promise; - getJobSchedule(jobScheduleId: string, options?: GetJobScheduleOptions): Promise; - getJobTaskCounts(jobId: string, options?: GetJobTaskCountsOptions): Promise; - getNode(poolId: string, nodeId: string, options?: GetNodeOptions): Promise; - getNodeExtension(poolId: string, nodeId: string, extensionName: string, options?: GetNodeExtensionOptions): Promise; - getNodeFile(poolId: string, nodeId: string, filePath: string, options?: GetNodeFileOptions): Promise; - getNodeFileProperties(poolId: string, nodeId: string, filePath: string, options?: GetNodeFilePropertiesOptions): Promise; - getNodeRemoteDesktopFile(poolId: string, nodeId: string, options?: GetNodeRemoteDesktopFileOptions): Promise; - getNodeRemoteLoginSettings(poolId: string, nodeId: string, options?: GetNodeRemoteLoginSettingsOptions): Promise; - getPool(poolId: string, options?: GetPoolOptions): Promise; - getTask(jobId: string, taskId: string, options?: GetTaskOptions): Promise; - getTaskFile(jobId: string, taskId: string, filePath: string, options?: GetTaskFileOptions): Promise; - getTaskFileProperties(jobId: string, taskId: string, filePath: string, options?: GetTaskFilePropertiesOptions): Promise; - jobScheduleExists(jobScheduleId: string, options?: JobScheduleExistsOptions): Promise; - listApplications(options?: ListApplicationsOptions): PagedAsyncIterableIterator; - listCertificates(options?: ListCertificatesOptions): PagedAsyncIterableIterator; - listJobPreparationAndReleaseTaskStatus(jobId: string, options?: ListJobPreparationAndReleaseTaskStatusOptions): PagedAsyncIterableIterator; - listJobs(options?: ListJobsOptions): PagedAsyncIterableIterator; - listJobSchedules(options?: ListJobSchedulesOptions): PagedAsyncIterableIterator; - listJobsFromSchedule(jobScheduleId: string, options?: ListJobsFromScheduleOptions): PagedAsyncIterableIterator; - listNodeExtensions(poolId: string, nodeId: string, options?: ListNodeExtensionsOptions): PagedAsyncIterableIterator; - listNodeFiles(poolId: string, nodeId: string, options?: ListNodeFilesOptions): PagedAsyncIterableIterator; - listNodes(poolId: string, options?: ListNodesOptions): PagedAsyncIterableIterator; - listPoolNodeCounts(options?: ListPoolNodeCountsOptions): PagedAsyncIterableIterator; - listPools(options?: ListPoolsOptions): PagedAsyncIterableIterator; - listPoolUsageMetrics(options?: ListPoolUsageMetricsOptions): PagedAsyncIterableIterator; - listSubTasks(jobId: string, taskId: string, options?: ListSubTasksOptions): Promise; - listSupportedImages(options?: ListSupportedImagesOptions): PagedAsyncIterableIterator; - listTaskFiles(jobId: string, taskId: string, options?: ListTaskFilesOptions): PagedAsyncIterableIterator; - listTasks(jobId: string, options?: ListTasksOptions): PagedAsyncIterableIterator; + constructor(endpointParam: string, credential: TokenCredential, options?: BatchClientOptions); + cancelCertificateDeletion(thumbprintAlgorithm: string, thumbprint: string, options?: CancelCertificateDeletionOptionalParams): Promise; + createCertificate(body: BatchCertificate, options?: CreateCertificateOptionalParams): Promise; + createJob(body: BatchJobCreateOptions, options?: CreateJobOptionalParams): Promise; + createJobSchedule(body: BatchJobScheduleCreateOptions, options?: CreateJobScheduleOptionalParams): Promise; + createNodeUser(poolId: string, nodeId: string, body: BatchNodeUserCreateOptions, options?: CreateNodeUserOptionalParams): Promise; + createPool(body: BatchPoolCreateOptions, options?: CreatePoolOptionalParams): Promise; + createTask(jobId: string, body: BatchTaskCreateOptions, options?: CreateTaskOptionalParams): Promise; + createTaskCollection(jobId: string, collection: BatchTaskCollection, options?: CreateTaskCollectionOptionalParams): Promise; + deleteCertificate(thumbprintAlgorithm: string, thumbprint: string, options?: DeleteCertificateOptionalParams): Promise; + deleteJob(jobId: string, options?: DeleteJobOptionalParams): Promise; + deleteJobSchedule(jobScheduleId: string, options?: DeleteJobScheduleOptionalParams): Promise; + deleteNodeFile(poolId: string, nodeId: string, filePath: string, options?: DeleteNodeFileOptionalParams): Promise; + deleteNodeUser(poolId: string, nodeId: string, userName: string, options?: DeleteNodeUserOptionalParams): Promise; + deletePool(poolId: string, options?: DeletePoolOptionalParams): Promise; + deleteTask(jobId: string, taskId: string, options?: DeleteTaskOptionalParams): Promise; + deleteTaskFile(jobId: string, taskId: string, filePath: string, options?: DeleteTaskFileOptionalParams): Promise; + disableJob(jobId: string, body: BatchJobDisableOptions, options?: DisableJobOptionalParams): Promise; + disableJobSchedule(jobScheduleId: string, options?: DisableJobScheduleOptionalParams): Promise; + disableNodeScheduling(poolId: string, nodeId: string, body?: NodeDisableSchedulingOptions, options?: DisableNodeSchedulingOptionalParams): Promise; + disablePoolAutoScale(poolId: string, options?: DisablePoolAutoScaleOptionalParams): Promise; + enableJob(jobId: string, options?: EnableJobOptionalParams): Promise; + enableJobSchedule(jobScheduleId: string, options?: EnableJobScheduleOptionalParams): Promise; + enableNodeScheduling(poolId: string, nodeId: string, options?: EnableNodeSchedulingOptionalParams): Promise; + enablePoolAutoScale(poolId: string, body: BatchPoolEnableAutoScaleOptions, options?: EnablePoolAutoScaleOptionalParams): Promise; + evaluatePoolAutoScale(poolId: string, body: BatchPoolEvaluateAutoScaleOptions, options?: EvaluatePoolAutoScaleOptionalParams): Promise; + getApplication(applicationId: string, options?: GetApplicationOptionalParams): Promise; + getCertificate(thumbprintAlgorithm: string, thumbprint: string, options?: GetCertificateOptionalParams): Promise; + getJob(jobId: string, options?: GetJobOptionalParams): Promise; + getJobSchedule(jobScheduleId: string, options?: GetJobScheduleOptionalParams): Promise; + getJobTaskCounts(jobId: string, options?: GetJobTaskCountsOptionalParams): Promise; + getNode(poolId: string, nodeId: string, options?: GetNodeOptionalParams): Promise; + getNodeExtension(poolId: string, nodeId: string, extensionName: string, options?: GetNodeExtensionOptionalParams): Promise; + getNodeFile(poolId: string, nodeId: string, filePath: string, options?: GetNodeFileOptionalParams): Promise; + getNodeFileProperties(poolId: string, nodeId: string, filePath: string, options?: GetNodeFilePropertiesOptionalParams): Promise; + getNodeRemoteDesktopFile(poolId: string, nodeId: string, options?: GetNodeRemoteDesktopFileOptionalParams): Promise; + getNodeRemoteLoginSettings(poolId: string, nodeId: string, options?: GetNodeRemoteLoginSettingsOptionalParams): Promise; + getPool(poolId: string, options?: GetPoolOptionalParams): Promise; + getTask(jobId: string, taskId: string, options?: GetTaskOptionalParams): Promise; + getTaskFile(jobId: string, taskId: string, filePath: string, options?: GetTaskFileOptionalParams): Promise; + getTaskFileProperties(jobId: string, taskId: string, filePath: string, options?: GetTaskFilePropertiesOptionalParams): Promise; + jobScheduleExists(jobScheduleId: string, options?: JobScheduleExistsOptionalParams): Promise; + listApplications(options?: ListApplicationsOptionalParams): PagedAsyncIterableIterator; + listCertificates(options?: ListCertificatesOptionalParams): PagedAsyncIterableIterator; + listJobPreparationAndReleaseTaskStatus(jobId: string, options?: ListJobPreparationAndReleaseTaskStatusOptionalParams): PagedAsyncIterableIterator; + listJobs(options?: ListJobsOptionalParams): PagedAsyncIterableIterator; + listJobSchedules(options?: ListJobSchedulesOptionalParams): PagedAsyncIterableIterator; + listJobsFromSchedule(jobScheduleId: string, options?: ListJobsFromScheduleOptionalParams): PagedAsyncIterableIterator; + listNodeExtensions(poolId: string, nodeId: string, options?: ListNodeExtensionsOptionalParams): PagedAsyncIterableIterator; + listNodeFiles(poolId: string, nodeId: string, options?: ListNodeFilesOptionalParams): PagedAsyncIterableIterator; + listNodes(poolId: string, options?: ListNodesOptionalParams): PagedAsyncIterableIterator; + listPoolNodeCounts(options?: ListPoolNodeCountsOptionalParams): PagedAsyncIterableIterator; + listPools(options?: ListPoolsOptionalParams): PagedAsyncIterableIterator; + listPoolUsageMetrics(options?: ListPoolUsageMetricsOptionalParams): PagedAsyncIterableIterator; + listSubTasks(jobId: string, taskId: string, options?: ListSubTasksOptionalParams): Promise; + listSupportedImages(options?: ListSupportedImagesOptionalParams): PagedAsyncIterableIterator; + listTaskFiles(jobId: string, taskId: string, options?: ListTaskFilesOptionalParams): PagedAsyncIterableIterator; + listTasks(jobId: string, options?: ListTasksOptionalParams): PagedAsyncIterableIterator; readonly pipeline: Pipeline; - poolExists(poolId: string, options?: PoolExistsOptions): Promise; - reactivateTask(jobId: string, taskId: string, options?: ReactivateTaskOptions): Promise; - rebootNode(poolId: string, nodeId: string, body?: NodeRebootOptions, options?: RebootNodeOptions): Promise; - reimageNode(poolId: string, nodeId: string, body?: NodeReimageOptions, options?: ReimageNodeOptions): Promise; - removeNodes(poolId: string, body: NodeRemoveOptions, options?: RemoveNodesOptions): Promise; - replaceJob(jobId: string, body: BatchJob, options?: ReplaceJobOptions): Promise; - replaceJobSchedule(jobScheduleId: string, body: BatchJobSchedule, options?: ReplaceJobScheduleOptions): Promise; - replaceNodeUser(poolId: string, nodeId: string, userName: string, body: BatchNodeUserUpdateOptions, options?: ReplaceNodeUserOptions): Promise; - replacePoolProperties(poolId: string, body: BatchPoolReplaceOptions, options?: ReplacePoolPropertiesOptions): Promise; - replaceTask(jobId: string, taskId: string, body: BatchTask, options?: ReplaceTaskOptions): Promise; - resizePool(poolId: string, body: BatchPoolResizeOptions, options?: ResizePoolOptions): Promise; - stopPoolResize(poolId: string, options?: StopPoolResizeOptions): Promise; - terminateJob(jobId: string, body?: BatchJobTerminateOptions, options?: TerminateJobOptions): Promise; - terminateJobSchedule(jobScheduleId: string, options?: TerminateJobScheduleOptions): Promise; - terminateTask(jobId: string, taskId: string, options?: TerminateTaskOptions): Promise; - updateJob(jobId: string, body: BatchJobUpdateOptions, options?: UpdateJobOptions): Promise; - updateJobSchedule(jobScheduleId: string, body: BatchJobScheduleUpdateOptions, options?: UpdateJobScheduleOptions): Promise; - updatePool(poolId: string, body: BatchPoolUpdateOptions, options?: UpdatePoolOptions): Promise; - uploadNodeLogs(poolId: string, nodeId: string, body: UploadBatchServiceLogsOptions, options?: UploadNodeLogsOptions): Promise; + poolExists(poolId: string, options?: PoolExistsOptionalParams): Promise; + reactivateTask(jobId: string, taskId: string, options?: ReactivateTaskOptionalParams): Promise; + rebootNode(poolId: string, nodeId: string, body?: NodeRebootOptions, options?: RebootNodeOptionalParams): Promise; + reimageNode(poolId: string, nodeId: string, body?: NodeReimageOptions, options?: ReimageNodeOptionalParams): Promise; + removeNodes(poolId: string, body: NodeRemoveOptions, options?: RemoveNodesOptionalParams): Promise; + replaceJob(jobId: string, body: BatchJob, options?: ReplaceJobOptionalParams): Promise; + replaceJobSchedule(jobScheduleId: string, body: BatchJobSchedule, options?: ReplaceJobScheduleOptionalParams): Promise; + replaceNodeUser(poolId: string, nodeId: string, userName: string, body: BatchNodeUserUpdateOptions, options?: ReplaceNodeUserOptionalParams): Promise; + replacePoolProperties(poolId: string, body: BatchPoolReplaceOptions, options?: ReplacePoolPropertiesOptionalParams): Promise; + replaceTask(jobId: string, taskId: string, body: BatchTask, options?: ReplaceTaskOptionalParams): Promise; + resizePool(poolId: string, body: BatchPoolResizeOptions, options?: ResizePoolOptionalParams): Promise; + stopPoolResize(poolId: string, options?: StopPoolResizeOptionalParams): Promise; + terminateJob(jobId: string, body?: BatchJobTerminateOptions, options?: TerminateJobOptionalParams): Promise; + terminateJobSchedule(jobScheduleId: string, options?: TerminateJobScheduleOptionalParams): Promise; + terminateTask(jobId: string, taskId: string, options?: TerminateTaskOptionalParams): Promise; + updateJob(jobId: string, body: BatchJobUpdateOptions, options?: UpdateJobOptionalParams): Promise; + updateJobSchedule(jobScheduleId: string, body: BatchJobScheduleUpdateOptions, options?: UpdateJobScheduleOptionalParams): Promise; + updatePool(poolId: string, body: BatchPoolUpdateOptions, options?: UpdatePoolOptionalParams): Promise; + uploadNodeLogs(poolId: string, nodeId: string, body: UploadBatchServiceLogsOptions, options?: UploadNodeLogsOptionalParams): Promise; } // @public (undocumented) @@ -367,8 +367,8 @@ export interface BatchNode { vmSize?: string; } -// @public -export type BatchNodeDeallocationOption = string; +// @public (undocumented) +export type BatchNodeDeallocationOption = "requeue" | "terminate" | "taskcompletion" | "retaineddata"; // @public export interface BatchNodeEndpointConfiguration { @@ -382,8 +382,8 @@ export interface BatchNodeError { message?: string; } -// @public -export type BatchNodeFillType = string; +// @public (undocumented) +export type BatchNodeFillType = "spread" | "pack"; // @public export interface BatchNodeIdentityReference { @@ -406,11 +406,11 @@ export interface BatchNodeListResult { value?: BatchNode[]; } -// @public -export type BatchNodeRebootOption = string; +// @public (undocumented) +export type BatchNodeRebootOption = "requeue" | "terminate" | "taskcompletion" | "retaineddata"; -// @public -export type BatchNodeReimageOption = string; +// @public (undocumented) +export type BatchNodeReimageOption = "requeue" | "terminate" | "taskcompletion" | "retaineddata"; // @public export interface BatchNodeRemoteLoginSettingsResult { @@ -418,8 +418,8 @@ export interface BatchNodeRemoteLoginSettingsResult { remoteLoginPort: number; } -// @public -export type BatchNodeState = string; +// @public (undocumented) +export type BatchNodeState = "idle" | "rebooting" | "reimaging" | "running" | "unusable" | "creating" | "starting" | "waitingforstarttask" | "starttaskfailed" | "unknown" | "leavingpool" | "offline" | "preempted"; // @public export interface BatchNodeUserCreateOptions { @@ -622,17 +622,17 @@ export interface BatchTaskListSubtasksResult { value?: SubtaskInformation[]; } -// @public -export type CachingType = string; +// @public (undocumented) +export type CachingType = "none" | "readonly" | "readwrite"; // @public (undocumented) -export interface CancelCertificateDeletionOptions extends OperationOptions { +export interface CancelCertificateDeletionOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } -// @public -export type CertificateFormat = string; +// @public (undocumented) +export type CertificateFormat = "pfx" | "cer"; // @public export interface CertificateListResult { @@ -649,14 +649,14 @@ export interface CertificateReference { visibility?: CertificateVisibility[]; } -// @public -export type CertificateState = string; +// @public (undocumented) +export type CertificateState = "active" | "deleting" | "deletefailed"; -// @public -export type CertificateStoreLocation = string; +// @public (undocumented) +export type CertificateStoreLocation = "currentuser" | "localmachine"; -// @public -export type CertificateVisibility = string; +// @public (undocumented) +export type CertificateVisibility = "starttask" | "task" | "remoteuser"; // @public export interface CifsMountConfiguration { @@ -688,11 +688,11 @@ export interface ContainerRegistry { username?: string; } -// @public -export type ContainerType = string; +// @public (undocumented) +export type ContainerType = "dockerCompatible" | "criCompatible"; -// @public -export type ContainerWorkingDirectory = string; +// @public (undocumented) +export type ContainerWorkingDirectory = "taskWorkingDirectory" | "containerImageDefault"; // @public export type ContinuablePage = TPage & { @@ -700,49 +700,49 @@ export type ContinuablePage = TPage & { }; // @public (undocumented) -export interface CreateCertificateOptions extends OperationOptions { +export interface CreateCertificateOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface CreateJobOptions extends OperationOptions { +export interface CreateJobOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface CreateJobScheduleOptions extends OperationOptions { +export interface CreateJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface CreateNodeUserOptions extends OperationOptions { +export interface CreateNodeUserOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface CreatePoolOptions extends OperationOptions { +export interface CreatePoolOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface CreateTaskCollectionOptions extends OperationOptions { +export interface CreateTaskCollectionOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface CreateTaskOptions extends OperationOptions { +export interface CreateTaskOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; @@ -764,13 +764,13 @@ export interface DeleteCertificateError { } // @public (undocumented) -export interface DeleteCertificateOptions extends OperationOptions { +export interface DeleteCertificateOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface DeleteJobOptions extends OperationOptions { +export interface DeleteJobOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -780,7 +780,7 @@ export interface DeleteJobOptions extends OperationOptions { } // @public (undocumented) -export interface DeleteJobScheduleOptions extends OperationOptions { +export interface DeleteJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -790,20 +790,20 @@ export interface DeleteJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface DeleteNodeFileOptions extends OperationOptions { +export interface DeleteNodeFileOptionalParams extends OperationOptions { apiVersion?: string; recursive?: boolean; timeOutInSeconds?: number; } // @public (undocumented) -export interface DeleteNodeUserOptions extends OperationOptions { +export interface DeleteNodeUserOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface DeletePoolOptions extends OperationOptions { +export interface DeletePoolOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -813,14 +813,14 @@ export interface DeletePoolOptions extends OperationOptions { } // @public (undocumented) -export interface DeleteTaskFileOptions extends OperationOptions { +export interface DeleteTaskFileOptionalParams extends OperationOptions { apiVersion?: string; recursive?: boolean; timeOutInSeconds?: number; } // @public (undocumented) -export interface DeleteTaskOptions extends OperationOptions { +export interface DeleteTaskOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -829,25 +829,25 @@ export interface DeleteTaskOptions extends OperationOptions { timeOutInSeconds?: number; } -// @public -export type DependencyAction = string; +// @public (undocumented) +export type DependencyAction = "satisfy" | "block"; -// @public -export type DiffDiskPlacement = string; +// @public (undocumented) +export type DiffDiskPlacement = "cachedisk"; // @public export interface DiffDiskSettings { placement?: DiffDiskPlacement; } -// @public -export type DisableBatchNodeSchedulingOption = string; +// @public (undocumented) +export type DisableBatchNodeSchedulingOption = "requeue" | "terminate" | "taskcompletion"; -// @public -export type DisableJobOption = string; +// @public (undocumented) +export type DisableJobOption = "requeue" | "terminate" | "wait"; // @public (undocumented) -export interface DisableJobOptions extends OperationOptions { +export interface DisableJobOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -858,7 +858,7 @@ export interface DisableJobOptions extends OperationOptions { } // @public (undocumented) -export interface DisableJobScheduleOptions extends OperationOptions { +export interface DisableJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -868,14 +868,14 @@ export interface DisableJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface DisableNodeSchedulingOptions extends OperationOptions { +export interface DisableNodeSchedulingOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface DisablePoolAutoScaleOptions extends OperationOptions { +export interface DisablePoolAutoScaleOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } @@ -885,17 +885,17 @@ export interface DiskEncryptionConfiguration { targets?: DiskEncryptionTarget[]; } -// @public -export type DiskEncryptionTarget = string; +// @public (undocumented) +export type DiskEncryptionTarget = "osdisk" | "temporarydisk"; -// @public -export type DynamicVNetAssignmentScope = string; +// @public (undocumented) +export type DynamicVNetAssignmentScope = "none" | "job"; -// @public -export type ElevationLevel = string; +// @public (undocumented) +export type ElevationLevel = "nonadmin" | "admin"; // @public (undocumented) -export interface EnableJobOptions extends OperationOptions { +export interface EnableJobOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -905,7 +905,7 @@ export interface EnableJobOptions extends OperationOptions { } // @public (undocumented) -export interface EnableJobScheduleOptions extends OperationOptions { +export interface EnableJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -915,13 +915,13 @@ export interface EnableJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface EnableNodeSchedulingOptions extends OperationOptions { +export interface EnableNodeSchedulingOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface EnablePoolAutoScaleOptions extends OperationOptions { +export interface EnablePoolAutoScaleOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -937,8 +937,8 @@ export interface EnvironmentSetting { value?: string; } -// @public -export type ErrorCategory = string; +// @public (undocumented) +export type ErrorCategory = "usererror" | "servererror"; // @public export interface ErrorMessage { @@ -947,7 +947,7 @@ export interface ErrorMessage { } // @public (undocumented) -export interface EvaluatePoolAutoScaleOptions extends OperationOptions { +export interface EvaluatePoolAutoScaleOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; @@ -991,20 +991,20 @@ export interface FileProperties { } // @public (undocumented) -export interface GetApplicationOptions extends OperationOptions { +export interface GetApplicationOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetCertificateOptions extends OperationOptions { +export interface GetCertificateOptionalParams extends OperationOptions { $select?: string[]; apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetJobOptions extends OperationOptions { +export interface GetJobOptionalParams extends OperationOptions { $expand?: string[]; $select?: string[]; apiVersion?: string; @@ -1016,7 +1016,7 @@ export interface GetJobOptions extends OperationOptions { } // @public (undocumented) -export interface GetJobScheduleOptions extends OperationOptions { +export interface GetJobScheduleOptionalParams extends OperationOptions { $expand?: string[]; $select?: string[]; apiVersion?: string; @@ -1028,20 +1028,20 @@ export interface GetJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface GetJobTaskCountsOptions extends OperationOptions { +export interface GetJobTaskCountsOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetNodeExtensionOptions extends OperationOptions { +export interface GetNodeExtensionOptionalParams extends OperationOptions { $select?: string[]; apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetNodeFileOptions extends OperationOptions { +export interface GetNodeFileOptionalParams extends OperationOptions { apiVersion?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; @@ -1050,7 +1050,7 @@ export interface GetNodeFileOptions extends OperationOptions { } // @public (undocumented) -export interface GetNodeFilePropertiesOptions extends OperationOptions { +export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { apiVersion?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; @@ -1058,26 +1058,26 @@ export interface GetNodeFilePropertiesOptions extends OperationOptions { } // @public (undocumented) -export interface GetNodeOptions extends OperationOptions { +export interface GetNodeOptionalParams extends OperationOptions { $select?: string[]; apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetNodeRemoteDesktopFileOptions extends OperationOptions { +export interface GetNodeRemoteDesktopFileOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetNodeRemoteLoginSettingsOptions extends OperationOptions { +export interface GetNodeRemoteLoginSettingsOptionalParams extends OperationOptions { apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface GetPoolOptions extends OperationOptions { +export interface GetPoolOptionalParams extends OperationOptions { $expand?: string[]; $select?: string[]; apiVersion?: string; @@ -1089,7 +1089,7 @@ export interface GetPoolOptions extends OperationOptions { } // @public (undocumented) -export interface GetTaskFileOptions extends OperationOptions { +export interface GetTaskFileOptionalParams extends OperationOptions { apiVersion?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; @@ -1098,7 +1098,7 @@ export interface GetTaskFileOptions extends OperationOptions { } // @public (undocumented) -export interface GetTaskFilePropertiesOptions extends OperationOptions { +export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { apiVersion?: string; ifModifiedSince?: Date; ifUnmodifiedSince?: Date; @@ -1106,7 +1106,7 @@ export interface GetTaskFilePropertiesOptions extends OperationOptions { } // @public (undocumented) -export interface GetTaskOptions extends OperationOptions { +export interface GetTaskOptionalParams extends OperationOptions { $expand?: string[]; $select?: string[]; apiVersion?: string; @@ -1153,8 +1153,8 @@ export interface InboundEndpoint { publicIpAddress?: string; } -// @public -export type InboundEndpointProtocol = string; +// @public (undocumented) +export type InboundEndpointProtocol = "tcp" | "udp"; // @public export interface InboundNATPool { @@ -1175,11 +1175,11 @@ export interface InstanceViewStatus { time?: string; } -// @public -export type IpAddressProvisioningType = string; +// @public (undocumented) +export type IpAddressProvisioningType = "batchmanaged" | "usermanaged" | "nopublicipaddresses"; -// @public -export type JobAction = string; +// @public (undocumented) +export type JobAction = "none" | "disable" | "terminate"; // @public export interface JobConstraints { @@ -1257,8 +1257,8 @@ export interface JobPreparationTaskExecutionInformation { taskRootDirectoryUrl?: string; } -// @public -export type JobPreparationTaskState = string; +// @public (undocumented) +export type JobPreparationTaskState = "running" | "completed"; // @public export interface JobReleaseTask { @@ -1285,8 +1285,8 @@ export interface JobReleaseTaskExecutionInformation { taskRootDirectoryUrl?: string; } -// @public -export type JobReleaseTaskState = string; +// @public (undocumented) +export type JobReleaseTaskState = "running" | "completed"; // @public export interface JobScheduleExecutionInformation { @@ -1296,7 +1296,7 @@ export interface JobScheduleExecutionInformation { } // @public (undocumented) -export interface JobScheduleExistsOptions extends OperationOptions { +export interface JobScheduleExistsOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -1305,8 +1305,8 @@ export interface JobScheduleExistsOptions extends OperationOptions { timeOutInSeconds?: number; } -// @public -export type JobScheduleState = string; +// @public (undocumented) +export type JobScheduleState = "active" | "completed" | "disabled" | "terminating" | "deleting"; // @public export interface JobScheduleStatistics { @@ -1353,8 +1353,8 @@ export interface JobSpecification { usesTaskDependencies?: boolean; } -// @public -export type JobState = string; +// @public (undocumented) +export type JobState = "active" | "disabling" | "disabled" | "enabling" | "terminating" | "completed" | "deleting"; // @public export interface JobStatistics { @@ -1382,14 +1382,14 @@ export interface LinuxUserConfiguration { } // @public (undocumented) -export interface ListApplicationsOptions extends OperationOptions { +export interface ListApplicationsOptionalParams extends OperationOptions { apiVersion?: string; maxresults?: number; timeOutInSeconds?: number; } // @public (undocumented) -export interface ListCertificatesOptions extends OperationOptions { +export interface ListCertificatesOptionalParams extends OperationOptions { $filter?: string; $select?: string[]; apiVersion?: string; @@ -1398,7 +1398,7 @@ export interface ListCertificatesOptions extends OperationOptions { } // @public (undocumented) -export interface ListJobPreparationAndReleaseTaskStatusOptions extends OperationOptions { +export interface ListJobPreparationAndReleaseTaskStatusOptionalParams extends OperationOptions { $filter?: string; $select?: string[]; maxresults?: number; @@ -1406,7 +1406,7 @@ export interface ListJobPreparationAndReleaseTaskStatusOptions extends Operation } // @public (undocumented) -export interface ListJobSchedulesOptions extends OperationOptions { +export interface ListJobSchedulesOptionalParams extends OperationOptions { $expand?: string[]; $filter?: string; $select?: string[]; @@ -1416,7 +1416,7 @@ export interface ListJobSchedulesOptions extends OperationOptions { } // @public (undocumented) -export interface ListJobsFromScheduleOptions extends OperationOptions { +export interface ListJobsFromScheduleOptionalParams extends OperationOptions { $expand?: string[]; $filter?: string; $select?: string[]; @@ -1426,7 +1426,7 @@ export interface ListJobsFromScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface ListJobsOptions extends OperationOptions { +export interface ListJobsOptionalParams extends OperationOptions { $expand?: string[]; $filter?: string; $select?: string[]; @@ -1436,14 +1436,14 @@ export interface ListJobsOptions extends OperationOptions { } // @public (undocumented) -export interface ListNodeExtensionsOptions extends OperationOptions { +export interface ListNodeExtensionsOptionalParams extends OperationOptions { $select?: string[]; maxresults?: number; timeOutInSeconds?: number; } // @public (undocumented) -export interface ListNodeFilesOptions extends OperationOptions { +export interface ListNodeFilesOptionalParams extends OperationOptions { $filter?: string; apiVersion?: string; maxresults?: number; @@ -1452,7 +1452,7 @@ export interface ListNodeFilesOptions extends OperationOptions { } // @public (undocumented) -export interface ListNodesOptions extends OperationOptions { +export interface ListNodesOptionalParams extends OperationOptions { $filter?: string; $select?: string[]; apiVersion?: string; @@ -1461,7 +1461,7 @@ export interface ListNodesOptions extends OperationOptions { } // @public (undocumented) -export interface ListPoolNodeCountsOptions extends OperationOptions { +export interface ListPoolNodeCountsOptionalParams extends OperationOptions { $filter?: string; apiVersion?: string; maxresults?: number; @@ -1469,7 +1469,7 @@ export interface ListPoolNodeCountsOptions extends OperationOptions { } // @public (undocumented) -export interface ListPoolsOptions extends OperationOptions { +export interface ListPoolsOptionalParams extends OperationOptions { $expand?: string[]; $filter?: string; $select?: string[]; @@ -1479,7 +1479,7 @@ export interface ListPoolsOptions extends OperationOptions { } // @public (undocumented) -export interface ListPoolUsageMetricsOptions extends OperationOptions { +export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { $filter?: string; apiVersion?: string; endtime?: Date; @@ -1489,21 +1489,21 @@ export interface ListPoolUsageMetricsOptions extends OperationOptions { } // @public (undocumented) -export interface ListSubTasksOptions extends OperationOptions { +export interface ListSubTasksOptionalParams extends OperationOptions { $select?: string[]; apiVersion?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface ListSupportedImagesOptions extends OperationOptions { +export interface ListSupportedImagesOptionalParams extends OperationOptions { $filter?: string; maxresults?: number; timeOutInSeconds?: number; } // @public (undocumented) -export interface ListTaskFilesOptions extends OperationOptions { +export interface ListTaskFilesOptionalParams extends OperationOptions { $filter?: string; apiVersion?: string; maxresults?: number; @@ -1512,7 +1512,7 @@ export interface ListTaskFilesOptions extends OperationOptions { } // @public (undocumented) -export interface ListTasksOptions extends OperationOptions { +export interface ListTasksOptionalParams extends OperationOptions { $expand?: string[]; $filter?: string; $select?: string[]; @@ -1521,8 +1521,8 @@ export interface ListTasksOptions extends OperationOptions { timeOutInSeconds?: number; } -// @public -export type LoginMode = string; +// @public (undocumented) +export type LoginMode = "batch" | "interactive"; // @public export interface MetadataItem { @@ -1568,8 +1568,8 @@ export interface NetworkSecurityGroupRule { sourcePortRanges?: string[]; } -// @public -export type NetworkSecurityGroupRuleAccess = string; +// @public (undocumented) +export type NetworkSecurityGroupRuleAccess = "allow" | "deny"; // @public export interface NfsMountConfiguration { @@ -1584,8 +1584,8 @@ export interface NodeAgentInformation { version: string; } -// @public -export type NodeCommunicationMode = string; +// @public (undocumented) +export type NodeCommunicationMode = "default" | "classic" | "simplified"; // @public export interface NodeCounts { @@ -1629,8 +1629,8 @@ export interface NodePlacementConfiguration { policy?: NodePlacementPolicyType; } -// @public -export type NodePlacementPolicyType = string; +// @public (undocumented) +export type NodePlacementPolicyType = "regional" | "zonal"; // @public export interface NodeRebootOptions { @@ -1662,19 +1662,19 @@ export interface NodeVMExtensionList { value?: NodeVMExtension[]; } -// @public -export type OnAllTasksComplete = string; +// @public (undocumented) +export type OnAllTasksComplete = "noaction" | "terminatejob"; -// @public -export type OnTaskFailure = string; +// @public (undocumented) +export type OnTaskFailure = "noaction" | "performexitoptionsjobaction"; // @public export interface OSDisk { ephemeralOSDiskSettings?: DiffDiskSettings; } -// @public -export type OSType = string; +// @public (undocumented) +export type OSType = "linux" | "windows"; // @public export interface OutputFile { @@ -1696,8 +1696,8 @@ export interface OutputFileDestination { container?: OutputFileBlobContainerDestination; } -// @public -export type OutputFileUploadCondition = string; +// @public (undocumented) +export type OutputFileUploadCondition = "tasksuccess" | "taskfailure" | "taskcompletion"; // @public export interface OutputFileUploadOptions { @@ -1722,7 +1722,7 @@ export interface PoolEndpointConfiguration { } // @public (undocumented) -export interface PoolExistsOptions extends OperationOptions { +export interface PoolExistsOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -1731,8 +1731,8 @@ export interface PoolExistsOptions extends OperationOptions { timeOutInSeconds?: number; } -// @public -export type PoolIdentityType = string; +// @public (undocumented) +export type PoolIdentityType = "UserAssigned" | "None"; // @public export interface PoolInformation { @@ -1740,8 +1740,8 @@ export interface PoolInformation { poolId?: string; } -// @public -export type PoolLifetimeOption = string; +// @public (undocumented) +export type PoolLifetimeOption = "jobschedule" | "job"; // @public export interface PoolListUsageMetricsResult { @@ -1788,8 +1788,8 @@ export interface PoolSpecification { vmSize: string; } -// @public -export type PoolState = string; +// @public (undocumented) +export type PoolState = "active" | "deleting"; // @public export interface PoolStatistics { @@ -1816,7 +1816,7 @@ export interface PublicIpAddressConfiguration { } // @public (undocumented) -export interface ReactivateTaskOptions extends OperationOptions { +export interface ReactivateTaskOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -1826,7 +1826,7 @@ export interface ReactivateTaskOptions extends OperationOptions { } // @public (undocumented) -export interface RebootNodeOptions extends OperationOptions { +export interface RebootNodeOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; @@ -1839,14 +1839,14 @@ export interface RecentJob { } // @public (undocumented) -export interface ReimageNodeOptions extends OperationOptions { +export interface ReimageNodeOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface RemoveNodesOptions extends OperationOptions { +export interface RemoveNodesOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -1857,7 +1857,7 @@ export interface RemoveNodesOptions extends OperationOptions { } // @public (undocumented) -export interface ReplaceJobOptions extends OperationOptions { +export interface ReplaceJobOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -1868,7 +1868,7 @@ export interface ReplaceJobOptions extends OperationOptions { } // @public (undocumented) -export interface ReplaceJobScheduleOptions extends OperationOptions { +export interface ReplaceJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -1879,21 +1879,21 @@ export interface ReplaceJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface ReplaceNodeUserOptions extends OperationOptions { +export interface ReplaceNodeUserOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface ReplacePoolPropertiesOptions extends OperationOptions { +export interface ReplacePoolPropertiesOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; } // @public (undocumented) -export interface ReplaceTaskOptions extends OperationOptions { +export interface ReplaceTaskOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -1911,7 +1911,7 @@ export interface ResizeError { } // @public (undocumented) -export interface ResizePoolOptions extends OperationOptions { +export interface ResizePoolOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -1957,8 +1957,8 @@ export interface Schedule { startWindow?: string; } -// @public -export type SchedulingState = string; +// @public (undocumented) +export type SchedulingState = "enabled" | "disabled"; // @public export interface StartTask { @@ -1984,14 +1984,14 @@ export interface StartTaskInformation { state: StartTaskState; } -// @public -export type StartTaskState = string; +// @public (undocumented) +export type StartTaskState = "running" | "completed"; -// @public -export type StatusLevelTypes = string; +// @public (undocumented) +export type StatusLevelTypes = "Error" | "Info" | "Warning"; // @public (undocumented) -export interface StopPoolResizeOptions extends OperationOptions { +export interface StopPoolResizeOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -2000,8 +2000,8 @@ export interface StopPoolResizeOptions extends OperationOptions { timeOutInSeconds?: number; } -// @public -export type StorageAccountType = string; +// @public (undocumented) +export type StorageAccountType = "standard_lrs" | "premium_lrs"; // @public export interface SubtaskInformation { @@ -2019,8 +2019,8 @@ export interface SubtaskInformation { stateTransitionTime?: Date; } -// @public -export type SubtaskState = string; +// @public (undocumented) +export type SubtaskState = "preparing" | "running" | "completed"; // @public export interface TaskAddCollectionResult { @@ -2037,8 +2037,8 @@ export interface TaskAddResult { taskId: string; } -// @public -export type TaskAddStatus = string; +// @public (undocumented) +export type TaskAddStatus = "Success" | "clienterror" | "servererror"; // @public export interface TaskConstraints { @@ -2097,8 +2097,8 @@ export interface TaskExecutionInformation { startTime?: Date; } -// @public -export type TaskExecutionResult = string; +// @public (undocumented) +export type TaskExecutionResult = "success" | "failure"; // @public export interface TaskFailureInformation { @@ -2138,8 +2138,8 @@ export interface TaskSlotCounts { succeeded: number; } -// @public -export type TaskState = string; +// @public (undocumented) +export type TaskState = "active" | "preparing" | "running" | "completed"; // @public export interface TaskStatistics { @@ -2157,7 +2157,7 @@ export interface TaskStatistics { } // @public (undocumented) -export interface TerminateJobOptions extends OperationOptions { +export interface TerminateJobOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -2168,7 +2168,7 @@ export interface TerminateJobOptions extends OperationOptions { } // @public (undocumented) -export interface TerminateJobScheduleOptions extends OperationOptions { +export interface TerminateJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -2178,7 +2178,7 @@ export interface TerminateJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface TerminateTaskOptions extends OperationOptions { +export interface TerminateTaskOptionalParams extends OperationOptions { apiVersion?: string; ifMatch?: string; ifModifiedSince?: Date; @@ -2188,7 +2188,7 @@ export interface TerminateTaskOptions extends OperationOptions { } // @public (undocumented) -export interface UpdateJobOptions extends OperationOptions { +export interface UpdateJobOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -2199,7 +2199,7 @@ export interface UpdateJobOptions extends OperationOptions { } // @public (undocumented) -export interface UpdateJobScheduleOptions extends OperationOptions { +export interface UpdateJobScheduleOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -2210,7 +2210,7 @@ export interface UpdateJobScheduleOptions extends OperationOptions { } // @public (undocumented) -export interface UpdatePoolOptions extends OperationOptions { +export interface UpdatePoolOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; ifMatch?: string; @@ -2235,7 +2235,7 @@ export interface UploadBatchServiceLogsResult { } // @public (undocumented) -export interface UploadNodeLogsOptions extends OperationOptions { +export interface UploadNodeLogsOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; timeOutInSeconds?: number; @@ -2270,8 +2270,11 @@ export interface UserIdentity { username?: string; } -// @public -export type VerificationType = string; +// @public (undocumented) +export type VerificationType = "verified" | "unverified"; + +// @public (undocumented) +export type Versions = "2023-05-01.17.0"; // @public export interface VirtualMachineConfiguration { diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/BatchContext.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts similarity index 86% rename from packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/BatchContext.ts rename to packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts index 8efec31c2a..f5bc92bd2d 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/BatchContext.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/batchContext.ts @@ -12,10 +12,10 @@ export { BatchContext } from "../rest/index.js"; /** Azure Batch provides Cloud-scale job scheduling and compute management. */ export function createBatch( - endpoint: string, + endpointParam: string, credential: TokenCredential, options: BatchClientOptions = {}, ): BatchContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts index cfc770d76f..92a7f8fd6d 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createBatch, BatchClientOptions, BatchContext, -} from "./BatchContext.js"; +} from "./batchContext.js"; export { listApplications, getApplication, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts index e781004327..fa22a6ad86 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/api/operations.ts @@ -223,87 +223,87 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util"; import { - ListApplicationsOptions, - GetApplicationOptions, - ListPoolUsageMetricsOptions, - CreatePoolOptions, - ListPoolsOptions, - DeletePoolOptions, - PoolExistsOptions, - GetPoolOptions, - UpdatePoolOptions, - DisablePoolAutoScaleOptions, - EnablePoolAutoScaleOptions, - EvaluatePoolAutoScaleOptions, - ResizePoolOptions, - StopPoolResizeOptions, - ReplacePoolPropertiesOptions, - RemoveNodesOptions, - ListSupportedImagesOptions, - ListPoolNodeCountsOptions, - DeleteJobOptions, - GetJobOptions, - UpdateJobOptions, - ReplaceJobOptions, - DisableJobOptions, - EnableJobOptions, - TerminateJobOptions, - CreateJobOptions, - ListJobsOptions, - ListJobsFromScheduleOptions, - ListJobPreparationAndReleaseTaskStatusOptions, - GetJobTaskCountsOptions, - CreateCertificateOptions, - ListCertificatesOptions, - CancelCertificateDeletionOptions, - DeleteCertificateOptions, - GetCertificateOptions, - JobScheduleExistsOptions, - DeleteJobScheduleOptions, - GetJobScheduleOptions, - UpdateJobScheduleOptions, - ReplaceJobScheduleOptions, - DisableJobScheduleOptions, - EnableJobScheduleOptions, - TerminateJobScheduleOptions, - CreateJobScheduleOptions, - ListJobSchedulesOptions, - CreateTaskOptions, - ListTasksOptions, - CreateTaskCollectionOptions, - DeleteTaskOptions, - GetTaskOptions, - ReplaceTaskOptions, - ListSubTasksOptions, - TerminateTaskOptions, - ReactivateTaskOptions, - DeleteTaskFileOptions, - GetTaskFileOptions, - GetTaskFilePropertiesOptions, - ListTaskFilesOptions, - CreateNodeUserOptions, - DeleteNodeUserOptions, - ReplaceNodeUserOptions, - GetNodeOptions, - RebootNodeOptions, - ReimageNodeOptions, - DisableNodeSchedulingOptions, - EnableNodeSchedulingOptions, - GetNodeRemoteLoginSettingsOptions, - GetNodeRemoteDesktopFileOptions, - UploadNodeLogsOptions, - ListNodesOptions, - GetNodeExtensionOptions, - ListNodeExtensionsOptions, - DeleteNodeFileOptions, - GetNodeFileOptions, - GetNodeFilePropertiesOptions, - ListNodeFilesOptions, + ListApplicationsOptionalParams, + GetApplicationOptionalParams, + ListPoolUsageMetricsOptionalParams, + CreatePoolOptionalParams, + ListPoolsOptionalParams, + DeletePoolOptionalParams, + PoolExistsOptionalParams, + GetPoolOptionalParams, + UpdatePoolOptionalParams, + DisablePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + ResizePoolOptionalParams, + StopPoolResizeOptionalParams, + ReplacePoolPropertiesOptionalParams, + RemoveNodesOptionalParams, + ListSupportedImagesOptionalParams, + ListPoolNodeCountsOptionalParams, + DeleteJobOptionalParams, + GetJobOptionalParams, + UpdateJobOptionalParams, + ReplaceJobOptionalParams, + DisableJobOptionalParams, + EnableJobOptionalParams, + TerminateJobOptionalParams, + CreateJobOptionalParams, + ListJobsOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + GetJobTaskCountsOptionalParams, + CreateCertificateOptionalParams, + ListCertificatesOptionalParams, + CancelCertificateDeletionOptionalParams, + DeleteCertificateOptionalParams, + GetCertificateOptionalParams, + JobScheduleExistsOptionalParams, + DeleteJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + CreateJobScheduleOptionalParams, + ListJobSchedulesOptionalParams, + CreateTaskOptionalParams, + ListTasksOptionalParams, + CreateTaskCollectionOptionalParams, + DeleteTaskOptionalParams, + GetTaskOptionalParams, + ReplaceTaskOptionalParams, + ListSubTasksOptionalParams, + TerminateTaskOptionalParams, + ReactivateTaskOptionalParams, + DeleteTaskFileOptionalParams, + GetTaskFileOptionalParams, + GetTaskFilePropertiesOptionalParams, + ListTaskFilesOptionalParams, + CreateNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + ReplaceNodeUserOptionalParams, + GetNodeOptionalParams, + RebootNodeOptionalParams, + ReimageNodeOptionalParams, + DisableNodeSchedulingOptionalParams, + EnableNodeSchedulingOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + UploadNodeLogsOptionalParams, + ListNodesOptionalParams, + GetNodeExtensionOptionalParams, + ListNodeExtensionsOptionalParams, + DeleteNodeFileOptionalParams, + GetNodeFileOptionalParams, + GetNodeFilePropertiesOptionalParams, + ListNodeFilesOptionalParams, } from "../models/options.js"; export function _listApplicationsSend( context: Client, - options: ListApplicationsOptions = { requestOptions: {} }, + options: ListApplicationsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListApplications200Response | ListApplicationsDefaultResponse > { @@ -348,7 +348,7 @@ export async function _listApplicationsDeserialize( */ export function listApplications( context: Client, - options: ListApplicationsOptions = { requestOptions: {} }, + options: ListApplicationsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -361,7 +361,7 @@ export function listApplications( export function _getApplicationSend( context: Client, applicationId: string, - options: GetApplicationOptions = { requestOptions: {} }, + options: GetApplicationOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/applications/{applicationId}", applicationId) @@ -398,7 +398,7 @@ export async function _getApplicationDeserialize( export async function getApplication( context: Client, applicationId: string, - options: GetApplicationOptions = { requestOptions: {} }, + options: GetApplicationOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getApplicationSend(context, applicationId, options); return _getApplicationDeserialize(result); @@ -406,7 +406,7 @@ export async function getApplication( export function _listPoolUsageMetricsSend( context: Client, - options: ListPoolUsageMetricsOptions = { requestOptions: {} }, + options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListPoolUsageMetrics200Response | ListPoolUsageMetricsDefaultResponse > { @@ -457,7 +457,7 @@ export async function _listPoolUsageMetricsDeserialize( */ export function listPoolUsageMetrics( context: Client, - options: ListPoolUsageMetricsOptions = { requestOptions: {} }, + options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -470,7 +470,7 @@ export function listPoolUsageMetrics( export function _createPoolSend( context: Client, body: BatchPoolCreateOptions, - options: CreatePoolOptions = { requestOptions: {} }, + options: CreatePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools") @@ -872,7 +872,7 @@ export async function _createPoolDeserialize( export async function createPool( context: Client, body: BatchPoolCreateOptions, - options: CreatePoolOptions = { requestOptions: {} }, + options: CreatePoolOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createPoolSend(context, body, options); return _createPoolDeserialize(result); @@ -880,7 +880,7 @@ export async function createPool( export function _listPoolsSend( context: Client, - options: ListPoolsOptions = { requestOptions: {} }, + options: ListPoolsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools") @@ -1424,7 +1424,7 @@ export async function _listPoolsDeserialize( /** Lists all of the Pools in the specified Account. */ export function listPools( context: Client, - options: ListPoolsOptions = { requestOptions: {} }, + options: ListPoolsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -1437,7 +1437,7 @@ export function listPools( export function _deletePoolSend( context: Client, poolId: string, - options: DeletePoolOptions = { requestOptions: {} }, + options: DeletePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}", poolId) @@ -1491,7 +1491,7 @@ export async function _deletePoolDeserialize( export async function deletePool( context: Client, poolId: string, - options: DeletePoolOptions = { requestOptions: {} }, + options: DeletePoolOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deletePoolSend(context, poolId, options); return _deletePoolDeserialize(result); @@ -1500,7 +1500,7 @@ export async function deletePool( export function _poolExistsSend( context: Client, poolId: string, - options: PoolExistsOptions = { requestOptions: {} }, + options: PoolExistsOptionalParams = { requestOptions: {} }, ): StreamableMethod< PoolExists200Response | PoolExists404Response | PoolExistsDefaultResponse > { @@ -1546,7 +1546,7 @@ export async function _poolExistsDeserialize( export async function poolExists( context: Client, poolId: string, - options: PoolExistsOptions = { requestOptions: {} }, + options: PoolExistsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _poolExistsSend(context, poolId, options); return _poolExistsDeserialize(result); @@ -1555,7 +1555,7 @@ export async function poolExists( export function _getPoolSend( context: Client, poolId: string, - options: GetPoolOptions = { requestOptions: {} }, + options: GetPoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}", poolId) @@ -2082,7 +2082,7 @@ export async function _getPoolDeserialize( export async function getPool( context: Client, poolId: string, - options: GetPoolOptions = { requestOptions: {} }, + options: GetPoolOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getPoolSend(context, poolId, options); return _getPoolDeserialize(result); @@ -2092,7 +2092,7 @@ export function _updatePoolSend( context: Client, poolId: string, body: BatchPoolUpdateOptions, - options: UpdatePoolOptions = { requestOptions: {} }, + options: UpdatePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}", poolId) @@ -2246,7 +2246,7 @@ export async function updatePool( context: Client, poolId: string, body: BatchPoolUpdateOptions, - options: UpdatePoolOptions = { requestOptions: {} }, + options: UpdatePoolOptionalParams = { requestOptions: {} }, ): Promise { const result = await _updatePoolSend(context, poolId, body, options); return _updatePoolDeserialize(result); @@ -2255,7 +2255,7 @@ export async function updatePool( export function _disablePoolAutoScaleSend( context: Client, poolId: string, - options: DisablePoolAutoScaleOptions = { requestOptions: {} }, + options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): StreamableMethod< DisablePoolAutoScale200Response | DisablePoolAutoScaleDefaultResponse > { @@ -2284,7 +2284,7 @@ export async function _disablePoolAutoScaleDeserialize( export async function disablePoolAutoScale( context: Client, poolId: string, - options: DisablePoolAutoScaleOptions = { requestOptions: {} }, + options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _disablePoolAutoScaleSend(context, poolId, options); return _disablePoolAutoScaleDeserialize(result); @@ -2294,7 +2294,7 @@ export function _enablePoolAutoScaleSend( context: Client, poolId: string, body: BatchPoolEnableAutoScaleOptions, - options: EnablePoolAutoScaleOptions = { requestOptions: {} }, + options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): StreamableMethod< EnablePoolAutoScale200Response | EnablePoolAutoScaleDefaultResponse > { @@ -2352,7 +2352,7 @@ export async function enablePoolAutoScale( context: Client, poolId: string, body: BatchPoolEnableAutoScaleOptions, - options: EnablePoolAutoScaleOptions = { requestOptions: {} }, + options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enablePoolAutoScaleSend(context, poolId, body, options); return _enablePoolAutoScaleDeserialize(result); @@ -2362,7 +2362,7 @@ export function _evaluatePoolAutoScaleSend( context: Client, poolId: string, body: BatchPoolEvaluateAutoScaleOptions, - options: EvaluatePoolAutoScaleOptions = { requestOptions: {} }, + options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, ): StreamableMethod< EvaluatePoolAutoScale200Response | EvaluatePoolAutoScaleDefaultResponse > { @@ -2418,7 +2418,7 @@ export async function evaluatePoolAutoScale( context: Client, poolId: string, body: BatchPoolEvaluateAutoScaleOptions, - options: EvaluatePoolAutoScaleOptions = { requestOptions: {} }, + options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _evaluatePoolAutoScaleSend( context, @@ -2433,7 +2433,7 @@ export function _resizePoolSend( context: Client, poolId: string, body: BatchPoolResizeOptions, - options: ResizePoolOptions = { requestOptions: {} }, + options: ResizePoolOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/resize", poolId) @@ -2492,7 +2492,7 @@ export async function resizePool( context: Client, poolId: string, body: BatchPoolResizeOptions, - options: ResizePoolOptions = { requestOptions: {} }, + options: ResizePoolOptionalParams = { requestOptions: {} }, ): Promise { const result = await _resizePoolSend(context, poolId, body, options); return _resizePoolDeserialize(result); @@ -2501,7 +2501,7 @@ export async function resizePool( export function _stopPoolResizeSend( context: Client, poolId: string, - options: StopPoolResizeOptions = { requestOptions: {} }, + options: StopPoolResizeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/stopresize", poolId) @@ -2550,7 +2550,7 @@ export async function _stopPoolResizeDeserialize( export async function stopPoolResize( context: Client, poolId: string, - options: StopPoolResizeOptions = { requestOptions: {} }, + options: StopPoolResizeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stopPoolResizeSend(context, poolId, options); return _stopPoolResizeDeserialize(result); @@ -2560,7 +2560,7 @@ export function _replacePoolPropertiesSend( context: Client, poolId: string, body: BatchPoolReplaceOptions, - options: ReplacePoolPropertiesOptions = { requestOptions: {} }, + options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, ): StreamableMethod< ReplacePoolProperties204Response | ReplacePoolPropertiesDefaultResponse > { @@ -2694,7 +2694,7 @@ export async function replacePoolProperties( context: Client, poolId: string, body: BatchPoolReplaceOptions, - options: ReplacePoolPropertiesOptions = { requestOptions: {} }, + options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, ): Promise { const result = await _replacePoolPropertiesSend( context, @@ -2709,7 +2709,7 @@ export function _removeNodesSend( context: Client, poolId: string, body: NodeRemoveOptions, - options: RemoveNodesOptions = { requestOptions: {} }, + options: RemoveNodesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/removenodes", poolId) @@ -2763,7 +2763,7 @@ export async function removeNodes( context: Client, poolId: string, body: NodeRemoveOptions, - options: RemoveNodesOptions = { requestOptions: {} }, + options: RemoveNodesOptionalParams = { requestOptions: {} }, ): Promise { const result = await _removeNodesSend(context, poolId, body, options); return _removeNodesDeserialize(result); @@ -2771,7 +2771,7 @@ export async function removeNodes( export function _listSupportedImagesSend( context: Client, - options: ListSupportedImagesOptions = { requestOptions: {} }, + options: ListSupportedImagesOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListSupportedImages200Response | ListSupportedImagesDefaultResponse > { @@ -2823,7 +2823,7 @@ export async function _listSupportedImagesDeserialize( /** Lists all Virtual Machine Images supported by the Azure Batch service. */ export function listSupportedImages( context: Client, - options: ListSupportedImagesOptions = { requestOptions: {} }, + options: ListSupportedImagesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -2835,7 +2835,7 @@ export function listSupportedImages( export function _listPoolNodeCountsSend( context: Client, - options: ListPoolNodeCountsOptions = { requestOptions: {} }, + options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListPoolNodeCounts200Response | ListPoolNodeCountsDefaultResponse > { @@ -2913,7 +2913,7 @@ export async function _listPoolNodeCountsDeserialize( */ export function listPoolNodeCounts( context: Client, - options: ListPoolNodeCountsOptions = { requestOptions: {} }, + options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -2926,7 +2926,7 @@ export function listPoolNodeCounts( export function _deleteJobSend( context: Client, jobId: string, - options: DeleteJobOptions = { requestOptions: {} }, + options: DeleteJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}", jobId) @@ -2976,7 +2976,7 @@ export async function _deleteJobDeserialize( export async function deleteJob( context: Client, jobId: string, - options: DeleteJobOptions = { requestOptions: {} }, + options: DeleteJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteJobSend(context, jobId, options); return _deleteJobDeserialize(result); @@ -2985,7 +2985,7 @@ export async function deleteJob( export function _getJobSend( context: Client, jobId: string, - options: GetJobOptions = { requestOptions: {} }, + options: GetJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}", jobId) @@ -4072,7 +4072,7 @@ export async function _getJobDeserialize( export async function getJob( context: Client, jobId: string, - options: GetJobOptions = { requestOptions: {} }, + options: GetJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getJobSend(context, jobId, options); return _getJobDeserialize(result); @@ -4082,7 +4082,7 @@ export function _updateJobSend( context: Client, jobId: string, body: BatchJobUpdateOptions, - options: UpdateJobOptions = { requestOptions: {} }, + options: UpdateJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}", jobId) @@ -4836,7 +4836,7 @@ export async function updateJob( context: Client, jobId: string, body: BatchJobUpdateOptions, - options: UpdateJobOptions = { requestOptions: {} }, + options: UpdateJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _updateJobSend(context, jobId, body, options); return _updateJobDeserialize(result); @@ -4846,7 +4846,7 @@ export function _replaceJobSend( context: Client, jobId: string, body: BatchJob, - options: ReplaceJobOptions = { requestOptions: {} }, + options: ReplaceJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}", jobId) @@ -5544,7 +5544,7 @@ export async function replaceJob( context: Client, jobId: string, body: BatchJob, - options: ReplaceJobOptions = { requestOptions: {} }, + options: ReplaceJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _replaceJobSend(context, jobId, body, options); return _replaceJobDeserialize(result); @@ -5554,7 +5554,7 @@ export function _disableJobSend( context: Client, jobId: string, body: BatchJobDisableOptions, - options: DisableJobOptions = { requestOptions: {} }, + options: DisableJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/disable", jobId) @@ -5609,7 +5609,7 @@ export async function disableJob( context: Client, jobId: string, body: BatchJobDisableOptions, - options: DisableJobOptions = { requestOptions: {} }, + options: DisableJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _disableJobSend(context, jobId, body, options); return _disableJobDeserialize(result); @@ -5618,7 +5618,7 @@ export async function disableJob( export function _enableJobSend( context: Client, jobId: string, - options: EnableJobOptions = { requestOptions: {} }, + options: EnableJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/enable", jobId) @@ -5666,7 +5666,7 @@ export async function _enableJobDeserialize( export async function enableJob( context: Client, jobId: string, - options: EnableJobOptions = { requestOptions: {} }, + options: EnableJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enableJobSend(context, jobId, options); return _enableJobDeserialize(result); @@ -5676,7 +5676,7 @@ export function _terminateJobSend( context: Client, jobId: string, body?: BatchJobTerminateOptions, - options: TerminateJobOptions = { requestOptions: {} }, + options: TerminateJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/terminate", jobId) @@ -5732,7 +5732,7 @@ export async function terminateJob( context: Client, jobId: string, body?: BatchJobTerminateOptions, - options: TerminateJobOptions = { requestOptions: {} }, + options: TerminateJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _terminateJobSend(context, jobId, body, options); return _terminateJobDeserialize(result); @@ -5741,7 +5741,7 @@ export async function terminateJob( export function _createJobSend( context: Client, body: BatchJobCreateOptions, - options: CreateJobOptions = { requestOptions: {} }, + options: CreateJobOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs") @@ -6784,7 +6784,7 @@ export async function _createJobDeserialize( export async function createJob( context: Client, body: BatchJobCreateOptions, - options: CreateJobOptions = { requestOptions: {} }, + options: CreateJobOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createJobSend(context, body, options); return _createJobDeserialize(result); @@ -6792,7 +6792,7 @@ export async function createJob( export function _listJobsSend( context: Client, - options: ListJobsOptions = { requestOptions: {} }, + options: ListJobsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs") @@ -7959,7 +7959,7 @@ export async function _listJobsDeserialize( /** Lists all of the Jobs in the specified Account. */ export function listJobs( context: Client, - options: ListJobsOptions = { requestOptions: {} }, + options: ListJobsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -7972,7 +7972,7 @@ export function listJobs( export function _listJobsFromScheduleSend( context: Client, jobScheduleId: string, - options: ListJobsFromScheduleOptions = { requestOptions: {} }, + options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListJobsFromSchedule200Response | ListJobsFromScheduleDefaultResponse > { @@ -9142,7 +9142,7 @@ export async function _listJobsFromScheduleDeserialize( export function listJobsFromSchedule( context: Client, jobScheduleId: string, - options: ListJobsFromScheduleOptions = { requestOptions: {} }, + options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -9155,7 +9155,7 @@ export function listJobsFromSchedule( export function _listJobPreparationAndReleaseTaskStatusSend( context: Client, jobId: string, - options: ListJobPreparationAndReleaseTaskStatusOptions = { + options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { requestOptions: {}, }, ): StreamableMethod< @@ -9341,7 +9341,7 @@ export async function _listJobPreparationAndReleaseTaskStatusDeserialize( export function listJobPreparationAndReleaseTaskStatus( context: Client, jobId: string, - options: ListJobPreparationAndReleaseTaskStatusOptions = { + options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { requestOptions: {}, }, ): PagedAsyncIterableIterator { @@ -9356,7 +9356,7 @@ export function listJobPreparationAndReleaseTaskStatus( export function _getJobTaskCountsSend( context: Client, jobId: string, - options: GetJobTaskCountsOptions = { requestOptions: {} }, + options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetJobTaskCounts200Response | GetJobTaskCountsDefaultResponse > { @@ -9405,7 +9405,7 @@ export async function _getJobTaskCountsDeserialize( export async function getJobTaskCounts( context: Client, jobId: string, - options: GetJobTaskCountsOptions = { requestOptions: {} }, + options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getJobTaskCountsSend(context, jobId, options); return _getJobTaskCountsDeserialize(result); @@ -9414,7 +9414,7 @@ export async function getJobTaskCounts( export function _createCertificateSend( context: Client, body: BatchCertificate, - options: CreateCertificateOptions = { requestOptions: {} }, + options: CreateCertificateOptionalParams = { requestOptions: {} }, ): StreamableMethod< CreateCertificate201Response | CreateCertificateDefaultResponse > { @@ -9453,7 +9453,7 @@ export async function _createCertificateDeserialize( export async function createCertificate( context: Client, body: BatchCertificate, - options: CreateCertificateOptions = { requestOptions: {} }, + options: CreateCertificateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createCertificateSend(context, body, options); return _createCertificateDeserialize(result); @@ -9461,7 +9461,7 @@ export async function createCertificate( export function _listCertificatesSend( context: Client, - options: ListCertificatesOptions = { requestOptions: {} }, + options: ListCertificatesOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListCertificates200Response | ListCertificatesDefaultResponse > { @@ -9535,7 +9535,7 @@ export async function _listCertificatesDeserialize( /** Lists all of the Certificates that have been added to the specified Account. */ export function listCertificates( context: Client, - options: ListCertificatesOptions = { requestOptions: {} }, + options: ListCertificatesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -9549,7 +9549,7 @@ export function _cancelCertificateDeletionSend( context: Client, thumbprintAlgorithm: string, thumbprint: string, - options: CancelCertificateDeletionOptions = { requestOptions: {} }, + options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, ): StreamableMethod< | CancelCertificateDeletion204Response | CancelCertificateDeletionDefaultResponse @@ -9594,7 +9594,7 @@ export async function cancelCertificateDeletion( context: Client, thumbprintAlgorithm: string, thumbprint: string, - options: CancelCertificateDeletionOptions = { requestOptions: {} }, + options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _cancelCertificateDeletionSend( context, @@ -9609,7 +9609,7 @@ export function _deleteCertificateSend( context: Client, thumbprintAlgorithm: string, thumbprint: string, - options: DeleteCertificateOptions = { requestOptions: {} }, + options: DeleteCertificateOptionalParams = { requestOptions: {} }, ): StreamableMethod< DeleteCertificate202Response | DeleteCertificateDefaultResponse > { @@ -9653,7 +9653,7 @@ export async function deleteCertificate( context: Client, thumbprintAlgorithm: string, thumbprint: string, - options: DeleteCertificateOptions = { requestOptions: {} }, + options: DeleteCertificateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteCertificateSend( context, @@ -9668,7 +9668,7 @@ export function _getCertificateSend( context: Client, thumbprintAlgorithm: string, thumbprint: string, - options: GetCertificateOptions = { requestOptions: {} }, + options: GetCertificateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -9738,7 +9738,7 @@ export async function getCertificate( context: Client, thumbprintAlgorithm: string, thumbprint: string, - options: GetCertificateOptions = { requestOptions: {} }, + options: GetCertificateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getCertificateSend( context, @@ -9752,7 +9752,7 @@ export async function getCertificate( export function _jobScheduleExistsSend( context: Client, jobScheduleId: string, - options: JobScheduleExistsOptions = { requestOptions: {} }, + options: JobScheduleExistsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | JobScheduleExists200Response | JobScheduleExists404Response @@ -9800,7 +9800,7 @@ export async function _jobScheduleExistsDeserialize( export async function jobScheduleExists( context: Client, jobScheduleId: string, - options: JobScheduleExistsOptions = { requestOptions: {} }, + options: JobScheduleExistsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _jobScheduleExistsSend(context, jobScheduleId, options); return _jobScheduleExistsDeserialize(result); @@ -9809,7 +9809,7 @@ export async function jobScheduleExists( export function _deleteJobScheduleSend( context: Client, jobScheduleId: string, - options: DeleteJobScheduleOptions = { requestOptions: {} }, + options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< DeleteJobSchedule202Response | DeleteJobScheduleDefaultResponse > { @@ -9858,7 +9858,7 @@ export async function _deleteJobScheduleDeserialize( export async function deleteJobSchedule( context: Client, jobScheduleId: string, - options: DeleteJobScheduleOptions = { requestOptions: {} }, + options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteJobScheduleSend(context, jobScheduleId, options); return _deleteJobScheduleDeserialize(result); @@ -9867,7 +9867,7 @@ export async function deleteJobSchedule( export function _getJobScheduleSend( context: Client, jobScheduleId: string, - options: GetJobScheduleOptions = { requestOptions: {} }, + options: GetJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobschedules/{jobScheduleId}", jobScheduleId) @@ -11100,7 +11100,7 @@ export async function _getJobScheduleDeserialize( export async function getJobSchedule( context: Client, jobScheduleId: string, - options: GetJobScheduleOptions = { requestOptions: {} }, + options: GetJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getJobScheduleSend(context, jobScheduleId, options); return _getJobScheduleDeserialize(result); @@ -11110,7 +11110,7 @@ export function _updateJobScheduleSend( context: Client, jobScheduleId: string, body: BatchJobScheduleUpdateOptions, - options: UpdateJobScheduleOptions = { requestOptions: {} }, + options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< UpdateJobSchedule200Response | UpdateJobScheduleDefaultResponse > { @@ -12424,7 +12424,7 @@ export async function updateJobSchedule( context: Client, jobScheduleId: string, body: BatchJobScheduleUpdateOptions, - options: UpdateJobScheduleOptions = { requestOptions: {} }, + options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _updateJobScheduleSend( context, @@ -12439,7 +12439,7 @@ export function _replaceJobScheduleSend( context: Client, jobScheduleId: string, body: BatchJobSchedule, - options: ReplaceJobScheduleOptions = { requestOptions: {} }, + options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< ReplaceJobSchedule200Response | ReplaceJobScheduleDefaultResponse > { @@ -13645,7 +13645,7 @@ export async function replaceJobSchedule( context: Client, jobScheduleId: string, body: BatchJobSchedule, - options: ReplaceJobScheduleOptions = { requestOptions: {} }, + options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _replaceJobScheduleSend( context, @@ -13659,7 +13659,7 @@ export async function replaceJobSchedule( export function _disableJobScheduleSend( context: Client, jobScheduleId: string, - options: DisableJobScheduleOptions = { requestOptions: {} }, + options: DisableJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< DisableJobSchedule204Response | DisableJobScheduleDefaultResponse > { @@ -13702,7 +13702,7 @@ export async function _disableJobScheduleDeserialize( export async function disableJobSchedule( context: Client, jobScheduleId: string, - options: DisableJobScheduleOptions = { requestOptions: {} }, + options: DisableJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _disableJobScheduleSend(context, jobScheduleId, options); return _disableJobScheduleDeserialize(result); @@ -13711,7 +13711,7 @@ export async function disableJobSchedule( export function _enableJobScheduleSend( context: Client, jobScheduleId: string, - options: EnableJobScheduleOptions = { requestOptions: {} }, + options: EnableJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< EnableJobSchedule204Response | EnableJobScheduleDefaultResponse > { @@ -13754,7 +13754,7 @@ export async function _enableJobScheduleDeserialize( export async function enableJobSchedule( context: Client, jobScheduleId: string, - options: EnableJobScheduleOptions = { requestOptions: {} }, + options: EnableJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enableJobScheduleSend(context, jobScheduleId, options); return _enableJobScheduleDeserialize(result); @@ -13763,7 +13763,7 @@ export async function enableJobSchedule( export function _terminateJobScheduleSend( context: Client, jobScheduleId: string, - options: TerminateJobScheduleOptions = { requestOptions: {} }, + options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< TerminateJobSchedule202Response | TerminateJobScheduleDefaultResponse > { @@ -13806,7 +13806,7 @@ export async function _terminateJobScheduleDeserialize( export async function terminateJobSchedule( context: Client, jobScheduleId: string, - options: TerminateJobScheduleOptions = { requestOptions: {} }, + options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _terminateJobScheduleSend( context, @@ -13819,7 +13819,7 @@ export async function terminateJobSchedule( export function _createJobScheduleSend( context: Client, body: BatchJobScheduleCreateOptions, - options: CreateJobScheduleOptions = { requestOptions: {} }, + options: CreateJobScheduleOptionalParams = { requestOptions: {} }, ): StreamableMethod< CreateJobSchedule201Response | CreateJobScheduleDefaultResponse > { @@ -15006,7 +15006,7 @@ export async function _createJobScheduleDeserialize( export async function createJobSchedule( context: Client, body: BatchJobScheduleCreateOptions, - options: CreateJobScheduleOptions = { requestOptions: {} }, + options: CreateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createJobScheduleSend(context, body, options); return _createJobScheduleDeserialize(result); @@ -15014,7 +15014,7 @@ export async function createJobSchedule( export function _listJobSchedulesSend( context: Client, - options: ListJobSchedulesOptions = { requestOptions: {} }, + options: ListJobSchedulesOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListJobSchedules200Response | ListJobSchedulesDefaultResponse > { @@ -16337,7 +16337,7 @@ export async function _listJobSchedulesDeserialize( /** Lists all of the Job Schedules in the specified Account. */ export function listJobSchedules( context: Client, - options: ListJobSchedulesOptions = { requestOptions: {} }, + options: ListJobSchedulesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -16351,7 +16351,7 @@ export function _createTaskSend( context: Client, jobId: string, body: BatchTaskCreateOptions, - options: CreateTaskOptions = { requestOptions: {} }, + options: CreateTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks", jobId) @@ -16591,7 +16591,7 @@ export async function createTask( context: Client, jobId: string, body: BatchTaskCreateOptions, - options: CreateTaskOptions = { requestOptions: {} }, + options: CreateTaskOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createTaskSend(context, jobId, body, options); return _createTaskDeserialize(result); @@ -16600,7 +16600,7 @@ export async function createTask( export function _listTasksSend( context: Client, jobId: string, - options: ListTasksOptions = { requestOptions: {} }, + options: ListTasksOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks", jobId) @@ -16943,7 +16943,7 @@ export async function _listTasksDeserialize( export function listTasks( context: Client, jobId: string, - options: ListTasksOptions = { requestOptions: {} }, + options: ListTasksOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -16957,7 +16957,7 @@ export function _createTaskCollectionSend( context: Client, jobId: string, collection: BatchTaskCollection, - options: CreateTaskCollectionOptions = { requestOptions: {} }, + options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, ): StreamableMethod< CreateTaskCollection200Response | CreateTaskCollectionDefaultResponse > { @@ -17248,7 +17248,7 @@ export async function createTaskCollection( context: Client, jobId: string, collection: BatchTaskCollection, - options: CreateTaskCollectionOptions = { requestOptions: {} }, + options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createTaskCollectionSend( context, @@ -17263,7 +17263,7 @@ export function _deleteTaskSend( context: Client, jobId: string, taskId: string, - options: DeleteTaskOptions = { requestOptions: {} }, + options: DeleteTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) @@ -17311,7 +17311,7 @@ export async function deleteTask( context: Client, jobId: string, taskId: string, - options: DeleteTaskOptions = { requestOptions: {} }, + options: DeleteTaskOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteTaskSend(context, jobId, taskId, options); return _deleteTaskDeserialize(result); @@ -17321,7 +17321,7 @@ export function _getTaskSend( context: Client, jobId: string, taskId: string, - options: GetTaskOptions = { requestOptions: {} }, + options: GetTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) @@ -17663,7 +17663,7 @@ export async function getTask( context: Client, jobId: string, taskId: string, - options: GetTaskOptions = { requestOptions: {} }, + options: GetTaskOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTaskSend(context, jobId, taskId, options); return _getTaskDeserialize(result); @@ -17674,7 +17674,7 @@ export function _replaceTaskSend( jobId: string, taskId: string, body: BatchTask, - options: ReplaceTaskOptions = { requestOptions: {} }, + options: ReplaceTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}", jobId, taskId) @@ -17729,7 +17729,7 @@ export async function replaceTask( jobId: string, taskId: string, body: BatchTask, - options: ReplaceTaskOptions = { requestOptions: {} }, + options: ReplaceTaskOptionalParams = { requestOptions: {} }, ): Promise { const result = await _replaceTaskSend(context, jobId, taskId, body, options); return _replaceTaskDeserialize(result); @@ -17739,7 +17739,7 @@ export function _listSubTasksSend( context: Client, jobId: string, taskId: string, - options: ListSubTasksOptions = { requestOptions: {} }, + options: ListSubTasksOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}/subtasksinfo", jobId, taskId) @@ -17824,7 +17824,7 @@ export async function listSubTasks( context: Client, jobId: string, taskId: string, - options: ListSubTasksOptions = { requestOptions: {} }, + options: ListSubTasksOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSubTasksSend(context, jobId, taskId, options); return _listSubTasksDeserialize(result); @@ -17834,7 +17834,7 @@ export function _terminateTaskSend( context: Client, jobId: string, taskId: string, - options: TerminateTaskOptions = { requestOptions: {} }, + options: TerminateTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}/terminate", jobId, taskId) @@ -17880,7 +17880,7 @@ export async function terminateTask( context: Client, jobId: string, taskId: string, - options: TerminateTaskOptions = { requestOptions: {} }, + options: TerminateTaskOptionalParams = { requestOptions: {} }, ): Promise { const result = await _terminateTaskSend(context, jobId, taskId, options); return _terminateTaskDeserialize(result); @@ -17890,7 +17890,7 @@ export function _reactivateTaskSend( context: Client, jobId: string, taskId: string, - options: ReactivateTaskOptions = { requestOptions: {} }, + options: ReactivateTaskOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}/reactivate", jobId, taskId) @@ -17940,7 +17940,7 @@ export async function reactivateTask( context: Client, jobId: string, taskId: string, - options: ReactivateTaskOptions = { requestOptions: {} }, + options: ReactivateTaskOptionalParams = { requestOptions: {} }, ): Promise { const result = await _reactivateTaskSend(context, jobId, taskId, options); return _reactivateTaskDeserialize(result); @@ -17951,7 +17951,7 @@ export function _deleteTaskFileSend( jobId: string, taskId: string, filePath: string, - options: DeleteTaskFileOptions = { requestOptions: {} }, + options: DeleteTaskFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -17986,7 +17986,7 @@ export async function deleteTaskFile( jobId: string, taskId: string, filePath: string, - options: DeleteTaskFileOptions = { requestOptions: {} }, + options: DeleteTaskFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteTaskFileSend( context, @@ -18003,7 +18003,7 @@ export function _getTaskFileSend( jobId: string, taskId: string, filePath: string, - options: GetTaskFileOptions = { requestOptions: {} }, + options: GetTaskFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -18048,7 +18048,7 @@ export async function getTaskFile( jobId: string, taskId: string, filePath: string, - options: GetTaskFileOptions = { requestOptions: {} }, + options: GetTaskFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTaskFileSend( context, @@ -18065,7 +18065,7 @@ export function _getTaskFilePropertiesSend( jobId: string, taskId: string, filePath: string, - options: GetTaskFilePropertiesOptions = { requestOptions: {} }, + options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetTaskFileProperties200Response | GetTaskFilePropertiesDefaultResponse > { @@ -18111,7 +18111,7 @@ export async function getTaskFileProperties( jobId: string, taskId: string, filePath: string, - options: GetTaskFilePropertiesOptions = { requestOptions: {} }, + options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTaskFilePropertiesSend( context, @@ -18127,7 +18127,7 @@ export function _listTaskFilesSend( context: Client, jobId: string, taskId: string, - options: ListTaskFilesOptions = { requestOptions: {} }, + options: ListTaskFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/jobs/{jobId}/tasks/{taskId}/files", jobId, taskId) @@ -18180,7 +18180,7 @@ export function listTaskFiles( context: Client, jobId: string, taskId: string, - options: ListTaskFilesOptions = { requestOptions: {} }, + options: ListTaskFilesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -18195,7 +18195,7 @@ export function _createNodeUserSend( poolId: string, nodeId: string, body: BatchNodeUserCreateOptions, - options: CreateNodeUserOptions = { requestOptions: {} }, + options: CreateNodeUserOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/nodes/{nodeId}/users", poolId, nodeId) @@ -18237,7 +18237,7 @@ export async function createNodeUser( poolId: string, nodeId: string, body: BatchNodeUserCreateOptions, - options: CreateNodeUserOptions = { requestOptions: {} }, + options: CreateNodeUserOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createNodeUserSend( context, @@ -18254,7 +18254,7 @@ export function _deleteNodeUserSend( poolId: string, nodeId: string, userName: string, - options: DeleteNodeUserOptions = { requestOptions: {} }, + options: DeleteNodeUserOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -18291,7 +18291,7 @@ export async function deleteNodeUser( poolId: string, nodeId: string, userName: string, - options: DeleteNodeUserOptions = { requestOptions: {} }, + options: DeleteNodeUserOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteNodeUserSend( context, @@ -18309,7 +18309,7 @@ export function _replaceNodeUserSend( nodeId: string, userName: string, body: BatchNodeUserUpdateOptions, - options: ReplaceNodeUserOptions = { requestOptions: {} }, + options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, ): StreamableMethod< ReplaceNodeUser200Response | ReplaceNodeUserDefaultResponse > { @@ -18359,7 +18359,7 @@ export async function replaceNodeUser( nodeId: string, userName: string, body: BatchNodeUserUpdateOptions, - options: ReplaceNodeUserOptions = { requestOptions: {} }, + options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, ): Promise { const result = await _replaceNodeUserSend( context, @@ -18376,7 +18376,7 @@ export function _getNodeSend( context: Client, poolId: string, nodeId: string, - options: GetNodeOptions = { requestOptions: {} }, + options: GetNodeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/nodes/{nodeId}", poolId, nodeId) @@ -18677,7 +18677,7 @@ export async function getNode( context: Client, poolId: string, nodeId: string, - options: GetNodeOptions = { requestOptions: {} }, + options: GetNodeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getNodeSend(context, poolId, nodeId, options); return _getNodeDeserialize(result); @@ -18688,7 +18688,7 @@ export function _rebootNodeSend( poolId: string, nodeId: string, body?: NodeRebootOptions, - options: RebootNodeOptions = { requestOptions: {} }, + options: RebootNodeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/nodes/{nodeId}/reboot", poolId, nodeId) @@ -18724,7 +18724,7 @@ export async function rebootNode( poolId: string, nodeId: string, body?: NodeRebootOptions, - options: RebootNodeOptions = { requestOptions: {} }, + options: RebootNodeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _rebootNodeSend(context, poolId, nodeId, body, options); return _rebootNodeDeserialize(result); @@ -18735,7 +18735,7 @@ export function _reimageNodeSend( poolId: string, nodeId: string, body?: NodeReimageOptions, - options: ReimageNodeOptions = { requestOptions: {} }, + options: ReimageNodeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/nodes/{nodeId}/reimage", poolId, nodeId) @@ -18775,7 +18775,7 @@ export async function reimageNode( poolId: string, nodeId: string, body?: NodeReimageOptions, - options: ReimageNodeOptions = { requestOptions: {} }, + options: ReimageNodeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _reimageNodeSend(context, poolId, nodeId, body, options); return _reimageNodeDeserialize(result); @@ -18786,7 +18786,7 @@ export function _disableNodeSchedulingSend( poolId: string, nodeId: string, body?: NodeDisableSchedulingOptions, - options: DisableNodeSchedulingOptions = { requestOptions: {} }, + options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, ): StreamableMethod< DisableNodeScheduling200Response | DisableNodeSchedulingDefaultResponse > { @@ -18831,7 +18831,7 @@ export async function disableNodeScheduling( poolId: string, nodeId: string, body?: NodeDisableSchedulingOptions, - options: DisableNodeSchedulingOptions = { requestOptions: {} }, + options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { const result = await _disableNodeSchedulingSend( context, @@ -18847,7 +18847,7 @@ export function _enableNodeSchedulingSend( context: Client, poolId: string, nodeId: string, - options: EnableNodeSchedulingOptions = { requestOptions: {} }, + options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, ): StreamableMethod< EnableNodeScheduling200Response | EnableNodeSchedulingDefaultResponse > { @@ -18880,7 +18880,7 @@ export async function enableNodeScheduling( context: Client, poolId: string, nodeId: string, - options: EnableNodeSchedulingOptions = { requestOptions: {} }, + options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enableNodeSchedulingSend( context, @@ -18895,7 +18895,7 @@ export function _getNodeRemoteLoginSettingsSend( context: Client, poolId: string, nodeId: string, - options: GetNodeRemoteLoginSettingsOptions = { requestOptions: {} }, + options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | GetNodeRemoteLoginSettings200Response | GetNodeRemoteLoginSettingsDefaultResponse @@ -18937,7 +18937,7 @@ export async function getNodeRemoteLoginSettings( context: Client, poolId: string, nodeId: string, - options: GetNodeRemoteLoginSettingsOptions = { requestOptions: {} }, + options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getNodeRemoteLoginSettingsSend( context, @@ -18952,7 +18952,7 @@ export function _getNodeRemoteDesktopFileSend( context: Client, poolId: string, nodeId: string, - options: GetNodeRemoteDesktopFileOptions = { requestOptions: {} }, + options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetNodeRemoteDesktopFile200Response | GetNodeRemoteDesktopFileDefaultResponse > { @@ -18991,7 +18991,7 @@ export async function getNodeRemoteDesktopFile( context: Client, poolId: string, nodeId: string, - options: GetNodeRemoteDesktopFileOptions = { requestOptions: {} }, + options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getNodeRemoteDesktopFileSend( context, @@ -19007,7 +19007,7 @@ export function _uploadNodeLogsSend( poolId: string, nodeId: string, body: UploadBatchServiceLogsOptions, - options: UploadNodeLogsOptions = { requestOptions: {} }, + options: UploadNodeLogsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -19059,7 +19059,7 @@ export async function uploadNodeLogs( poolId: string, nodeId: string, body: UploadBatchServiceLogsOptions, - options: UploadNodeLogsOptions = { requestOptions: {} }, + options: UploadNodeLogsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _uploadNodeLogsSend( context, @@ -19074,7 +19074,7 @@ export async function uploadNodeLogs( export function _listNodesSend( context: Client, poolId: string, - options: ListNodesOptions = { requestOptions: {} }, + options: ListNodesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/nodes", poolId) @@ -19387,7 +19387,7 @@ export async function _listNodesDeserialize( export function listNodes( context: Client, poolId: string, - options: ListNodesOptions = { requestOptions: {} }, + options: ListNodesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -19402,7 +19402,7 @@ export function _getNodeExtensionSend( poolId: string, nodeId: string, extensionName: string, - options: GetNodeExtensionOptions = { requestOptions: {} }, + options: GetNodeExtensionOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetNodeExtension200Response | GetNodeExtensionDefaultResponse > { @@ -19482,7 +19482,7 @@ export async function getNodeExtension( poolId: string, nodeId: string, extensionName: string, - options: GetNodeExtensionOptions = { requestOptions: {} }, + options: GetNodeExtensionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getNodeExtensionSend( context, @@ -19498,7 +19498,7 @@ export function _listNodeExtensionsSend( context: Client, poolId: string, nodeId: string, - options: ListNodeExtensionsOptions = { requestOptions: {} }, + options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListNodeExtensions200Response | ListNodeExtensionsDefaultResponse > { @@ -19578,7 +19578,7 @@ export function listNodeExtensions( context: Client, poolId: string, nodeId: string, - options: ListNodeExtensionsOptions = { requestOptions: {} }, + options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -19593,7 +19593,7 @@ export function _deleteNodeFileSend( poolId: string, nodeId: string, filePath: string, - options: DeleteNodeFileOptions = { requestOptions: {} }, + options: DeleteNodeFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -19628,7 +19628,7 @@ export async function deleteNodeFile( poolId: string, nodeId: string, filePath: string, - options: DeleteNodeFileOptions = { requestOptions: {} }, + options: DeleteNodeFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteNodeFileSend( context, @@ -19645,7 +19645,7 @@ export function _getNodeFileSend( poolId: string, nodeId: string, filePath: string, - options: GetNodeFileOptions = { requestOptions: {} }, + options: GetNodeFileOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -19692,7 +19692,7 @@ export async function getNodeFile( poolId: string, nodeId: string, filePath: string, - options: GetNodeFileOptions = { requestOptions: {} }, + options: GetNodeFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getNodeFileSend( context, @@ -19709,7 +19709,7 @@ export function _getNodeFilePropertiesSend( poolId: string, nodeId: string, filePath: string, - options: GetNodeFilePropertiesOptions = { requestOptions: {} }, + options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetNodeFileProperties200Response | GetNodeFilePropertiesDefaultResponse > { @@ -19755,7 +19755,7 @@ export async function getNodeFileProperties( poolId: string, nodeId: string, filePath: string, - options: GetNodeFilePropertiesOptions = { requestOptions: {} }, + options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getNodeFilePropertiesSend( context, @@ -19771,7 +19771,7 @@ export function _listNodeFilesSend( context: Client, poolId: string, nodeId: string, - options: ListNodeFilesOptions = { requestOptions: {} }, + options: ListNodeFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/pools/{poolId}/nodes/{nodeId}/files", poolId, nodeId) @@ -19824,7 +19824,7 @@ export function listNodeFiles( context: Client, poolId: string, nodeId: string, - options: ListNodeFilesOptions = { requestOptions: {} }, + options: ListNodeFilesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/BatchClient.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts similarity index 81% rename from packages/typespec-test/test/batch_modular/generated/typespec-ts/src/BatchClient.ts rename to packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts index cfe6d5d067..5d38dfbe7e 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/BatchClient.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/batchClient.ts @@ -46,82 +46,82 @@ import { BatchApplication, } from "./models/models.js"; import { - ListApplicationsOptions, - GetApplicationOptions, - ListPoolUsageMetricsOptions, - CreatePoolOptions, - ListPoolsOptions, - DeletePoolOptions, - PoolExistsOptions, - GetPoolOptions, - UpdatePoolOptions, - DisablePoolAutoScaleOptions, - EnablePoolAutoScaleOptions, - EvaluatePoolAutoScaleOptions, - ResizePoolOptions, - StopPoolResizeOptions, - ReplacePoolPropertiesOptions, - RemoveNodesOptions, - ListSupportedImagesOptions, - ListPoolNodeCountsOptions, - DeleteJobOptions, - GetJobOptions, - UpdateJobOptions, - ReplaceJobOptions, - DisableJobOptions, - EnableJobOptions, - TerminateJobOptions, - CreateJobOptions, - ListJobsOptions, - ListJobsFromScheduleOptions, - ListJobPreparationAndReleaseTaskStatusOptions, - GetJobTaskCountsOptions, - CreateCertificateOptions, - ListCertificatesOptions, - CancelCertificateDeletionOptions, - DeleteCertificateOptions, - GetCertificateOptions, - JobScheduleExistsOptions, - DeleteJobScheduleOptions, - GetJobScheduleOptions, - UpdateJobScheduleOptions, - ReplaceJobScheduleOptions, - DisableJobScheduleOptions, - EnableJobScheduleOptions, - TerminateJobScheduleOptions, - CreateJobScheduleOptions, - ListJobSchedulesOptions, - CreateTaskOptions, - ListTasksOptions, - CreateTaskCollectionOptions, - DeleteTaskOptions, - GetTaskOptions, - ReplaceTaskOptions, - ListSubTasksOptions, - TerminateTaskOptions, - ReactivateTaskOptions, - DeleteTaskFileOptions, - GetTaskFileOptions, - GetTaskFilePropertiesOptions, - ListTaskFilesOptions, - CreateNodeUserOptions, - DeleteNodeUserOptions, - ReplaceNodeUserOptions, - GetNodeOptions, - RebootNodeOptions, - ReimageNodeOptions, - DisableNodeSchedulingOptions, - EnableNodeSchedulingOptions, - GetNodeRemoteLoginSettingsOptions, - GetNodeRemoteDesktopFileOptions, - UploadNodeLogsOptions, - ListNodesOptions, - GetNodeExtensionOptions, - ListNodeExtensionsOptions, - DeleteNodeFileOptions, - GetNodeFileOptions, - GetNodeFilePropertiesOptions, - ListNodeFilesOptions, + ListApplicationsOptionalParams, + GetApplicationOptionalParams, + ListPoolUsageMetricsOptionalParams, + CreatePoolOptionalParams, + ListPoolsOptionalParams, + DeletePoolOptionalParams, + PoolExistsOptionalParams, + GetPoolOptionalParams, + UpdatePoolOptionalParams, + DisablePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + ResizePoolOptionalParams, + StopPoolResizeOptionalParams, + ReplacePoolPropertiesOptionalParams, + RemoveNodesOptionalParams, + ListSupportedImagesOptionalParams, + ListPoolNodeCountsOptionalParams, + DeleteJobOptionalParams, + GetJobOptionalParams, + UpdateJobOptionalParams, + ReplaceJobOptionalParams, + DisableJobOptionalParams, + EnableJobOptionalParams, + TerminateJobOptionalParams, + CreateJobOptionalParams, + ListJobsOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + GetJobTaskCountsOptionalParams, + CreateCertificateOptionalParams, + ListCertificatesOptionalParams, + CancelCertificateDeletionOptionalParams, + DeleteCertificateOptionalParams, + GetCertificateOptionalParams, + JobScheduleExistsOptionalParams, + DeleteJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + CreateJobScheduleOptionalParams, + ListJobSchedulesOptionalParams, + CreateTaskOptionalParams, + ListTasksOptionalParams, + CreateTaskCollectionOptionalParams, + DeleteTaskOptionalParams, + GetTaskOptionalParams, + ReplaceTaskOptionalParams, + ListSubTasksOptionalParams, + TerminateTaskOptionalParams, + ReactivateTaskOptionalParams, + DeleteTaskFileOptionalParams, + GetTaskFileOptionalParams, + GetTaskFilePropertiesOptionalParams, + ListTaskFilesOptionalParams, + CreateNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + ReplaceNodeUserOptionalParams, + GetNodeOptionalParams, + RebootNodeOptionalParams, + ReimageNodeOptionalParams, + DisableNodeSchedulingOptionalParams, + EnableNodeSchedulingOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + UploadNodeLogsOptionalParams, + ListNodesOptionalParams, + GetNodeExtensionOptionalParams, + ListNodeExtensionsOptionalParams, + DeleteNodeFileOptionalParams, + GetNodeFileOptionalParams, + GetNodeFilePropertiesOptionalParams, + ListNodeFilesOptionalParams, } from "./models/options.js"; import { PagedAsyncIterableIterator } from "./models/pagingTypes.js"; import { @@ -206,7 +206,7 @@ import { listNodeFiles, } from "./api/index.js"; -export { BatchClientOptions } from "./api/BatchContext.js"; +export { BatchClientOptions } from "./api/batchContext.js"; export class BatchClient { private _client: BatchContext; @@ -215,11 +215,11 @@ export class BatchClient { /** Azure Batch provides Cloud-scale job scheduling and compute management. */ constructor( - endpoint: string, + endpointParam: string, credential: TokenCredential, options: BatchClientOptions = {}, ) { - this._client = createBatch(endpoint, credential, options); + this._client = createBatch(endpointParam, credential, options); this.pipeline = this._client.pipeline; } @@ -231,7 +231,7 @@ export class BatchClient { * API. */ listApplications( - options: ListApplicationsOptions = { requestOptions: {} }, + options: ListApplicationsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listApplications(this._client, options); } @@ -245,7 +245,7 @@ export class BatchClient { */ getApplication( applicationId: string, - options: GetApplicationOptions = { requestOptions: {} }, + options: GetApplicationOptionalParams = { requestOptions: {} }, ): Promise { return getApplication(this._client, applicationId, options); } @@ -259,7 +259,7 @@ export class BatchClient { * last aggregation interval is returned. */ listPoolUsageMetrics( - options: ListPoolUsageMetricsOptions = { requestOptions: {} }, + options: ListPoolUsageMetricsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listPoolUsageMetrics(this._client, options); } @@ -271,14 +271,14 @@ export class BatchClient { */ createPool( body: BatchPoolCreateOptions, - options: CreatePoolOptions = { requestOptions: {} }, + options: CreatePoolOptionalParams = { requestOptions: {} }, ): Promise { return createPool(this._client, body, options); } /** Lists all of the Pools in the specified Account. */ listPools( - options: ListPoolsOptions = { requestOptions: {} }, + options: ListPoolsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listPools(this._client, options); } @@ -299,7 +299,7 @@ export class BatchClient { */ deletePool( poolId: string, - options: DeletePoolOptions = { requestOptions: {} }, + options: DeletePoolOptionalParams = { requestOptions: {} }, ): Promise { return deletePool(this._client, poolId, options); } @@ -307,7 +307,7 @@ export class BatchClient { /** Gets basic properties of a Pool. */ poolExists( poolId: string, - options: PoolExistsOptions = { requestOptions: {} }, + options: PoolExistsOptionalParams = { requestOptions: {} }, ): Promise { return poolExists(this._client, poolId, options); } @@ -315,7 +315,7 @@ export class BatchClient { /** Gets information about the specified Pool. */ getPool( poolId: string, - options: GetPoolOptions = { requestOptions: {} }, + options: GetPoolOptionalParams = { requestOptions: {} }, ): Promise { return getPool(this._client, poolId, options); } @@ -328,7 +328,7 @@ export class BatchClient { updatePool( poolId: string, body: BatchPoolUpdateOptions, - options: UpdatePoolOptions = { requestOptions: {} }, + options: UpdatePoolOptionalParams = { requestOptions: {} }, ): Promise { return updatePool(this._client, poolId, body, options); } @@ -336,7 +336,7 @@ export class BatchClient { /** Disables automatic scaling for a Pool. */ disablePoolAutoScale( poolId: string, - options: DisablePoolAutoScaleOptions = { requestOptions: {} }, + options: DisablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): Promise { return disablePoolAutoScale(this._client, poolId, options); } @@ -352,7 +352,7 @@ export class BatchClient { enablePoolAutoScale( poolId: string, body: BatchPoolEnableAutoScaleOptions, - options: EnablePoolAutoScaleOptions = { requestOptions: {} }, + options: EnablePoolAutoScaleOptionalParams = { requestOptions: {} }, ): Promise { return enablePoolAutoScale(this._client, poolId, body, options); } @@ -365,7 +365,7 @@ export class BatchClient { evaluatePoolAutoScale( poolId: string, body: BatchPoolEvaluateAutoScaleOptions, - options: EvaluatePoolAutoScaleOptions = { requestOptions: {} }, + options: EvaluatePoolAutoScaleOptionalParams = { requestOptions: {} }, ): Promise { return evaluatePoolAutoScale(this._client, poolId, body, options); } @@ -382,7 +382,7 @@ export class BatchClient { resizePool( poolId: string, body: BatchPoolResizeOptions, - options: ResizePoolOptions = { requestOptions: {} }, + options: ResizePoolOptionalParams = { requestOptions: {} }, ): Promise { return resizePool(this._client, poolId, body, options); } @@ -398,7 +398,7 @@ export class BatchClient { */ stopPoolResize( poolId: string, - options: StopPoolResizeOptions = { requestOptions: {} }, + options: StopPoolResizeOptionalParams = { requestOptions: {} }, ): Promise { return stopPoolResize(this._client, poolId, options); } @@ -411,7 +411,7 @@ export class BatchClient { replacePoolProperties( poolId: string, body: BatchPoolReplaceOptions, - options: ReplacePoolPropertiesOptions = { requestOptions: {} }, + options: ReplacePoolPropertiesOptionalParams = { requestOptions: {} }, ): Promise { return replacePoolProperties(this._client, poolId, body, options); } @@ -424,14 +424,14 @@ export class BatchClient { removeNodes( poolId: string, body: NodeRemoveOptions, - options: RemoveNodesOptions = { requestOptions: {} }, + options: RemoveNodesOptionalParams = { requestOptions: {} }, ): Promise { return removeNodes(this._client, poolId, body, options); } /** Lists all Virtual Machine Images supported by the Azure Batch service. */ listSupportedImages( - options: ListSupportedImagesOptions = { requestOptions: {} }, + options: ListSupportedImagesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listSupportedImages(this._client, options); } @@ -442,7 +442,7 @@ export class BatchClient { * use a list query. */ listPoolNodeCounts( - options: ListPoolNodeCountsOptions = { requestOptions: {} }, + options: ListPoolNodeCountsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listPoolNodeCounts(this._client, options); } @@ -459,7 +459,7 @@ export class BatchClient { */ deleteJob( jobId: string, - options: DeleteJobOptions = { requestOptions: {} }, + options: DeleteJobOptionalParams = { requestOptions: {} }, ): Promise { return deleteJob(this._client, jobId, options); } @@ -467,7 +467,7 @@ export class BatchClient { /** Gets information about the specified Job. */ getJob( jobId: string, - options: GetJobOptions = { requestOptions: {} }, + options: GetJobOptionalParams = { requestOptions: {} }, ): Promise { return getJob(this._client, jobId, options); } @@ -480,7 +480,7 @@ export class BatchClient { updateJob( jobId: string, body: BatchJobUpdateOptions, - options: UpdateJobOptions = { requestOptions: {} }, + options: UpdateJobOptionalParams = { requestOptions: {} }, ): Promise { return updateJob(this._client, jobId, body, options); } @@ -493,7 +493,7 @@ export class BatchClient { replaceJob( jobId: string, body: BatchJob, - options: ReplaceJobOptions = { requestOptions: {} }, + options: ReplaceJobOptionalParams = { requestOptions: {} }, ): Promise { return replaceJob(this._client, jobId, body, options); } @@ -511,7 +511,7 @@ export class BatchClient { disableJob( jobId: string, body: BatchJobDisableOptions, - options: DisableJobOptions = { requestOptions: {} }, + options: DisableJobOptionalParams = { requestOptions: {} }, ): Promise { return disableJob(this._client, jobId, body, options); } @@ -526,7 +526,7 @@ export class BatchClient { */ enableJob( jobId: string, - options: EnableJobOptions = { requestOptions: {} }, + options: EnableJobOptionalParams = { requestOptions: {} }, ): Promise { return enableJob(this._client, jobId, options); } @@ -542,7 +542,7 @@ export class BatchClient { terminateJob( jobId: string, body?: BatchJobTerminateOptions, - options: TerminateJobOptions = { requestOptions: {} }, + options: TerminateJobOptionalParams = { requestOptions: {} }, ): Promise { return terminateJob(this._client, jobId, body, options); } @@ -560,14 +560,14 @@ export class BatchClient { */ createJob( body: BatchJobCreateOptions, - options: CreateJobOptions = { requestOptions: {} }, + options: CreateJobOptionalParams = { requestOptions: {} }, ): Promise { return createJob(this._client, body, options); } /** Lists all of the Jobs in the specified Account. */ listJobs( - options: ListJobsOptions = { requestOptions: {} }, + options: ListJobsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listJobs(this._client, options); } @@ -575,7 +575,7 @@ export class BatchClient { /** Lists the Jobs that have been created under the specified Job Schedule. */ listJobsFromSchedule( jobScheduleId: string, - options: ListJobsFromScheduleOptions = { requestOptions: {} }, + options: ListJobsFromScheduleOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listJobsFromSchedule(this._client, jobScheduleId, options); } @@ -590,7 +590,7 @@ export class BatchClient { */ listJobPreparationAndReleaseTaskStatus( jobId: string, - options: ListJobPreparationAndReleaseTaskStatusOptions = { + options: ListJobPreparationAndReleaseTaskStatusOptionalParams = { requestOptions: {}, }, ): PagedAsyncIterableIterator { @@ -605,7 +605,7 @@ export class BatchClient { */ getJobTaskCounts( jobId: string, - options: GetJobTaskCountsOptions = { requestOptions: {} }, + options: GetJobTaskCountsOptionalParams = { requestOptions: {} }, ): Promise { return getJobTaskCounts(this._client, jobId, options); } @@ -613,14 +613,14 @@ export class BatchClient { /** Creates a Certificate to the specified Account. */ createCertificate( body: BatchCertificate, - options: CreateCertificateOptions = { requestOptions: {} }, + options: CreateCertificateOptionalParams = { requestOptions: {} }, ): Promise { return createCertificate(this._client, body, options); } /** Lists all of the Certificates that have been added to the specified Account. */ listCertificates( - options: ListCertificatesOptions = { requestOptions: {} }, + options: ListCertificatesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listCertificates(this._client, options); } @@ -637,7 +637,7 @@ export class BatchClient { cancelCertificateDeletion( thumbprintAlgorithm: string, thumbprint: string, - options: CancelCertificateDeletionOptions = { requestOptions: {} }, + options: CancelCertificateDeletionOptionalParams = { requestOptions: {} }, ): Promise { return cancelCertificateDeletion( this._client, @@ -661,7 +661,7 @@ export class BatchClient { deleteCertificate( thumbprintAlgorithm: string, thumbprint: string, - options: DeleteCertificateOptions = { requestOptions: {} }, + options: DeleteCertificateOptionalParams = { requestOptions: {} }, ): Promise { return deleteCertificate( this._client, @@ -675,7 +675,7 @@ export class BatchClient { getCertificate( thumbprintAlgorithm: string, thumbprint: string, - options: GetCertificateOptions = { requestOptions: {} }, + options: GetCertificateOptionalParams = { requestOptions: {} }, ): Promise { return getCertificate( this._client, @@ -688,7 +688,7 @@ export class BatchClient { /** Checks the specified Job Schedule exists. */ jobScheduleExists( jobScheduleId: string, - options: JobScheduleExistsOptions = { requestOptions: {} }, + options: JobScheduleExistsOptionalParams = { requestOptions: {} }, ): Promise { return jobScheduleExists(this._client, jobScheduleId, options); } @@ -702,7 +702,7 @@ export class BatchClient { */ deleteJobSchedule( jobScheduleId: string, - options: DeleteJobScheduleOptions = { requestOptions: {} }, + options: DeleteJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return deleteJobSchedule(this._client, jobScheduleId, options); } @@ -710,7 +710,7 @@ export class BatchClient { /** Gets information about the specified Job Schedule. */ getJobSchedule( jobScheduleId: string, - options: GetJobScheduleOptions = { requestOptions: {} }, + options: GetJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return getJobSchedule(this._client, jobScheduleId, options); } @@ -725,7 +725,7 @@ export class BatchClient { updateJobSchedule( jobScheduleId: string, body: BatchJobScheduleUpdateOptions, - options: UpdateJobScheduleOptions = { requestOptions: {} }, + options: UpdateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return updateJobSchedule(this._client, jobScheduleId, body, options); } @@ -740,7 +740,7 @@ export class BatchClient { replaceJobSchedule( jobScheduleId: string, body: BatchJobSchedule, - options: ReplaceJobScheduleOptions = { requestOptions: {} }, + options: ReplaceJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return replaceJobSchedule(this._client, jobScheduleId, body, options); } @@ -748,7 +748,7 @@ export class BatchClient { /** No new Jobs will be created until the Job Schedule is enabled again. */ disableJobSchedule( jobScheduleId: string, - options: DisableJobScheduleOptions = { requestOptions: {} }, + options: DisableJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return disableJobSchedule(this._client, jobScheduleId, options); } @@ -756,7 +756,7 @@ export class BatchClient { /** Enables a Job Schedule. */ enableJobSchedule( jobScheduleId: string, - options: EnableJobScheduleOptions = { requestOptions: {} }, + options: EnableJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return enableJobSchedule(this._client, jobScheduleId, options); } @@ -764,7 +764,7 @@ export class BatchClient { /** Terminates a Job Schedule. */ terminateJobSchedule( jobScheduleId: string, - options: TerminateJobScheduleOptions = { requestOptions: {} }, + options: TerminateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return terminateJobSchedule(this._client, jobScheduleId, options); } @@ -772,14 +772,14 @@ export class BatchClient { /** Creates a Job Schedule to the specified Account. */ createJobSchedule( body: BatchJobScheduleCreateOptions, - options: CreateJobScheduleOptions = { requestOptions: {} }, + options: CreateJobScheduleOptionalParams = { requestOptions: {} }, ): Promise { return createJobSchedule(this._client, body, options); } /** Lists all of the Job Schedules in the specified Account. */ listJobSchedules( - options: ListJobSchedulesOptions = { requestOptions: {} }, + options: ListJobSchedulesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listJobSchedules(this._client, options); } @@ -792,7 +792,7 @@ export class BatchClient { createTask( jobId: string, body: BatchTaskCreateOptions, - options: CreateTaskOptions = { requestOptions: {} }, + options: CreateTaskOptionalParams = { requestOptions: {} }, ): Promise { return createTask(this._client, jobId, body, options); } @@ -804,7 +804,7 @@ export class BatchClient { */ listTasks( jobId: string, - options: ListTasksOptions = { requestOptions: {} }, + options: ListTasksOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTasks(this._client, jobId, options); } @@ -828,7 +828,7 @@ export class BatchClient { createTaskCollection( jobId: string, collection: BatchTaskCollection, - options: CreateTaskCollectionOptions = { requestOptions: {} }, + options: CreateTaskCollectionOptionalParams = { requestOptions: {} }, ): Promise { return createTaskCollection(this._client, jobId, collection, options); } @@ -843,7 +843,7 @@ export class BatchClient { deleteTask( jobId: string, taskId: string, - options: DeleteTaskOptions = { requestOptions: {} }, + options: DeleteTaskOptionalParams = { requestOptions: {} }, ): Promise { return deleteTask(this._client, jobId, taskId, options); } @@ -856,7 +856,7 @@ export class BatchClient { getTask( jobId: string, taskId: string, - options: GetTaskOptions = { requestOptions: {} }, + options: GetTaskOptionalParams = { requestOptions: {} }, ): Promise { return getTask(this._client, jobId, taskId, options); } @@ -866,7 +866,7 @@ export class BatchClient { jobId: string, taskId: string, body: BatchTask, - options: ReplaceTaskOptions = { requestOptions: {} }, + options: ReplaceTaskOptionalParams = { requestOptions: {} }, ): Promise { return replaceTask(this._client, jobId, taskId, body, options); } @@ -875,7 +875,7 @@ export class BatchClient { listSubTasks( jobId: string, taskId: string, - options: ListSubTasksOptions = { requestOptions: {} }, + options: ListSubTasksOptionalParams = { requestOptions: {} }, ): Promise { return listSubTasks(this._client, jobId, taskId, options); } @@ -888,7 +888,7 @@ export class BatchClient { terminateTask( jobId: string, taskId: string, - options: TerminateTaskOptions = { requestOptions: {} }, + options: TerminateTaskOptionalParams = { requestOptions: {} }, ): Promise { return terminateTask(this._client, jobId, taskId, options); } @@ -905,7 +905,7 @@ export class BatchClient { reactivateTask( jobId: string, taskId: string, - options: ReactivateTaskOptions = { requestOptions: {} }, + options: ReactivateTaskOptionalParams = { requestOptions: {} }, ): Promise { return reactivateTask(this._client, jobId, taskId, options); } @@ -915,7 +915,7 @@ export class BatchClient { jobId: string, taskId: string, filePath: string, - options: DeleteTaskFileOptions = { requestOptions: {} }, + options: DeleteTaskFileOptionalParams = { requestOptions: {} }, ): Promise { return deleteTaskFile(this._client, jobId, taskId, filePath, options); } @@ -925,7 +925,7 @@ export class BatchClient { jobId: string, taskId: string, filePath: string, - options: GetTaskFileOptions = { requestOptions: {} }, + options: GetTaskFileOptionalParams = { requestOptions: {} }, ): Promise { return getTaskFile(this._client, jobId, taskId, filePath, options); } @@ -935,7 +935,7 @@ export class BatchClient { jobId: string, taskId: string, filePath: string, - options: GetTaskFilePropertiesOptions = { requestOptions: {} }, + options: GetTaskFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { return getTaskFileProperties( this._client, @@ -950,7 +950,7 @@ export class BatchClient { listTaskFiles( jobId: string, taskId: string, - options: ListTaskFilesOptions = { requestOptions: {} }, + options: ListTaskFilesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTaskFiles(this._client, jobId, taskId, options); } @@ -963,7 +963,7 @@ export class BatchClient { poolId: string, nodeId: string, body: BatchNodeUserCreateOptions, - options: CreateNodeUserOptions = { requestOptions: {} }, + options: CreateNodeUserOptionalParams = { requestOptions: {} }, ): Promise { return createNodeUser(this._client, poolId, nodeId, body, options); } @@ -976,7 +976,7 @@ export class BatchClient { poolId: string, nodeId: string, userName: string, - options: DeleteNodeUserOptions = { requestOptions: {} }, + options: DeleteNodeUserOptionalParams = { requestOptions: {} }, ): Promise { return deleteNodeUser(this._client, poolId, nodeId, userName, options); } @@ -992,7 +992,7 @@ export class BatchClient { nodeId: string, userName: string, body: BatchNodeUserUpdateOptions, - options: ReplaceNodeUserOptions = { requestOptions: {} }, + options: ReplaceNodeUserOptionalParams = { requestOptions: {} }, ): Promise { return replaceNodeUser( this._client, @@ -1008,7 +1008,7 @@ export class BatchClient { getNode( poolId: string, nodeId: string, - options: GetNodeOptions = { requestOptions: {} }, + options: GetNodeOptionalParams = { requestOptions: {} }, ): Promise { return getNode(this._client, poolId, nodeId, options); } @@ -1018,7 +1018,7 @@ export class BatchClient { poolId: string, nodeId: string, body?: NodeRebootOptions, - options: RebootNodeOptions = { requestOptions: {} }, + options: RebootNodeOptionalParams = { requestOptions: {} }, ): Promise { return rebootNode(this._client, poolId, nodeId, body, options); } @@ -1032,7 +1032,7 @@ export class BatchClient { poolId: string, nodeId: string, body?: NodeReimageOptions, - options: ReimageNodeOptions = { requestOptions: {} }, + options: ReimageNodeOptionalParams = { requestOptions: {} }, ): Promise { return reimageNode(this._client, poolId, nodeId, body, options); } @@ -1045,7 +1045,7 @@ export class BatchClient { poolId: string, nodeId: string, body?: NodeDisableSchedulingOptions, - options: DisableNodeSchedulingOptions = { requestOptions: {} }, + options: DisableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { return disableNodeScheduling(this._client, poolId, nodeId, body, options); } @@ -1057,7 +1057,7 @@ export class BatchClient { enableNodeScheduling( poolId: string, nodeId: string, - options: EnableNodeSchedulingOptions = { requestOptions: {} }, + options: EnableNodeSchedulingOptionalParams = { requestOptions: {} }, ): Promise { return enableNodeScheduling(this._client, poolId, nodeId, options); } @@ -1072,7 +1072,7 @@ export class BatchClient { getNodeRemoteLoginSettings( poolId: string, nodeId: string, - options: GetNodeRemoteLoginSettingsOptions = { requestOptions: {} }, + options: GetNodeRemoteLoginSettingsOptionalParams = { requestOptions: {} }, ): Promise { return getNodeRemoteLoginSettings(this._client, poolId, nodeId, options); } @@ -1086,7 +1086,7 @@ export class BatchClient { getNodeRemoteDesktopFile( poolId: string, nodeId: string, - options: GetNodeRemoteDesktopFileOptions = { requestOptions: {} }, + options: GetNodeRemoteDesktopFileOptionalParams = { requestOptions: {} }, ): Promise { return getNodeRemoteDesktopFile(this._client, poolId, nodeId, options); } @@ -1101,7 +1101,7 @@ export class BatchClient { poolId: string, nodeId: string, body: UploadBatchServiceLogsOptions, - options: UploadNodeLogsOptions = { requestOptions: {} }, + options: UploadNodeLogsOptionalParams = { requestOptions: {} }, ): Promise { return uploadNodeLogs(this._client, poolId, nodeId, body, options); } @@ -1109,7 +1109,7 @@ export class BatchClient { /** Lists the Compute Nodes in the specified Pool. */ listNodes( poolId: string, - options: ListNodesOptions = { requestOptions: {} }, + options: ListNodesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listNodes(this._client, poolId, options); } @@ -1119,7 +1119,7 @@ export class BatchClient { poolId: string, nodeId: string, extensionName: string, - options: GetNodeExtensionOptions = { requestOptions: {} }, + options: GetNodeExtensionOptionalParams = { requestOptions: {} }, ): Promise { return getNodeExtension( this._client, @@ -1134,7 +1134,7 @@ export class BatchClient { listNodeExtensions( poolId: string, nodeId: string, - options: ListNodeExtensionsOptions = { requestOptions: {} }, + options: ListNodeExtensionsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listNodeExtensions(this._client, poolId, nodeId, options); } @@ -1144,7 +1144,7 @@ export class BatchClient { poolId: string, nodeId: string, filePath: string, - options: DeleteNodeFileOptions = { requestOptions: {} }, + options: DeleteNodeFileOptionalParams = { requestOptions: {} }, ): Promise { return deleteNodeFile(this._client, poolId, nodeId, filePath, options); } @@ -1154,7 +1154,7 @@ export class BatchClient { poolId: string, nodeId: string, filePath: string, - options: GetNodeFileOptions = { requestOptions: {} }, + options: GetNodeFileOptionalParams = { requestOptions: {} }, ): Promise { return getNodeFile(this._client, poolId, nodeId, filePath, options); } @@ -1164,7 +1164,7 @@ export class BatchClient { poolId: string, nodeId: string, filePath: string, - options: GetNodeFilePropertiesOptions = { requestOptions: {} }, + options: GetNodeFilePropertiesOptionalParams = { requestOptions: {} }, ): Promise { return getNodeFileProperties( this._client, @@ -1179,7 +1179,7 @@ export class BatchClient { listNodeFiles( poolId: string, nodeId: string, - options: ListNodeFilesOptions = { requestOptions: {} }, + options: ListNodeFilesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listNodeFiles(this._client, poolId, nodeId, options); } diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts index edfccd2932..47ea77c9a6 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { BatchClient, BatchClientOptions } from "./BatchClient.js"; +export { BatchClient, BatchClientOptions } from "./batchClient.js"; export { BatchNodeUserCreateOptions, BatchError, @@ -207,82 +207,83 @@ export { NodeRemoveOptions, ApplicationListResult, BatchApplication, - ListApplicationsOptions, - GetApplicationOptions, - ListPoolUsageMetricsOptions, - CreatePoolOptions, - ListPoolsOptions, - DeletePoolOptions, - PoolExistsOptions, - GetPoolOptions, - UpdatePoolOptions, - DisablePoolAutoScaleOptions, - EnablePoolAutoScaleOptions, - EvaluatePoolAutoScaleOptions, - ResizePoolOptions, - StopPoolResizeOptions, - ReplacePoolPropertiesOptions, - RemoveNodesOptions, - ListSupportedImagesOptions, - ListPoolNodeCountsOptions, - DeleteJobOptions, - GetJobOptions, - UpdateJobOptions, - ReplaceJobOptions, - DisableJobOptions, - EnableJobOptions, - TerminateJobOptions, - CreateJobOptions, - ListJobsOptions, - ListJobsFromScheduleOptions, - ListJobPreparationAndReleaseTaskStatusOptions, - GetJobTaskCountsOptions, - CreateCertificateOptions, - ListCertificatesOptions, - CancelCertificateDeletionOptions, - DeleteCertificateOptions, - GetCertificateOptions, - JobScheduleExistsOptions, - DeleteJobScheduleOptions, - GetJobScheduleOptions, - UpdateJobScheduleOptions, - ReplaceJobScheduleOptions, - DisableJobScheduleOptions, - EnableJobScheduleOptions, - TerminateJobScheduleOptions, - CreateJobScheduleOptions, - ListJobSchedulesOptions, - CreateTaskOptions, - ListTasksOptions, - CreateTaskCollectionOptions, - DeleteTaskOptions, - GetTaskOptions, - ReplaceTaskOptions, - ListSubTasksOptions, - TerminateTaskOptions, - ReactivateTaskOptions, - DeleteTaskFileOptions, - GetTaskFileOptions, - GetTaskFilePropertiesOptions, - ListTaskFilesOptions, - CreateNodeUserOptions, - DeleteNodeUserOptions, - ReplaceNodeUserOptions, - GetNodeOptions, - RebootNodeOptions, - ReimageNodeOptions, - DisableNodeSchedulingOptions, - EnableNodeSchedulingOptions, - GetNodeRemoteLoginSettingsOptions, - GetNodeRemoteDesktopFileOptions, - UploadNodeLogsOptions, - ListNodesOptions, - GetNodeExtensionOptions, - ListNodeExtensionsOptions, - DeleteNodeFileOptions, - GetNodeFileOptions, - GetNodeFilePropertiesOptions, - ListNodeFilesOptions, + Versions, + ListApplicationsOptionalParams, + GetApplicationOptionalParams, + ListPoolUsageMetricsOptionalParams, + CreatePoolOptionalParams, + ListPoolsOptionalParams, + DeletePoolOptionalParams, + PoolExistsOptionalParams, + GetPoolOptionalParams, + UpdatePoolOptionalParams, + DisablePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + ResizePoolOptionalParams, + StopPoolResizeOptionalParams, + ReplacePoolPropertiesOptionalParams, + RemoveNodesOptionalParams, + ListSupportedImagesOptionalParams, + ListPoolNodeCountsOptionalParams, + DeleteJobOptionalParams, + GetJobOptionalParams, + UpdateJobOptionalParams, + ReplaceJobOptionalParams, + DisableJobOptionalParams, + EnableJobOptionalParams, + TerminateJobOptionalParams, + CreateJobOptionalParams, + ListJobsOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + GetJobTaskCountsOptionalParams, + CreateCertificateOptionalParams, + ListCertificatesOptionalParams, + CancelCertificateDeletionOptionalParams, + DeleteCertificateOptionalParams, + GetCertificateOptionalParams, + JobScheduleExistsOptionalParams, + DeleteJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + CreateJobScheduleOptionalParams, + ListJobSchedulesOptionalParams, + CreateTaskOptionalParams, + ListTasksOptionalParams, + CreateTaskCollectionOptionalParams, + DeleteTaskOptionalParams, + GetTaskOptionalParams, + ReplaceTaskOptionalParams, + ListSubTasksOptionalParams, + TerminateTaskOptionalParams, + ReactivateTaskOptionalParams, + DeleteTaskFileOptionalParams, + GetTaskFileOptionalParams, + GetTaskFilePropertiesOptionalParams, + ListTaskFilesOptionalParams, + CreateNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + ReplaceNodeUserOptionalParams, + GetNodeOptionalParams, + RebootNodeOptionalParams, + ReimageNodeOptionalParams, + DisableNodeSchedulingOptionalParams, + EnableNodeSchedulingOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + UploadNodeLogsOptionalParams, + ListNodesOptionalParams, + GetNodeExtensionOptionalParams, + ListNodeExtensionsOptionalParams, + DeleteNodeFileOptionalParams, + GetNodeFileOptionalParams, + GetNodeFilePropertiesOptionalParams, + ListNodeFilesOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts index 3dfadae946..632dc50282 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/index.ts @@ -206,84 +206,85 @@ export { NodeRemoveOptions, ApplicationListResult, BatchApplication, + Versions, } from "./models.js"; export { - ListApplicationsOptions, - GetApplicationOptions, - ListPoolUsageMetricsOptions, - CreatePoolOptions, - ListPoolsOptions, - DeletePoolOptions, - PoolExistsOptions, - GetPoolOptions, - UpdatePoolOptions, - DisablePoolAutoScaleOptions, - EnablePoolAutoScaleOptions, - EvaluatePoolAutoScaleOptions, - ResizePoolOptions, - StopPoolResizeOptions, - ReplacePoolPropertiesOptions, - RemoveNodesOptions, - ListSupportedImagesOptions, - ListPoolNodeCountsOptions, - DeleteJobOptions, - GetJobOptions, - UpdateJobOptions, - ReplaceJobOptions, - DisableJobOptions, - EnableJobOptions, - TerminateJobOptions, - CreateJobOptions, - ListJobsOptions, - ListJobsFromScheduleOptions, - ListJobPreparationAndReleaseTaskStatusOptions, - GetJobTaskCountsOptions, - CreateCertificateOptions, - ListCertificatesOptions, - CancelCertificateDeletionOptions, - DeleteCertificateOptions, - GetCertificateOptions, - JobScheduleExistsOptions, - DeleteJobScheduleOptions, - GetJobScheduleOptions, - UpdateJobScheduleOptions, - ReplaceJobScheduleOptions, - DisableJobScheduleOptions, - EnableJobScheduleOptions, - TerminateJobScheduleOptions, - CreateJobScheduleOptions, - ListJobSchedulesOptions, - CreateTaskOptions, - ListTasksOptions, - CreateTaskCollectionOptions, - DeleteTaskOptions, - GetTaskOptions, - ReplaceTaskOptions, - ListSubTasksOptions, - TerminateTaskOptions, - ReactivateTaskOptions, - DeleteTaskFileOptions, - GetTaskFileOptions, - GetTaskFilePropertiesOptions, - ListTaskFilesOptions, - CreateNodeUserOptions, - DeleteNodeUserOptions, - ReplaceNodeUserOptions, - GetNodeOptions, - RebootNodeOptions, - ReimageNodeOptions, - DisableNodeSchedulingOptions, - EnableNodeSchedulingOptions, - GetNodeRemoteLoginSettingsOptions, - GetNodeRemoteDesktopFileOptions, - UploadNodeLogsOptions, - ListNodesOptions, - GetNodeExtensionOptions, - ListNodeExtensionsOptions, - DeleteNodeFileOptions, - GetNodeFileOptions, - GetNodeFilePropertiesOptions, - ListNodeFilesOptions, + ListApplicationsOptionalParams, + GetApplicationOptionalParams, + ListPoolUsageMetricsOptionalParams, + CreatePoolOptionalParams, + ListPoolsOptionalParams, + DeletePoolOptionalParams, + PoolExistsOptionalParams, + GetPoolOptionalParams, + UpdatePoolOptionalParams, + DisablePoolAutoScaleOptionalParams, + EnablePoolAutoScaleOptionalParams, + EvaluatePoolAutoScaleOptionalParams, + ResizePoolOptionalParams, + StopPoolResizeOptionalParams, + ReplacePoolPropertiesOptionalParams, + RemoveNodesOptionalParams, + ListSupportedImagesOptionalParams, + ListPoolNodeCountsOptionalParams, + DeleteJobOptionalParams, + GetJobOptionalParams, + UpdateJobOptionalParams, + ReplaceJobOptionalParams, + DisableJobOptionalParams, + EnableJobOptionalParams, + TerminateJobOptionalParams, + CreateJobOptionalParams, + ListJobsOptionalParams, + ListJobsFromScheduleOptionalParams, + ListJobPreparationAndReleaseTaskStatusOptionalParams, + GetJobTaskCountsOptionalParams, + CreateCertificateOptionalParams, + ListCertificatesOptionalParams, + CancelCertificateDeletionOptionalParams, + DeleteCertificateOptionalParams, + GetCertificateOptionalParams, + JobScheduleExistsOptionalParams, + DeleteJobScheduleOptionalParams, + GetJobScheduleOptionalParams, + UpdateJobScheduleOptionalParams, + ReplaceJobScheduleOptionalParams, + DisableJobScheduleOptionalParams, + EnableJobScheduleOptionalParams, + TerminateJobScheduleOptionalParams, + CreateJobScheduleOptionalParams, + ListJobSchedulesOptionalParams, + CreateTaskOptionalParams, + ListTasksOptionalParams, + CreateTaskCollectionOptionalParams, + DeleteTaskOptionalParams, + GetTaskOptionalParams, + ReplaceTaskOptionalParams, + ListSubTasksOptionalParams, + TerminateTaskOptionalParams, + ReactivateTaskOptionalParams, + DeleteTaskFileOptionalParams, + GetTaskFileOptionalParams, + GetTaskFilePropertiesOptionalParams, + ListTaskFilesOptionalParams, + CreateNodeUserOptionalParams, + DeleteNodeUserOptionalParams, + ReplaceNodeUserOptionalParams, + GetNodeOptionalParams, + RebootNodeOptionalParams, + ReimageNodeOptionalParams, + DisableNodeSchedulingOptionalParams, + EnableNodeSchedulingOptionalParams, + GetNodeRemoteLoginSettingsOptionalParams, + GetNodeRemoteDesktopFileOptionalParams, + UploadNodeLogsOptionalParams, + ListNodesOptionalParams, + GetNodeExtensionOptionalParams, + ListNodeExtensionsOptionalParams, + DeleteNodeFileOptionalParams, + GetNodeFileOptionalParams, + GetNodeFilePropertiesOptionalParams, + ListNodeFilesOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts index cfe8926557..afe9fa4ebb 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/models.ts @@ -107,11 +107,24 @@ export interface BatchNode { } /** BatchNodeState enums */ -/** "idle", "rebooting", "reimaging", "running", "unusable", "creating", "starting", "waitingforstarttask", "starttaskfailed", "unknown", "leavingpool", "offline", "preempted" */ -export type BatchNodeState = string; +/** */ +export type BatchNodeState = + | "idle" + | "rebooting" + | "reimaging" + | "running" + | "unusable" + | "creating" + | "starting" + | "waitingforstarttask" + | "starttaskfailed" + | "unknown" + | "leavingpool" + | "offline" + | "preempted"; /** SchedulingState enums */ -/** "enabled", "disabled" */ -export type SchedulingState = string; +/** */ +export type SchedulingState = "enabled" | "disabled"; /** Information about a Task running on a Compute Node. */ export interface TaskInformation { @@ -130,8 +143,8 @@ export interface TaskInformation { } /** TaskState enums */ -/** "active", "preparing", "running", "completed" */ -export type TaskState = string; +/** */ +export type TaskState = "active" | "preparing" | "running" | "completed"; /** Information about the execution of a Task. */ export interface TaskExecutionInformation { @@ -180,8 +193,8 @@ export interface TaskFailureInformation { } /** ErrorCategory enums */ -/** "usererror", "servererror" */ -export type ErrorCategory = string; +/** */ +export type ErrorCategory = "usererror" | "servererror"; /** Represents a name-value pair. */ export interface NameValuePair { @@ -192,8 +205,8 @@ export interface NameValuePair { } /** TaskExecutionResult enums */ -/** "success", "failure" */ -export type TaskExecutionResult = string; +/** */ +export type TaskExecutionResult = "success" | "failure"; /** * Batch will retry Tasks when a recovery operation is triggered on a Node. @@ -261,8 +274,10 @@ export interface BatchNodeIdentityReference { } /** ContainerWorkingDirectory enums */ -/** "taskWorkingDirectory", "containerImageDefault" */ -export type ContainerWorkingDirectory = string; +/** */ +export type ContainerWorkingDirectory = + | "taskWorkingDirectory" + | "containerImageDefault"; /** A single file or multiple files to be downloaded to a Compute Node. */ export interface ResourceFile { @@ -307,11 +322,11 @@ export interface AutoUserSpecification { } /** AutoUserScope enums */ -/** "task", "pool" */ -export type AutoUserScope = string; +/** */ +export type AutoUserScope = "task" | "pool"; /** ElevationLevel enums */ -/** "nonadmin", "admin" */ -export type ElevationLevel = string; +/** */ +export type ElevationLevel = "nonadmin" | "admin"; /** Information about a StartTask running on a Compute Node. */ export interface StartTaskInformation { @@ -336,8 +351,8 @@ export interface StartTaskInformation { } /** StartTaskState enums */ -/** "running", "completed" */ -export type StartTaskState = string; +/** */ +export type StartTaskState = "running" | "completed"; /** A reference to a Certificate to be installed on Compute Nodes in a Pool. Warning: This object is deprecated and will be removed after February, 2024. Please use the [Azure KeyVault Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) instead. */ export interface CertificateReference { @@ -354,11 +369,11 @@ export interface CertificateReference { } /** CertificateStoreLocation enums */ -/** "currentuser", "localmachine" */ -export type CertificateStoreLocation = string; +/** */ +export type CertificateStoreLocation = "currentuser" | "localmachine"; /** CertificateVisibility enums */ -/** "starttask", "task", "remoteuser" */ -export type CertificateVisibility = string; +/** */ +export type CertificateVisibility = "starttask" | "task" | "remoteuser"; /** An error encountered by a Compute Node. */ export interface BatchNodeError { @@ -393,8 +408,8 @@ export interface InboundEndpoint { } /** InboundEndpointProtocol enums */ -/** "tcp", "udp" */ -export type InboundEndpointProtocol = string; +/** */ +export type InboundEndpointProtocol = "tcp" | "udp"; /** * The Batch Compute Node agent is a program that runs on each Compute Node in the @@ -440,8 +455,12 @@ export interface NodeRebootOptions { } /** BatchNodeRebootOption enums */ -/** "requeue", "terminate", "taskcompletion", "retaineddata" */ -export type BatchNodeRebootOption = string; +/** */ +export type BatchNodeRebootOption = + | "requeue" + | "terminate" + | "taskcompletion" + | "retaineddata"; /** Options for reimaging an Azure Batch Compute Node. */ export interface NodeReimageOptions { @@ -450,8 +469,12 @@ export interface NodeReimageOptions { } /** BatchNodeReimageOption enums */ -/** "requeue", "terminate", "taskcompletion", "retaineddata" */ -export type BatchNodeReimageOption = string; +/** */ +export type BatchNodeReimageOption = + | "requeue" + | "terminate" + | "taskcompletion" + | "retaineddata"; /** Options for disabling scheduling on an Azure Batch Compute Node. */ export interface NodeDisableSchedulingOptions { @@ -460,8 +483,11 @@ export interface NodeDisableSchedulingOptions { } /** DisableBatchNodeSchedulingOption enums */ -/** "requeue", "terminate", "taskcompletion" */ -export type DisableBatchNodeSchedulingOption = string; +/** */ +export type DisableBatchNodeSchedulingOption = + | "requeue" + | "terminate" + | "taskcompletion"; /** The remote login settings for a Compute Node. */ export interface BatchNodeRemoteLoginSettingsResult { @@ -556,8 +582,8 @@ export interface InstanceViewStatus { } /** Level code. */ -/** "Error", "Info", "Warning" */ -export type StatusLevelTypes = string; +/** */ +export type StatusLevelTypes = "Error" | "Info" | "Warning"; /** The result of listing the Compute Node extensions in a Node. */ export interface NodeVMExtensionList { @@ -674,11 +700,11 @@ export interface ExitOptions { } /** JobAction enums */ -/** "none", "disable", "terminate" */ -export type JobAction = string; +/** */ +export type JobAction = "none" | "disable" | "terminate"; /** DependencyAction enums */ -/** "satisfy", "block" */ -export type DependencyAction = string; +/** */ +export type DependencyAction = "satisfy" | "block"; /** * A range of exit codes and how the Batch service should respond to exit codes @@ -739,8 +765,11 @@ export interface OutputFileUploadOptions { } /** OutputFileUploadCondition enums */ -/** "tasksuccess", "taskfailure", "taskcompletion" */ -export type OutputFileUploadCondition = string; +/** */ +export type OutputFileUploadCondition = + | "tasksuccess" + | "taskfailure" + | "taskcompletion"; /** * A locality hint that can be used by the Batch service to select a Compute Node @@ -817,8 +846,8 @@ export interface AuthenticationTokenSettings { } /** AccessScope enums */ -/** "job" */ -export type AccessScope = string; +/** */ +export type AccessScope = "job"; /** The result of listing the Tasks in a Job. */ export interface BatchTaskListResult { @@ -967,8 +996,8 @@ export interface TaskAddResult { } /** TaskAddStatus enums */ -/** "Success", "clienterror", "servererror" */ -export type TaskAddStatus = string; +/** */ +export type TaskAddStatus = "Success" | "clienterror" | "servererror"; /** The result of listing the subtasks of a Task. */ export interface BatchTaskListSubtasksResult { @@ -1005,8 +1034,8 @@ export interface SubtaskInformation { } /** SubtaskState enums */ -/** "preparing", "running", "completed" */ -export type SubtaskState = string; +/** */ +export type SubtaskState = "preparing" | "running" | "completed"; /** * A Job Schedule that allows recurring Jobs by specifying when to run Jobs and a @@ -1046,8 +1075,13 @@ export interface BatchJobSchedule { } /** JobScheduleState enums */ -/** "active", "completed", "disabled", "terminating", "deleting" */ -export type JobScheduleState = string; +/** */ +export type JobScheduleState = + | "active" + | "completed" + | "disabled" + | "terminating" + | "deleting"; /** * The schedule according to which Jobs will be created. All times are fixed @@ -1099,11 +1133,11 @@ export interface JobSpecification { } /** The action the Batch service should take when all Tasks in the Job are in the completed state. */ -/** "noaction", "terminatejob" */ -export type OnAllTasksComplete = string; +/** */ +export type OnAllTasksComplete = "noaction" | "terminatejob"; /** OnTaskFailure enums */ -/** "noaction", "performexitoptionsjobaction" */ -export type OnTaskFailure = string; +/** */ +export type OnTaskFailure = "noaction" | "performexitoptionsjobaction"; /** The network configuration for the Job. */ export interface JobNetworkConfiguration { @@ -1296,8 +1330,8 @@ export interface AutoPoolSpecification { } /** PoolLifetimeOption enums */ -/** "jobschedule", "job" */ -export type PoolLifetimeOption = string; +/** */ +export type PoolLifetimeOption = "jobschedule" | "job"; /** Specification for creating a new Pool. */ export interface PoolSpecification { @@ -1434,11 +1468,11 @@ export interface DataDisk { } /** CachingType enums */ -/** "none", "readonly", "readwrite" */ -export type CachingType = string; +/** */ +export type CachingType = "none" | "readonly" | "readwrite"; /** StorageAccountType enums */ -/** "standard_lrs", "premium_lrs" */ -export type StorageAccountType = string; +/** */ +export type StorageAccountType = "standard_lrs" | "premium_lrs"; /** The configuration for container-enabled Pools. */ export interface ContainerConfiguration { @@ -1451,8 +1485,8 @@ export interface ContainerConfiguration { } /** ContainerType enums */ -/** "dockerCompatible", "criCompatible" */ -export type ContainerType = string; +/** */ +export type ContainerType = "dockerCompatible" | "criCompatible"; /** * The disk encryption configuration applied on compute nodes in the pool. Disk @@ -1465,8 +1499,8 @@ export interface DiskEncryptionConfiguration { } /** DiskEncryptionTarget enums */ -/** "osdisk", "temporarydisk" */ -export type DiskEncryptionTarget = string; +/** */ +export type DiskEncryptionTarget = "osdisk" | "temporarydisk"; /** * For regional placement, nodes in the pool will be allocated in the same region. @@ -1479,8 +1513,8 @@ export interface NodePlacementConfiguration { } /** NodePlacementPolicyType enums */ -/** "regional", "zonal" */ -export type NodePlacementPolicyType = string; +/** */ +export type NodePlacementPolicyType = "regional" | "zonal"; /** Settings for the operating system disk of the compute node (VM). */ export interface OSDisk { @@ -1498,8 +1532,8 @@ export interface DiffDiskSettings { } /** AccessDiffDiskPlacementScope enums */ -/** "cachedisk" */ -export type DiffDiskPlacement = string; +/** */ +export type DiffDiskPlacement = "cachedisk"; /** Specifies how Tasks should be distributed across Compute Nodes. */ export interface TaskSchedulingPolicy { @@ -1508,8 +1542,8 @@ export interface TaskSchedulingPolicy { } /** BatchNodeFillType enums */ -/** "spread", "pack" */ -export type BatchNodeFillType = string; +/** */ +export type BatchNodeFillType = "spread" | "pack"; /** The network configuration for a Pool. */ export interface NetworkConfiguration { @@ -1526,8 +1560,8 @@ export interface NetworkConfiguration { } /** DynamicVNetAssignmentScope enums */ -/** "none", "job" */ -export type DynamicVNetAssignmentScope = string; +/** */ +export type DynamicVNetAssignmentScope = "none" | "job"; /** The endpoint configuration for a Pool. */ export interface PoolEndpointConfiguration { @@ -1567,8 +1601,8 @@ export interface NetworkSecurityGroupRule { } /** NetworkSecurityGroupRuleAccess enums */ -/** "allow", "deny" */ -export type NetworkSecurityGroupRuleAccess = string; +/** */ +export type NetworkSecurityGroupRuleAccess = "allow" | "deny"; /** The public IP Address configuration of the networking configuration of a Pool. */ export interface PublicIpAddressConfiguration { @@ -1579,8 +1613,11 @@ export interface PublicIpAddressConfiguration { } /** IPAddressProvisioningType enums */ -/** "batchmanaged", "usermanaged", "nopublicipaddresses" */ -export type IpAddressProvisioningType = string; +/** */ +export type IpAddressProvisioningType = + | "batchmanaged" + | "usermanaged" + | "nopublicipaddresses"; /** * Properties used to create a user used to execute Tasks on an Azure Batch @@ -1616,8 +1653,8 @@ export interface WindowsUserConfiguration { } /** LoginMode enums */ -/** "batch", "interactive" */ -export type LoginMode = string; +/** */ +export type LoginMode = "batch" | "interactive"; /** * The Batch service does not assign any meaning to this metadata; it is solely @@ -1699,8 +1736,8 @@ export interface AzureFileShareConfiguration { } /** NodeCommunicationMode enums */ -/** "default", "classic", "simplified" */ -export type NodeCommunicationMode = string; +/** */ +export type NodeCommunicationMode = "default" | "classic" | "simplified"; /** * Contains information about Jobs that have been and will be run under a Job @@ -1819,8 +1856,8 @@ export interface BatchCertificate { } /** CertificateState enums */ -/** "active", "deleting", "deletefailed" */ -export type CertificateState = string; +/** */ +export type CertificateState = "active" | "deleting" | "deletefailed"; /** An error encountered by the Batch service when deleting a Certificate. */ export interface DeleteCertificateError { @@ -1833,8 +1870,8 @@ export interface DeleteCertificateError { } /** CertificateFormat enums */ -/** "pfx", "cer" */ -export type CertificateFormat = string; +/** */ +export type CertificateFormat = "pfx" | "cer"; /** The result of listing the Certificates in the Account. */ export interface CertificateListResult { @@ -1901,8 +1938,15 @@ export interface BatchJob { } /** JobState enums */ -/** "active", "disabling", "disabled", "enabling", "terminating", "completed", "deleting" */ -export type JobState = string; +/** */ +export type JobState = + | "active" + | "disabling" + | "disabled" + | "enabling" + | "terminating" + | "completed" + | "deleting"; /** Contains information about the execution of a Job in the Azure Batch service. */ export interface JobExecutionInformation { @@ -1987,8 +2031,8 @@ export interface BatchJobDisableOptions { } /** DisableJobOption enums */ -/** "requeue", "terminate", "wait" */ -export type DisableJobOption = string; +/** */ +export type DisableJobOption = "requeue" | "terminate" | "wait"; /** Options for terminating an Azure Batch Job. */ export interface BatchJobTerminateOptions { @@ -2095,8 +2139,8 @@ export interface JobPreparationTaskExecutionInformation { } /** JobPreparationTaskState enums */ -/** "running", "completed" */ -export type JobPreparationTaskState = string; +/** */ +export type JobPreparationTaskState = "running" | "completed"; /** * Contains information about the execution of a Job Release Task on a Compute @@ -2124,8 +2168,8 @@ export interface JobReleaseTaskExecutionInformation { } /** JobReleaseTaskState enums */ -/** "running", "completed" */ -export type JobReleaseTaskState = string; +/** */ +export type JobReleaseTaskState = "running" | "completed"; /** The Task and TaskSlot counts for a Job. */ export interface TaskCountsResult { @@ -2191,11 +2235,11 @@ export interface ImageInformation { } /** OSType enums */ -/** "linux", "windows" */ -export type OSType = string; +/** */ +export type OSType = "linux" | "windows"; /** VerificationType enums */ -/** "verified", "unverified" */ -export type VerificationType = string; +/** */ +export type VerificationType = "verified" | "unverified"; /** The result of listing the Compute Node counts in the Account. */ export interface PoolNodeCountsListResult { @@ -2418,11 +2462,11 @@ export interface BatchPool { } /** PoolState enums */ -/** "active", "deleting" */ -export type PoolState = string; +/** */ +export type PoolState = "active" | "deleting"; /** AllocationState enums */ -/** "steady", "resizing", "stopping" */ -export type AllocationState = string; +/** */ +export type AllocationState = "steady" | "resizing" | "stopping"; /** An error that occurred when resizing a Pool. */ export interface ResizeError { @@ -2517,8 +2561,8 @@ export interface BatchPoolIdentity { } /** PoolIdentityType enums */ -/** "UserAssigned", "None" */ -export type PoolIdentityType = string; +/** */ +export type PoolIdentityType = "UserAssigned" | "None"; /** The user assigned Identity */ export interface UserAssignedIdentity { @@ -2578,8 +2622,12 @@ export interface BatchPoolResizeOptions { } /** BatchNodeDeallocationOption enums */ -/** "requeue", "terminate", "taskcompletion", "retaineddata" */ -export type BatchNodeDeallocationOption = string; +/** */ +export type BatchNodeDeallocationOption = + | "requeue" + | "terminate" + | "taskcompletion" + | "retaineddata"; /** Options for replacing properties on an Azure Batch Pool. */ export interface BatchPoolReplaceOptions { @@ -2629,3 +2677,7 @@ export interface BatchApplication { /** The list of available versions of the application. */ versions: string[]; } + +/** The Azure Batch service version. */ +/** */ +export type Versions = "2023-05-01.17.0"; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/options.ts index cdedc88f15..c471a986d2 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/models/options.ts @@ -3,7 +3,7 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ListApplicationsOptions extends OperationOptions { +export interface ListApplicationsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -18,7 +18,7 @@ export interface ListApplicationsOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface GetApplicationOptions extends OperationOptions { +export interface GetApplicationOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -28,7 +28,7 @@ export interface GetApplicationOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface ListPoolUsageMetricsOptions extends OperationOptions { +export interface ListPoolUsageMetricsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -60,7 +60,7 @@ export interface ListPoolUsageMetricsOptions extends OperationOptions { $filter?: string; } -export interface CreatePoolOptions extends OperationOptions { +export interface CreatePoolOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -72,7 +72,7 @@ export interface CreatePoolOptions extends OperationOptions { contentType?: string; } -export interface ListPoolsOptions extends OperationOptions { +export interface ListPoolsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -96,7 +96,7 @@ export interface ListPoolsOptions extends OperationOptions { $expand?: string[]; } -export interface DeletePoolOptions extends OperationOptions { +export interface DeletePoolOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -130,7 +130,7 @@ export interface DeletePoolOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface PoolExistsOptions extends OperationOptions { +export interface PoolExistsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -164,7 +164,7 @@ export interface PoolExistsOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface GetPoolOptions extends OperationOptions { +export interface GetPoolOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -202,7 +202,7 @@ export interface GetPoolOptions extends OperationOptions { $expand?: string[]; } -export interface UpdatePoolOptions extends OperationOptions { +export interface UpdatePoolOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -238,7 +238,7 @@ export interface UpdatePoolOptions extends OperationOptions { contentType?: string; } -export interface DisablePoolAutoScaleOptions extends OperationOptions { +export interface DisablePoolAutoScaleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -248,7 +248,7 @@ export interface DisablePoolAutoScaleOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface EnablePoolAutoScaleOptions extends OperationOptions { +export interface EnablePoolAutoScaleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -284,7 +284,7 @@ export interface EnablePoolAutoScaleOptions extends OperationOptions { contentType?: string; } -export interface EvaluatePoolAutoScaleOptions extends OperationOptions { +export interface EvaluatePoolAutoScaleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -296,7 +296,7 @@ export interface EvaluatePoolAutoScaleOptions extends OperationOptions { contentType?: string; } -export interface ResizePoolOptions extends OperationOptions { +export interface ResizePoolOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -332,7 +332,7 @@ export interface ResizePoolOptions extends OperationOptions { contentType?: string; } -export interface StopPoolResizeOptions extends OperationOptions { +export interface StopPoolResizeOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -366,7 +366,7 @@ export interface StopPoolResizeOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface ReplacePoolPropertiesOptions extends OperationOptions { +export interface ReplacePoolPropertiesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -378,7 +378,7 @@ export interface ReplacePoolPropertiesOptions extends OperationOptions { contentType?: string; } -export interface RemoveNodesOptions extends OperationOptions { +export interface RemoveNodesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -414,7 +414,7 @@ export interface RemoveNodesOptions extends OperationOptions { contentType?: string; } -export interface ListSupportedImagesOptions extends OperationOptions { +export interface ListSupportedImagesOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. @@ -432,7 +432,7 @@ export interface ListSupportedImagesOptions extends OperationOptions { $filter?: string; } -export interface ListPoolNodeCountsOptions extends OperationOptions { +export interface ListPoolNodeCountsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -452,7 +452,7 @@ export interface ListPoolNodeCountsOptions extends OperationOptions { $filter?: string; } -export interface DeleteJobOptions extends OperationOptions { +export interface DeleteJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -486,7 +486,7 @@ export interface DeleteJobOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface GetJobOptions extends OperationOptions { +export interface GetJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -524,7 +524,7 @@ export interface GetJobOptions extends OperationOptions { $expand?: string[]; } -export interface UpdateJobOptions extends OperationOptions { +export interface UpdateJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -560,7 +560,7 @@ export interface UpdateJobOptions extends OperationOptions { contentType?: string; } -export interface ReplaceJobOptions extends OperationOptions { +export interface ReplaceJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -596,7 +596,7 @@ export interface ReplaceJobOptions extends OperationOptions { contentType?: string; } -export interface DisableJobOptions extends OperationOptions { +export interface DisableJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -632,7 +632,7 @@ export interface DisableJobOptions extends OperationOptions { contentType?: string; } -export interface EnableJobOptions extends OperationOptions { +export interface EnableJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -666,7 +666,7 @@ export interface EnableJobOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface TerminateJobOptions extends OperationOptions { +export interface TerminateJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -702,7 +702,7 @@ export interface TerminateJobOptions extends OperationOptions { contentType?: string; } -export interface CreateJobOptions extends OperationOptions { +export interface CreateJobOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -714,7 +714,7 @@ export interface CreateJobOptions extends OperationOptions { contentType?: string; } -export interface ListJobsOptions extends OperationOptions { +export interface ListJobsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -738,7 +738,7 @@ export interface ListJobsOptions extends OperationOptions { $expand?: string[]; } -export interface ListJobsFromScheduleOptions extends OperationOptions { +export interface ListJobsFromScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -762,7 +762,7 @@ export interface ListJobsFromScheduleOptions extends OperationOptions { $expand?: string[]; } -export interface ListJobPreparationAndReleaseTaskStatusOptions +export interface ListJobPreparationAndReleaseTaskStatusOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 @@ -783,7 +783,7 @@ export interface ListJobPreparationAndReleaseTaskStatusOptions $select?: string[]; } -export interface GetJobTaskCountsOptions extends OperationOptions { +export interface GetJobTaskCountsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -793,7 +793,7 @@ export interface GetJobTaskCountsOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface CreateCertificateOptions extends OperationOptions { +export interface CreateCertificateOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -805,7 +805,7 @@ export interface CreateCertificateOptions extends OperationOptions { contentType?: string; } -export interface ListCertificatesOptions extends OperationOptions { +export interface ListCertificatesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -827,7 +827,8 @@ export interface ListCertificatesOptions extends OperationOptions { $select?: string[]; } -export interface CancelCertificateDeletionOptions extends OperationOptions { +export interface CancelCertificateDeletionOptionalParams + extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -837,7 +838,7 @@ export interface CancelCertificateDeletionOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface DeleteCertificateOptions extends OperationOptions { +export interface DeleteCertificateOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -847,7 +848,7 @@ export interface DeleteCertificateOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface GetCertificateOptions extends OperationOptions { +export interface GetCertificateOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -859,7 +860,7 @@ export interface GetCertificateOptions extends OperationOptions { $select?: string[]; } -export interface JobScheduleExistsOptions extends OperationOptions { +export interface JobScheduleExistsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -893,7 +894,7 @@ export interface JobScheduleExistsOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface DeleteJobScheduleOptions extends OperationOptions { +export interface DeleteJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -927,7 +928,7 @@ export interface DeleteJobScheduleOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface GetJobScheduleOptions extends OperationOptions { +export interface GetJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -965,7 +966,7 @@ export interface GetJobScheduleOptions extends OperationOptions { $expand?: string[]; } -export interface UpdateJobScheduleOptions extends OperationOptions { +export interface UpdateJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1001,7 +1002,7 @@ export interface UpdateJobScheduleOptions extends OperationOptions { contentType?: string; } -export interface ReplaceJobScheduleOptions extends OperationOptions { +export interface ReplaceJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1037,7 +1038,7 @@ export interface ReplaceJobScheduleOptions extends OperationOptions { contentType?: string; } -export interface DisableJobScheduleOptions extends OperationOptions { +export interface DisableJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1071,7 +1072,7 @@ export interface DisableJobScheduleOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface EnableJobScheduleOptions extends OperationOptions { +export interface EnableJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1105,7 +1106,7 @@ export interface EnableJobScheduleOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface TerminateJobScheduleOptions extends OperationOptions { +export interface TerminateJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1139,7 +1140,7 @@ export interface TerminateJobScheduleOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface CreateJobScheduleOptions extends OperationOptions { +export interface CreateJobScheduleOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1151,7 +1152,7 @@ export interface CreateJobScheduleOptions extends OperationOptions { contentType?: string; } -export interface ListJobSchedulesOptions extends OperationOptions { +export interface ListJobSchedulesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1175,7 +1176,7 @@ export interface ListJobSchedulesOptions extends OperationOptions { $expand?: string[]; } -export interface CreateTaskOptions extends OperationOptions { +export interface CreateTaskOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1187,7 +1188,7 @@ export interface CreateTaskOptions extends OperationOptions { contentType?: string; } -export interface ListTasksOptions extends OperationOptions { +export interface ListTasksOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1211,7 +1212,7 @@ export interface ListTasksOptions extends OperationOptions { $expand?: string[]; } -export interface CreateTaskCollectionOptions extends OperationOptions { +export interface CreateTaskCollectionOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1223,7 +1224,7 @@ export interface CreateTaskCollectionOptions extends OperationOptions { contentType?: string; } -export interface DeleteTaskOptions extends OperationOptions { +export interface DeleteTaskOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1257,7 +1258,7 @@ export interface DeleteTaskOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface GetTaskOptions extends OperationOptions { +export interface GetTaskOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1295,7 +1296,7 @@ export interface GetTaskOptions extends OperationOptions { $expand?: string[]; } -export interface ReplaceTaskOptions extends OperationOptions { +export interface ReplaceTaskOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1331,7 +1332,7 @@ export interface ReplaceTaskOptions extends OperationOptions { contentType?: string; } -export interface ListSubTasksOptions extends OperationOptions { +export interface ListSubTasksOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1343,7 +1344,7 @@ export interface ListSubTasksOptions extends OperationOptions { $select?: string[]; } -export interface TerminateTaskOptions extends OperationOptions { +export interface TerminateTaskOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1377,7 +1378,7 @@ export interface TerminateTaskOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface ReactivateTaskOptions extends OperationOptions { +export interface ReactivateTaskOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1411,7 +1412,7 @@ export interface ReactivateTaskOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface DeleteTaskFileOptions extends OperationOptions { +export interface DeleteTaskFileOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1428,7 +1429,7 @@ export interface DeleteTaskFileOptions extends OperationOptions { recursive?: boolean; } -export interface GetTaskFileOptions extends OperationOptions { +export interface GetTaskFileOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1455,7 +1456,7 @@ export interface GetTaskFileOptions extends OperationOptions { ocpRange?: string; } -export interface GetTaskFilePropertiesOptions extends OperationOptions { +export interface GetTaskFilePropertiesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1477,7 +1478,7 @@ export interface GetTaskFilePropertiesOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface ListTaskFilesOptions extends OperationOptions { +export interface ListTaskFilesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1502,7 +1503,7 @@ export interface ListTaskFilesOptions extends OperationOptions { recursive?: boolean; } -export interface CreateNodeUserOptions extends OperationOptions { +export interface CreateNodeUserOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1514,7 +1515,7 @@ export interface CreateNodeUserOptions extends OperationOptions { contentType?: string; } -export interface DeleteNodeUserOptions extends OperationOptions { +export interface DeleteNodeUserOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1524,7 +1525,7 @@ export interface DeleteNodeUserOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface ReplaceNodeUserOptions extends OperationOptions { +export interface ReplaceNodeUserOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1536,7 +1537,7 @@ export interface ReplaceNodeUserOptions extends OperationOptions { contentType?: string; } -export interface GetNodeOptions extends OperationOptions { +export interface GetNodeOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1548,7 +1549,7 @@ export interface GetNodeOptions extends OperationOptions { $select?: string[]; } -export interface RebootNodeOptions extends OperationOptions { +export interface RebootNodeOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1560,7 +1561,7 @@ export interface RebootNodeOptions extends OperationOptions { contentType?: string; } -export interface ReimageNodeOptions extends OperationOptions { +export interface ReimageNodeOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1572,7 +1573,7 @@ export interface ReimageNodeOptions extends OperationOptions { contentType?: string; } -export interface DisableNodeSchedulingOptions extends OperationOptions { +export interface DisableNodeSchedulingOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1584,7 +1585,7 @@ export interface DisableNodeSchedulingOptions extends OperationOptions { contentType?: string; } -export interface EnableNodeSchedulingOptions extends OperationOptions { +export interface EnableNodeSchedulingOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1594,7 +1595,8 @@ export interface EnableNodeSchedulingOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface GetNodeRemoteLoginSettingsOptions extends OperationOptions { +export interface GetNodeRemoteLoginSettingsOptionalParams + extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1604,7 +1606,8 @@ export interface GetNodeRemoteLoginSettingsOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface GetNodeRemoteDesktopFileOptions extends OperationOptions { +export interface GetNodeRemoteDesktopFileOptionalParams + extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1614,7 +1617,7 @@ export interface GetNodeRemoteDesktopFileOptions extends OperationOptions { timeOutInSeconds?: number; } -export interface UploadNodeLogsOptions extends OperationOptions { +export interface UploadNodeLogsOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1626,7 +1629,7 @@ export interface UploadNodeLogsOptions extends OperationOptions { contentType?: string; } -export interface ListNodesOptions extends OperationOptions { +export interface ListNodesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1648,7 +1651,7 @@ export interface ListNodesOptions extends OperationOptions { $select?: string[]; } -export interface GetNodeExtensionOptions extends OperationOptions { +export interface GetNodeExtensionOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1660,7 +1663,7 @@ export interface GetNodeExtensionOptions extends OperationOptions { $select?: string[]; } -export interface ListNodeExtensionsOptions extends OperationOptions { +export interface ListNodeExtensionsOptionalParams extends OperationOptions { /** * The maximum number of items to return in the response. A maximum of 1000 * applications can be returned. @@ -1675,7 +1678,7 @@ export interface ListNodeExtensionsOptions extends OperationOptions { $select?: string[]; } -export interface DeleteNodeFileOptions extends OperationOptions { +export interface DeleteNodeFileOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1692,7 +1695,7 @@ export interface DeleteNodeFileOptions extends OperationOptions { recursive?: boolean; } -export interface GetNodeFileOptions extends OperationOptions { +export interface GetNodeFileOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1719,7 +1722,7 @@ export interface GetNodeFileOptions extends OperationOptions { ocpRange?: string; } -export interface GetNodeFilePropertiesOptions extends OperationOptions { +export interface GetNodeFilePropertiesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** @@ -1741,7 +1744,7 @@ export interface GetNodeFilePropertiesOptions extends OperationOptions { ifUnmodifiedSince?: Date; } -export interface ListNodeFilesOptions extends OperationOptions { +export interface ListNodeFilesOptionalParams extends OperationOptions { /** The API version to use for this operation. */ apiVersion?: string; /** diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/models.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/models.ts index 6d574f6d68..d25bd21c62 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/models.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/models.ts @@ -52,12 +52,8 @@ export interface BatchPoolCreateOptions { metadata?: Array; /** Mount storage using specified file system for the entire lifetime of the pool. Mount the storage using Azure fileshare, NFS, CIFS or Blobfuse based file system. */ mountConfiguration?: Array; - /** - * The desired node communication mode for the pool. If omitted, the default value is Default. - * - * Possible values: "default", "classic", "simplified" - */ - targetNodeCommunicationMode?: string; + /** The desired node communication mode for the pool. If omitted, the default value is Default. */ + targetNodeCommunicationMode?: NodeCommunicationMode; } /** @@ -152,30 +148,18 @@ export interface WindowsConfiguration { export interface DataDisk { /** The logical unit number. The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. */ lun: number; - /** - * The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. - * - * Possible values: "none", "readonly", "readwrite" - */ - caching?: string; + /** The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. */ + caching?: CachingType; /** The initial disk size in gigabytes. */ diskSizeGB: number; - /** - * The storage Account type to be used for the data disk. If omitted, the default is "standard_lrs". - * - * Possible values: "standard_lrs", "premium_lrs" - */ - storageAccountType?: string; + /** The storage Account type to be used for the data disk. If omitted, the default is "standard_lrs". */ + storageAccountType?: StorageAccountType; } /** The configuration for container-enabled Pools. */ export interface ContainerConfiguration { - /** - * The container technology to be used. - * - * Possible values: "dockerCompatible", "criCompatible" - */ - type: string; + /** The container technology to be used. */ + type: ContainerType; /** The collection of container Image names. This is the full Image reference, as would be specified to "docker pull". An Image will be sourced from the default Docker registry unless the Image is fully qualified with an alternative registry. */ containerImageNames?: string[]; /** Additional private registries from which containers can be pulled. If any Images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. */ @@ -210,7 +194,7 @@ export interface BatchNodeIdentityReference { */ export interface DiskEncryptionConfiguration { /** The list of disk targets Batch Service will encrypt on the compute node. If omitted, no disks on the compute nodes in the pool will be encrypted. On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. */ - targets?: string[]; + targets?: DiskEncryptionTarget[]; } /** @@ -219,12 +203,8 @@ export interface DiskEncryptionConfiguration { * with best effort balancing. */ export interface NodePlacementConfiguration { - /** - * Node placement Policy type on Batch Pools. Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. - * - * Possible values: "regional", "zonal" - */ - policy?: string; + /** Node placement Policy type on Batch Pools. Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. */ + policy?: NodePlacementPolicyType; } /** The configuration for virtual machine extensions. */ @@ -260,24 +240,16 @@ export interface OSDisk { * compute node (VM). */ export interface DiffDiskSettings { - /** - * Specifies the ephemeral disk placement for operating system disk for all VMs in the pool. This property can be used by user in the request to choose the location e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. - * - * Possible values: "cachedisk" - */ - placement?: string; + /** Specifies the ephemeral disk placement for operating system disk for all VMs in the pool. This property can be used by user in the request to choose the location e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. */ + placement?: DiffDiskPlacement; } /** The network configuration for a Pool. */ export interface NetworkConfiguration { /** The ARM resource identifier of the virtual network subnet which the Compute Nodes of the Pool will join. This is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. The virtual network must be in the same region and subscription as the Azure Batch Account. The specified subnet should have enough free IP addresses to accommodate the number of Compute Nodes in the Pool. If the subnet doesn't have enough free IP addresses, the Pool will partially allocate Nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule Tasks on the Nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the Nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the Compute Nodes to unusable. For Pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for Pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For Pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For Pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. */ subnetId?: string; - /** - * The scope of dynamic vnet assignment. - * - * Possible values: "none", "job" - */ - dynamicVNetAssignmentScope?: string; + /** The scope of dynamic vnet assignment. */ + dynamicVNetAssignmentScope?: DynamicVNetAssignmentScope; /** The configuration for endpoints on Compute Nodes in the Batch Pool. Pool endpoint configuration is only supported on Pools with the virtualMachineConfiguration property. */ endpointConfiguration?: PoolEndpointConfiguration; /** The Public IPAddress configuration for Compute Nodes in the Batch Pool. Public IP configuration property is only supported on Pools with the virtualMachineConfiguration property. */ @@ -299,12 +271,8 @@ export interface PoolEndpointConfiguration { export interface InboundNATPool { /** The name of the endpoint. The name must be unique within a Batch Pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. */ name: string; - /** - * The protocol of the endpoint. - * - * Possible values: "tcp", "udp" - */ - protocol: string; + /** The protocol of the endpoint. */ + protocol: InboundEndpointProtocol; /** The port number on the Compute Node. This must be unique within a Batch Pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. */ backendPort: number; /** The first port number in the range of external ports that will be used to provide inbound access to the backendPort on individual Compute Nodes. Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a Pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. */ @@ -319,12 +287,8 @@ export interface InboundNATPool { export interface NetworkSecurityGroupRule { /** The priority for this rule. Priorities within a Pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. */ priority: number; - /** - * The action that should be taken for a specified IP address, subnet range or tag. - * - * Possible values: "allow", "deny" - */ - access: string; + /** The action that should be taken for a specified IP address, subnet range or tag. */ + access: NetworkSecurityGroupRuleAccess; /** The source address prefix or tag to match for the rule. Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. */ sourceAddressPrefix: string; /** The source port ranges to match for the rule. Valid values are '*' (for all ports 0 - 65535), a specific port (i.e. 22), or a port range (i.e. 100-200). The ports must be in the range of 0 to 65535. Each entry in this collection must not overlap any other entry (either a range or an individual port). If any other values are provided the request fails with HTTP status code 400. The default value is '*'. */ @@ -333,12 +297,8 @@ export interface NetworkSecurityGroupRule { /** The public IP Address configuration of the networking configuration of a Pool. */ export interface PublicIPAddressConfiguration { - /** - * The provisioning type for Public IP Addresses for the Pool. The default value is BatchManaged. - * - * Possible values: "batchmanaged", "usermanaged", "nopublicipaddresses" - */ - provision?: string; + /** The provisioning type for Public IP Addresses for the Pool. The default value is BatchManaged. */ + provision?: IPAddressProvisioningType; /** The list of public IPs which the Batch service will use when provisioning Compute Nodes. The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/Low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. */ ipAddressIds?: string[]; } @@ -383,12 +343,8 @@ export interface TaskContainerSettings { imageName: string; /** The private registry which contains the container Image. This setting can be omitted if was already provided at Pool creation. */ registry?: ContainerRegistry; - /** - * The location of the container Task working directory. The default is 'taskWorkingDirectory'. - * - * Possible values: "taskWorkingDirectory", "containerImageDefault" - */ - workingDirectory?: string; + /** The location of the container Task working directory. The default is 'taskWorkingDirectory'. */ + workingDirectory?: ContainerWorkingDirectory; } /** A single file or multiple files to be downloaded to a Compute Node. */ @@ -427,18 +383,10 @@ export interface UserIdentity { /** Specifies the options for the auto user that runs an Azure Batch Task. */ export interface AutoUserSpecification { - /** - * The scope for the auto user. The default value is pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by StartTasks. - * - * Possible values: "task", "pool" - */ - scope?: string; - /** - * The elevation level of the auto user. The default value is nonAdmin. - * - * Possible values: "nonadmin", "admin" - */ - elevationLevel?: string; + /** The scope for the auto user. The default value is pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by StartTasks. */ + scope?: AutoUserScope; + /** The elevation level of the auto user. The default value is nonAdmin. */ + elevationLevel?: ElevationLevel; } /** A reference to a Certificate to be installed on Compute Nodes in a Pool. Warning: This object is deprecated and will be removed after February, 2024. Please use the [Azure KeyVault Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) instead. */ @@ -447,16 +395,12 @@ export interface CertificateReference { thumbprint: string; /** The algorithm with which the thumbprint is associated. This must be sha1. */ thumbprintAlgorithm: string; - /** - * The location of the Certificate store on the Compute Node into which to install the Certificate. The default value is currentuser. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. - * - * Possible values: "currentuser", "localmachine" - */ - storeLocation?: string; + /** The location of the Certificate store on the Compute Node into which to install the Certificate. The default value is currentuser. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. */ + storeLocation?: CertificateStoreLocation; /** The name of the Certificate store on the Compute Node into which to install the Certificate. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. */ storeName?: string; /** Which user Accounts on the Compute Node should have access to the private data of the Certificate. You can specify more than one visibility in this collection. The default is all Accounts. */ - visibility?: string[]; + visibility?: CertificateVisibility[]; } /** A reference to an Package to be deployed to Compute Nodes. */ @@ -469,12 +413,8 @@ export interface ApplicationPackageReference { /** Specifies how Tasks should be distributed across Compute Nodes. */ export interface TaskSchedulingPolicy { - /** - * How Tasks are distributed across Compute Nodes in a Pool. If not specified, the default is spread. - * - * Possible values: "spread", "pack" - */ - nodeFillType: string; + /** How Tasks are distributed across Compute Nodes in a Pool. If not specified, the default is spread. */ + nodeFillType: BatchNodeFillType; } /** @@ -486,12 +426,8 @@ export interface UserAccount { name: string; /** The password for the user Account. */ password: string; - /** - * The elevation level of the user Account. The default value is nonAdmin. - * - * Possible values: "nonadmin", "admin" - */ - elevationLevel?: string; + /** The elevation level of the user Account. The default value is nonAdmin. */ + elevationLevel?: ElevationLevel; /** The Linux-specific user configuration for the user Account. This property is ignored if specified on a Windows Pool. If not specified, the user is created with the default options. */ linuxUserConfiguration?: LinuxUserConfiguration; /** The Windows-specific user configuration for the user Account. This property can only be specified if the user is on a Windows Pool. If not specified and on a Windows Pool, the user is created with the default options. */ @@ -510,12 +446,8 @@ export interface LinuxUserConfiguration { /** Properties used to create a user Account on a Windows Compute Node. */ export interface WindowsUserConfiguration { - /** - * The login mode for the user. The default value for VirtualMachineConfiguration Pools is 'batch' and for CloudServiceConfiguration Pools is 'interactive'. - * - * Possible values: "batch", "interactive" - */ - loginMode?: string; + /** The login mode for the user. The default value for VirtualMachineConfiguration Pools is 'batch' and for CloudServiceConfiguration Pools is 'interactive'. */ + loginMode?: LoginMode; } /** @@ -622,12 +554,8 @@ export interface BatchPoolUpdateOptions { applicationPackageReferences?: Array; /** A list of name-value pairs associated with the Pool as metadata. If this element is present, it replaces any existing metadata configured on the Pool. If you specify an empty collection, any metadata is removed from the Pool. If omitted, any existing metadata is left unchanged. */ metadata?: Array; - /** - * The desired node communication mode for the pool. If this element is present, it replaces the existing targetNodeCommunicationMode configured on the Pool. If omitted, any existing metadata is left unchanged. - * - * Possible values: "default", "classic", "simplified" - */ - targetNodeCommunicationMode?: string; + /** The desired node communication mode for the pool. If this element is present, it replaces the existing targetNodeCommunicationMode configured on the Pool. If omitted, any existing metadata is left unchanged. */ + targetNodeCommunicationMode?: NodeCommunicationMode; } /** Options for enabling automatic scaling on an Azure Batch Pool. */ @@ -652,12 +580,8 @@ export interface BatchPoolResizeOptions { targetLowPriorityNodes?: number; /** The timeout for allocation of Nodes to the Pool or removal of Compute Nodes from the Pool. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). */ resizeTimeout?: string; - /** - * Determines what to do with a Compute Node and its running task(s) if the Pool size is decreasing. The default value is requeue. - * - * Possible values: "requeue", "terminate", "taskcompletion", "retaineddata" - */ - nodeDeallocationOption?: string; + /** Determines what to do with a Compute Node and its running task(s) if the Pool size is decreasing. The default value is requeue. */ + nodeDeallocationOption?: BatchNodeDeallocationOption; } /** Options for replacing properties on an Azure Batch Pool. */ @@ -677,12 +601,8 @@ export interface BatchPoolReplaceOptions { applicationPackageReferences: Array; /** A list of name-value pairs associated with the Pool as metadata. This list replaces any existing metadata configured on the Pool. If omitted, or if you specify an empty collection, any existing metadata is removed from the Pool. */ metadata: Array; - /** - * The desired node communication mode for the pool. This setting replaces any existing targetNodeCommunication setting on the Pool. If omitted, the existing setting is default. - * - * Possible values: "default", "classic", "simplified" - */ - targetNodeCommunicationMode?: string; + /** The desired node communication mode for the pool. This setting replaces any existing targetNodeCommunication setting on the Pool. If omitted, the existing setting is default. */ + targetNodeCommunicationMode?: NodeCommunicationMode; } /** Options for removing nodes from an Azure Batch Pool. */ @@ -691,12 +611,8 @@ export interface NodeRemoveOptions { nodeList: string[]; /** The timeout for removal of Compute Nodes to the Pool. The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). */ resizeTimeout?: string; - /** - * Determines what to do with a Compute Node and its running task(s) after it has been selected for deallocation. The default value is requeue. - * - * Possible values: "requeue", "terminate", "taskcompletion", "retaineddata" - */ - nodeDeallocationOption?: string; + /** Determines what to do with a Compute Node and its running task(s) after it has been selected for deallocation. The default value is requeue. */ + nodeDeallocationOption?: BatchNodeDeallocationOption; } /** An Azure Batch Job. */ @@ -711,12 +627,8 @@ export interface BatchJob { constraints?: JobConstraints; /** The Pool settings associated with the Job. */ poolInfo: PoolInformation; - /** - * The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. - * - * Possible values: "noaction", "terminatejob" - */ - onAllTasksComplete?: string; + /** The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. */ + onAllTasksComplete?: OnAllTasksComplete; /** A list of name-value pairs associated with the Job as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code. */ metadata?: Array; } @@ -837,12 +749,8 @@ export interface HttpHeader { * to perform the upload. */ export interface OutputFileUploadOptions { - /** - * The conditions under which the Task output file or set of files should be uploaded. The default is taskcompletion. - * - * Possible values: "tasksuccess", "taskfailure", "taskcompletion" - */ - uploadCondition: string; + /** The conditions under which the Task output file or set of files should be uploaded. The default is taskcompletion. */ + uploadCondition: OutputFileUploadCondition; } /** Execution constraints to apply to a Task. */ @@ -861,7 +769,7 @@ export interface TaskConstraints { */ export interface AuthenticationTokenSettings { /** The Batch resources to which the token grants access. The authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the Job which contains the Task. */ - access?: string[]; + access?: AccessScope[]; } /** @@ -965,12 +873,8 @@ export interface PoolInformation { export interface AutoPoolSpecification { /** A prefix to be added to the unique identifier when a Pool is automatically created. The Batch service assigns each auto Pool a unique identifier on creation. To distinguish between Pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long. */ autoPoolIdPrefix?: string; - /** - * The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools. - * - * Possible values: "jobschedule", "job" - */ - poolLifetimeOption: string; + /** The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools. */ + poolLifetimeOption: PoolLifetimeOption; /** Whether to keep an auto Pool alive after its lifetime expires. If false, the Batch service deletes the Pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the Job or Job Schedule completes. If true, the Batch service does not delete the Pool automatically. It is up to the user to delete auto Pools created with this option. */ keepAlive?: boolean; /** The Pool specification for the auto Pool. */ @@ -1025,12 +929,8 @@ export interface PoolSpecification { metadata?: Array; /** A list of file systems to mount on each node in the pool. This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. */ mountConfiguration?: Array; - /** - * The desired node communication mode for the pool. If omitted, the default value is Default. - * - * Possible values: "default", "classic", "simplified" - */ - targetNodeCommunicationMode?: string; + /** The desired node communication mode for the pool. If omitted, the default value is Default. */ + targetNodeCommunicationMode?: NodeCommunicationMode; } /** The network configuration for the Job. */ @@ -1055,12 +955,8 @@ export interface JobExecutionInformation { /** An error encountered by the Batch service when scheduling a Job. */ export interface JobSchedulingError { - /** - * The category of the Job scheduling error. - * - * Possible values: "usererror", "servererror" - */ - category: string; + /** The category of the Job scheduling error. */ + category: ErrorCategory; /** An identifier for the Job scheduling error. Codes are invariant and are intended to be consumed programmatically. */ code?: string; /** A message describing the Job scheduling error, intended to be suitable for display in a user interface. */ @@ -1113,24 +1009,16 @@ export interface BatchJobUpdateOptions { constraints?: JobConstraints; /** The Pool on which the Batch service runs the Job's Tasks. You may change the Pool for a Job only when the Job is disabled. The Patch Job call will fail if you include the poolInfo element and the Job is not disabled. If you specify an autoPoolSpecification in the poolInfo, only the keepAlive property of the autoPoolSpecification can be updated, and then only if the autoPoolSpecification has a poolLifetimeOption of Job (other job properties can be updated as normal). If omitted, the Job continues to run on its current Pool. */ poolInfo?: PoolInformation; - /** - * The action the Batch service should take when all Tasks in the Job are in the completed state. If omitted, the completion behavior is left unchanged. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic Job termination, you cannot turn it off again. If you try to do this, the request fails with an 'invalid property value' error response; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - * - * Possible values: "noaction", "terminatejob" - */ - onAllTasksComplete?: string; + /** The action the Batch service should take when all Tasks in the Job are in the completed state. If omitted, the completion behavior is left unchanged. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic Job termination, you cannot turn it off again. If you try to do this, the request fails with an 'invalid property value' error response; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). */ + onAllTasksComplete?: OnAllTasksComplete; /** A list of name-value pairs associated with the Job as metadata. If omitted, the existing Job metadata is left unchanged. */ metadata?: Array; } /** Options for disabling an Azure Batch Job. */ export interface BatchJobDisableOptions { - /** - * What to do with active Tasks associated with the Job. - * - * Possible values: "requeue", "terminate", "wait" - */ - disableTasks: string; + /** What to do with active Tasks associated with the Job. */ + disableTasks: DisableJobOption; } /** Options for terminating an Azure Batch Job. */ @@ -1165,18 +1053,10 @@ export interface BatchJobCreateOptions { commonEnvironmentSettings?: Array; /** The Pool on which the Batch service runs the Job's Tasks. */ poolInfo: PoolInformation; - /** - * The action the Batch service should take when all Tasks in the Job are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. - * - * Possible values: "noaction", "terminatejob" - */ - onAllTasksComplete?: string; - /** - * The action the Batch service should take when any Task in the Job fails. A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. - * - * Possible values: "noaction", "performexitoptionsjobaction" - */ - onTaskFailure?: string; + /** The action the Batch service should take when all Tasks in the Job are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. */ + onAllTasksComplete?: OnAllTasksComplete; + /** The action the Batch service should take when any Task in the Job fails. A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. */ + onTaskFailure?: OnTaskFailure; /** The network configuration for the Job. */ networkConfiguration?: JobNetworkConfiguration; /** A list of name-value pairs associated with the Job as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code. */ @@ -1195,12 +1075,8 @@ export interface TaskContainerExecutionInformation { /** Information about a Task failure. */ export interface TaskFailureInformation { - /** - * The category of the Task error. - * - * Possible values: "usererror", "servererror" - */ - category: string; + /** The category of the Task error. */ + category: ErrorCategory; /** An identifier for the Task error. Codes are invariant and are intended to be consumed programmatically. */ code?: string; /** A message describing the Task error, intended to be suitable for display in a user interface. */ @@ -1220,12 +1096,8 @@ export interface BatchCertificate { thumbprintAlgorithm: string; /** The base64-encoded contents of the Certificate. The maximum size is 10KB. */ data: string; - /** - * The format of the Certificate data. - * - * Possible values: "pfx", "cer" - */ - certificateFormat?: string; + /** The format of the Certificate data. */ + certificateFormat?: CertificateFormat; /** The password to access the Certificate's private key. This must be omitted if the Certificate format is cer. */ password?: string; } @@ -1280,18 +1152,10 @@ export interface JobSpecification { displayName?: string; /** Whether Tasks in the Job can define dependencies on each other. The default is false. */ usesTaskDependencies?: boolean; - /** - * The action the Batch service should take when all Tasks in a Job created under this schedule are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. - * - * Possible values: "noaction", "terminatejob" - */ - onAllTasksComplete?: string; - /** - * The action the Batch service should take when any Task fails in a Job created under this schedule. A Task is considered to have failed if it have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. - * - * Possible values: "noaction", "performexitoptionsjobaction" - */ - onTaskFailure?: string; + /** The action the Batch service should take when all Tasks in a Job created under this schedule are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. */ + onAllTasksComplete?: OnAllTasksComplete; + /** The action the Batch service should take when any Task fails in a Job created under this schedule. A Task is considered to have failed if it have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. */ + onTaskFailure?: OnTaskFailure; /** The network configuration for the Job. */ networkConfiguration?: JobNetworkConfiguration; /** The execution constraints for Jobs created under this schedule. */ @@ -1450,18 +1314,10 @@ export interface ExitCodeMapping { /** Specifies how the Batch service responds to a particular exit condition. */ export interface ExitOptions { - /** - * An action to take on the Job containing the Task, if the Task completes with the given exit condition and the Job's onTaskFailed property is 'performExitOptionsJobAction'. The default is none for exit code 0 and terminate for all other exit conditions. If the Job's onTaskFailed property is noaction, then specifying this property returns an error and the add Task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - * - * Possible values: "none", "disable", "terminate" - */ - jobAction?: string; - /** - * An action that the Batch service performs on Tasks that depend on this Task. Possible values are 'satisfy' (allowing dependent tasks to progress) and 'block' (dependent tasks continue to wait). Batch does not yet support cancellation of dependent tasks. - * - * Possible values: "satisfy", "block" - */ - dependencyAction?: string; + /** An action to take on the Job containing the Task, if the Task completes with the given exit condition and the Job's onTaskFailed property is 'performExitOptionsJobAction'. The default is none for exit code 0 and terminate for all other exit conditions. If the Job's onTaskFailed property is noaction, then specifying this property returns an error and the add Task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). */ + jobAction?: JobAction; + /** An action that the Batch service performs on Tasks that depend on this Task. Possible values are 'satisfy' (allowing dependent tasks to progress) and 'block' (dependent tasks continue to wait). Batch does not yet support cancellation of dependent tasks. */ + dependencyAction?: DependencyAction; } /** @@ -1560,12 +1416,8 @@ export interface TaskExecutionInformation { requeueCount: number; /** The most recent time at which the Task has been requeued by the Batch service as the result of a user request. This property is set only if the requeueCount is nonzero. */ lastRequeueTime?: Date | string; - /** - * The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. - * - * Possible values: "success", "failure" - */ - result?: string; + /** The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. */ + result?: TaskExecutionResult; } /** Information about the Compute Node on which a Task ran. */ @@ -1642,32 +1494,20 @@ export interface BatchNodeUserUpdateOptions { /** Options for rebooting an Azure Batch Compute Node. */ export interface NodeRebootOptions { - /** - * When to reboot the Compute Node and what to do with currently running Tasks. The default value is requeue. - * - * Possible values: "requeue", "terminate", "taskcompletion", "retaineddata" - */ - nodeRebootOption?: string; + /** When to reboot the Compute Node and what to do with currently running Tasks. The default value is requeue. */ + nodeRebootOption?: BatchNodeRebootOption; } /** Options for reimaging an Azure Batch Compute Node. */ export interface NodeReimageOptions { - /** - * When to reimage the Compute Node and what to do with currently running Tasks. The default value is requeue. - * - * Possible values: "requeue", "terminate", "taskcompletion", "retaineddata" - */ - nodeReimageOption?: string; + /** When to reimage the Compute Node and what to do with currently running Tasks. The default value is requeue. */ + nodeReimageOption?: BatchNodeReimageOption; } /** Options for disabling scheduling on an Azure Batch Compute Node. */ export interface NodeDisableSchedulingOptions { - /** - * What to do with currently running Tasks when disabling Task scheduling on the Compute Node. The default value is requeue. - * - * Possible values: "requeue", "terminate", "taskcompletion" - */ - nodeDisableSchedulingOption?: string; + /** What to do with currently running Tasks when disabling Task scheduling on the Compute Node. The default value is requeue. */ + nodeDisableSchedulingOption?: DisableBatchNodeSchedulingOption; } /** The Azure Batch service log files upload options for a Compute Node. */ @@ -1681,3 +1521,113 @@ export interface UploadBatchServiceLogsOptions { /** The reference to the user assigned identity to use to access Azure Blob Storage specified by containerUrl. The identity must have write access to the Azure Blob Storage container. */ identityReference?: BatchNodeIdentityReference; } + +/** CachingType enums */ +export type CachingType = "none" | "readonly" | "readwrite"; +/** StorageAccountType enums */ +export type StorageAccountType = "standard_lrs" | "premium_lrs"; +/** ContainerType enums */ +export type ContainerType = "dockerCompatible" | "criCompatible"; +/** DiskEncryptionTarget enums */ +export type DiskEncryptionTarget = "osdisk" | "temporarydisk"; +/** NodePlacementPolicyType enums */ +export type NodePlacementPolicyType = "regional" | "zonal"; +/** AccessDiffDiskPlacementScope enums */ +export type DiffDiskPlacement = "cachedisk"; +/** DynamicVNetAssignmentScope enums */ +export type DynamicVNetAssignmentScope = "none" | "job"; +/** InboundEndpointProtocol enums */ +export type InboundEndpointProtocol = "tcp" | "udp"; +/** NetworkSecurityGroupRuleAccess enums */ +export type NetworkSecurityGroupRuleAccess = "allow" | "deny"; +/** IPAddressProvisioningType enums */ +export type IPAddressProvisioningType = + | "batchmanaged" + | "usermanaged" + | "nopublicipaddresses"; +/** ContainerWorkingDirectory enums */ +export type ContainerWorkingDirectory = + | "taskWorkingDirectory" + | "containerImageDefault"; +/** AutoUserScope enums */ +export type AutoUserScope = "task" | "pool"; +/** ElevationLevel enums */ +export type ElevationLevel = "nonadmin" | "admin"; +/** CertificateStoreLocation enums */ +export type CertificateStoreLocation = "currentuser" | "localmachine"; +/** CertificateVisibility enums */ +export type CertificateVisibility = "starttask" | "task" | "remoteuser"; +/** BatchNodeFillType enums */ +export type BatchNodeFillType = "spread" | "pack"; +/** LoginMode enums */ +export type LoginMode = "batch" | "interactive"; +/** NodeCommunicationMode enums */ +export type NodeCommunicationMode = "default" | "classic" | "simplified"; +/** BatchNodeDeallocationOption enums */ +export type BatchNodeDeallocationOption = + | "requeue" + | "terminate" + | "taskcompletion" + | "retaineddata"; +/** JobState enums */ +export type JobState = + | "active" + | "disabling" + | "disabled" + | "enabling" + | "terminating" + | "completed" + | "deleting"; +/** OutputFileUploadCondition enums */ +export type OutputFileUploadCondition = + | "tasksuccess" + | "taskfailure" + | "taskcompletion"; +/** AccessScope enums */ +export type AccessScope = "job"; +/** PoolLifetimeOption enums */ +export type PoolLifetimeOption = "jobschedule" | "job"; +/** The action the Batch service should take when all Tasks in the Job are in the completed state. */ +export type OnAllTasksComplete = "noaction" | "terminatejob"; +/** OnTaskFailure enums */ +export type OnTaskFailure = "noaction" | "performexitoptionsjobaction"; +/** ErrorCategory enums */ +export type ErrorCategory = "usererror" | "servererror"; +/** DisableJobOption enums */ +export type DisableJobOption = "requeue" | "terminate" | "wait"; +/** TaskExecutionResult enums */ +export type TaskExecutionResult = "success" | "failure"; +/** CertificateState enums */ +export type CertificateState = "active" | "deleting" | "deletefailed"; +/** CertificateFormat enums */ +export type CertificateFormat = "pfx" | "cer"; +/** JobScheduleState enums */ +export type JobScheduleState = + | "active" + | "completed" + | "disabled" + | "terminating" + | "deleting"; +/** JobAction enums */ +export type JobAction = "none" | "disable" | "terminate"; +/** DependencyAction enums */ +export type DependencyAction = "satisfy" | "block"; +/** TaskState enums */ +export type TaskState = "active" | "preparing" | "running" | "completed"; +/** BatchNodeRebootOption enums */ +export type BatchNodeRebootOption = + | "requeue" + | "terminate" + | "taskcompletion" + | "retaineddata"; +/** BatchNodeReimageOption enums */ +export type BatchNodeReimageOption = + | "requeue" + | "terminate" + | "taskcompletion" + | "retaineddata"; +/** DisableBatchNodeSchedulingOption enums */ +export type DisableBatchNodeSchedulingOption = + | "requeue" + | "terminate" + | "taskcompletion"; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/outputModels.ts index 19aab2ed04..ac96d16d41 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/src/rest/outputModels.ts @@ -1,21 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** The parameters for a widget status request */ -export interface BatchApplicationListHeadersOutput - extends BatchClientRequestHeadersOutput {} - -/** The parameters for a widget status request */ -export interface BatchClientRequestHeadersOutput {} - -/** Common path parms for Task related File operartions */ -export interface BatchTaskFileClientPathParametersOutput - extends BatchClientRequestHeadersOutput {} - -/** Common path parms for Node related File operartions */ -export interface BatchNodeFileClientPathParametersOutput - extends BatchClientRequestHeadersOutput {} - /** The result of listing the applications available in an Account. */ export interface ApplicationListResultOutput { /** The list of applications available in the Account. */ @@ -176,30 +161,18 @@ export interface WindowsConfigurationOutput { export interface DataDiskOutput { /** The logical unit number. The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. The value must be between 0 and 63, inclusive. */ lun: number; - /** - * The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. - * - * Possible values: "none", "readonly", "readwrite" - */ - caching?: string; + /** The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. */ + caching?: CachingTypeOutput; /** The initial disk size in gigabytes. */ diskSizeGB: number; - /** - * The storage Account type to be used for the data disk. If omitted, the default is "standard_lrs". - * - * Possible values: "standard_lrs", "premium_lrs" - */ - storageAccountType?: string; + /** The storage Account type to be used for the data disk. If omitted, the default is "standard_lrs". */ + storageAccountType?: StorageAccountTypeOutput; } /** The configuration for container-enabled Pools. */ export interface ContainerConfigurationOutput { - /** - * The container technology to be used. - * - * Possible values: "dockerCompatible", "criCompatible" - */ - type: string; + /** The container technology to be used. */ + type: ContainerTypeOutput; /** The collection of container Image names. This is the full Image reference, as would be specified to "docker pull". An Image will be sourced from the default Docker registry unless the Image is fully qualified with an alternative registry. */ containerImageNames?: string[]; /** Additional private registries from which containers can be pulled. If any Images must be downloaded from a private registry which requires credentials, then those credentials must be provided here. */ @@ -234,7 +207,7 @@ export interface BatchNodeIdentityReferenceOutput { */ export interface DiskEncryptionConfigurationOutput { /** The list of disk targets Batch Service will encrypt on the compute node. If omitted, no disks on the compute nodes in the pool will be encrypted. On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and "TemporaryDisk" must be specified. */ - targets?: string[]; + targets?: DiskEncryptionTargetOutput[]; } /** @@ -243,12 +216,8 @@ export interface DiskEncryptionConfigurationOutput { * with best effort balancing. */ export interface NodePlacementConfigurationOutput { - /** - * Node placement Policy type on Batch Pools. Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. - * - * Possible values: "regional", "zonal" - */ - policy?: string; + /** Node placement Policy type on Batch Pools. Allocation policy used by Batch Service to provision the nodes. If not specified, Batch will use the regional policy. */ + policy?: NodePlacementPolicyTypeOutput; } /** The configuration for virtual machine extensions. */ @@ -284,24 +253,16 @@ export interface OSDiskOutput { * compute node (VM). */ export interface DiffDiskSettingsOutput { - /** - * Specifies the ephemeral disk placement for operating system disk for all VMs in the pool. This property can be used by user in the request to choose the location e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. - * - * Possible values: "cachedisk" - */ - placement?: string; + /** Specifies the ephemeral disk placement for operating system disk for all VMs in the pool. This property can be used by user in the request to choose the location e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. */ + placement?: DiffDiskPlacementOutput; } /** The network configuration for a Pool. */ export interface NetworkConfigurationOutput { /** The ARM resource identifier of the virtual network subnet which the Compute Nodes of the Pool will join. This is of the form /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}. The virtual network must be in the same region and subscription as the Azure Batch Account. The specified subnet should have enough free IP addresses to accommodate the number of Compute Nodes in the Pool. If the subnet doesn't have enough free IP addresses, the Pool will partially allocate Nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule Tasks on the Nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the Nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the Compute Nodes to unusable. For Pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for Pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For Pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For Pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. */ subnetId?: string; - /** - * The scope of dynamic vnet assignment. - * - * Possible values: "none", "job" - */ - dynamicVNetAssignmentScope?: string; + /** The scope of dynamic vnet assignment. */ + dynamicVNetAssignmentScope?: DynamicVNetAssignmentScopeOutput; /** The configuration for endpoints on Compute Nodes in the Batch Pool. Pool endpoint configuration is only supported on Pools with the virtualMachineConfiguration property. */ endpointConfiguration?: PoolEndpointConfigurationOutput; /** The Public IPAddress configuration for Compute Nodes in the Batch Pool. Public IP configuration property is only supported on Pools with the virtualMachineConfiguration property. */ @@ -323,12 +284,8 @@ export interface PoolEndpointConfigurationOutput { export interface InboundNATPoolOutput { /** The name of the endpoint. The name must be unique within a Batch Pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. */ name: string; - /** - * The protocol of the endpoint. - * - * Possible values: "tcp", "udp" - */ - protocol: string; + /** The protocol of the endpoint. */ + protocol: InboundEndpointProtocolOutput; /** The port number on the Compute Node. This must be unique within a Batch Pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. */ backendPort: number; /** The first port number in the range of external ports that will be used to provide inbound access to the backendPort on individual Compute Nodes. Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a Pool must be distinct and cannot overlap. Each range must contain at least 40 ports. If any reserved or overlapping values are provided the request fails with HTTP status code 400. */ @@ -343,12 +300,8 @@ export interface InboundNATPoolOutput { export interface NetworkSecurityGroupRuleOutput { /** The priority for this rule. Priorities within a Pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status code 400. */ priority: number; - /** - * The action that should be taken for a specified IP address, subnet range or tag. - * - * Possible values: "allow", "deny" - */ - access: string; + /** The action that should be taken for a specified IP address, subnet range or tag. */ + access: NetworkSecurityGroupRuleAccessOutput; /** The source address prefix or tag to match for the rule. Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. */ sourceAddressPrefix: string; /** The source port ranges to match for the rule. Valid values are '*' (for all ports 0 - 65535), a specific port (i.e. 22), or a port range (i.e. 100-200). The ports must be in the range of 0 to 65535. Each entry in this collection must not overlap any other entry (either a range or an individual port). If any other values are provided the request fails with HTTP status code 400. The default value is '*'. */ @@ -357,12 +310,8 @@ export interface NetworkSecurityGroupRuleOutput { /** The public IP Address configuration of the networking configuration of a Pool. */ export interface PublicIPAddressConfigurationOutput { - /** - * The provisioning type for Public IP Addresses for the Pool. The default value is BatchManaged. - * - * Possible values: "batchmanaged", "usermanaged", "nopublicipaddresses" - */ - provision?: string; + /** The provisioning type for Public IP Addresses for the Pool. The default value is BatchManaged. */ + provision?: IPAddressProvisioningTypeOutput; /** The list of public IPs which the Batch service will use when provisioning Compute Nodes. The number of IPs specified here limits the maximum size of the Pool - 100 dedicated nodes or 100 Spot/Low-priority nodes can be allocated for each public IP. For example, a pool needing 250 dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. */ ipAddressIds?: string[]; } @@ -407,12 +356,8 @@ export interface TaskContainerSettingsOutput { imageName: string; /** The private registry which contains the container Image. This setting can be omitted if was already provided at Pool creation. */ registry?: ContainerRegistryOutput; - /** - * The location of the container Task working directory. The default is 'taskWorkingDirectory'. - * - * Possible values: "taskWorkingDirectory", "containerImageDefault" - */ - workingDirectory?: string; + /** The location of the container Task working directory. The default is 'taskWorkingDirectory'. */ + workingDirectory?: ContainerWorkingDirectoryOutput; } /** A single file or multiple files to be downloaded to a Compute Node. */ @@ -451,18 +396,10 @@ export interface UserIdentityOutput { /** Specifies the options for the auto user that runs an Azure Batch Task. */ export interface AutoUserSpecificationOutput { - /** - * The scope for the auto user. The default value is pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by StartTasks. - * - * Possible values: "task", "pool" - */ - scope?: string; - /** - * The elevation level of the auto user. The default value is nonAdmin. - * - * Possible values: "nonadmin", "admin" - */ - elevationLevel?: string; + /** The scope for the auto user. The default value is pool. If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way which could impact other tasks, or if certificates have been specified on the pool which should not be accessible by normal tasks but should be accessible by StartTasks. */ + scope?: AutoUserScopeOutput; + /** The elevation level of the auto user. The default value is nonAdmin. */ + elevationLevel?: ElevationLevelOutput; } /** A reference to a Certificate to be installed on Compute Nodes in a Pool. Warning: This object is deprecated and will be removed after February, 2024. Please use the [Azure KeyVault Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) instead. */ @@ -471,16 +408,12 @@ export interface CertificateReferenceOutput { thumbprint: string; /** The algorithm with which the thumbprint is associated. This must be sha1. */ thumbprintAlgorithm: string; - /** - * The location of the Certificate store on the Compute Node into which to install the Certificate. The default value is currentuser. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. - * - * Possible values: "currentuser", "localmachine" - */ - storeLocation?: string; + /** The location of the Certificate store on the Compute Node into which to install the Certificate. The default value is currentuser. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). For Linux Compute Nodes, the Certificates are stored in a directory inside the Task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the Task to query for this location. For Certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and Certificates are placed in that directory. */ + storeLocation?: CertificateStoreLocationOutput; /** The name of the Certificate store on the Compute Node into which to install the Certificate. This property is applicable only for Pools configured with Windows Compute Nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows Image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. */ storeName?: string; /** Which user Accounts on the Compute Node should have access to the private data of the Certificate. You can specify more than one visibility in this collection. The default is all Accounts. */ - visibility?: string[]; + visibility?: CertificateVisibilityOutput[]; } /** A reference to an Package to be deployed to Compute Nodes. */ @@ -493,12 +426,8 @@ export interface ApplicationPackageReferenceOutput { /** Specifies how Tasks should be distributed across Compute Nodes. */ export interface TaskSchedulingPolicyOutput { - /** - * How Tasks are distributed across Compute Nodes in a Pool. If not specified, the default is spread. - * - * Possible values: "spread", "pack" - */ - nodeFillType: string; + /** How Tasks are distributed across Compute Nodes in a Pool. If not specified, the default is spread. */ + nodeFillType: BatchNodeFillTypeOutput; } /** @@ -510,12 +439,8 @@ export interface UserAccountOutput { name: string; /** The password for the user Account. */ password: string; - /** - * The elevation level of the user Account. The default value is nonAdmin. - * - * Possible values: "nonadmin", "admin" - */ - elevationLevel?: string; + /** The elevation level of the user Account. The default value is nonAdmin. */ + elevationLevel?: ElevationLevelOutput; /** The Linux-specific user configuration for the user Account. This property is ignored if specified on a Windows Pool. If not specified, the user is created with the default options. */ linuxUserConfiguration?: LinuxUserConfigurationOutput; /** The Windows-specific user configuration for the user Account. This property can only be specified if the user is on a Windows Pool. If not specified and on a Windows Pool, the user is created with the default options. */ @@ -534,12 +459,8 @@ export interface LinuxUserConfigurationOutput { /** Properties used to create a user Account on a Windows Compute Node. */ export interface WindowsUserConfigurationOutput { - /** - * The login mode for the user. The default value for VirtualMachineConfiguration Pools is 'batch' and for CloudServiceConfiguration Pools is 'interactive'. - * - * Possible values: "batch", "interactive" - */ - loginMode?: string; + /** The login mode for the user. The default value for VirtualMachineConfiguration Pools is 'batch' and for CloudServiceConfiguration Pools is 'interactive'. */ + loginMode?: LoginModeOutput; } /** @@ -643,20 +564,12 @@ export interface BatchPoolOutput { readonly lastModified?: string; /** The creation time of the Pool. */ readonly creationTime?: string; - /** - * The current state of the Pool. - * - * Possible values: "active", "deleting" - */ - readonly state?: string; + /** The current state of the Pool. */ + readonly state?: PoolStateOutput; /** The time at which the Pool entered its current state. */ readonly stateTransitionTime?: string; - /** - * Whether the Pool is resizing. - * - * Possible values: "steady", "resizing", "stopping" - */ - readonly allocationState?: string; + /** Whether the Pool is resizing. */ + readonly allocationState?: AllocationStateOutput; /** The time at which the Pool entered its current allocation state. */ readonly allocationStateTransitionTime?: string; /** The size of virtual machines in the Pool. All virtual machines in a Pool are the same size. For information about available sizes of virtual machines in Pools, see Choose a VM size for Compute Nodes in an Azure Batch Pool (https://docs.microsoft.com/azure/batch/batch-pool-vm-sizes). */ @@ -716,18 +629,10 @@ export interface BatchPoolOutput { readonly mountConfiguration?: Array; /** The identity of the Batch pool, if configured. The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ readonly identity?: BatchPoolIdentityOutput; - /** - * The desired node communication mode for the pool. If omitted, the default value is Default. - * - * Possible values: "default", "classic", "simplified" - */ - targetNodeCommunicationMode?: string; - /** - * The current state of the pool communication mode. - * - * Possible values: "default", "classic", "simplified" - */ - readonly currentNodeCommunicationMode?: string; + /** The desired node communication mode for the pool. If omitted, the default value is Default. */ + targetNodeCommunicationMode?: NodeCommunicationModeOutput; + /** The current state of the pool communication mode. */ + readonly currentNodeCommunicationMode?: NodeCommunicationModeOutput; } /** An error that occurred when resizing a Pool. */ @@ -824,12 +729,8 @@ export interface ResourceStatisticsOutput { /** The identity of the Batch pool, if configured. */ export interface BatchPoolIdentityOutput { - /** - * The identity of the Batch pool, if configured. The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - * - * Possible values: "UserAssigned", "None" - */ - type: string; + /** The identity of the Batch pool, if configured. The list of user identities associated with the Batch pool. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + type: PoolIdentityTypeOutput; /** The list of user identities associated with the Batch account. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ userAssignedIdentities?: Array; } @@ -844,12 +745,6 @@ export interface UserAssignedIdentityOutput { readonly principalId?: string; } -/** Options for evaluating an automatic scaling formula on an Azure Batch Pool. */ -export interface BatchPoolEvaluateAutoScaleOptionsOutput { - /** The formula for the desired number of Compute Nodes in the Pool. The formula is validated and its results calculated, but it is not applied to the Pool. To apply the formula to the Pool, 'Enable automatic scaling on a Pool'. For more information about specifying this formula, see Automatically scale Compute Nodes in an Azure Batch Pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling). */ - autoScaleFormula: string; -} - /** The result of listing the supported Virtual Machine Images. */ export interface AccountListSupportedImagesResultOutput { /** The list of supported Virtual Machine Images. */ @@ -867,22 +762,14 @@ export interface ImageInformationOutput { nodeAgentSKUId: string; /** The reference to the Azure Virtual Machine's Marketplace Image. */ imageReference: ImageReferenceOutput; - /** - * The type of operating system (e.g. Windows or Linux) of the Image. - * - * Possible values: "linux", "windows" - */ - osType: string; + /** The type of operating system (e.g. Windows or Linux) of the Image. */ + osType: OSTypeOutput; /** The capabilities or features which the Image supports. Not every capability of the Image is listed. Capabilities in this list are considered of special interest and are generally related to integration with other features in the Azure Batch service. */ capabilities?: string[]; /** The time when the Azure Batch service will stop accepting create Pool requests for the Image. */ batchSupportEndOfLife?: string; - /** - * Whether the Azure Batch service actively verifies that the Image is compatible with the associated Compute Node agent SKU. - * - * Possible values: "verified", "unverified" - */ - verificationType: string; + /** Whether the Azure Batch service actively verifies that the Image is compatible with the associated Compute Node agent SKU. */ + verificationType: VerificationTypeOutput; } /** The result of listing the Compute Node counts in the Account. */ @@ -951,20 +838,12 @@ export interface BatchJobOutput { readonly lastModified?: string; /** The creation time of the Job. */ readonly creationTime?: string; - /** - * The current state of the Job. - * - * Possible values: "active", "disabling", "disabled", "enabling", "terminating", "completed", "deleting" - */ - readonly state?: string; + /** The current state of the Job. */ + readonly state?: JobStateOutput; /** The time at which the Job entered its current state. */ readonly stateTransitionTime?: string; - /** - * The previous state of the Job. This property is not set if the Job is in its initial Active state. - * - * Possible values: "active", "disabling", "disabled", "enabling", "terminating", "completed", "deleting" - */ - readonly previousState?: string; + /** The previous state of the Job. This property is not set if the Job is in its initial Active state. */ + readonly previousState?: JobStateOutput; /** The time at which the Job entered its previous state. This property is not set if the Job is in its initial Active state. */ readonly previousStateTransitionTime?: string; /** The priority of the Job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. */ @@ -985,18 +864,10 @@ export interface BatchJobOutput { readonly commonEnvironmentSettings?: Array; /** The Pool settings associated with the Job. */ poolInfo: PoolInformationOutput; - /** - * The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. - * - * Possible values: "noaction", "terminatejob" - */ - onAllTasksComplete?: string; - /** - * The action the Batch service should take when any Task in the Job fails. A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. - * - * Possible values: "noaction", "performexitoptionsjobaction" - */ - readonly onTaskFailure?: string; + /** The action the Batch service should take when all Tasks in the Job are in the completed state. The default is noaction. */ + onAllTasksComplete?: OnAllTasksCompleteOutput; + /** The action the Batch service should take when any Task in the Job fails. A Task is considered to have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. */ + readonly onTaskFailure?: OnTaskFailureOutput; /** The network configuration for the Job. */ readonly networkConfiguration?: JobNetworkConfigurationOutput; /** A list of name-value pairs associated with the Job as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code. */ @@ -1123,12 +994,8 @@ export interface HttpHeaderOutput { * to perform the upload. */ export interface OutputFileUploadOptionsOutput { - /** - * The conditions under which the Task output file or set of files should be uploaded. The default is taskcompletion. - * - * Possible values: "tasksuccess", "taskfailure", "taskcompletion" - */ - uploadCondition: string; + /** The conditions under which the Task output file or set of files should be uploaded. The default is taskcompletion. */ + uploadCondition: OutputFileUploadConditionOutput; } /** Execution constraints to apply to a Task. */ @@ -1147,7 +1014,7 @@ export interface TaskConstraintsOutput { */ export interface AuthenticationTokenSettingsOutput { /** The Batch resources to which the token grants access. The authentication token grants access to a limited set of Batch service operations. Currently the only supported value for the access property is 'job', which grants access to all operations related to the Job which contains the Task. */ - access?: string[]; + access?: AccessScopeOutput[]; } /** @@ -1251,12 +1118,8 @@ export interface PoolInformationOutput { export interface AutoPoolSpecificationOutput { /** A prefix to be added to the unique identifier when a Pool is automatically created. The Batch service assigns each auto Pool a unique identifier on creation. To distinguish between Pools created for different purposes, you can specify this element to add a prefix to the ID that is assigned. The prefix can be up to 20 characters long. */ autoPoolIdPrefix?: string; - /** - * The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools. - * - * Possible values: "jobschedule", "job" - */ - poolLifetimeOption: string; + /** The minimum lifetime of created auto Pools, and how multiple Jobs on a schedule are assigned to Pools. */ + poolLifetimeOption: PoolLifetimeOptionOutput; /** Whether to keep an auto Pool alive after its lifetime expires. If false, the Batch service deletes the Pool once its lifetime (as determined by the poolLifetimeOption setting) expires; that is, when the Job or Job Schedule completes. If true, the Batch service does not delete the Pool automatically. It is up to the user to delete auto Pools created with this option. */ keepAlive?: boolean; /** The Pool specification for the auto Pool. */ @@ -1311,12 +1174,8 @@ export interface PoolSpecificationOutput { metadata?: Array; /** A list of file systems to mount on each node in the pool. This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. */ mountConfiguration?: Array; - /** - * The desired node communication mode for the pool. If omitted, the default value is Default. - * - * Possible values: "default", "classic", "simplified" - */ - targetNodeCommunicationMode?: string; + /** The desired node communication mode for the pool. If omitted, the default value is Default. */ + targetNodeCommunicationMode?: NodeCommunicationModeOutput; } /** The network configuration for the Job. */ @@ -1341,12 +1200,8 @@ export interface JobExecutionInformationOutput { /** An error encountered by the Batch service when scheduling a Job. */ export interface JobSchedulingErrorOutput { - /** - * The category of the Job scheduling error. - * - * Possible values: "usererror", "servererror" - */ - category: string; + /** The category of the Job scheduling error. */ + category: ErrorCategoryOutput; /** An identifier for the Job scheduling error. Codes are invariant and are intended to be consumed programmatically. */ code?: string; /** A message describing the Job scheduling error, intended to be suitable for display in a user interface. */ @@ -1429,12 +1284,8 @@ export interface JobPreparationTaskExecutionInformationOutput { startTime: string; /** The time at which the Job Preparation Task completed. This property is set only if the Task is in the Completed state. */ endTime?: string; - /** - * The current state of the Job Preparation Task on the Compute Node. - * - * Possible values: "running", "completed" - */ - state: string; + /** The current state of the Job Preparation Task on the Compute Node. */ + state: JobPreparationTaskStateOutput; /** The root directory of the Job Preparation Task on the Compute Node. You can use this path to retrieve files created by the Task, such as log files. */ taskRootDirectory?: string; /** The URL to the root directory of the Job Preparation Task on the Compute Node. */ @@ -1449,12 +1300,8 @@ export interface JobPreparationTaskExecutionInformationOutput { retryCount: number; /** The most recent time at which a retry of the Job Preparation Task started running. This property is set only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. */ lastRetryTime?: string; - /** - * The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. - * - * Possible values: "success", "failure" - */ - result?: string; + /** The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. */ + result?: TaskExecutionResultOutput; } /** Contains information about the container which a Task is executing. */ @@ -1469,12 +1316,8 @@ export interface TaskContainerExecutionInformationOutput { /** Information about a Task failure. */ export interface TaskFailureInformationOutput { - /** - * The category of the Task error. - * - * Possible values: "usererror", "servererror" - */ - category: string; + /** The category of the Task error. */ + category: ErrorCategoryOutput; /** An identifier for the Task error. Codes are invariant and are intended to be consumed programmatically. */ code?: string; /** A message describing the Task error, intended to be suitable for display in a user interface. */ @@ -1492,12 +1335,8 @@ export interface JobReleaseTaskExecutionInformationOutput { startTime: string; /** The time at which the Job Release Task completed. This property is set only if the Task is in the Completed state. */ endTime?: string; - /** - * The current state of the Job Release Task on the Compute Node. - * - * Possible values: "running", "completed" - */ - state: string; + /** The current state of the Job Release Task on the Compute Node. */ + state: JobReleaseTaskStateOutput; /** The root directory of the Job Release Task on the Compute Node. You can use this path to retrieve files created by the Task, such as log files. */ taskRootDirectory?: string; /** The URL to the root directory of the Job Release Task on the Compute Node. */ @@ -1508,12 +1347,8 @@ export interface JobReleaseTaskExecutionInformationOutput { containerInfo?: TaskContainerExecutionInformationOutput; /** Information describing the Task failure, if any. This property is set only if the Task is in the completed state and encountered a failure. */ failureInfo?: TaskFailureInformationOutput; - /** - * The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. - * - * Possible values: "success", "failure" - */ - result?: string; + /** The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. */ + result?: TaskExecutionResultOutput; } /** The Task and TaskSlot counts for a Job. */ @@ -1563,20 +1398,12 @@ export interface BatchCertificateOutput { thumbprintAlgorithm: string; /** The URL of the Certificate. */ readonly url?: string; - /** - * The state of the Certificate. - * - * Possible values: "active", "deleting", "deletefailed" - */ - readonly state?: string; + /** The state of the Certificate. */ + readonly state?: CertificateStateOutput; /** The time at which the Certificate entered its current state. */ readonly stateTransitionTime?: string; - /** - * The previous state of the Certificate. This property is not set if the Certificate is in its initial active state. - * - * Possible values: "active", "deleting", "deletefailed" - */ - readonly previousState?: string; + /** The previous state of the Certificate. This property is not set if the Certificate is in its initial active state. */ + readonly previousState?: CertificateStateOutput; /** The time at which the Certificate entered its previous state. This property is not set if the Certificate is in its initial Active state. */ readonly previousStateTransitionTime?: string; /** The public part of the Certificate as a base-64 encoded .cer file. */ @@ -1585,12 +1412,8 @@ export interface BatchCertificateOutput { readonly deleteCertificateError?: DeleteCertificateErrorOutput; /** The base64-encoded contents of the Certificate. The maximum size is 10KB. */ data: string; - /** - * The format of the Certificate data. - * - * Possible values: "pfx", "cer" - */ - certificateFormat?: string; + /** The format of the Certificate data. */ + certificateFormat?: CertificateFormatOutput; /** The password to access the Certificate's private key. This must be omitted if the Certificate format is cer. */ password?: string; } @@ -1630,20 +1453,12 @@ export interface BatchJobScheduleOutput { readonly lastModified?: string; /** The creation time of the Job Schedule. */ readonly creationTime?: string; - /** - * The current state of the Job Schedule. - * - * Possible values: "active", "completed", "disabled", "terminating", "deleting" - */ - readonly state?: string; + /** The current state of the Job Schedule. */ + readonly state?: JobScheduleStateOutput; /** The time at which the Job Schedule entered the current state. */ readonly stateTransitionTime?: string; - /** - * The previous state of the Job Schedule. This property is not present if the Job Schedule is in its initial active state. - * - * Possible values: "active", "completed", "disabled", "terminating", "deleting" - */ - readonly previousState?: string; + /** The previous state of the Job Schedule. This property is not present if the Job Schedule is in its initial active state. */ + readonly previousState?: JobScheduleStateOutput; /** The time at which the Job Schedule entered its previous state. This property is not present if the Job Schedule is in its initial active state. */ readonly previousStateTransitionTime?: string; /** The schedule according to which Jobs will be created. All times are fixed respective to UTC and are not impacted by daylight saving time. */ @@ -1685,18 +1500,10 @@ export interface JobSpecificationOutput { displayName?: string; /** Whether Tasks in the Job can define dependencies on each other. The default is false. */ usesTaskDependencies?: boolean; - /** - * The action the Batch service should take when all Tasks in a Job created under this schedule are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. - * - * Possible values: "noaction", "terminatejob" - */ - onAllTasksComplete?: string; - /** - * The action the Batch service should take when any Task fails in a Job created under this schedule. A Task is considered to have failed if it have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. - * - * Possible values: "noaction", "performexitoptionsjobaction" - */ - onTaskFailure?: string; + /** The action the Batch service should take when all Tasks in a Job created under this schedule are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction. */ + onAllTasksComplete?: OnAllTasksCompleteOutput; + /** The action the Batch service should take when any Task fails in a Job created under this schedule. A Task is considered to have failed if it have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction. */ + onTaskFailure?: OnTaskFailureOutput; /** The network configuration for the Job. */ networkConfiguration?: JobNetworkConfigurationOutput; /** The execution constraints for Jobs created under this schedule. */ @@ -1776,42 +1583,6 @@ export interface BatchJobScheduleListResultOutput { "odata.nextLink"?: string; } -/** Options for creating an Azure Batch Task. */ -export interface BatchTaskCreateOptionsOutput { - /** A string that uniquely identifies the Task within the Job. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a Job that differ only by case). */ - id: string; - /** A display name for the Task. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. */ - displayName?: string; - /** How the Batch service should respond when the Task completes. */ - exitConditions?: ExitConditionsOutput; - /** The command line of the Task. For multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). */ - commandLine: string; - /** The settings for the container under which the Task runs. If the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files. */ - containerSettings?: TaskContainerSettingsOutput; - /** A list of files that the Batch service will download to the Compute Node before running the command line. For multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers. */ - resourceFiles?: Array; - /** A list of files that the Batch service will upload from the Compute Node after running the command line. For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed. */ - outputFiles?: Array; - /** A list of environment variable settings for the Task. */ - environmentSettings?: Array; - /** A locality hint that can be used by the Batch service to select a Compute Node on which to start the new Task. */ - affinityInfo?: AffinityInformationOutput; - /** The execution constraints that apply to this Task. If you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the Job, the maxWallClockTime is infinite, and the retentionTime is 7 days. */ - constraints?: TaskConstraintsOutput; - /** The number of scheduling slots that the Task required to run. The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this must be 1. */ - requiredSlots?: number; - /** The user identity under which the Task runs. If omitted, the Task runs as a non-administrative user unique to the Task. */ - userIdentity?: UserIdentityOutput; - /** An object that indicates that the Task is a multi-instance Task, and contains information about how to run the multi-instance Task. */ - multiInstanceSettings?: MultiInstanceSettingsOutput; - /** The Tasks that this Task depends on. This Task will not be scheduled until all Tasks that it depends on have completed successfully. If any of those Tasks fail and exhaust their retry counts, this Task will never be scheduled. If the Job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob. */ - dependsOn?: TaskDependenciesOutput; - /** A list of Packages that the Batch service will deploy to the Compute Node before running the command line. Application packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced package is already on the Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails. */ - applicationPackageReferences?: Array; - /** The settings for an authentication token that the Task can use to perform Batch service operations. If this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job. */ - authenticationTokenSettings?: AuthenticationTokenSettingsOutput; -} - /** Specifies how the Batch service should respond when the Task completes. */ export interface ExitConditionsOutput { /** A list of individual Task exit codes and how the Batch service should respond to them. */ @@ -1839,18 +1610,10 @@ export interface ExitCodeMappingOutput { /** Specifies how the Batch service responds to a particular exit condition. */ export interface ExitOptionsOutput { - /** - * An action to take on the Job containing the Task, if the Task completes with the given exit condition and the Job's onTaskFailed property is 'performExitOptionsJobAction'. The default is none for exit code 0 and terminate for all other exit conditions. If the Job's onTaskFailed property is noaction, then specifying this property returns an error and the add Task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). - * - * Possible values: "none", "disable", "terminate" - */ - jobAction?: string; - /** - * An action that the Batch service performs on Tasks that depend on this Task. Possible values are 'satisfy' (allowing dependent tasks to progress) and 'block' (dependent tasks continue to wait). Batch does not yet support cancellation of dependent tasks. - * - * Possible values: "satisfy", "block" - */ - dependencyAction?: string; + /** An action to take on the Job containing the Task, if the Task completes with the given exit condition and the Job's onTaskFailed property is 'performExitOptionsJobAction'. The default is none for exit code 0 and terminate for all other exit conditions. If the Job's onTaskFailed property is noaction, then specifying this property returns an error and the add Task request fails with an invalid property value error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). */ + jobAction?: JobActionOutput; + /** An action that the Batch service performs on Tasks that depend on this Task. Possible values are 'satisfy' (allowing dependent tasks to progress) and 'block' (dependent tasks continue to wait). Batch does not yet support cancellation of dependent tasks. */ + dependencyAction?: DependencyActionOutput; } /** @@ -1947,20 +1710,12 @@ export interface BatchTaskOutput { readonly creationTime?: string; /** How the Batch service should respond when the Task completes. */ readonly exitConditions?: ExitConditionsOutput; - /** - * The current state of the Task. - * - * Possible values: "active", "preparing", "running", "completed" - */ - readonly state?: string; + /** The current state of the Task. */ + readonly state?: TaskStateOutput; /** The time at which the Task entered its current state. */ readonly stateTransitionTime?: string; - /** - * The previous state of the Task. This property is not set if the Task is in its initial Active state. - * - * Possible values: "active", "preparing", "running", "completed" - */ - readonly previousState?: string; + /** The previous state of the Task. This property is not set if the Task is in its initial Active state. */ + readonly previousState?: TaskStateOutput; /** The time at which the Task entered its previous state. This property is not set if the Task is in its initial Active state. */ readonly previousStateTransitionTime?: string; /** The command line of the Task. For multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables). */ @@ -2017,12 +1772,8 @@ export interface TaskExecutionInformationOutput { requeueCount: number; /** The most recent time at which the Task has been requeued by the Batch service as the result of a user request. This property is set only if the requeueCount is nonzero. */ lastRequeueTime?: string; - /** - * The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. - * - * Possible values: "success", "failure" - */ - result?: string; + /** The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. */ + result?: TaskExecutionResultOutput; } /** Information about the Compute Node on which a Task ran. */ @@ -2067,12 +1818,6 @@ export interface TaskStatisticsOutput { waitTime: string; } -/** A collection of Azure Batch Tasks to add. */ -export interface BatchTaskCollectionOutput { - /** The collection of Tasks to add. The maximum count of Tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each Task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer Tasks. */ - value: Array; -} - /** The result of adding a collection of Tasks to a Job. */ export interface TaskAddCollectionResultOutput { /** The results of the add Task collection operation. */ @@ -2081,12 +1826,8 @@ export interface TaskAddCollectionResultOutput { /** Result for a single Task added as part of an add Task collection operation. */ export interface TaskAddResultOutput { - /** - * The status of the add Task request. - * - * Possible values: "Success", "clienterror", "servererror" - */ - status: string; + /** The status of the add Task request. */ + status: TaskAddStatusOutput; /** The ID of the Task for which this is the result. */ taskId: string; /** The ETag of the Task, if the Task was successfully added. You can use this to detect whether the Task has changed between requests. In particular, you can be pass the ETag with an Update Task request to specify that your changes should take effect only if nobody else has modified the Job in the meantime. */ @@ -2121,28 +1862,16 @@ export interface SubtaskInformationOutput { containerInfo?: TaskContainerExecutionInformationOutput; /** Information describing the Task failure, if any. This property is set only if the Task is in the completed state and encountered a failure. */ failureInfo?: TaskFailureInformationOutput; - /** - * The current state of the subtask. - * - * Possible values: "preparing", "running", "completed" - */ - state?: string; + /** The current state of the subtask. */ + state?: SubtaskStateOutput; /** The time at which the subtask entered its current state. */ stateTransitionTime?: string; - /** - * The previous state of the subtask. This property is not set if the subtask is in its initial running state. - * - * Possible values: "preparing", "running", "completed" - */ - previousState?: string; + /** The previous state of the subtask. This property is not set if the subtask is in its initial running state. */ + previousState?: SubtaskStateOutput; /** The time at which the subtask entered its previous state. This property is not set if the subtask is in its initial running state. */ previousStateTransitionTime?: string; - /** - * The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. - * - * Possible values: "success", "failure" - */ - result?: string; + /** The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. */ + result?: TaskExecutionResultOutput; } /** @@ -2188,18 +1917,10 @@ export interface BatchNodeOutput { id?: string; /** The URL of the Compute Node. */ url?: string; - /** - * The current state of the Compute Node. The Spot/Low-priority Compute Node has been preempted. Tasks which were running on the Compute Node when it was preempted will be rescheduled when another Compute Node becomes available. - * - * Possible values: "idle", "rebooting", "reimaging", "running", "unusable", "creating", "starting", "waitingforstarttask", "starttaskfailed", "unknown", "leavingpool", "offline", "preempted" - */ - state?: string; - /** - * Whether the Compute Node is available for Task scheduling. - * - * Possible values: "enabled", "disabled" - */ - schedulingState?: string; + /** The current state of the Compute Node. The Spot/Low-priority Compute Node has been preempted. Tasks which were running on the Compute Node when it was preempted will be rescheduled when another Compute Node becomes available. */ + state?: BatchNodeStateOutput; + /** Whether the Compute Node is available for Task scheduling. */ + schedulingState?: SchedulingStateOutput; /** The time at which the Compute Node entered its current state. */ stateTransitionTime?: string; /** The last time at which the Compute Node was started. This property may not be present if the Compute Node state is unusable. */ @@ -2255,24 +1976,16 @@ export interface TaskInformationOutput { taskId?: string; /** The ID of the subtask if the Task is a multi-instance Task. */ subtaskId?: number; - /** - * The current state of the Task. - * - * Possible values: "active", "preparing", "running", "completed" - */ - taskState: string; + /** The current state of the Task. */ + taskState: TaskStateOutput; /** Information about the execution of the Task. */ executionInfo?: TaskExecutionInformationOutput; } /** Information about a StartTask running on a Compute Node. */ export interface StartTaskInformationOutput { - /** - * The state of the StartTask on the Compute Node. - * - * Possible values: "running", "completed" - */ - state: string; + /** The state of the StartTask on the Compute Node. */ + state: StartTaskStateOutput; /** The time at which the StartTask started running. This value is reset every time the Task is restarted or retried (that is, this is the most recent time at which the StartTask started running). */ startTime: string; /** The time at which the StartTask stopped running. This is the end time of the most recent run of the StartTask, if that run has completed (even if that run failed and a retry is pending). This element is not present if the StartTask is currently running. */ @@ -2287,12 +2000,8 @@ export interface StartTaskInformationOutput { retryCount: number; /** The most recent time at which a retry of the Task started running. This element is present only if the Task was retried (i.e. retryCount is nonzero). If present, this is typically the same as startTime, but may be different if the Task has been restarted for reasons other than retry; for example, if the Compute Node was rebooted during a retry, then the startTime is updated but the lastRetryTime is not. */ lastRetryTime?: string; - /** - * The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. - * - * Possible values: "success", "failure" - */ - result?: string; + /** The result of the Task execution. If the value is 'failed', then the details of the failure can be found in the failureInfo property. */ + result?: TaskExecutionResultOutput; } /** An error encountered by a Compute Node. */ @@ -2315,12 +2024,8 @@ export interface BatchNodeEndpointConfigurationOutput { export interface InboundEndpointOutput { /** The name of the endpoint. */ name: string; - /** - * The protocol of the endpoint. - * - * Possible values: "tcp", "udp" - */ - protocol: string; + /** The protocol of the endpoint. */ + protocol: InboundEndpointProtocolOutput; /** The public IP address of the Compute Node. */ publicIPAddress?: string; /** The public fully qualified domain name for the Compute Node. */ @@ -2356,18 +2061,6 @@ export interface BatchNodeRemoteLoginSettingsResultOutput { remoteLoginPort: number; } -/** The Azure Batch service log files upload options for a Compute Node. */ -export interface UploadBatchServiceLogsOptionsOutput { - /** The URL of the container within Azure Blob Storage to which to upload the Batch Service log file(s). If a user assigned managed identity is not being used, the URL must include a Shared Access Signature (SAS) granting write permissions to the container. The SAS duration must allow enough time for the upload to finish. The start time for SAS is optional and recommended to not be specified. */ - containerUrl: string; - /** The start of the time range from which to upload Batch Service log file(s). Any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. */ - startTime: string; - /** The end of the time range from which to upload Batch Service log file(s). Any log file containing a log message in the time range will be uploaded. This means that the operation might retrieve more logs than have been requested since the entire log file is always uploaded, but the operation should not retrieve fewer logs than have been requested. If omitted, the default is to upload all logs available after the startTime. */ - endTime?: string; - /** The reference to the user assigned identity to use to access Azure Blob Storage specified by containerUrl. The identity must have write access to the Azure Blob Storage container. */ - identityReference?: BatchNodeIdentityReferenceOutput; -} - /** The result of uploading Batch service log files from a specific Compute Node. */ export interface UploadBatchServiceLogsResultOutput { /** The virtual directory within Azure Blob Storage container to which the Batch Service log file(s) will be uploaded. The virtual directory name is part of the blob name for each log file uploaded, and it is built based poolId, nodeId and a unique identifier. */ @@ -2410,12 +2103,8 @@ export interface InstanceViewStatusOutput { code?: string; /** The localized label for the status. */ displayStatus?: string; - /** - * Level code. - * - * Possible values: "Error", "Info", "Warning" - */ - level?: string; + /** Level code. */ + level?: StatusLevelTypesOutput; /** The detailed status message. */ message?: string; /** The time of the status. */ @@ -2429,3 +2118,127 @@ export interface NodeVMExtensionListOutput { /** The URL to get the next set of results. */ "odata.nextLink"?: string; } + +/** CachingType enums */ +export type CachingTypeOutput = "none" | "readonly" | "readwrite"; +/** StorageAccountType enums */ +export type StorageAccountTypeOutput = "standard_lrs" | "premium_lrs"; +/** ContainerType enums */ +export type ContainerTypeOutput = "dockerCompatible" | "criCompatible"; +/** DiskEncryptionTarget enums */ +export type DiskEncryptionTargetOutput = "osdisk" | "temporarydisk"; +/** NodePlacementPolicyType enums */ +export type NodePlacementPolicyTypeOutput = "regional" | "zonal"; +/** AccessDiffDiskPlacementScope enums */ +export type DiffDiskPlacementOutput = "cachedisk"; +/** DynamicVNetAssignmentScope enums */ +export type DynamicVNetAssignmentScopeOutput = "none" | "job"; +/** InboundEndpointProtocol enums */ +export type InboundEndpointProtocolOutput = "tcp" | "udp"; +/** NetworkSecurityGroupRuleAccess enums */ +export type NetworkSecurityGroupRuleAccessOutput = "allow" | "deny"; +/** IPAddressProvisioningType enums */ +export type IPAddressProvisioningTypeOutput = + | "batchmanaged" + | "usermanaged" + | "nopublicipaddresses"; +/** ContainerWorkingDirectory enums */ +export type ContainerWorkingDirectoryOutput = + | "taskWorkingDirectory" + | "containerImageDefault"; +/** AutoUserScope enums */ +export type AutoUserScopeOutput = "task" | "pool"; +/** ElevationLevel enums */ +export type ElevationLevelOutput = "nonadmin" | "admin"; +/** CertificateStoreLocation enums */ +export type CertificateStoreLocationOutput = "currentuser" | "localmachine"; +/** CertificateVisibility enums */ +export type CertificateVisibilityOutput = "starttask" | "task" | "remoteuser"; +/** BatchNodeFillType enums */ +export type BatchNodeFillTypeOutput = "spread" | "pack"; +/** LoginMode enums */ +export type LoginModeOutput = "batch" | "interactive"; +/** NodeCommunicationMode enums */ +export type NodeCommunicationModeOutput = "default" | "classic" | "simplified"; +/** PoolState enums */ +export type PoolStateOutput = "active" | "deleting"; +/** AllocationState enums */ +export type AllocationStateOutput = "steady" | "resizing" | "stopping"; +/** PoolIdentityType enums */ +export type PoolIdentityTypeOutput = "UserAssigned" | "None"; +/** OSType enums */ +export type OSTypeOutput = "linux" | "windows"; +/** VerificationType enums */ +export type VerificationTypeOutput = "verified" | "unverified"; +/** JobState enums */ +export type JobStateOutput = + | "active" + | "disabling" + | "disabled" + | "enabling" + | "terminating" + | "completed" + | "deleting"; +/** OutputFileUploadCondition enums */ +export type OutputFileUploadConditionOutput = + | "tasksuccess" + | "taskfailure" + | "taskcompletion"; +/** AccessScope enums */ +export type AccessScopeOutput = "job"; +/** PoolLifetimeOption enums */ +export type PoolLifetimeOptionOutput = "jobschedule" | "job"; +/** The action the Batch service should take when all Tasks in the Job are in the completed state. */ +export type OnAllTasksCompleteOutput = "noaction" | "terminatejob"; +/** OnTaskFailure enums */ +export type OnTaskFailureOutput = "noaction" | "performexitoptionsjobaction"; +/** ErrorCategory enums */ +export type ErrorCategoryOutput = "usererror" | "servererror"; +/** JobPreparationTaskState enums */ +export type JobPreparationTaskStateOutput = "running" | "completed"; +/** TaskExecutionResult enums */ +export type TaskExecutionResultOutput = "success" | "failure"; +/** JobReleaseTaskState enums */ +export type JobReleaseTaskStateOutput = "running" | "completed"; +/** CertificateState enums */ +export type CertificateStateOutput = "active" | "deleting" | "deletefailed"; +/** CertificateFormat enums */ +export type CertificateFormatOutput = "pfx" | "cer"; +/** JobScheduleState enums */ +export type JobScheduleStateOutput = + | "active" + | "completed" + | "disabled" + | "terminating" + | "deleting"; +/** JobAction enums */ +export type JobActionOutput = "none" | "disable" | "terminate"; +/** DependencyAction enums */ +export type DependencyActionOutput = "satisfy" | "block"; +/** TaskState enums */ +export type TaskStateOutput = "active" | "preparing" | "running" | "completed"; +/** TaskAddStatus enums */ +export type TaskAddStatusOutput = "Success" | "clienterror" | "servererror"; +/** SubtaskState enums */ +export type SubtaskStateOutput = "preparing" | "running" | "completed"; +/** BatchNodeState enums */ +export type BatchNodeStateOutput = + | "idle" + | "rebooting" + | "reimaging" + | "running" + | "unusable" + | "creating" + | "starting" + | "waitingforstarttask" + | "starttaskfailed" + | "unknown" + | "leavingpool" + | "offline" + | "preempted"; +/** SchedulingState enums */ +export type SchedulingStateOutput = "enabled" | "disabled"; +/** StartTaskState enums */ +export type StartTaskStateOutput = "running" | "completed"; +/** Level code. */ +export type StatusLevelTypesOutput = "Error" | "Info" | "Warning"; diff --git a/packages/typespec-test/test/batch_modular/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/batch_modular/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/batch_modular/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/batch_modular/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/package.json index 65bbda0cf0..c4b542bdbc 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/package.json @@ -42,7 +42,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -55,8 +55,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md index 5cd0b0375f..79715c3bb8 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/review/ai-chat-protocol.api.md @@ -10,8 +10,11 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; +// @public (undocumented) +export type APIVersion = "2023-10-01-preview"; + // @public -export interface ChatChoice { +export interface ChatChoiceRecord { context?: Record; finishReason: FinishReason; index: number; @@ -20,23 +23,23 @@ export interface ChatChoice { } // @public -export interface ChatCompletion { - choices: ChatChoice[]; -} - -// @public -export interface ChatCompletionChunk { - choices: ChoiceDelta[]; +export interface ChatCompletionChunkRecord { + choices: ChoiceDeltaRecord[]; } // @public -export interface ChatCompletionOptions { +export interface ChatCompletionOptionsRecord { context?: Record; messages: ChatMessage[]; sessionState?: unknown; stream: false; } +// @public +export interface ChatCompletionRecord { + choices: ChatChoiceRecord[]; +} + // @public export interface ChatMessage { content: string; @@ -53,9 +56,9 @@ export interface ChatMessageDelta { // @public (undocumented) export class ChatProtocolClient { - constructor(endpoint: string, credential: KeyCredential | TokenCredential, options?: ChatProtocolClientOptions); - create(body: ChatCompletionOptions, options?: CreateOptions): Promise; - createStreaming(body: StreamingChatCompletionOptions, options?: CreateStreamingOptions): Promise; + constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: ChatProtocolClientOptions); + create(body: ChatCompletionOptionsRecord, options?: CreateOptionalParams): Promise; + createStreaming(body: StreamingChatCompletionOptionsRecord, options?: CreateStreamingOptionalParams): Promise; readonly pipeline: Pipeline; } @@ -63,11 +66,11 @@ export class ChatProtocolClient { export interface ChatProtocolClientOptions extends ClientOptions { } -// @public -export type ChatRole = string; +// @public (undocumented) +export type ChatRole = "user" | "system" | "assistant"; // @public -export interface ChoiceDelta { +export interface ChoiceDeltaRecord { context?: Record; delta: ChatMessageDelta; finishReason?: FinishReason; @@ -76,18 +79,18 @@ export interface ChoiceDelta { } // @public (undocumented) -export interface CreateOptions extends OperationOptions { +export interface CreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface CreateStreamingOptions extends OperationOptions { +export interface CreateStreamingOptionalParams extends OperationOptions { } -// @public -export type FinishReason = string; +// @public (undocumented) +export type FinishReason = "stop" | "length"; // @public -export interface StreamingChatCompletionOptions { +export interface StreamingChatCompletionOptionsRecord { context?: Record; messages: ChatMessage[]; sessionState?: unknown; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/ChatProtocolContext.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts similarity index 87% rename from packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/ChatProtocolContext.ts rename to packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts index c03def967b..9157a96755 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/ChatProtocolContext.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/chatProtocolContext.ts @@ -12,10 +12,10 @@ export { ChatProtocolContext } from "../rest/index.js"; /** Azure APIs for the Azure Chat protocol. */ export function createChatProtocol( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: ChatProtocolClientOptions = {}, ): ChatProtocolContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts index 8b1f1576f5..a3c55645e0 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/index.ts @@ -5,5 +5,5 @@ export { createChatProtocol, ChatProtocolClientOptions, ChatProtocolContext, -} from "./ChatProtocolContext.js"; +} from "./chatProtocolContext.js"; export { createStreaming, create } from "./operations.js"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts index 43ff7a34de..785cc0aab4 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/api/operations.ts @@ -2,10 +2,10 @@ // Licensed under the MIT license. import { - StreamingChatCompletionOptions, - ChatCompletionChunk, - ChatCompletionOptions, - ChatCompletion, + StreamingChatCompletionOptionsRecord, + ChatCompletionChunkRecord, + ChatCompletionOptionsRecord, + ChatCompletionRecord, } from "../models/models.js"; import { ChatProtocolContext as Client, @@ -17,12 +17,15 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { CreateStreamingOptions, CreateOptions } from "../models/options.js"; +import { + CreateStreamingOptionalParams, + CreateOptionalParams, +} from "../models/options.js"; export function _createStreamingSend( context: Client, - body: StreamingChatCompletionOptions, - options: CreateStreamingOptions = { requestOptions: {} }, + body: StreamingChatCompletionOptionsRecord, + options: CreateStreamingOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/chat") @@ -43,7 +46,7 @@ export function _createStreamingSend( export async function _createStreamingDeserialize( result: CreateStreaming200Response, -): Promise { +): Promise { if (result.status !== "200") { throw createRestError(result); } @@ -66,17 +69,17 @@ export async function _createStreamingDeserialize( /** Creates a new streaming chat completion. */ export async function createStreaming( context: Client, - body: StreamingChatCompletionOptions, - options: CreateStreamingOptions = { requestOptions: {} }, -): Promise { + body: StreamingChatCompletionOptionsRecord, + options: CreateStreamingOptionalParams = { requestOptions: {} }, +): Promise { const result = await _createStreamingSend(context, body, options); return _createStreamingDeserialize(result); } export function _createSend( context: Client, - body: ChatCompletionOptions, - options: CreateOptions = { requestOptions: {} }, + body: ChatCompletionOptionsRecord, + options: CreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/chat") @@ -97,7 +100,7 @@ export function _createSend( export async function _createDeserialize( result: Create200Response, -): Promise { +): Promise { if (result.status !== "200") { throw createRestError(result); } @@ -120,9 +123,9 @@ export async function _createDeserialize( /** Creates a new chat completion. */ export async function create( context: Client, - body: ChatCompletionOptions, - options: CreateOptions = { requestOptions: {} }, -): Promise { + body: ChatCompletionOptionsRecord, + options: CreateOptionalParams = { requestOptions: {} }, +): Promise { const result = await _createSend(context, body, options); return _createDeserialize(result); } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/ChatProtocolClient.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts similarity index 59% rename from packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/ChatProtocolClient.ts rename to packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts index c03485a515..fdfe5f1bb8 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/ChatProtocolClient.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/chatProtocolClient.ts @@ -4,12 +4,15 @@ import { TokenCredential, KeyCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; import { - StreamingChatCompletionOptions, - ChatCompletionChunk, - ChatCompletionOptions, - ChatCompletion, + StreamingChatCompletionOptionsRecord, + ChatCompletionChunkRecord, + ChatCompletionOptionsRecord, + ChatCompletionRecord, } from "./models/models.js"; -import { CreateStreamingOptions, CreateOptions } from "./models/options.js"; +import { + CreateStreamingOptionalParams, + CreateOptionalParams, +} from "./models/options.js"; import { createChatProtocol, ChatProtocolClientOptions, @@ -18,7 +21,7 @@ import { create, } from "./api/index.js"; -export { ChatProtocolClientOptions } from "./api/ChatProtocolContext.js"; +export { ChatProtocolClientOptions } from "./api/chatProtocolContext.js"; export class ChatProtocolClient { private _client: ChatProtocolContext; @@ -27,27 +30,27 @@ export class ChatProtocolClient { /** Azure APIs for the Azure Chat protocol. */ constructor( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: ChatProtocolClientOptions = {}, ) { - this._client = createChatProtocol(endpoint, credential, options); + this._client = createChatProtocol(endpointParam, credential, options); this.pipeline = this._client.pipeline; } /** Creates a new streaming chat completion. */ createStreaming( - body: StreamingChatCompletionOptions, - options: CreateStreamingOptions = { requestOptions: {} }, - ): Promise { + body: StreamingChatCompletionOptionsRecord, + options: CreateStreamingOptionalParams = { requestOptions: {} }, + ): Promise { return createStreaming(this._client, body, options); } /** Creates a new chat completion. */ create( - body: ChatCompletionOptions, - options: CreateOptions = { requestOptions: {} }, - ): Promise { + body: ChatCompletionOptionsRecord, + options: CreateOptionalParams = { requestOptions: {} }, + ): Promise { return create(this._client, body, options); } } diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts index 919ec8ab39..4aa4ee5edb 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/index.ts @@ -4,18 +4,19 @@ export { ChatProtocolClient, ChatProtocolClientOptions, -} from "./ChatProtocolClient.js"; +} from "./chatProtocolClient.js"; export { - StreamingChatCompletionOptions, ChatMessage, ChatRole, - ChatCompletionChunk, - ChoiceDelta, + StreamingChatCompletionOptionsRecord, + ChatCompletionChunkRecord, + ChoiceDeltaRecord, ChatMessageDelta, FinishReason, - ChatCompletionOptions, - ChatCompletion, - ChatChoice, - CreateStreamingOptions, - CreateOptions, + ChatCompletionOptionsRecord, + ChatCompletionRecord, + ChatChoiceRecord, + APIVersion, + CreateStreamingOptionalParams, + CreateOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/index.ts index a69c499179..0e0d2bcee9 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/index.ts @@ -2,15 +2,19 @@ // Licensed under the MIT license. export { - StreamingChatCompletionOptions, ChatMessage, ChatRole, - ChatCompletionChunk, - ChoiceDelta, + StreamingChatCompletionOptionsRecord, + ChatCompletionChunkRecord, + ChoiceDeltaRecord, ChatMessageDelta, FinishReason, - ChatCompletionOptions, - ChatCompletion, - ChatChoice, + ChatCompletionOptionsRecord, + ChatCompletionRecord, + ChatChoiceRecord, + APIVersion, } from "./models.js"; -export { CreateStreamingOptions, CreateOptions } from "./options.js"; +export { + CreateStreamingOptionalParams, + CreateOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts index d6ce42536f..ebf8433659 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/models.ts @@ -1,8 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +/** A single, role-attributed message within a chat completion interaction. */ +export interface ChatMessage { + /** The text associated with the message. */ + content: string; + /** The role associated with the message. */ + role: ChatRole; + /** + * Field that allows the chat app to store and retrieve data, the structure of such data is dependant on the backend + * being used. The client must send back the data in this field unchanged in subsequent requests, until the chat app + * sends a new one. The data in this field can be used to implement stateful services, such as remembering previous + * conversations or user preferences. + */ + sessionState?: unknown; +} + +/** A representation of the intended purpose of a message. */ +/** */ +export type ChatRole = "user" | "system" | "assistant"; + /** The configuration for a streaming chat completion request. */ -export interface StreamingChatCompletionOptions { +export interface StreamingChatCompletionOptionsRecord { /** The collection of context messages associated with this completion request. */ messages: ChatMessage[]; /** Indicates whether the completion is a streaming or non-streaming completion. */ @@ -21,33 +40,14 @@ export interface StreamingChatCompletionOptions { context?: Record; } -/** A single, role-attributed message within a chat completion interaction. */ -export interface ChatMessage { - /** The text associated with the message. */ - content: string; - /** The role associated with the message. */ - role: ChatRole; - /** - * Field that allows the chat app to store and retrieve data, the structure of such data is dependant on the backend - * being used. The client must send back the data in this field unchanged in subsequent requests, until the chat app - * sends a new one. The data in this field can be used to implement stateful services, such as remembering previous - * conversations or user preferences. - */ - sessionState?: unknown; -} - -/** A representation of the intended purpose of a message. */ -/** "user", "system", "assistant" */ -export type ChatRole = string; - /** A single response to a streaming completion request. */ -export interface ChatCompletionChunk { +export interface ChatCompletionChunkRecord { /** The collection of choice deltas received in this chunk. */ - choices: ChoiceDelta[]; + choices: ChoiceDeltaRecord[]; } /** The representation of an incremental choice received in a streaming completion. */ -export interface ChoiceDelta { +export interface ChoiceDeltaRecord { /** The index of the of the chat choice, relative to the other choices in the same completion. */ index: number; /** The partial message received for this choice. */ @@ -84,11 +84,11 @@ export interface ChatMessageDelta { } /** Representation of the reason why a chat session has finished processing. */ -/** "stop", "length" */ -export type FinishReason = string; +/** */ +export type FinishReason = "stop" | "length"; /** The configuration for a chat completion request. */ -export interface ChatCompletionOptions { +export interface ChatCompletionOptionsRecord { /** The collection of context messages associated with this completion request. */ messages: ChatMessage[]; /** Indicates whether the completion is a streaming or non-streaming completion. */ @@ -108,13 +108,13 @@ export interface ChatCompletionOptions { } /** Representation of the response to a chat completion request. */ -export interface ChatCompletion { +export interface ChatCompletionRecord { /** The collection of generated completions. */ - choices: ChatChoice[]; + choices: ChatChoiceRecord[]; } /** The representation of a single generated completion. */ -export interface ChatChoice { +export interface ChatChoiceRecord { /** The index of the of the chat choice, relative to the other choices in the same completion. */ index: number; /** The chat message for a given chat completion. */ @@ -134,3 +134,6 @@ export interface ChatChoice { /** The reason this chat completion completed its generation. */ finishReason: FinishReason; } + +/** */ +export type APIVersion = "2023-10-01-preview"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/options.ts index 155d5f9c49..63ed4490cd 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface CreateStreamingOptions extends OperationOptions {} +export interface CreateStreamingOptionalParams extends OperationOptions {} -export interface CreateOptions extends OperationOptions {} +export interface CreateOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/models.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/models.ts index 7cc033ab6d..5937823c96 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/models.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/models.ts @@ -25,12 +25,8 @@ export interface StreamingChatCompletionOptions { export interface ChatMessage { /** The text associated with the message. */ content: string; - /** - * The role associated with the message. - * - * Possible values: "user", "system", "assistant" - */ - role: string; + /** The role associated with the message. */ + role: ChatRole; /** * Field that allows the chat app to store and retrieve data, the structure of such data is dependant on the backend * being used. The client must send back the data in this field unchanged in subsequent requests, until the chat app @@ -59,3 +55,6 @@ export interface ChatCompletionOptions { */ context?: Record; } + +/** A representation of the intended purpose of a message. */ +export type ChatRole = "user" | "system" | "assistant"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/outputModels.ts index 012af89493..3693e74557 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/src/rest/outputModels.ts @@ -5,12 +5,8 @@ export interface ChatMessageOutput { /** The text associated with the message. */ content: string; - /** - * The role associated with the message. - * - * Possible values: "user", "system", "assistant" - */ - role: string; + /** The role associated with the message. */ + role: ChatRoleOutput; /** * Field that allows the chat app to store and retrieve data, the structure of such data is dependant on the backend * being used. The client must send back the data in this field unchanged in subsequent requests, until the chat app @@ -44,24 +40,16 @@ export interface ChoiceDeltaOutput { * customer_info. These parameters are specific to the chat app and not understood by the generic clients. */ context?: Record; - /** - * The reason this chat completion completed its generation. - * - * Possible values: "stop", "length" - */ - finish_reason?: string; + /** The reason this chat completion completed its generation. */ + finish_reason?: FinishReasonOutput; } /** The representation of a delta message received in a streaming completion. */ export interface ChatMessageDeltaOutput { /** An incremental part of the text associated with the message. */ content?: string; - /** - * The role associated with the message. - * - * Possible values: "user", "system", "assistant" - */ - role?: string; + /** The role associated with the message. */ + role?: ChatRoleOutput; /** * Field that allows the chat app to store and retrieve data, the structure of such data is dependant on the backend * being used. The client must send back the data in this field unchanged in subsequent requests, until the chat app @@ -95,10 +83,11 @@ export interface ChatChoiceOutput { * customer_info. These parameters are specific to the chat app and not understood by the generic clients. */ context?: Record; - /** - * The reason this chat completion completed its generation. - * - * Possible values: "stop", "length" - */ - finish_reason: string; + /** The reason this chat completion completed its generation. */ + finish_reason: FinishReasonOutput; } + +/** A representation of the intended purpose of a message. */ +export type ChatRoleOutput = "user" | "system" | "assistant"; +/** Representation of the reason why a chat session has finished processing. */ +export type FinishReasonOutput = "stop" | "length"; diff --git a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/chatApi_modular/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/package.json b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/package.json index 2fe13765f8..738797f9da 100644 --- a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -54,8 +54,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/review/confidential-ledger.api.md b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/review/confidential-ledger.api.md index 650a8e50a3..e1c3e263e5 100644 --- a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/review/confidential-ledger.api.md +++ b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/review/confidential-ledger.api.md @@ -454,20 +454,29 @@ export interface LedgerEntryOutput { readonly transactionId: string; } +// @public +export type LedgerQueryStateOutput = "Loading" | "Ready"; + // @public export interface LedgerUser { - assignedRole: "Administrator" | "Contributor" | "Reader"; + assignedRole: LedgerUserRole; } // @public export interface LedgerUserOutput { - assignedRole: "Administrator" | "Contributor" | "Reader"; + assignedRole: LedgerUserRoleOutput; readonly userId: string; } // @public export type LedgerUserResourceMergeAndPatch = Partial; +// @public +export type LedgerUserRole = "Administrator" | "Contributor" | "Reader"; + +// @public +export type LedgerUserRoleOutput = "Administrator" | "Contributor" | "Reader"; + // @public (undocumented) export interface ListCollections { get(options?: ListCollectionsParameters): StreamableMethod; @@ -534,7 +543,7 @@ export type ListLedgerEntriesParameters = RequestParameters; export interface PagedLedgerEntriesOutput { entries: Array; nextLink?: string; - state: "Loading" | "Ready"; + state: LedgerQueryStateOutput; } // @public @@ -578,13 +587,16 @@ export interface Routes { // @public export interface TransactionReceiptOutput { receipt: ReceiptContentsOutput; - state: "Loading" | "Ready"; + state: LedgerQueryStateOutput; transactionId: string; } +// @public +export type TransactionStateOutput = "Committed" | "Pending"; + // @public export interface TransactionStatusOutput { - state: "Committed" | "Pending"; + state: TransactionStateOutput; transactionId: string; } diff --git a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/models.ts index 7e1dce3674..8e9f0e1682 100644 --- a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/models.ts @@ -10,5 +10,8 @@ export interface LedgerEntry { /** Details about a Confidential ledger user. */ export interface LedgerUser { /** The user's assigned role. */ - assignedRole: "Administrator" | "Contributor" | "Reader"; + assignedRole: LedgerUserRole; } + +/** Represents an assignable role. */ +export type LedgerUserRole = "Administrator" | "Contributor" | "Reader"; diff --git a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/outputModels.ts index b5f8be446a..2de2453090 100644 --- a/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/confidentialLedger/generated/typespec-ts/src/outputModels.ts @@ -12,7 +12,7 @@ export interface PagedLedgerEntriesOutput { /** Array of ledger entries. */ entries: Array; /** State of the ledger query. */ - state: "Loading" | "Ready"; + state: LedgerQueryStateOutput; /** Path from which to retrieve the next page of results. */ nextLink?: string; } @@ -32,7 +32,7 @@ export interface TransactionReceiptOutput { /** The receipt contents. */ receipt: ReceiptContentsOutput; /** The state of the ledger query. */ - state: "Loading" | "Ready"; + state: LedgerQueryStateOutput; /** The transaction ID. */ transactionId: string; } @@ -43,7 +43,7 @@ export interface ReceiptContentsOutput {} /** Response returned to a query for the transaction status. */ export interface TransactionStatusOutput { /** The transaction state. */ - state: "Committed" | "Pending"; + state: TransactionStateOutput; /** The transaction ID. */ transactionId: string; } @@ -53,5 +53,12 @@ export interface LedgerUserOutput { /** The user id, either an AAD object ID or certificate fingerprint. */ readonly userId: string; /** The user's assigned role. */ - assignedRole: "Administrator" | "Contributor" | "Reader"; + assignedRole: LedgerUserRoleOutput; } + +/** State of a ledger query. */ +export type LedgerQueryStateOutput = "Loading" | "Ready"; +/** Represents the state of the transaction. */ +export type TransactionStateOutput = "Committed" | "Pending"; +/** Represents an assignable role. */ +export type LedgerUserRoleOutput = "Administrator" | "Contributor" | "Reader"; diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/package.json index dc40638c3e..6e42276f50 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/package.json @@ -42,7 +42,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md index c860c420a8..11c561cf57 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/review/ai-content-safety.api.md @@ -10,20 +10,24 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; +// @public (undocumented) +export interface AddOrUpdateBlockItemsOptionalParams extends OperationOptions { +} + // @public export interface AddOrUpdateBlockItemsOptions { blockItems: TextBlockItemInfo[]; } -// @public (undocumented) -export interface AddOrUpdateBlockItemsRequestOptions extends OperationOptions { -} - // @public export interface AddOrUpdateBlockItemsResult { value?: TextBlockItem[]; } +// @public (undocumented) +export interface AnalyzeImageOptionalParams extends OperationOptions { +} + // @public export interface AnalyzeImageOptions { categories?: ImageCategory[]; @@ -31,18 +35,18 @@ export interface AnalyzeImageOptions { outputType?: AnalyzeImageOutputType; } -// @public -export type AnalyzeImageOutputType = string; - // @public (undocumented) -export interface AnalyzeImageRequestOptions extends OperationOptions { -} +export type AnalyzeImageOutputType = "FourLevels"; // @public export interface AnalyzeImageResult { analyzeResults: ImageAnalyzeSeverityResult[]; } +// @public (undocumented) +export interface AnalyzeTextOptionalParams extends OperationOptions { +} + // @public export interface AnalyzeTextOptions { blocklistNames?: string[]; @@ -52,12 +56,8 @@ export interface AnalyzeTextOptions { text: string; } -// @public -export type AnalyzeTextOutputType = string; - // @public (undocumented) -export interface AnalyzeTextRequestOptions extends OperationOptions { -} +export type AnalyzeTextOutputType = "FourLevels" | "EightLevels"; // @public export interface AnalyzeTextResult { @@ -67,22 +67,23 @@ export interface AnalyzeTextResult { // @public (undocumented) export class ContentSafetyClient { - constructor(endpoint: string, credential: KeyCredential | TokenCredential, options?: ContentSafetyClientOptions); - addOrUpdateBlockItems(blocklistName: string, body: AddOrUpdateBlockItemsOptions, options?: AddOrUpdateBlockItemsRequestOptions): Promise; - analyzeImage(body: AnalyzeImageOptions, options?: AnalyzeImageRequestOptions): Promise; - analyzeText(body: AnalyzeTextOptions, options?: AnalyzeTextRequestOptions): Promise; - createOrUpdateTextBlocklist(blocklistName: string, resource: TextBlocklist, options?: CreateOrUpdateTextBlocklistOptions): Promise; - deleteTextBlocklist(blocklistName: string, options?: DeleteTextBlocklistOptions): Promise; - getTextBlocklist(blocklistName: string, options?: GetTextBlocklistOptions): Promise; - getTextBlocklistItem(blocklistName: string, blockItemId: string, options?: GetTextBlocklistItemOptions): Promise; - listTextBlocklistItems(blocklistName: string, options?: ListTextBlocklistItemsOptions): PagedAsyncIterableIterator; - listTextBlocklists(options?: ListTextBlocklistsOptions): PagedAsyncIterableIterator; + constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: ContentSafetyClientOptions); + addOrUpdateBlockItems(blocklistName: string, body: AddOrUpdateBlockItemsOptions, options?: AddOrUpdateBlockItemsOptionalParams): Promise; + analyzeImage(body: AnalyzeImageOptions, options?: AnalyzeImageOptionalParams): Promise; + analyzeText(body: AnalyzeTextOptions, options?: AnalyzeTextOptionalParams): Promise; + createOrUpdateTextBlocklist(blocklistName: string, resource: TextBlocklist, options?: CreateOrUpdateTextBlocklistOptionalParams): Promise; + deleteTextBlocklist(blocklistName: string, options?: DeleteTextBlocklistOptionalParams): Promise; + getTextBlocklist(blocklistName: string, options?: GetTextBlocklistOptionalParams): Promise; + getTextBlocklistItem(blocklistName: string, blockItemId: string, options?: GetTextBlocklistItemOptionalParams): Promise; + listTextBlocklistItems(blocklistName: string, options?: ListTextBlocklistItemsOptionalParams): PagedAsyncIterableIterator; + listTextBlocklists(options?: ListTextBlocklistsOptionalParams): PagedAsyncIterableIterator; readonly pipeline: Pipeline; - removeBlockItems(blocklistName: string, body: RemoveBlockItemsOptions, options?: RemoveBlockItemsRequestOptions): Promise; + removeBlockItems(blocklistName: string, body: RemoveBlockItemsOptions, options?: RemoveBlockItemsOptionalParams): Promise; } // @public (undocumented) export interface ContentSafetyClientOptions extends ClientOptions { + apiVersion?: string; } // @public @@ -91,20 +92,20 @@ export type ContinuablePage = TPage & { }; // @public (undocumented) -export interface CreateOrUpdateTextBlocklistOptions extends OperationOptions { +export interface CreateOrUpdateTextBlocklistOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface DeleteTextBlocklistOptions extends OperationOptions { +export interface DeleteTextBlocklistOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetTextBlocklistItemOptions extends OperationOptions { +export interface GetTextBlocklistItemOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetTextBlocklistOptions extends OperationOptions { +export interface GetTextBlocklistOptionalParams extends OperationOptions { } // @public @@ -113,8 +114,8 @@ export interface ImageAnalyzeSeverityResult { severity?: number; } -// @public -export type ImageCategory = string; +// @public (undocumented) +export type ImageCategory = "Hate" | "SelfHarm" | "Sexual" | "Violence"; // @public export interface ImageData { @@ -123,14 +124,14 @@ export interface ImageData { } // @public (undocumented) -export interface ListTextBlocklistItemsOptions extends OperationOptions { +export interface ListTextBlocklistItemsOptionalParams extends OperationOptions { maxpagesize?: number; skip?: number; top?: number; } // @public (undocumented) -export interface ListTextBlocklistsOptions extends OperationOptions { +export interface ListTextBlocklistsOptionalParams extends OperationOptions { } // @public @@ -142,13 +143,13 @@ export interface PagedAsyncIterableIterator { return context .path("/text:analyze") @@ -106,7 +106,7 @@ export async function _analyzeTextDeserialize( export async function analyzeText( context: Client, body: AnalyzeTextOptions, - options: AnalyzeTextRequestOptions = { requestOptions: {} }, + options: AnalyzeTextOptionalParams = { requestOptions: {} }, ): Promise { const result = await _analyzeTextSend(context, body, options); return _analyzeTextDeserialize(result); @@ -115,7 +115,7 @@ export async function analyzeText( export function _analyzeImageSend( context: Client, body: AnalyzeImageOptions, - options: AnalyzeImageRequestOptions = { requestOptions: {} }, + options: AnalyzeImageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/image:analyze") @@ -154,7 +154,7 @@ export async function _analyzeImageDeserialize( export async function analyzeImage( context: Client, body: AnalyzeImageOptions, - options: AnalyzeImageRequestOptions = { requestOptions: {} }, + options: AnalyzeImageOptionalParams = { requestOptions: {} }, ): Promise { const result = await _analyzeImageSend(context, body, options); return _analyzeImageDeserialize(result); @@ -163,7 +163,7 @@ export async function analyzeImage( export function _getTextBlocklistSend( context: Client, blocklistName: string, - options: GetTextBlocklistOptions = { requestOptions: {} }, + options: GetTextBlocklistOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetTextBlocklist200Response | GetTextBlocklistDefaultResponse > { @@ -189,7 +189,7 @@ export async function _getTextBlocklistDeserialize( export async function getTextBlocklist( context: Client, blocklistName: string, - options: GetTextBlocklistOptions = { requestOptions: {} }, + options: GetTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTextBlocklistSend(context, blocklistName, options); return _getTextBlocklistDeserialize(result); @@ -199,7 +199,7 @@ export function _createOrUpdateTextBlocklistSend( context: Client, blocklistName: string, resource: TextBlocklist, - options: CreateOrUpdateTextBlocklistOptions = { requestOptions: {} }, + options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, ): StreamableMethod< | CreateOrUpdateTextBlocklist200Response | CreateOrUpdateTextBlocklist201Response @@ -239,7 +239,7 @@ export async function createOrUpdateTextBlocklist( context: Client, blocklistName: string, resource: TextBlocklist, - options: CreateOrUpdateTextBlocklistOptions = { requestOptions: {} }, + options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createOrUpdateTextBlocklistSend( context, @@ -253,7 +253,7 @@ export async function createOrUpdateTextBlocklist( export function _deleteTextBlocklistSend( context: Client, blocklistName: string, - options: DeleteTextBlocklistOptions = { requestOptions: {} }, + options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, ): StreamableMethod< DeleteTextBlocklist204Response | DeleteTextBlocklistDefaultResponse > { @@ -276,7 +276,7 @@ export async function _deleteTextBlocklistDeserialize( export async function deleteTextBlocklist( context: Client, blocklistName: string, - options: DeleteTextBlocklistOptions = { requestOptions: {} }, + options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteTextBlocklistSend( context, @@ -288,7 +288,7 @@ export async function deleteTextBlocklist( export function _listTextBlocklistsSend( context: Client, - options: ListTextBlocklistsOptions = { requestOptions: {} }, + options: ListTextBlocklistsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListTextBlocklists200Response | ListTextBlocklistsDefaultResponse > { @@ -316,7 +316,7 @@ export async function _listTextBlocklistsDeserialize( /** Get all text blocklists details. */ export function listTextBlocklists( context: Client, - options: ListTextBlocklistsOptions = { requestOptions: {} }, + options: ListTextBlocklistsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -330,7 +330,7 @@ export function _addOrUpdateBlockItemsSend( context: Client, blocklistName: string, body: AddOrUpdateBlockItemsOptions, - options: AddOrUpdateBlockItemsRequestOptions = { requestOptions: {} }, + options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, ): StreamableMethod< AddOrUpdateBlockItems200Response | AddOrUpdateBlockItemsDefaultResponse > { @@ -376,7 +376,7 @@ export async function addOrUpdateBlockItems( context: Client, blocklistName: string, body: AddOrUpdateBlockItemsOptions, - options: AddOrUpdateBlockItemsRequestOptions = { requestOptions: {} }, + options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _addOrUpdateBlockItemsSend( context, @@ -391,7 +391,7 @@ export function _removeBlockItemsSend( context: Client, blocklistName: string, body: RemoveBlockItemsOptions, - options: RemoveBlockItemsRequestOptions = { requestOptions: {} }, + options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, ): StreamableMethod< RemoveBlockItems204Response | RemoveBlockItemsDefaultResponse > { @@ -418,7 +418,7 @@ export async function removeBlockItems( context: Client, blocklistName: string, body: RemoveBlockItemsOptions, - options: RemoveBlockItemsRequestOptions = { requestOptions: {} }, + options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _removeBlockItemsSend( context, @@ -433,7 +433,7 @@ export function _getTextBlocklistItemSend( context: Client, blocklistName: string, blockItemId: string, - options: GetTextBlocklistItemOptions = { requestOptions: {} }, + options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetTextBlocklistItem200Response | GetTextBlocklistItemDefaultResponse > { @@ -465,7 +465,7 @@ export async function getTextBlocklistItem( context: Client, blocklistName: string, blockItemId: string, - options: GetTextBlocklistItemOptions = { requestOptions: {} }, + options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTextBlocklistItemSend( context, @@ -479,7 +479,7 @@ export async function getTextBlocklistItem( export function _listTextBlocklistItemsSend( context: Client, blocklistName: string, - options: ListTextBlocklistItemsOptions = { requestOptions: {} }, + options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListTextBlocklistItems200Response | ListTextBlocklistItemsDefaultResponse > { @@ -518,7 +518,7 @@ export async function _listTextBlocklistItemsDeserialize( export function listTextBlocklistItems( context: Client, blocklistName: string, - options: ListTextBlocklistItemsOptions = { requestOptions: {} }, + options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/ContentSafetyClient.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts similarity index 75% rename from packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/ContentSafetyClient.ts rename to packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts index 77489434e1..2d1f081179 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/ContentSafetyClient.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/contentSafetyClient.ts @@ -15,16 +15,16 @@ import { AnalyzeTextResult, } from "./models/models.js"; import { - AnalyzeTextRequestOptions, - AnalyzeImageRequestOptions, - GetTextBlocklistOptions, - CreateOrUpdateTextBlocklistOptions, - DeleteTextBlocklistOptions, - ListTextBlocklistsOptions, - AddOrUpdateBlockItemsRequestOptions, - RemoveBlockItemsRequestOptions, - GetTextBlocklistItemOptions, - ListTextBlocklistItemsOptions, + AnalyzeTextOptionalParams, + AnalyzeImageOptionalParams, + GetTextBlocklistOptionalParams, + CreateOrUpdateTextBlocklistOptionalParams, + DeleteTextBlocklistOptionalParams, + ListTextBlocklistsOptionalParams, + AddOrUpdateBlockItemsOptionalParams, + RemoveBlockItemsOptionalParams, + GetTextBlocklistItemOptionalParams, + ListTextBlocklistItemsOptionalParams, } from "./models/options.js"; import { PagedAsyncIterableIterator } from "./models/pagingTypes.js"; import { @@ -43,7 +43,7 @@ import { listTextBlocklistItems, } from "./api/index.js"; -export { ContentSafetyClientOptions } from "./api/ContentSafetyContext.js"; +export { ContentSafetyClientOptions } from "./api/contentSafetyContext.js"; export class ContentSafetyClient { private _client: ContentSafetyContext; @@ -52,18 +52,18 @@ export class ContentSafetyClient { /** Analyze harmful content */ constructor( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: ContentSafetyClientOptions = {}, ) { - this._client = createContentSafety(endpoint, credential, options); + this._client = createContentSafety(endpointParam, credential, options); this.pipeline = this._client.pipeline; } /** A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ analyzeText( body: AnalyzeTextOptions, - options: AnalyzeTextRequestOptions = { requestOptions: {} }, + options: AnalyzeTextOptionalParams = { requestOptions: {} }, ): Promise { return analyzeText(this._client, body, options); } @@ -71,7 +71,7 @@ export class ContentSafetyClient { /** A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, Sexual, Violence. */ analyzeImage( body: AnalyzeImageOptions, - options: AnalyzeImageRequestOptions = { requestOptions: {} }, + options: AnalyzeImageOptionalParams = { requestOptions: {} }, ): Promise { return analyzeImage(this._client, body, options); } @@ -79,7 +79,7 @@ export class ContentSafetyClient { /** Returns text blocklist details. */ getTextBlocklist( blocklistName: string, - options: GetTextBlocklistOptions = { requestOptions: {} }, + options: GetTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { return getTextBlocklist(this._client, blocklistName, options); } @@ -88,7 +88,7 @@ export class ContentSafetyClient { createOrUpdateTextBlocklist( blocklistName: string, resource: TextBlocklist, - options: CreateOrUpdateTextBlocklistOptions = { requestOptions: {} }, + options: CreateOrUpdateTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { return createOrUpdateTextBlocklist( this._client, @@ -101,14 +101,14 @@ export class ContentSafetyClient { /** Deletes a text blocklist. */ deleteTextBlocklist( blocklistName: string, - options: DeleteTextBlocklistOptions = { requestOptions: {} }, + options: DeleteTextBlocklistOptionalParams = { requestOptions: {} }, ): Promise { return deleteTextBlocklist(this._client, blocklistName, options); } /** Get all text blocklists details. */ listTextBlocklists( - options: ListTextBlocklistsOptions = { requestOptions: {} }, + options: ListTextBlocklistsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTextBlocklists(this._client, options); } @@ -117,7 +117,7 @@ export class ContentSafetyClient { addOrUpdateBlockItems( blocklistName: string, body: AddOrUpdateBlockItemsOptions, - options: AddOrUpdateBlockItemsRequestOptions = { requestOptions: {} }, + options: AddOrUpdateBlockItemsOptionalParams = { requestOptions: {} }, ): Promise { return addOrUpdateBlockItems(this._client, blocklistName, body, options); } @@ -126,7 +126,7 @@ export class ContentSafetyClient { removeBlockItems( blocklistName: string, body: RemoveBlockItemsOptions, - options: RemoveBlockItemsRequestOptions = { requestOptions: {} }, + options: RemoveBlockItemsOptionalParams = { requestOptions: {} }, ): Promise { return removeBlockItems(this._client, blocklistName, body, options); } @@ -135,7 +135,7 @@ export class ContentSafetyClient { getTextBlocklistItem( blocklistName: string, blockItemId: string, - options: GetTextBlocklistItemOptions = { requestOptions: {} }, + options: GetTextBlocklistItemOptionalParams = { requestOptions: {} }, ): Promise { return getTextBlocklistItem( this._client, @@ -148,7 +148,7 @@ export class ContentSafetyClient { /** Get all blockItems in a text blocklist */ listTextBlocklistItems( blocklistName: string, - options: ListTextBlocklistItemsOptions = { requestOptions: {} }, + options: ListTextBlocklistItemsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTextBlocklistItems(this._client, blocklistName, options); } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts index 9786cc8e6a..12f7881e11 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/index.ts @@ -4,11 +4,11 @@ export { ContentSafetyClient, ContentSafetyClientOptions, -} from "./ContentSafetyClient.js"; +} from "./contentSafetyClient.js"; export { TextBlocklist, - AddOrUpdateBlockItemsOptions, TextBlockItemInfo, + AddOrUpdateBlockItemsOptions, AddOrUpdateBlockItemsResult, TextBlockItem, RemoveBlockItemsOptions, @@ -24,18 +24,19 @@ export { AnalyzeTextResult, TextBlocklistMatchResult, TextAnalyzeSeverityResult, + Versions, PagedTextBlocklist, PagedTextBlockItem, - AnalyzeTextRequestOptions, - AnalyzeImageRequestOptions, - GetTextBlocklistOptions, - CreateOrUpdateTextBlocklistOptions, - DeleteTextBlocklistOptions, - ListTextBlocklistsOptions, - AddOrUpdateBlockItemsRequestOptions, - RemoveBlockItemsRequestOptions, - GetTextBlocklistItemOptions, - ListTextBlocklistItemsOptions, + AnalyzeTextOptionalParams, + AnalyzeImageOptionalParams, + GetTextBlocklistOptionalParams, + CreateOrUpdateTextBlocklistOptionalParams, + DeleteTextBlocklistOptionalParams, + ListTextBlocklistsOptionalParams, + AddOrUpdateBlockItemsOptionalParams, + RemoveBlockItemsOptionalParams, + GetTextBlocklistItemOptionalParams, + ListTextBlocklistItemsOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/index.ts index 18b2d927e9..1d92d7b9e5 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/index.ts @@ -3,8 +3,8 @@ export { TextBlocklist, - AddOrUpdateBlockItemsOptions, TextBlockItemInfo, + AddOrUpdateBlockItemsOptions, AddOrUpdateBlockItemsResult, TextBlockItem, RemoveBlockItemsOptions, @@ -20,20 +20,21 @@ export { AnalyzeTextResult, TextBlocklistMatchResult, TextAnalyzeSeverityResult, + Versions, PagedTextBlocklist, PagedTextBlockItem, } from "./models.js"; export { - AnalyzeTextRequestOptions, - AnalyzeImageRequestOptions, - GetTextBlocklistOptions, - CreateOrUpdateTextBlocklistOptions, - DeleteTextBlocklistOptions, - ListTextBlocklistsOptions, - AddOrUpdateBlockItemsRequestOptions, - RemoveBlockItemsRequestOptions, - GetTextBlocklistItemOptions, - ListTextBlocklistItemsOptions, + AnalyzeTextOptionalParams, + AnalyzeImageOptionalParams, + GetTextBlocklistOptionalParams, + CreateOrUpdateTextBlocklistOptionalParams, + DeleteTextBlocklistOptionalParams, + ListTextBlocklistsOptionalParams, + AddOrUpdateBlockItemsOptionalParams, + RemoveBlockItemsOptionalParams, + GetTextBlocklistItemOptionalParams, + ListTextBlocklistItemsOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts index 7fda838260..f5202c4eb1 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/models.ts @@ -9,12 +9,6 @@ export interface TextBlocklist { description?: string; } -/** The request of adding blockItems to text blocklist. */ -export interface AddOrUpdateBlockItemsOptions { - /** Array of blockItemInfo to add. */ - blockItems: TextBlockItemInfo[]; -} - /** Block item info in text blocklist. */ export interface TextBlockItemInfo { /** Block item description. */ @@ -23,6 +17,12 @@ export interface TextBlockItemInfo { text: string; } +/** The request of adding blockItems to text blocklist. */ +export interface AddOrUpdateBlockItemsOptions { + /** Array of blockItemInfo to add. */ + blockItems: TextBlockItemInfo[]; +} + /** The response of adding blockItems to text blocklist. */ export interface AddOrUpdateBlockItemsResult { /** Array of blockItems added. */ @@ -64,11 +64,11 @@ export interface ImageData { } /** Image analyze category */ -/** "Hate", "SelfHarm", "Sexual", "Violence" */ -export type ImageCategory = string; +/** */ +export type ImageCategory = "Hate" | "SelfHarm" | "Sexual" | "Violence"; /** The type of image analysis output. */ -/** "FourLevels" */ -export type AnalyzeImageOutputType = string; +/** */ +export type AnalyzeImageOutputType = "FourLevels"; /** The analysis response of the image. */ export interface AnalyzeImageResult { @@ -99,11 +99,11 @@ export interface AnalyzeTextOptions { } /** Text analyze category */ -/** "Hate", "SelfHarm", "Sexual", "Violence" */ -export type TextCategory = string; +/** */ +export type TextCategory = "Hate" | "SelfHarm" | "Sexual" | "Violence"; /** The type of text analysis output. */ -/** "FourLevels", "EightLevels" */ -export type AnalyzeTextOutputType = string; +/** */ +export type AnalyzeTextOutputType = "FourLevels" | "EightLevels"; /** The analysis response of the text */ export interface AnalyzeTextResult { @@ -131,12 +131,15 @@ export interface TextAnalyzeSeverityResult { severity?: number; } +/** */ +export type Versions = "2023-10-01"; + /** Paged collection of TextBlocklist items */ export interface PagedTextBlocklist { /** The TextBlocklist items on this page */ value: TextBlocklist[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } /** Paged collection of TextBlockItem items */ @@ -144,5 +147,5 @@ export interface PagedTextBlockItem { /** The TextBlockItem items on this page */ value: TextBlockItem[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/options.ts index 33f3f77bb7..5dd4631db2 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/models/options.ts @@ -3,28 +3,29 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface AnalyzeTextRequestOptions extends OperationOptions {} +export interface AnalyzeTextOptionalParams extends OperationOptions {} -export interface AnalyzeImageRequestOptions extends OperationOptions {} +export interface AnalyzeImageOptionalParams extends OperationOptions {} -export interface GetTextBlocklistOptions extends OperationOptions {} +export interface GetTextBlocklistOptionalParams extends OperationOptions {} -export interface CreateOrUpdateTextBlocklistOptions extends OperationOptions { +export interface CreateOrUpdateTextBlocklistOptionalParams + extends OperationOptions { /** This request has a JSON Merge Patch body. */ contentType?: string; } -export interface DeleteTextBlocklistOptions extends OperationOptions {} +export interface DeleteTextBlocklistOptionalParams extends OperationOptions {} -export interface ListTextBlocklistsOptions extends OperationOptions {} +export interface ListTextBlocklistsOptionalParams extends OperationOptions {} -export interface AddOrUpdateBlockItemsRequestOptions extends OperationOptions {} +export interface AddOrUpdateBlockItemsOptionalParams extends OperationOptions {} -export interface RemoveBlockItemsRequestOptions extends OperationOptions {} +export interface RemoveBlockItemsOptionalParams extends OperationOptions {} -export interface GetTextBlocklistItemOptions extends OperationOptions {} +export interface GetTextBlocklistItemOptionalParams extends OperationOptions {} -export interface ListTextBlocklistItemsOptions extends OperationOptions { +export interface ListTextBlocklistItemsOptionalParams extends OperationOptions { /** The number of result items to return. */ top?: number; /** The number of result items to skip. */ diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/models.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/models.ts index 708dc191dd..ac32d67a9f 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/models.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/models.ts @@ -6,17 +6,13 @@ export interface AnalyzeTextOptions { /** The text needs to be scanned. We support at most 10k Unicode characters (unicode code points) in text of one request. */ text: string; /** The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. */ - categories?: string[]; + categories?: TextCategory[]; /** The names of blocklists. */ blocklistNames?: string[]; /** When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit. */ breakByBlocklists?: boolean; - /** - * The type of text analysis output. If not assigned, the default value is "FourLevels". - * - * Possible values: "FourLevels", "EightLevels" - */ - outputType?: string; + /** The type of text analysis output. If not assigned, the default value is "FourLevels". */ + outputType?: AnalyzeTextOutputType; } /** The analysis request of the image. */ @@ -24,13 +20,9 @@ export interface AnalyzeImageOptions { /** The image needs to be analyzed. */ image: ImageData; /** The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. */ - categories?: string[]; - /** - * The type of image analysis output. If not assigned, the default value is "FourLevels". - * - * Possible values: "FourLevels" - */ - outputType?: string; + categories?: ImageCategory[]; + /** The type of image analysis output. If not assigned, the default value is "FourLevels". */ + outputType?: AnalyzeImageOutputType; } /** The content or blob url of image, could be base64 encoding bytes or blob url. You can choose only one of them. If both are given, the request will be refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum size of image is 50 pixels * 50 pixels. */ @@ -68,3 +60,12 @@ export interface RemoveBlockItemsOptions { /** Array of blockItemIds to remove. */ blockItemIds: string[]; } + +/** Text analyze category */ +export type TextCategory = "Hate" | "SelfHarm" | "Sexual" | "Violence"; +/** The type of text analysis output. */ +export type AnalyzeTextOutputType = "FourLevels" | "EightLevels"; +/** Image analyze category */ +export type ImageCategory = "Hate" | "SelfHarm" | "Sexual" | "Violence"; +/** The type of image analysis output. */ +export type AnalyzeImageOutputType = "FourLevels"; diff --git a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/outputModels.ts index c86b3d8ebe..12f4e49325 100644 --- a/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/rest/outputModels.ts @@ -3,24 +3,6 @@ import { Paged } from "@azure/core-paging"; -/** The analysis request of the text. */ -export interface AnalyzeTextOptionsOutput { - /** The text needs to be scanned. We support at most 10k Unicode characters (unicode code points) in text of one request. */ - text: string; - /** The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. */ - categories?: string[]; - /** The names of blocklists. */ - blocklistNames?: string[]; - /** When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit. */ - breakByBlocklists?: boolean; - /** - * The type of text analysis output. If not assigned, the default value is "FourLevels". - * - * Possible values: "FourLevels", "EightLevels" - */ - outputType?: string; -} - /** The analysis response of the text */ export interface AnalyzeTextResultOutput { /** The details of blocklist match. */ @@ -41,38 +23,12 @@ export interface TextBlocklistMatchResultOutput { /** Text analysis result. */ export interface TextAnalyzeSeverityResultOutput { - /** - * The text category. - * - * Possible values: "Hate", "SelfHarm", "Sexual", "Violence" - */ - category: string; + /** The text category. */ + category: TextCategoryOutput; /** This field is decided by outputType in request, if choose "FourLevels", the value could be 0,2,4,6. The higher the severity of input content, the larger this value is. */ severity?: number; } -/** The analysis request of the image. */ -export interface AnalyzeImageOptionsOutput { - /** The image needs to be analyzed. */ - image: ImageDataOutput; - /** The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be returned. */ - categories?: string[]; - /** - * The type of image analysis output. If not assigned, the default value is "FourLevels". - * - * Possible values: "FourLevels" - */ - outputType?: string; -} - -/** The content or blob url of image, could be base64 encoding bytes or blob url. You can choose only one of them. If both are given, the request will be refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum size of image is 50 pixels * 50 pixels. */ -export interface ImageDataOutput { - /** Base64 encoding of image. */ - content?: string; - /** The blob url of image. */ - blobUrl?: string; -} - /** The analysis response of the image. */ export interface AnalyzeImageResultOutput { /** Analysis result for categories. */ @@ -81,12 +37,8 @@ export interface AnalyzeImageResultOutput { /** Image analysis result. */ export interface ImageAnalyzeSeverityResultOutput { - /** - * The image category. - * - * Possible values: "Hate", "SelfHarm", "Sexual", "Violence" - */ - category: string; + /** The image category. */ + category: ImageCategoryOutput; /** This field is decided by outputType in request, if choose "FourLevels", the value could be 0,2,4,6. The higher the severity of input content, the larger this value is. */ severity?: number; } @@ -115,6 +67,10 @@ export interface TextBlockItemOutput { text: string; } +/** Text analyze category */ +export type TextCategoryOutput = "Hate" | "SelfHarm" | "Sexual" | "Violence"; +/** Image analyze category */ +export type ImageCategoryOutput = "Hate" | "SelfHarm" | "Sexual" | "Violence"; /** Paged collection of TextBlocklist items */ export type PagedTextBlocklistOutput = Paged; /** Paged collection of TextBlockItem items */ diff --git a/packages/typespec-test/test/contoso/generated/openapi/2022-11-01-preview/openapi.json b/packages/typespec-test/test/contoso/generated/openapi/2022-11-01-preview/openapi.json index 04abab6e37..6e6d50850d 100644 --- a/packages/typespec-test/test/contoso/generated/openapi/2022-11-01-preview/openapi.json +++ b/packages/typespec-test/test/contoso/generated/openapi/2022-11-01-preview/openapi.json @@ -446,8 +446,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/package.json b/packages/typespec-test/test/contoso/generated/typespec-ts/package.json index 93f1212bf5..e84f8884ac 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md b/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md index 3c706f0e1d..c8989a29aa 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/review/contosowidgetmanager-rest.api.md @@ -268,11 +268,14 @@ export interface ListWidgetsDefaultResponse extends HttpResponse { // @public (undocumented) export type ListWidgetsParameters = RequestParameters; +// @public +export type OperationStateOutput = "NotStarted" | "Running" | "Succeeded" | "Failed" | "Canceled"; + // @public export interface OperationStatusOutput { error?: ErrorModel; id: string; - status: string; + status: OperationStateOutput; } // @public @@ -298,7 +301,7 @@ export interface ResourceOperationStatusOutput { error?: ErrorModel; id: string; result?: WidgetOutput; - status: string; + status: OperationStateOutput; } // @public (undocumented) diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts index 64e304bf04..33d855583f 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/src/outputModels.ts @@ -26,12 +26,8 @@ export interface FakedSharedModelOutput { export interface ResourceOperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; /** The result of the operation. */ @@ -42,15 +38,18 @@ export interface ResourceOperationStatusOutput { export interface OperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; } +/** Enum describing allowed operation states. */ +export type OperationStateOutput = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled"; /** Paged collection of Widget items */ export type PagedWidgetOutput = Paged; diff --git a/packages/typespec-test/test/contoso/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/contoso/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/contoso/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/contoso/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/customWrapper/generated/typespec-ts/package.json b/packages/typespec-test/test/customWrapper/generated/typespec-ts/package.json index 2a9ccdc459..6b1f984703 100644 --- a/packages/typespec-test/test/customWrapper/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/customWrapper/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/customWrapper/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/customWrapper/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/customWrapper/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/customWrapper/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/package.json index 58abe4fecd..713efb3117 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/package.json @@ -42,7 +42,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -55,8 +55,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md index e194a0fe0e..d0d9775ed2 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/review/eventgrid.api.md @@ -10,7 +10,7 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; // @public (undocumented) -export interface AcknowledgeCloudEventsOptions extends OperationOptions { +export interface AcknowledgeCloudEventsOptionalParams extends OperationOptions { contentType?: string; } @@ -47,18 +47,19 @@ export interface CloudEvent { // @public (undocumented) export class EventGridClient { - constructor(endpoint: string, credential: KeyCredential, options?: EventGridClientOptions); - acknowledgeCloudEvents(topicName: string, eventSubscriptionName: string, lockTokens: AcknowledgeOptions, options?: AcknowledgeCloudEventsOptions): Promise; + constructor(endpointParam: string, credential: KeyCredential, options?: EventGridClientOptions); + acknowledgeCloudEvents(topicName: string, eventSubscriptionName: string, lockTokens: AcknowledgeOptions, options?: AcknowledgeCloudEventsOptionalParams): Promise; readonly pipeline: Pipeline; - publishCloudEvent(topicName: string, event: CloudEvent, options?: PublishCloudEventOptions): Promise>; - publishCloudEvents(topicName: string, events: CloudEvent[], options?: PublishCloudEventsOptions): Promise>; - receiveCloudEvents(topicName: string, eventSubscriptionName: string, options?: ReceiveCloudEventsOptions): Promise; - rejectCloudEvents(topicName: string, eventSubscriptionName: string, lockTokens: RejectOptions, options?: RejectCloudEventsOptions): Promise; - releaseCloudEvents(topicName: string, eventSubscriptionName: string, lockTokens: ReleaseOptions, options?: ReleaseCloudEventsOptions): Promise; + publishCloudEvent(topicName: string, event: CloudEvent, options?: PublishCloudEventOptionalParams): Promise>; + publishCloudEvents(topicName: string, events: CloudEvent[], options?: PublishCloudEventsOptionalParams): Promise>; + receiveCloudEvents(topicName: string, eventSubscriptionName: string, options?: ReceiveCloudEventsOptionalParams): Promise; + rejectCloudEvents(topicName: string, eventSubscriptionName: string, lockTokens: RejectOptions, options?: RejectCloudEventsOptionalParams): Promise; + releaseCloudEvents(topicName: string, eventSubscriptionName: string, lockTokens: ReleaseOptions, options?: ReleaseCloudEventsOptionalParams): Promise; } // @public (undocumented) export interface EventGridClientOptions extends ClientOptions { + apiVersion?: string; } // @public @@ -69,17 +70,17 @@ export interface FailedLockToken { } // @public (undocumented) -export interface PublishCloudEventOptions extends OperationOptions { +export interface PublishCloudEventOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface PublishCloudEventsOptions extends OperationOptions { +export interface PublishCloudEventsOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface ReceiveCloudEventsOptions extends OperationOptions { +export interface ReceiveCloudEventsOptionalParams extends OperationOptions { maxEvents?: number; maxWaitTime?: number; } @@ -96,7 +97,7 @@ export interface ReceiveResult { } // @public (undocumented) -export interface RejectCloudEventsOptions extends OperationOptions { +export interface RejectCloudEventsOptionalParams extends OperationOptions { contentType?: string; } @@ -112,7 +113,7 @@ export interface RejectResult { } // @public (undocumented) -export interface ReleaseCloudEventsOptions extends OperationOptions { +export interface ReleaseCloudEventsOptionalParams extends OperationOptions { contentType?: string; } @@ -127,6 +128,9 @@ export interface ReleaseResult { succeededLockTokens: string[]; } +// @public (undocumented) +export type ServiceApiVersions = "2023-06-01-preview"; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/EventGridContext.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts similarity index 68% rename from packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/EventGridContext.ts rename to packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts index 7dfedad12a..befb6833e0 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/EventGridContext.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/eventGridContext.ts @@ -6,16 +6,19 @@ import { ClientOptions } from "@azure-rest/core-client"; import { EventGridContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface EventGridClientOptions extends ClientOptions {} +export interface EventGridClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { EventGridContext } from "../rest/index.js"; /** Azure Messaging EventGrid Client */ export function createEventGrid( - endpoint: string, + endpointParam: string, credential: KeyCredential, options: EventGridClientOptions = {}, ): EventGridContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts index 45f2abdd33..a6186d2f6e 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createEventGrid, EventGridClientOptions, EventGridContext, -} from "./EventGridContext.js"; +} from "./eventGridContext.js"; export { publishCloudEvent, publishCloudEvents, diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts index b743e42721..0a7bcffc7c 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts @@ -34,19 +34,19 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util"; import { - PublishCloudEventOptions, - PublishCloudEventsOptions, - ReceiveCloudEventsOptions, - AcknowledgeCloudEventsOptions, - ReleaseCloudEventsOptions, - RejectCloudEventsOptions, + PublishCloudEventOptionalParams, + PublishCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + RejectCloudEventsOptionalParams, } from "../models/options.js"; export function _publishCloudEventSend( context: Client, topicName: string, event: CloudEvent, - options: PublishCloudEventOptions = { requestOptions: {} }, + options: PublishCloudEventOptionalParams = { requestOptions: {} }, ): StreamableMethod< PublishCloudEvent200Response | PublishCloudEventDefaultResponse > { @@ -94,7 +94,7 @@ export async function publishCloudEvent( context: Client, topicName: string, event: CloudEvent, - options: PublishCloudEventOptions = { requestOptions: {} }, + options: PublishCloudEventOptionalParams = { requestOptions: {} }, ): Promise> { const result = await _publishCloudEventSend( context, @@ -109,7 +109,7 @@ export function _publishCloudEventsSend( context: Client, topicName: string, events: CloudEvent[], - options: PublishCloudEventsOptions = { requestOptions: {} }, + options: PublishCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< PublishCloudEvents200Response | PublishCloudEventsDefaultResponse > { @@ -155,7 +155,7 @@ export async function publishCloudEvents( context: Client, topicName: string, events: CloudEvent[], - options: PublishCloudEventsOptions = { requestOptions: {} }, + options: PublishCloudEventsOptionalParams = { requestOptions: {} }, ): Promise> { const result = await _publishCloudEventsSend( context, @@ -170,7 +170,7 @@ export function _receiveCloudEventsSend( context: Client, topicName: string, eventSubscriptionName: string, - options: ReceiveCloudEventsOptions = { requestOptions: {} }, + options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ReceiveCloudEvents200Response | ReceiveCloudEventsDefaultResponse > { @@ -227,7 +227,7 @@ export async function receiveCloudEvents( context: Client, topicName: string, eventSubscriptionName: string, - options: ReceiveCloudEventsOptions = { requestOptions: {} }, + options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _receiveCloudEventsSend( context, @@ -243,7 +243,7 @@ export function _acknowledgeCloudEventsSend( topicName: string, eventSubscriptionName: string, lockTokens: AcknowledgeOptions, - options: AcknowledgeCloudEventsOptions = { requestOptions: {} }, + options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< AcknowledgeCloudEvents200Response | AcknowledgeCloudEventsDefaultResponse > { @@ -286,7 +286,7 @@ export async function acknowledgeCloudEvents( topicName: string, eventSubscriptionName: string, lockTokens: AcknowledgeOptions, - options: AcknowledgeCloudEventsOptions = { requestOptions: {} }, + options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _acknowledgeCloudEventsSend( context, @@ -303,7 +303,7 @@ export function _releaseCloudEventsSend( topicName: string, eventSubscriptionName: string, lockTokens: ReleaseOptions, - options: ReleaseCloudEventsOptions = { requestOptions: {} }, + options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< ReleaseCloudEvents200Response | ReleaseCloudEventsDefaultResponse > { @@ -344,7 +344,7 @@ export async function releaseCloudEvents( topicName: string, eventSubscriptionName: string, lockTokens: ReleaseOptions, - options: ReleaseCloudEventsOptions = { requestOptions: {} }, + options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _releaseCloudEventsSend( context, @@ -361,7 +361,7 @@ export function _rejectCloudEventsSend( topicName: string, eventSubscriptionName: string, lockTokens: RejectOptions, - options: RejectCloudEventsOptions = { requestOptions: {} }, + options: RejectCloudEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< RejectCloudEvents200Response | RejectCloudEventsDefaultResponse > { @@ -402,7 +402,7 @@ export async function rejectCloudEvents( topicName: string, eventSubscriptionName: string, lockTokens: RejectOptions, - options: RejectCloudEventsOptions = { requestOptions: {} }, + options: RejectCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _rejectCloudEventsSend( context, diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/EventGridClient.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts similarity index 83% rename from packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/EventGridClient.ts rename to packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts index 01d5b8f737..be9b11e29f 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/EventGridClient.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/eventGridClient.ts @@ -14,12 +14,12 @@ import { RejectResult, } from "./models/models.js"; import { - PublishCloudEventOptions, - PublishCloudEventsOptions, - ReceiveCloudEventsOptions, - AcknowledgeCloudEventsOptions, - ReleaseCloudEventsOptions, - RejectCloudEventsOptions, + PublishCloudEventOptionalParams, + PublishCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + RejectCloudEventsOptionalParams, } from "./models/options.js"; import { createEventGrid, @@ -33,7 +33,7 @@ import { rejectCloudEvents, } from "./api/index.js"; -export { EventGridClientOptions } from "./api/EventGridContext.js"; +export { EventGridClientOptions } from "./api/eventGridContext.js"; export class EventGridClient { private _client: EventGridContext; @@ -42,11 +42,11 @@ export class EventGridClient { /** Azure Messaging EventGrid Client */ constructor( - endpoint: string, + endpointParam: string, credential: KeyCredential, options: EventGridClientOptions = {}, ) { - this._client = createEventGrid(endpoint, credential, options); + this._client = createEventGrid(endpointParam, credential, options); this.pipeline = this._client.pipeline; } @@ -54,7 +54,7 @@ export class EventGridClient { publishCloudEvent( topicName: string, event: CloudEvent, - options: PublishCloudEventOptions = { requestOptions: {} }, + options: PublishCloudEventOptionalParams = { requestOptions: {} }, ): Promise> { return publishCloudEvent(this._client, topicName, event, options); } @@ -63,7 +63,7 @@ export class EventGridClient { publishCloudEvents( topicName: string, events: CloudEvent[], - options: PublishCloudEventsOptions = { requestOptions: {} }, + options: PublishCloudEventsOptionalParams = { requestOptions: {} }, ): Promise> { return publishCloudEvents(this._client, topicName, events, options); } @@ -72,7 +72,7 @@ export class EventGridClient { receiveCloudEvents( topicName: string, eventSubscriptionName: string, - options: ReceiveCloudEventsOptions = { requestOptions: {} }, + options: ReceiveCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { return receiveCloudEvents( this._client, @@ -87,7 +87,7 @@ export class EventGridClient { topicName: string, eventSubscriptionName: string, lockTokens: AcknowledgeOptions, - options: AcknowledgeCloudEventsOptions = { requestOptions: {} }, + options: AcknowledgeCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { return acknowledgeCloudEvents( this._client, @@ -103,7 +103,7 @@ export class EventGridClient { topicName: string, eventSubscriptionName: string, lockTokens: ReleaseOptions, - options: ReleaseCloudEventsOptions = { requestOptions: {} }, + options: ReleaseCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { return releaseCloudEvents( this._client, @@ -119,7 +119,7 @@ export class EventGridClient { topicName: string, eventSubscriptionName: string, lockTokens: RejectOptions, - options: RejectCloudEventsOptions = { requestOptions: {} }, + options: RejectCloudEventsOptionalParams = { requestOptions: {} }, ): Promise { return rejectCloudEvents( this._client, diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts index 26fa3b15f5..6b9afe32e8 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { EventGridClient, EventGridClientOptions } from "./EventGridClient.js"; +export { EventGridClient, EventGridClientOptions } from "./eventGridClient.js"; export { CloudEvent, ReceiveResult, @@ -14,10 +14,11 @@ export { ReleaseResult, RejectOptions, RejectResult, - PublishCloudEventOptions, - PublishCloudEventsOptions, - ReceiveCloudEventsOptions, - AcknowledgeCloudEventsOptions, - ReleaseCloudEventsOptions, - RejectCloudEventsOptions, + ServiceApiVersions, + PublishCloudEventOptionalParams, + PublishCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + RejectCloudEventsOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/index.ts index df8ef8378d..42e3eae037 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/index.ts @@ -13,12 +13,13 @@ export { ReleaseResult, RejectOptions, RejectResult, + ServiceApiVersions, } from "./models.js"; export { - PublishCloudEventOptions, - PublishCloudEventsOptions, - ReceiveCloudEventsOptions, - AcknowledgeCloudEventsOptions, - ReleaseCloudEventsOptions, - RejectCloudEventsOptions, + PublishCloudEventOptionalParams, + PublishCloudEventsOptionalParams, + ReceiveCloudEventsOptionalParams, + AcknowledgeCloudEventsOptionalParams, + ReleaseCloudEventsOptionalParams, + RejectCloudEventsOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts index c8ea7725e9..8eb8df8a51 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/models.ts @@ -98,3 +98,6 @@ export interface RejectResult { /** Array of lock tokens values for the successfully rejected cloud events. */ succeededLockTokens: string[]; } + +/** */ +export type ServiceApiVersions = "2023-06-01-preview"; diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/options.ts index d6dcab0c5b..ac8bfff5f9 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/models/options.ts @@ -3,34 +3,34 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface PublishCloudEventOptions extends OperationOptions { +export interface PublishCloudEventOptionalParams extends OperationOptions { /** content type */ contentType?: string; } -export interface PublishCloudEventsOptions extends OperationOptions { +export interface PublishCloudEventsOptionalParams extends OperationOptions { /** content type */ contentType?: string; } -export interface ReceiveCloudEventsOptions extends OperationOptions { +export interface ReceiveCloudEventsOptionalParams extends OperationOptions { /** Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1. */ maxEvents?: number; /** Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. */ maxWaitTime?: number; } -export interface AcknowledgeCloudEventsOptions extends OperationOptions { +export interface AcknowledgeCloudEventsOptionalParams extends OperationOptions { /** content type */ contentType?: string; } -export interface ReleaseCloudEventsOptions extends OperationOptions { +export interface ReleaseCloudEventsOptionalParams extends OperationOptions { /** content type */ contentType?: string; } -export interface RejectCloudEventsOptions extends OperationOptions { +export interface RejectCloudEventsOptionalParams extends OperationOptions { /** content type */ contentType?: string; } diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/rest/outputModels.ts index 490a0aa432..8598db5f57 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/rest/outputModels.ts @@ -47,12 +47,6 @@ export interface BrokerPropertiesOutput { deliveryCount: number; } -/** Array of lock token strings for the corresponding received Cloud Events to be acknowledged. */ -export interface AcknowledgeOptionsOutput { - /** String array of lock tokens. */ - lockTokens: string[]; -} - /** The result of the Acknowledge operation. */ export interface AcknowledgeResultOutput { /** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */ @@ -71,12 +65,6 @@ export interface FailedLockTokenOutput { errorDescription: string; } -/** Array of lock token strings for the corresponding received Cloud Events to be released. */ -export interface ReleaseOptionsOutput { - /** String array of lock tokens. */ - lockTokens: string[]; -} - /** The result of the Release operation. */ export interface ReleaseResultOutput { /** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */ @@ -85,12 +73,6 @@ export interface ReleaseResultOutput { succeededLockTokens: string[]; } -/** Array of lock token strings for the corresponding received Cloud Events to be rejected. */ -export interface RejectOptionsOutput { - /** String array of lock tokens. */ - lockTokens: string[]; -} - /** The result of the Reject operation. */ export interface RejectResultOutput { /** Array of LockToken values for failed cloud events. Each LockToken includes the lock token value along with the related error information (namely, the error code and description). */ diff --git a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/package.json b/packages/typespec-test/test/faceai/generated/typespec-ts/package.json index 5c65852290..27a33dbbc3 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md b/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md index d28bc263d8..bb08ebb9d7 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/review/ai-face-rest.api.md @@ -19,10 +19,6 @@ import { RawHttpHeaders } from '@azure/core-rest-pipeline'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; -// @public -export interface ApiVersionPathParameterOutput { -} - // @public function createClient(endpointParam: string, credentials: KeyCredential, options?: ClientOptions): FaceClient; export default createClient; @@ -458,10 +454,6 @@ export interface ListLivenessWithVerifySessionsQueryParamProperties { top?: number; } -// @public -export interface ListRequestOptionsOutput { -} - // @public export interface LivenessSessionAuditEntryOutput { clientRequestId: string; @@ -508,7 +500,7 @@ export interface LivenessSessionOutput { result?: LivenessSessionAuditEntryOutput; sessionExpired: boolean; sessionStartDateTime?: string; - status: string; + status: SessionStatusOutput; } // @public @@ -539,7 +531,7 @@ export interface LivenessWithVerifySessionOutput { result?: LivenessWithVerifySessionAuditEntryOutput; sessionExpired: boolean; sessionStartDateTime?: string; - status: string; + status: SessionStatusOutput; } // @public (undocumented) @@ -568,6 +560,9 @@ export interface SessionAuditEntryResponseInfoOutput { statusCode: number; } +// @public +export type SessionStatusOutput = "NotStarted" | "Started" | "ResultAvailable"; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/faceai/generated/typespec-ts/src/outputModels.ts index 04f35217e7..9bf5d0b35f 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/src/outputModels.ts @@ -9,12 +9,6 @@ export interface LivenessSessionCreationResultOutput { authToken: string; } -/** The ApiVersion path parameter. */ -export interface ApiVersionPathParameterOutput {} - -/** The request for list resources. */ -export interface ListRequestOptionsOutput {} - /** Session result of detect liveness. */ export interface LivenessSessionOutput { /** Device Correlation Id to use for linking multiple sessions together. */ @@ -31,12 +25,8 @@ export interface LivenessSessionOutput { sessionStartDateTime?: string; /** Whether or not the session is expired. */ sessionExpired: boolean; - /** - * The session status. - * - * Possible values: "NotStarted", "Started", "ResultAvailable" - */ - status: string; + /** The session status. */ + status: SessionStatusOutput; /** The last result of session. */ result?: LivenessSessionAuditEntryOutput; } @@ -119,12 +109,8 @@ export interface LivenessWithVerifySessionOutput { sessionStartDateTime?: string; /** Whether or not the session is expired. */ sessionExpired: boolean; - /** - * The session status. - * - * Possible values: "NotStarted", "Started", "ResultAvailable" - */ - status: string; + /** The session status. */ + status: SessionStatusOutput; /** The last result of session. */ result?: LivenessWithVerifySessionAuditEntryOutput; } @@ -148,3 +134,6 @@ export interface LivenessWithVerifySessionAuditEntryOutput { /** The digest of the request body. */ digest: string; } + +/** Session status. */ +export type SessionStatusOutput = "NotStarted" | "Started" | "ResultAvailable"; diff --git a/packages/typespec-test/test/faceai/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/faceai/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/faceai/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/faceai/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/package.json b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/package.json index 6f36554a5a..efa2eff74e 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -55,8 +55,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md index 88bb942053..729f9c6d05 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/review/health-insights-radiologyinsights.api.md @@ -48,6 +48,9 @@ export type AzureHealthInsightsClient = Client & { path: Routes; }; +// @public +export type ClinicalDocumentType = "consultation" | "dischargeSummary" | "historyAndPhysical" | "radiologyReport" | "procedure" | "progress" | "laboratory" | "pathologyReport"; + // @public export interface CodeableConcept extends Element { coding?: Array; @@ -172,8 +175,8 @@ export interface ContactDetailOutput extends ElementOutput { export interface ContactPoint { period?: Period; rank?: number; - system?: string; - use?: string; + system?: ContactPointSystem; + use?: ContactPointUse; value?: string; } @@ -181,11 +184,23 @@ export interface ContactPoint { export interface ContactPointOutput { period?: PeriodOutput; rank?: number; - system?: string; - use?: string; + system?: ContactPointSystemOutput; + use?: ContactPointUseOutput; value?: string; } +// @public +export type ContactPointSystem = "phone" | "fax" | "email" | "pager" | "url" | "sms" | "other"; + +// @public +export type ContactPointSystemOutput = "phone" | "fax" | "email" | "pager" | "url" | "sms" | "other"; + +// @public +export type ContactPointUse = "home" | "work" | "temp" | "old" | "mobile"; + +// @public +export type ContactPointUseOutput = "home" | "work" | "temp" | "old" | "mobile"; + // @public function createClient(endpointParam: string, credentials: KeyCredential, options?: ClientOptions): AzureHealthInsightsClient; export default createClient; @@ -286,35 +301,23 @@ export interface DocumentAdministrativeMetadata { orderedProcedures?: Array; } -// @public -export interface DocumentAdministrativeMetadataOutput { - encounterId?: string; - orderedProcedures?: Array; -} - // @public export interface DocumentAuthor { fullName?: string; id?: string; } -// @public -export interface DocumentAuthorOutput { - fullName?: string; - id?: string; -} - // @public export interface DocumentContent { - sourceType: string; + sourceType: DocumentContentSourceType; value: string; } // @public -export interface DocumentContentOutput { - sourceType: string; - value: string; -} +export type DocumentContentSourceType = "inline" | "reference"; + +// @public +export type DocumentType = "note" | "fhirBundle" | "dicom" | "genomicSequencing"; // @public export type DomainResource = DomainResourceParent | Observation | Condition | ResearchStudy; @@ -356,17 +359,13 @@ export interface ElementOutput { // @public export interface Encounter { - class?: string; + class?: EncounterClass; id: string; period?: TimePeriod; } // @public -export interface EncounterOutput { - class?: string; - id: string; - period?: TimePeriodOutput; -} +export type EncounterClass = "inpatient" | "ambulatory" | "observation" | "emergency" | "virtual" | "healthHome"; // @public export interface Extendible { @@ -429,16 +428,11 @@ export interface FindingOptions { provideFocusedSentenceEvidence?: boolean; } -// @public -export interface FindingOptionsOutput { - provideFocusedSentenceEvidence?: boolean; -} - // @public export interface FollowupCommunicationInference extends RadiologyInsightsInferenceParent { dateTime?: Date[] | string[]; kind: "followupCommunication"; - recipient?: string[]; + recipient?: MedicalProfessionalType[]; wasAcknowledged: boolean; } @@ -446,7 +440,7 @@ export interface FollowupCommunicationInference extends RadiologyInsightsInferen export interface FollowupCommunicationInferenceOutput extends RadiologyInsightsInferenceOutputParent { dateTime?: string[]; kind: "followupCommunication"; - recipient?: string[]; + recipient?: MedicalProfessionalTypeOutput[]; wasAcknowledged: boolean; } @@ -483,13 +477,6 @@ export interface FollowupRecommendationOptions { provideFocusedSentenceEvidence?: boolean; } -// @public -export interface FollowupRecommendationOptionsOutput { - includeRecommendationsInReferences?: boolean; - includeRecommendationsWithNoSpecifiedModality?: boolean; - provideFocusedSentenceEvidence?: boolean; -} - // @public export interface GenericProcedureRecommendation extends ProcedureRecommendationParent { code: CodeableConcept; @@ -552,7 +539,7 @@ export interface HealthInsightsOperationStatusOutput { readonly expirationDateTime?: string; readonly id: string; readonly lastUpdateDateTime?: string; - readonly status: string; + readonly status: JobStatusOutput; } // @public @@ -613,20 +600,29 @@ export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse // @public (undocumented) export function isUnexpected(response: CreateJob202Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse; +// @public +export type JobStatusOutput = "notStarted" | "running" | "succeeded" | "failed" | "canceled"; + // @public export interface LateralityDiscrepancyInference extends RadiologyInsightsInferenceParent { - discrepancyType: string; + discrepancyType: LateralityDiscrepancyType; kind: "lateralityDiscrepancy"; lateralityIndication?: CodeableConcept; } // @public export interface LateralityDiscrepancyInferenceOutput extends RadiologyInsightsInferenceOutputParent { - discrepancyType: string; + discrepancyType: LateralityDiscrepancyTypeOutput; kind: "lateralityDiscrepancy"; lateralityIndication?: CodeableConceptOutput; } +// @public +export type LateralityDiscrepancyType = "orderLateralityMismatch" | "textLateralityContradiction" | "textLateralityMissing"; + +// @public +export type LateralityDiscrepancyTypeOutput = "orderLateralityMismatch" | "textLateralityContradiction" | "textLateralityMissing"; + // @public export interface LimitedOrderDiscrepancyInference extends RadiologyInsightsInferenceParent { kind: "limitedOrderDiscrepancy"; @@ -643,6 +639,12 @@ export interface LimitedOrderDiscrepancyInferenceOutput extends RadiologyInsight presentBodyParts?: Array; } +// @public +export type MedicalProfessionalType = "unknown" | "doctor" | "nurse" | "midwife" | "physicianAssistant"; + +// @public +export type MedicalProfessionalTypeOutput = "unknown" | "doctor" | "nurse" | "midwife" | "physicianAssistant"; + // @public export interface Meta { lastUpdated?: string; @@ -695,7 +697,7 @@ export interface Observation extends DomainResourceParent { note?: Array; referenceRange?: Array; resourceType: "Observation"; - status: string; + status: ObservationStatusCodeType; subject?: Reference; valueBoolean?: boolean; valueCodeableConcept?: CodeableConcept; @@ -770,7 +772,7 @@ export interface ObservationOutput extends DomainResourceOutputParent { note?: Array; referenceRange?: Array; resourceType: "Observation"; - status: string; + status: ObservationStatusCodeTypeOutput; subject?: ReferenceOutput; valueBoolean?: boolean; valueCodeableConcept?: CodeableConceptOutput; @@ -805,6 +807,12 @@ export interface ObservationReferenceRangeOutput { type?: CodeableConceptOutput; } +// @public +export type ObservationStatusCodeType = "registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"; + +// @public +export type ObservationStatusCodeTypeOutput = "registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"; + // @public export interface OrderedProcedure extends Extendible { code?: CodeableConcept; @@ -821,41 +829,24 @@ export interface OrderedProcedureOutput extends ExtendibleOutput { export interface PatientDocument { administrativeMetadata?: DocumentAdministrativeMetadata; authors?: Array; - clinicalType?: string; + clinicalType?: ClinicalDocumentType; content: DocumentContent; createdDateTime?: Date | string; id: string; language?: string; - specialtyType?: string; - type: string; -} - -// @public -export interface PatientDocumentOutput { - administrativeMetadata?: DocumentAdministrativeMetadataOutput; - authors?: Array; - clinicalType?: string; - content: DocumentContentOutput; - createdDateTime?: string; - id: string; - language?: string; - specialtyType?: string; - type: string; + specialtyType?: SpecialtyType; + type: DocumentType; } // @public export interface PatientInfo { birthDate?: Date | string; clinicalInfo?: Array; - sex?: string; + sex?: PatientInfoSex; } // @public -export interface PatientInfoOutput { - birthDate?: string; - clinicalInfo?: Array; - sex?: string; -} +export type PatientInfoSex = "female" | "male" | "unspecified"; // @public export interface PatientRecord { @@ -865,14 +856,6 @@ export interface PatientRecord { patientDocuments?: Array; } -// @public -export interface PatientRecordOutput { - encounters?: Array; - id: string; - info?: PatientInfoOutput; - patientDocuments?: Array; -} - // @public export interface Period extends Element { end?: string; @@ -939,12 +922,6 @@ export interface RadiologyInsightsData { patients: Array; } -// @public -export interface RadiologyInsightsDataOutput { - configuration?: RadiologyInsightsModelConfigurationOutput; - patients: Array; -} - // @public export type RadiologyInsightsInference = RadiologyInsightsInferenceParent | AgeMismatchInference | SexMismatchInference | LateralityDiscrepancyInference | CompleteOrderDiscrepancyInference | LimitedOrderDiscrepancyInference | FindingInference | CriticalResultInference | RadiologyProcedureInference | FollowupRecommendationInference | FollowupCommunicationInference; @@ -954,12 +931,6 @@ export interface RadiologyInsightsInferenceOptions { followupRecommendation?: FollowupRecommendationOptions; } -// @public -export interface RadiologyInsightsInferenceOptionsOutput { - finding?: FindingOptionsOutput; - followupRecommendation?: FollowupRecommendationOptionsOutput; -} - // @public export type RadiologyInsightsInferenceOutput = RadiologyInsightsInferenceOutputParent | AgeMismatchInferenceOutput | SexMismatchInferenceOutput | LateralityDiscrepancyInferenceOutput | CompleteOrderDiscrepancyInferenceOutput | LimitedOrderDiscrepancyInferenceOutput | FindingInferenceOutput | CriticalResultInferenceOutput | RadiologyProcedureInferenceOutput | FollowupRecommendationInferenceOutput | FollowupCommunicationInferenceOutput; @@ -982,19 +953,13 @@ export interface RadiologyInsightsInferenceResultOutput { } // @public -export interface RadiologyInsightsModelConfiguration { - includeEvidence?: boolean; - inferenceOptions?: RadiologyInsightsInferenceOptions; - inferenceTypes?: string[]; - locale?: string; - verbose?: boolean; -} +export type RadiologyInsightsInferenceType = "ageMismatch" | "lateralityDiscrepancy" | "sexMismatch" | "completeOrderDiscrepancy" | "limitedOrderDiscrepancy" | "finding" | "criticalResult" | "followupRecommendation" | "followupCommunication" | "radiologyProcedure"; // @public -export interface RadiologyInsightsModelConfigurationOutput { +export interface RadiologyInsightsModelConfiguration { includeEvidence?: boolean; - inferenceOptions?: RadiologyInsightsInferenceOptionsOutput; - inferenceTypes?: string[]; + inferenceOptions?: RadiologyInsightsInferenceOptions; + inferenceTypes?: RadiologyInsightsInferenceType[]; locale?: string; verbose?: boolean; } @@ -1013,7 +978,7 @@ export interface RadiologyInsightsResultOutput { readonly id: string; readonly lastUpdateDateTime?: string; result?: RadiologyInsightsInferenceResultOutput; - readonly status: string; + readonly status: JobStatusOutput; } // @public @@ -1060,16 +1025,22 @@ export interface RatioOutput extends ElementOutput { export interface RecommendationFinding extends Extendible { criticalFinding?: CriticalResult; finding?: Observation; - recommendationFindingStatus: string; + recommendationFindingStatus: RecommendationFindingStatusType; } // @public export interface RecommendationFindingOutput extends ExtendibleOutput { criticalFinding?: CriticalResultOutput; finding?: ObservationOutput; - recommendationFindingStatus: string; + recommendationFindingStatus: RecommendationFindingStatusTypeOutput; } +// @public +export type RecommendationFindingStatusType = "present" | "differential" | "ruleOut" | "conditional"; + +// @public +export type RecommendationFindingStatusTypeOutput = "present" | "differential" | "ruleOut" | "conditional"; + // @public export interface Reference extends Element { display?: string; @@ -1120,7 +1091,7 @@ export interface ResearchStudy extends DomainResourceParent { resourceType: "ResearchStudy"; site?: Array; sponsor?: Reference; - status: string; + status: ResearchStudyStatusCodeType; title?: string; } @@ -1155,10 +1126,16 @@ export interface ResearchStudyOutput extends DomainResourceOutputParent { resourceType: "ResearchStudy"; site?: Array; sponsor?: ReferenceOutput; - status: string; + status: ResearchStudyStatusCodeTypeOutput; title?: string; } +// @public +export type ResearchStudyStatusCodeType = "active" | "administratively-completed" | "approved" | "closed-to-accrual" | "closed-to-accrual-and-intervention" | "completed" | "disapproved" | "in-review" | "temporarily-closed-to-accrual" | "temporarily-closed-to-accrual-and-intervention" | "withdrawn"; + +// @public +export type ResearchStudyStatusCodeTypeOutput = "active" | "administratively-completed" | "approved" | "closed-to-accrual" | "closed-to-accrual-and-intervention" | "completed" | "disapproved" | "in-review" | "temporarily-closed-to-accrual" | "temporarily-closed-to-accrual-and-intervention" | "withdrawn"; + // @public export interface Resource extends Record { id?: string; @@ -1238,18 +1215,15 @@ export interface SimplePollerLike, TResul toString(): string; } +// @public +export type SpecialtyType = "pathology" | "radiology"; + // @public export interface TimePeriod { end?: Date | string; start?: Date | string; } -// @public -export interface TimePeriodOutput { - end?: string; - start?: string; -} - // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/samples-dev/createJobSample.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/samples-dev/createJobSample.ts index cd2bcb27f7..3b8e3ba9ba 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/samples-dev/createJobSample.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/samples-dev/createJobSample.ts @@ -719,7 +719,7 @@ async function createJobSample() { configuration: { verbose: true, includeEvidence: true, - inferenceTypes: ["{Your inferenceTypes}"], + inferenceTypes: ["ageMismatch"], inferenceOptions: { followupRecommendation: { includeRecommendationsWithNoSpecifiedModality: true, diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models.ts index a4a4ce8d97..e24c824142 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/models.ts @@ -339,20 +339,12 @@ export interface ContactDetail extends Element { * See https://www.hl7.org/fhir/R4/datatypes.html#ContactPoint */ export interface ContactPoint { - /** - * phone | fax | email | pager | url | sms | other - * - * Possible values: "phone", "fax", "email", "pager", "url", "sms", "other" - */ - system?: string; + /** phone | fax | email | pager | url | sms | other */ + system?: ContactPointSystem; /** The actual contact point details */ value?: string; - /** - * home | work | temp | old | mobile - purpose of this contact point - * - * Possible values: "home", "work", "temp", "old", "mobile" - */ - use?: string; + /** home | work | temp | old | mobile - purpose of this contact point */ + use?: ContactPointUse; /** Specify preferred order of use (1 = highest) */ rank?: number; /** Time period when the contact point was/is in use */ @@ -373,12 +365,8 @@ export interface RecommendationFinding extends Extendible { finding?: Observation; /** critical finding inference */ criticalFinding?: CriticalResult; - /** - * recommendation finding status - * - * Possible values: "present", "differential", "ruleOut", "conditional" - */ - recommendationFindingStatus: string; + /** recommendation finding status */ + recommendationFindingStatus: RecommendationFindingStatusType; } /** @@ -390,12 +378,8 @@ export interface Observation extends DomainResourceParent { resourceType: "Observation"; /** Business Identifier for observation */ identifier?: Array; - /** - * registered | preliminary | final | amended + - * - * Possible values: "registered", "preliminary", "final", "amended", "corrected", "cancelled", "entered-in-error", "unknown" - */ - status: string; + /** registered | preliminary | final | amended + */ + status: ObservationStatusCodeType; /** Classification of type of observation */ category?: Array; /** Type of observation (code / type) */ @@ -583,12 +567,8 @@ export interface ResearchStudy extends DomainResourceParent { protocol?: Array; /** Part of larger study */ partOf?: Array; - /** - * active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn - * - * Possible values: "active", "administratively-completed", "approved", "closed-to-accrual", "closed-to-accrual-and-intervention", "completed", "disapproved", "in-review", "temporarily-closed-to-accrual", "temporarily-closed-to-accrual-and-intervention", "withdrawn" - */ - status: string; + /** active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn */ + status: ResearchStudyStatusCodeType; /** treatment | prevention | diagnostic | supportive-care | screening | health-services-research | basic-science | device-feasibility */ primaryPurposeType?: CodeableConcept; /** n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4 */ @@ -665,12 +645,8 @@ export interface LateralityDiscrepancyInference kind: "lateralityDiscrepancy"; /** laterality indication */ lateralityIndication?: CodeableConcept; - /** - * mismatch type - * - * Possible values: "orderLateralityMismatch", "textLateralityContradiction", "textLateralityMissing" - */ - discrepancyType: string; + /** mismatch type */ + discrepancyType: LateralityDiscrepancyType; } /** @@ -833,7 +809,7 @@ export interface FollowupCommunicationInference /** The communication date/time. */ dateTime?: Date[] | string[]; /** The recipient of the communication. */ - recipient?: string[]; + recipient?: MedicalProfessionalType[]; /** Communication was acknowledged */ wasAcknowledged: boolean; } @@ -860,12 +836,8 @@ export interface PatientRecord { /** Patient structured information, including demographics and known structured clinical information. */ export interface PatientInfo { - /** - * The patient's sex. - * - * Possible values: "female", "male", "unspecified" - */ - sex?: string; + /** The patient's sex. */ + sex?: PatientInfoSex; /** The patient's date of birth. */ birthDate?: Date | string; /** Known clinical information for the patient, structured. */ @@ -881,12 +853,8 @@ export interface Encounter { * In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to indicate the discharge time. */ period?: TimePeriod; - /** - * The class of the encounter. - * - * Possible values: "inpatient", "ambulatory", "observation", "emergency", "virtual", "healthHome" - */ - class?: string; + /** The class of the encounter. */ + class?: EncounterClass; } /** A duration of time during which an event is happening */ @@ -899,18 +867,10 @@ export interface TimePeriod { /** A clinical document related to a patient. Document here is in the wide sense - not just a text document (note). */ export interface PatientDocument { - /** - * The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). - * - * Possible values: "note", "fhirBundle", "dicom", "genomicSequencing" - */ - type: string; - /** - * The type of the clinical document. - * - * Possible values: "consultation", "dischargeSummary", "historyAndPhysical", "radiologyReport", "procedure", "progress", "laboratory", "pathologyReport" - */ - clinicalType?: string; + /** The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). */ + type: DocumentType; + /** The type of the clinical document. */ + clinicalType?: ClinicalDocumentType; /** A given identifier for the document. Has to be unique across all documents for a single patient. */ id: string; /** A 2 letter ISO 639-1 representation of the language of the document. */ @@ -919,12 +879,8 @@ export interface PatientDocument { createdDateTime?: Date | string; /** Document author(s) */ authors?: Array; - /** - * specialty type the document - * - * Possible values: "pathology", "radiology" - */ - specialtyType?: string; + /** specialty type the document */ + specialtyType?: SpecialtyType; /** Administrative metadata for the document. */ administrativeMetadata?: DocumentAdministrativeMetadata; /** The content of the patient document. */ @@ -953,10 +909,8 @@ export interface DocumentContent { * The type of the content's source. * In case the source type is 'inline', the content is given as a string (for instance, text). * In case the source type is 'reference', the content is given as a URI. - * - * Possible values: "inline", "reference" */ - sourceType: string; + sourceType: DocumentContentSourceType; /** The content of the document, given either inline (as a string) or as a reference (URI). */ value: string; } @@ -972,7 +926,7 @@ export interface RadiologyInsightsModelConfiguration { * This could be used if only part of the Radiology Insights inferences are required. * If this list is omitted or empty, the model will return all the inference types. */ - inferenceTypes?: string[]; + inferenceTypes?: RadiologyInsightsInferenceType[]; /** The options for the Radiology Insights Inferences */ inferenceOptions?: RadiologyInsightsInferenceOptions; /** Local for the model to use. If not specified, the model will use the default locale */ @@ -1042,3 +996,110 @@ export type ProcedureRecommendation = | ProcedureRecommendationParent | GenericProcedureRecommendation | ImagingProcedureRecommendation; +/** + * Contact Point System + * see https://www.hl7.org/fhir/R4/valueset-contact-point-system.html + */ +export type ContactPointSystem = + | "phone" + | "fax" + | "email" + | "pager" + | "url" + | "sms" + | "other"; +/** + * Contact Point Use + * See: http://hl7.org/fhir/ValueSet/contact-point-use + */ +export type ContactPointUse = "home" | "work" | "temp" | "old" | "mobile"; +/** + * Observation Status + * Based on [FHIR ObservationStatus](https://www.hl7.org/fhir/R4/valueset-observation-status.html) + */ +export type ObservationStatusCodeType = + | "registered" + | "preliminary" + | "final" + | "amended" + | "corrected" + | "cancelled" + | "entered-in-error" + | "unknown"; +/** https://www.hl7.org/fhir/R4/codesystem-research-study-status.html */ +export type ResearchStudyStatusCodeType = + | "active" + | "administratively-completed" + | "approved" + | "closed-to-accrual" + | "closed-to-accrual-and-intervention" + | "completed" + | "disapproved" + | "in-review" + | "temporarily-closed-to-accrual" + | "temporarily-closed-to-accrual-and-intervention" + | "withdrawn"; +/** Recommendation finding status */ +export type RecommendationFindingStatusType = + | "present" + | "differential" + | "ruleOut" + | "conditional"; +/** Laterality discrepancy type */ +export type LateralityDiscrepancyType = + | "orderLateralityMismatch" + | "textLateralityContradiction" + | "textLateralityMissing"; +/** Medical Professional Type */ +export type MedicalProfessionalType = + | "unknown" + | "doctor" + | "nurse" + | "midwife" + | "physicianAssistant"; +/** The patient's sex. */ +export type PatientInfoSex = "female" | "male" | "unspecified"; +/** Known values codes that can be used to indicate the class of encounter (TODO://Based on FHIR value set--http://....). */ +export type EncounterClass = + | "inpatient" + | "ambulatory" + | "observation" + | "emergency" + | "virtual" + | "healthHome"; +/** The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). */ +export type DocumentType = + | "note" + | "fhirBundle" + | "dicom" + | "genomicSequencing"; +/** The type of the clinical document. */ +export type ClinicalDocumentType = + | "consultation" + | "dischargeSummary" + | "historyAndPhysical" + | "radiologyReport" + | "procedure" + | "progress" + | "laboratory" + | "pathologyReport"; +/** Known values codes that can be used to indicate the type of the Specialty. */ +export type SpecialtyType = "pathology" | "radiology"; +/** + * The type of the content's source. + * In case the source type is 'inline', the content is given as a string (for instance, text). + * In case the source type is 'reference', the content is given as a URI. + */ +export type DocumentContentSourceType = "inline" | "reference"; +/** A Radiology Insights inference types. */ +export type RadiologyInsightsInferenceType = + | "ageMismatch" + | "lateralityDiscrepancy" + | "sexMismatch" + | "completeOrderDiscrepancy" + | "limitedOrderDiscrepancy" + | "finding" + | "criticalResult" + | "followupRecommendation" + | "followupCommunication" + | "radiologyProcedure"; diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/outputModels.ts index afa06345e7..c1c365ab3c 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/src/outputModels.ts @@ -7,12 +7,8 @@ import { ErrorModel } from "@azure-rest/core-client"; export interface RadiologyInsightsResultOutput { /** The unique ID of the operation. */ readonly id: string; - /** - * The status of the operation - * - * Possible values: "notStarted", "running", "succeeded", "failed", "canceled" - */ - readonly status: string; + /** The status of the operation */ + readonly status: JobStatusOutput; /** The date and time when the processing job was created. */ readonly createdDateTime?: string; /** The date and time when the processing job is set to expire. */ @@ -380,20 +376,12 @@ export interface ContactDetailOutput extends ElementOutput { * See https://www.hl7.org/fhir/R4/datatypes.html#ContactPoint */ export interface ContactPointOutput { - /** - * phone | fax | email | pager | url | sms | other - * - * Possible values: "phone", "fax", "email", "pager", "url", "sms", "other" - */ - system?: string; + /** phone | fax | email | pager | url | sms | other */ + system?: ContactPointSystemOutput; /** The actual contact point details */ value?: string; - /** - * home | work | temp | old | mobile - purpose of this contact point - * - * Possible values: "home", "work", "temp", "old", "mobile" - */ - use?: string; + /** home | work | temp | old | mobile - purpose of this contact point */ + use?: ContactPointUseOutput; /** Specify preferred order of use (1 = highest) */ rank?: number; /** Time period when the contact point was/is in use */ @@ -414,12 +402,8 @@ export interface RecommendationFindingOutput extends ExtendibleOutput { finding?: ObservationOutput; /** critical finding inference */ criticalFinding?: CriticalResultOutput; - /** - * recommendation finding status - * - * Possible values: "present", "differential", "ruleOut", "conditional" - */ - recommendationFindingStatus: string; + /** recommendation finding status */ + recommendationFindingStatus: RecommendationFindingStatusTypeOutput; } /** @@ -431,12 +415,8 @@ export interface ObservationOutput extends DomainResourceOutputParent { resourceType: "Observation"; /** Business Identifier for observation */ identifier?: Array; - /** - * registered | preliminary | final | amended + - * - * Possible values: "registered", "preliminary", "final", "amended", "corrected", "cancelled", "entered-in-error", "unknown" - */ - status: string; + /** registered | preliminary | final | amended + */ + status: ObservationStatusCodeTypeOutput; /** Classification of type of observation */ category?: Array; /** Type of observation (code / type) */ @@ -624,12 +604,8 @@ export interface ResearchStudyOutput extends DomainResourceOutputParent { protocol?: Array; /** Part of larger study */ partOf?: Array; - /** - * active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn - * - * Possible values: "active", "administratively-completed", "approved", "closed-to-accrual", "closed-to-accrual-and-intervention", "completed", "disapproved", "in-review", "temporarily-closed-to-accrual", "temporarily-closed-to-accrual-and-intervention", "withdrawn" - */ - status: string; + /** active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn */ + status: ResearchStudyStatusCodeTypeOutput; /** treatment | prevention | diagnostic | supportive-care | screening | health-services-research | basic-science | device-feasibility */ primaryPurposeType?: CodeableConceptOutput; /** n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4 */ @@ -708,12 +684,8 @@ export interface LateralityDiscrepancyInferenceOutput kind: "lateralityDiscrepancy"; /** laterality indication */ lateralityIndication?: CodeableConceptOutput; - /** - * mismatch type - * - * Possible values: "orderLateralityMismatch", "textLateralityContradiction", "textLateralityMissing" - */ - discrepancyType: string; + /** mismatch type */ + discrepancyType: LateralityDiscrepancyTypeOutput; } /** @@ -877,186 +849,17 @@ export interface FollowupCommunicationInferenceOutput /** The communication date/time. */ dateTime?: string[]; /** The recipient of the communication. */ - recipient?: string[]; + recipient?: MedicalProfessionalTypeOutput[]; /** Communication was acknowledged */ wasAcknowledged: boolean; } -/** The body of the Radiology Insights request. */ -export interface RadiologyInsightsDataOutput { - /** The list of patients, including their clinical information and data. */ - patients: Array; - /** Configuration affecting the Radiology Insights model's inference. */ - configuration?: RadiologyInsightsModelConfigurationOutput; -} - -/** A patient record, including their clinical information and data. */ -export interface PatientRecordOutput { - /** A given identifier for the patient. Has to be unique across all patients in a single request. */ - id: string; - /** Patient structured information, including demographics and known structured clinical information. */ - info?: PatientInfoOutput; - /** Patient encounters/visits. */ - encounters?: Array; - /** Patient unstructured clinical data, given as documents. */ - patientDocuments?: Array; -} - -/** Patient structured information, including demographics and known structured clinical information. */ -export interface PatientInfoOutput { - /** - * The patient's sex. - * - * Possible values: "female", "male", "unspecified" - */ - sex?: string; - /** The patient's date of birth. */ - birthDate?: string; - /** Known clinical information for the patient, structured. */ - clinicalInfo?: Array; -} - -/** visit/encounter information */ -export interface EncounterOutput { - /** The id of the visit. */ - id: string; - /** - * Time period of the visit. - * In case of admission, use timePeriod.start to indicate the admission time and timePeriod.end to indicate the discharge time. - */ - period?: TimePeriodOutput; - /** - * The class of the encounter. - * - * Possible values: "inpatient", "ambulatory", "observation", "emergency", "virtual", "healthHome" - */ - class?: string; -} - -/** A duration of time during which an event is happening */ -export interface TimePeriodOutput { - /** Starting time with inclusive boundary */ - start?: string; - /** End time with inclusive boundary, if not ongoing */ - end?: string; -} - -/** A clinical document related to a patient. Document here is in the wide sense - not just a text document (note). */ -export interface PatientDocumentOutput { - /** - * The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). - * - * Possible values: "note", "fhirBundle", "dicom", "genomicSequencing" - */ - type: string; - /** - * The type of the clinical document. - * - * Possible values: "consultation", "dischargeSummary", "historyAndPhysical", "radiologyReport", "procedure", "progress", "laboratory", "pathologyReport" - */ - clinicalType?: string; - /** A given identifier for the document. Has to be unique across all documents for a single patient. */ - id: string; - /** A 2 letter ISO 639-1 representation of the language of the document. */ - language?: string; - /** The date and time when the document was created. */ - createdDateTime?: string; - /** Document author(s) */ - authors?: Array; - /** - * specialty type the document - * - * Possible values: "pathology", "radiology" - */ - specialtyType?: string; - /** Administrative metadata for the document. */ - administrativeMetadata?: DocumentAdministrativeMetadataOutput; - /** The content of the patient document. */ - content: DocumentContentOutput; -} - -/** Document author */ -export interface DocumentAuthorOutput { - /** author id */ - id?: string; - /** Text representation of the full name */ - fullName?: string; -} - -/** Document administrative metadata */ -export interface DocumentAdministrativeMetadataOutput { - /** List of procedure information associated with the document. */ - orderedProcedures?: Array; - /** Reference to the encounter associated with the document. */ - encounterId?: string; -} - -/** The content of the patient document. */ -export interface DocumentContentOutput { - /** - * The type of the content's source. - * In case the source type is 'inline', the content is given as a string (for instance, text). - * In case the source type is 'reference', the content is given as a URI. - * - * Possible values: "inline", "reference" - */ - sourceType: string; - /** The content of the document, given either inline (as a string) or as a reference (URI). */ - value: string; -} - -/** Configuration affecting the Radiology Insights model's inference. */ -export interface RadiologyInsightsModelConfigurationOutput { - /** An indication whether the model should produce verbose output. */ - verbose?: boolean; - /** An indication whether the model's output should include evidence for the inferences. */ - includeEvidence?: boolean; - /** - * A list of inference types to be inferred for the current request. - * This could be used if only part of the Radiology Insights inferences are required. - * If this list is omitted or empty, the model will return all the inference types. - */ - inferenceTypes?: string[]; - /** The options for the Radiology Insights Inferences */ - inferenceOptions?: RadiologyInsightsInferenceOptionsOutput; - /** Local for the model to use. If not specified, the model will use the default locale */ - locale?: string; -} - -/** The options for the Radiology Insights Inferences */ -export interface RadiologyInsightsInferenceOptionsOutput { - /** Followup Recommendation Options */ - followupRecommendation?: FollowupRecommendationOptionsOutput; - /** Finding Options */ - finding?: FindingOptionsOutput; -} - -/** Followup Recommendation Options */ -export interface FollowupRecommendationOptionsOutput { - /** Include/Exclude followup recommendations with no specific radiologic modality, default is false. */ - includeRecommendationsWithNoSpecifiedModality?: boolean; - /** Include/Exclude followup recommendations in references to a guideline or article, default is false. */ - includeRecommendationsInReferences?: boolean; - /** Provide a single focused sentence as evidence for the recommendation, default is false. */ - provideFocusedSentenceEvidence?: boolean; -} - -/** Finding Options */ -export interface FindingOptionsOutput { - /** Provide a single focused sentence as evidence for the finding, default is false. */ - provideFocusedSentenceEvidence?: boolean; -} - /** Provides status details for long running operations. */ export interface HealthInsightsOperationStatusOutput { /** The unique ID of the operation. */ readonly id: string; - /** - * The status of the operation - * - * Possible values: "notStarted", "running", "succeeded", "failed", "canceled" - */ - readonly status: string; + /** The status of the operation */ + readonly status: JobStatusOutput; /** The date and time when the processing job was created. */ readonly createdDateTime?: string; /** The date and time when the processing job is set to expire. */ @@ -1106,5 +909,73 @@ export type ProcedureRecommendationOutput = | ProcedureRecommendationOutputParent | GenericProcedureRecommendationOutput | ImagingProcedureRecommendationOutput; +/** The status of the processing job. */ +export type JobStatusOutput = + | "notStarted" + | "running" + | "succeeded" + | "failed" + | "canceled"; +/** + * Contact Point System + * see https://www.hl7.org/fhir/R4/valueset-contact-point-system.html + */ +export type ContactPointSystemOutput = + | "phone" + | "fax" + | "email" + | "pager" + | "url" + | "sms" + | "other"; +/** + * Contact Point Use + * See: http://hl7.org/fhir/ValueSet/contact-point-use + */ +export type ContactPointUseOutput = "home" | "work" | "temp" | "old" | "mobile"; +/** + * Observation Status + * Based on [FHIR ObservationStatus](https://www.hl7.org/fhir/R4/valueset-observation-status.html) + */ +export type ObservationStatusCodeTypeOutput = + | "registered" + | "preliminary" + | "final" + | "amended" + | "corrected" + | "cancelled" + | "entered-in-error" + | "unknown"; +/** https://www.hl7.org/fhir/R4/codesystem-research-study-status.html */ +export type ResearchStudyStatusCodeTypeOutput = + | "active" + | "administratively-completed" + | "approved" + | "closed-to-accrual" + | "closed-to-accrual-and-intervention" + | "completed" + | "disapproved" + | "in-review" + | "temporarily-closed-to-accrual" + | "temporarily-closed-to-accrual-and-intervention" + | "withdrawn"; +/** Recommendation finding status */ +export type RecommendationFindingStatusTypeOutput = + | "present" + | "differential" + | "ruleOut" + | "conditional"; +/** Laterality discrepancy type */ +export type LateralityDiscrepancyTypeOutput = + | "orderLateralityMismatch" + | "textLateralityContradiction" + | "textLateralityMissing"; +/** Medical Professional Type */ +export type MedicalProfessionalTypeOutput = + | "unknown" + | "doctor" + | "nurse" + | "midwife" + | "physicianAssistant"; /** Alias for RepeatabilityResultOutput */ export type RepeatabilityResultOutput = "accepted" | "rejected"; diff --git a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/healthInsights_radiologyinsights/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/package.json b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/package.json index 48c43cd362..2663b90291 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -55,8 +55,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/review/health-insights-clinicalmatching.api.md b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/review/health-insights-clinicalmatching.api.md index 355cf011cb..4b60e26ef1 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/review/health-insights-clinicalmatching.api.md +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/review/health-insights-clinicalmatching.api.md @@ -21,7 +21,7 @@ import { StreamableMethod } from '@azure-rest/core-client'; // @public export interface AcceptedAge { - unit: string; + unit: AgeUnit; value: number; } @@ -31,16 +31,19 @@ export interface AcceptedAgeRange { minimumAge?: AcceptedAge; } +// @public +export type AgeUnit = "years" | "months" | "days"; + // @public export interface AreaGeometry { coordinates: number[]; - type: string; + type: GeoJsonGeometryType; } // @public export interface AreaProperties { radius: number; - subType: string; + subType: GeoJsonPropertiesSubType; } // @public @@ -59,6 +62,9 @@ export interface ClinicalCodedElementOutput { value?: string; } +// @public +export type ClinicalDocumentType = "consultation" | "dischargeSummary" | "historyAndPhysical" | "procedure" | "progress" | "imaging" | "laboratory" | "pathology"; + // @public export interface ClinicalNoteEvidenceOutput { id: string; @@ -67,10 +73,13 @@ export interface ClinicalNoteEvidenceOutput { text?: string; } +// @public +export type ClinicalTrialAcceptedSex = "all" | "female" | "male"; + // @public export interface ClinicalTrialDemographics { acceptedAgeRange?: AcceptedAgeRange; - acceptedSex?: string; + acceptedSex?: ClinicalTrialAcceptedSex; } // @public @@ -86,10 +95,10 @@ export interface ClinicalTrialMetadata { conditions: string[]; contacts?: Array; facilities?: Array; - phases?: string[]; - recruitmentStatus?: string; + phases?: ClinicalTrialPhase[]; + recruitmentStatus?: ClinicalTrialRecruitmentStatus; sponsors?: string[]; - studyType?: string; + studyType?: ClinicalTrialStudyType; } // @public @@ -97,12 +106,27 @@ export interface ClinicalTrialMetadataOutput { conditions: string[]; contacts?: Array; facilities?: Array; - phases?: string[]; - recruitmentStatus?: string; + phases?: ClinicalTrialPhaseOutput[]; + recruitmentStatus?: ClinicalTrialRecruitmentStatusOutput; sponsors?: string[]; - studyType?: string; + studyType?: ClinicalTrialStudyTypeOutput; } +// @public +export type ClinicalTrialPhase = "notApplicable" | "earlyPhase1" | "phase1" | "phase2" | "phase3" | "phase4"; + +// @public +export type ClinicalTrialPhaseOutput = "notApplicable" | "earlyPhase1" | "phase1" | "phase2" | "phase3" | "phase4"; + +// @public +export type ClinicalTrialPurpose = "notApplicable" | "screening" | "diagnostic" | "prevention" | "healthServicesResearch" | "treatment" | "deviceFeasibility" | "supportiveCare" | "basicScience" | "other"; + +// @public +export type ClinicalTrialRecruitmentStatus = "unknownStatus" | "notYetRecruiting" | "recruiting" | "enrollingByInvitation"; + +// @public +export type ClinicalTrialRecruitmentStatusOutput = "unknownStatus" | "notYetRecruiting" | "recruiting" | "enrollingByInvitation"; + // @public export interface ClinicalTrialRegistryFilter { conditions?: string[]; @@ -110,12 +134,12 @@ export interface ClinicalTrialRegistryFilter { facilityLocations?: Array; facilityNames?: string[]; ids?: string[]; - phases?: string[]; - purposes?: string[]; - recruitmentStatuses?: string[]; - sources?: string[]; + phases?: ClinicalTrialPhase[]; + purposes?: ClinicalTrialPurpose[]; + recruitmentStatuses?: ClinicalTrialRecruitmentStatus[]; + sources?: ClinicalTrialSource[]; sponsors?: string[]; - studyTypes?: string[]; + studyTypes?: ClinicalTrialStudyType[]; } // @public @@ -140,6 +164,18 @@ export interface ClinicalTrials { registryFilters?: Array; } +// @public +export type ClinicalTrialSource = "custom" | "clinicaltrials.gov"; + +// @public +export type ClinicalTrialSourceOutput = "custom" | "clinicaltrials.gov"; + +// @public +export type ClinicalTrialStudyType = "interventional" | "observational" | "expandedAccess" | "patientRegistries"; + +// @public +export type ClinicalTrialStudyTypeOutput = "interventional" | "observational" | "expandedAccess" | "patientRegistries"; + // @public export interface ContactDetails { email?: string; @@ -232,10 +268,16 @@ export type CreateJobParameters = CreateJobHeaderParam & CreateJobBodyParam & Re // @public export interface DocumentContent { - sourceType: string; + sourceType: DocumentContentSourceType; value: string; } +// @public +export type DocumentContentSourceType = "inline" | "reference"; + +// @public +export type DocumentType = "note" | "fhirBundle" | "dicom" | "genomicSequencing"; + // @public export interface ExtendedClinicalCodedElementOutput { category?: string; @@ -250,7 +292,7 @@ export interface ExtendedClinicalCodedElementOutput { export interface GeographicArea { geometry: AreaGeometry; properties: AreaProperties; - type: string; + type: GeoJsonType; } // @public @@ -260,6 +302,15 @@ export interface GeographicLocation { state?: string; } +// @public +export type GeoJsonGeometryType = "Point"; + +// @public +export type GeoJsonPropertiesSubType = "Circle"; + +// @public +export type GeoJsonType = "Feature"; + // @public (undocumented) export interface GetJob { get(options?: GetJobParameters): StreamableMethod; @@ -305,23 +356,29 @@ export function isUnexpected(response: GetJob200Response | GetJobDefaultResponse // @public (undocumented) export function isUnexpected(response: CreateJob200Response | CreateJob202Response | CreateJobLogicalResponse | CreateJobDefaultResponse): response is CreateJobDefaultResponse; +// @public +export type JobStatusOutput = "notStarted" | "running" | "succeeded" | "failed" | "partiallyCompleted"; + // @public export interface PatientDocument { - clinicalType?: string; + clinicalType?: ClinicalDocumentType; content: DocumentContent; createdDateTime?: Date | string; id: string; language?: string; - type: string; + type: DocumentType; } // @public export interface PatientInfo { birthDate?: Date | string; clinicalInfo?: Array; - sex?: string; + sex?: PatientInfoSex; } +// @public +export type PatientInfoSex = "female" | "male" | "unspecified"; + // @public export interface PatientRecord { data?: Array; @@ -380,11 +437,14 @@ export interface TrialMatcherInferenceOutput { evidence?: Array; id?: string; metadata?: ClinicalTrialMetadataOutput; - source?: string; - type: string; + source?: ClinicalTrialSourceOutput; + type: TrialMatcherInferenceTypeOutput; value: string; } +// @public +export type TrialMatcherInferenceTypeOutput = "trialEligibility"; + // @public export interface TrialMatcherModelConfiguration { clinicalTrials: ClinicalTrials; @@ -407,7 +467,7 @@ export interface TrialMatcherResultOutput { readonly jobId: string; readonly lastUpdateDateTime: string; readonly results?: TrialMatcherResultsOutput; - readonly status: string; + readonly status: JobStatusOutput; } // @public diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/samples-dev/createJobSample.ts b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/samples-dev/createJobSample.ts index c2a9db6d13..9f013e92ba 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/samples-dev/createJobSample.ts +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/samples-dev/createJobSample.ts @@ -71,8 +71,8 @@ async function createJobSample() { phases: ["notApplicable"], studyType: "interventional", recruitmentStatus: "unknownStatus", - conditions: ["notApplicable"], - sponsors: ["notApplicable"], + conditions: ["{Your conditions}"], + sponsors: ["{Your sponsors}"], contacts: [ { name: "{Your name}", @@ -93,15 +93,15 @@ async function createJobSample() { ], registryFilters: [ { - conditions: ["notApplicable"], - studyTypes: ["notApplicable"], - recruitmentStatuses: ["notApplicable"], - sponsors: ["notApplicable"], + conditions: ["{Your conditions}"], + studyTypes: ["interventional"], + recruitmentStatuses: ["unknownStatus"], + sponsors: ["{Your sponsors}"], phases: ["notApplicable"], purposes: ["notApplicable"], - ids: ["notApplicable"], - sources: ["notApplicable"], - facilityNames: ["notApplicable"], + ids: ["{Your ids}"], + sources: ["custom"], + facilityNames: ["{Your facilityNames}"], facilityLocations: [ { city: "{Your city}", diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/models.ts index dce387463f..c848668b40 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/models.ts @@ -19,19 +19,11 @@ export interface ClinicalTrialMetadata { * Phases which are relevant for the clinical trial. * Each clinical trial can be in a certain phase or in multiple phases. */ - phases?: string[]; - /** - * Possible study types of a clinical trial. - * - * Possible values: "interventional", "observational", "expandedAccess", "patientRegistries" - */ - studyType?: string; - /** - * Possible recruitment status of a clinical trial. - * - * Possible values: "unknownStatus", "notYetRecruiting", "recruiting", "enrollingByInvitation" - */ - recruitmentStatus?: string; + phases?: ClinicalTrialPhase[]; + /** Possible study types of a clinical trial. */ + studyType?: ClinicalTrialStudyType; + /** Possible recruitment status of a clinical trial. */ + recruitmentStatus?: ClinicalTrialRecruitmentStatus; /** Medical conditions and their synonyms which are relevant for the clinical trial, given as strings. */ conditions: string[]; /** Sponsors/collaborators involved with the trial. */ @@ -84,12 +76,8 @@ export interface PatientRecord { /** Patient structured information, including demographics and known structured clinical information. */ export interface PatientInfo { - /** - * The patient's sex. - * - * Possible values: "female", "male", "unspecified" - */ - sex?: string; + /** The patient's sex. */ + sex?: PatientInfoSex; /** The patient's date of birth. */ birthDate?: Date | string; /** Known clinical information for the patient, structured. */ @@ -98,18 +86,10 @@ export interface PatientInfo { /** A clinical document related to a patient. Document here is in the wide sense - not just a text document (note). */ export interface PatientDocument { - /** - * The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). - * - * Possible values: "note", "fhirBundle", "dicom", "genomicSequencing" - */ - type: string; - /** - * The type of the clinical document. - * - * Possible values: "consultation", "dischargeSummary", "historyAndPhysical", "procedure", "progress", "imaging", "laboratory", "pathology" - */ - clinicalType?: string; + /** The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). */ + type: DocumentType; + /** The type of the clinical document. */ + clinicalType?: ClinicalDocumentType; /** A given identifier for the document. Has to be unique across all documents for a single patient. */ id: string; /** A 2 letter ISO 639-1 representation of the language of the document. */ @@ -126,10 +106,8 @@ export interface DocumentContent { * The type of the content's source. * In case the source type is 'inline', the content is given as a string (for instance, text). * In case the source type is 'reference', the content is given as a URI. - * - * Possible values: "inline", "reference" */ - sourceType: string; + sourceType: DocumentContentSourceType; /** The content of the document, given either inline (as a string) or as a reference (URI). */ value: string; } @@ -178,12 +156,8 @@ export interface ClinicalTrialDetails { /** Demographic criteria for a clinical trial. */ export interface ClinicalTrialDemographics { - /** - * Indication of the sex of people who may participate in the clinical trial. - * - * Possible values: "all", "female", "male" - */ - acceptedSex?: string; + /** Indication of the sex of people who may participate in the clinical trial. */ + acceptedSex?: ClinicalTrialAcceptedSex; /** A definition of the range of ages accepted by a clinical trial. Contains a minimum age and/or a maximum age. */ acceptedAgeRange?: AcceptedAgeRange; } @@ -198,12 +172,8 @@ export interface AcceptedAgeRange { /** A person's age, given as a number (value) and a unit (e.g. years, months) */ export interface AcceptedAge { - /** - * Possible units for a person's age. - * - * Possible values: "years", "months", "days" - */ - unit: string; + /** Possible units for a person's age. */ + unit: AgeUnit; /** The number of years/months/days that represents the person's age. */ value: number; } @@ -219,12 +189,12 @@ export interface ClinicalTrialRegistryFilter { * Trials with any of the given study types will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the study types. */ - studyTypes?: string[]; + studyTypes?: ClinicalTrialStudyType[]; /** * Trials with any of the given recruitment statuses will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the recruitment statuses. */ - recruitmentStatuses?: string[]; + recruitmentStatuses?: ClinicalTrialRecruitmentStatus[]; /** * Trials with any of the given sponsors will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the sponsors. @@ -234,12 +204,12 @@ export interface ClinicalTrialRegistryFilter { * Trials with any of the given phases will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the phases. */ - phases?: string[]; + phases?: ClinicalTrialPhase[]; /** * Trials with any of the given purposes will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the purposes. */ - purposes?: string[]; + purposes?: ClinicalTrialPurpose[]; /** * Trials with any of the given identifiers will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the trial identifiers. @@ -249,7 +219,7 @@ export interface ClinicalTrialRegistryFilter { * Trials with any of the given sources will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the sources. */ - sources?: string[]; + sources?: ClinicalTrialSource[]; /** * Trials with any of the given facility names will be included in the selection (provided that other limitations are satisfied). * Leaving this list empty will not limit the trial facility names. @@ -283,12 +253,8 @@ export interface GeographicLocation { /** A geographic area, expressed as a `Circle` geometry represented using a `GeoJSON Feature` (see [GeoJSON spec](https://tools.ietf.org/html/rfc7946)). */ export interface GeographicArea { - /** - * `GeoJSON` type. - * - * Possible values: "Feature" - */ - type: string; + /** `GeoJSON` type. */ + type: GeoJsonType; /** `GeoJSON` geometry, representing the area circle's center. */ geometry: AreaGeometry; /** `GeoJSON` object properties. */ @@ -297,12 +263,8 @@ export interface GeographicArea { /** `GeoJSON` geometry, representing the area circle's center. */ export interface AreaGeometry { - /** - * `GeoJSON` geometry type. - * - * Possible values: "Point" - */ - type: string; + /** `GeoJSON` geometry type. */ + type: GeoJsonGeometryType; /** * Coordinates of the area circle's center, represented according to the `GeoJSON` standard. * This is an array of 2 decimal numbers, longitude and latitude (precisely in this order). @@ -312,12 +274,77 @@ export interface AreaGeometry { /** `GeoJSON` object properties. */ export interface AreaProperties { - /** - * `GeoJSON` object sub-type. - * - * Possible values: "Circle" - */ - subType: string; + /** `GeoJSON` object sub-type. */ + subType: GeoJsonPropertiesSubType; /** The radius of the area's circle, in meters. */ radius: number; } + +/** Possible sources of a clinical trial. */ +export type ClinicalTrialSource = "custom" | "clinicaltrials.gov"; +/** Possible phases of a clinical trial. */ +export type ClinicalTrialPhase = + | "notApplicable" + | "earlyPhase1" + | "phase1" + | "phase2" + | "phase3" + | "phase4"; +/** Possible study types of a clinical trial. */ +export type ClinicalTrialStudyType = + | "interventional" + | "observational" + | "expandedAccess" + | "patientRegistries"; +/** Possible recruitment status of a clinical trial. */ +export type ClinicalTrialRecruitmentStatus = + | "unknownStatus" + | "notYetRecruiting" + | "recruiting" + | "enrollingByInvitation"; +/** The patient's sex. */ +export type PatientInfoSex = "female" | "male" | "unspecified"; +/** The type of the patient document, such as 'note' (text document) or 'fhirBundle' (FHIR JSON document). */ +export type DocumentType = + | "note" + | "fhirBundle" + | "dicom" + | "genomicSequencing"; +/** The type of the clinical document. */ +export type ClinicalDocumentType = + | "consultation" + | "dischargeSummary" + | "historyAndPhysical" + | "procedure" + | "progress" + | "imaging" + | "laboratory" + | "pathology"; +/** + * The type of the content's source. + * In case the source type is 'inline', the content is given as a string (for instance, text). + * In case the source type is 'reference', the content is given as a URI. + */ +export type DocumentContentSourceType = "inline" | "reference"; +/** Possible values for the Sex eligibility criterion as accepted by clinical trials, which indicates the sex of people who may participate in a clinical study. */ +export type ClinicalTrialAcceptedSex = "all" | "female" | "male"; +/** Possible units for a person's age. */ +export type AgeUnit = "years" | "months" | "days"; +/** Possible purposes of a clinical trial. */ +export type ClinicalTrialPurpose = + | "notApplicable" + | "screening" + | "diagnostic" + | "prevention" + | "healthServicesResearch" + | "treatment" + | "deviceFeasibility" + | "supportiveCare" + | "basicScience" + | "other"; +/** `GeoJSON` type. */ +export type GeoJsonType = "Feature"; +/** `GeoJSON` geometry type. */ +export type GeoJsonGeometryType = "Point"; +/** `GeoJSON` object sub-type. */ +export type GeoJsonPropertiesSubType = "Circle"; diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/outputModels.ts index 5ab260d634..06fd6786ef 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/src/outputModels.ts @@ -13,12 +13,8 @@ export interface TrialMatcherResultOutput { readonly expirationDateTime: string; /** The date and time when the processing job was last updated. */ readonly lastUpdateDateTime: string; - /** - * The status of the processing job. - * - * Possible values: "notStarted", "running", "succeeded", "failed", "partiallyCompleted" - */ - readonly status: string; + /** The status of the processing job. */ + readonly status: JobStatusOutput; /** An array of errors, if any errors occurred during the processing job. */ readonly errors?: Array; /** The inference results for the Trial Matcher request. */ @@ -47,12 +43,8 @@ export interface TrialMatcherPatientResultOutput { /** An inference made by the Trial Matcher model regarding a patient. */ export interface TrialMatcherInferenceOutput { - /** - * The type of the Trial Matcher inference. - * - * Possible values: "trialEligibility" - */ - type: string; + /** The type of the Trial Matcher inference. */ + type: TrialMatcherInferenceTypeOutput; /** The value of the inference, as relevant for the given inference type. */ value: string; /** The description corresponding to the inference value. */ @@ -63,12 +55,8 @@ export interface TrialMatcherInferenceOutput { evidence?: Array; /** The identifier of the clinical trial. */ id?: string; - /** - * Possible sources of a clinical trial. - * - * Possible values: "custom", "clinicaltrials.gov" - */ - source?: string; + /** Possible sources of a clinical trial. */ + source?: ClinicalTrialSourceOutput; /** Trial data which is of interest to the potential participant. */ metadata?: ClinicalTrialMetadataOutput; } @@ -118,19 +106,11 @@ export interface ClinicalTrialMetadataOutput { * Phases which are relevant for the clinical trial. * Each clinical trial can be in a certain phase or in multiple phases. */ - phases?: string[]; - /** - * Possible study types of a clinical trial. - * - * Possible values: "interventional", "observational", "expandedAccess", "patientRegistries" - */ - studyType?: string; - /** - * Possible recruitment status of a clinical trial. - * - * Possible values: "unknownStatus", "notYetRecruiting", "recruiting", "enrollingByInvitation" - */ - recruitmentStatus?: string; + phases?: ClinicalTrialPhaseOutput[]; + /** Possible study types of a clinical trial. */ + studyType?: ClinicalTrialStudyTypeOutput; + /** Possible recruitment status of a clinical trial. */ + recruitmentStatus?: ClinicalTrialRecruitmentStatusOutput; /** Medical conditions and their synonyms which are relevant for the clinical trial, given as strings. */ conditions: string[]; /** Sponsors/collaborators involved with the trial. */ @@ -179,5 +159,36 @@ export interface ExtendedClinicalCodedElementOutput { category?: string; } +/** The status of the processing job. */ +export type JobStatusOutput = + | "notStarted" + | "running" + | "succeeded" + | "failed" + | "partiallyCompleted"; +/** The type of the Trial Matcher inference. */ +export type TrialMatcherInferenceTypeOutput = "trialEligibility"; +/** Possible sources of a clinical trial. */ +export type ClinicalTrialSourceOutput = "custom" | "clinicaltrials.gov"; +/** Possible phases of a clinical trial. */ +export type ClinicalTrialPhaseOutput = + | "notApplicable" + | "earlyPhase1" + | "phase1" + | "phase2" + | "phase3" + | "phase4"; +/** Possible study types of a clinical trial. */ +export type ClinicalTrialStudyTypeOutput = + | "interventional" + | "observational" + | "expandedAccess" + | "patientRegistries"; +/** Possible recruitment status of a clinical trial. */ +export type ClinicalTrialRecruitmentStatusOutput = + | "unknownStatus" + | "notYetRecruiting" + | "recruiting" + | "enrollingByInvitation"; /** Alias for RepeatabilityResultOutput */ export type RepeatabilityResultOutput = "accepted" | "rejected"; diff --git a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/healthInsights_trialmatcher/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json index 4346e66a18..a1a5b0e533 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/package.json @@ -46,7 +46,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -59,8 +59,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md index 5002df2158..73752ecbdc 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/review/hierarchy-generic.api.md @@ -21,13 +21,13 @@ export interface BA { } // @public (undocumented) -export interface BCOp1Options extends OperationOptions { +export interface BCOp1OptionalParams extends OperationOptions { } // @public (undocumented) export interface BCOperations { // (undocumented) - op1: (body: BA, options?: BCOp1Options) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } // @public (undocumented) @@ -37,13 +37,13 @@ export interface BEA { } // @public (undocumented) -export interface BECOp1Options extends OperationOptions { +export interface BECOp1OptionalParams extends OperationOptions { } // @public (undocumented) export interface BECOperations { // (undocumented) - op1: (body: BEA, options?: BECOp1Options) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } // @public (undocumented) @@ -53,7 +53,7 @@ export interface BEOperations { } // @public (undocumented) -export interface BOp1Options extends OperationOptions { +export interface BOp1OptionalParams extends OperationOptions { } // @public (undocumented) @@ -63,17 +63,17 @@ export interface BOperations { // (undocumented) e: BEOperations; // (undocumented) - op1: (body: BA, options?: BOp1Options) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; } // @public (undocumented) -export interface DOp1Options extends OperationOptions { +export interface DOp1OptionalParams extends OperationOptions { } // @public (undocumented) export interface DOperations { // (undocumented) - op1: (body: A, options?: DOp1Options) => Promise; + op1: (body: A, options?: DOp1OptionalParams) => Promise; } // @public (undocumented) @@ -82,7 +82,7 @@ export class FooClient { readonly b: BOperations; readonly d: DOperations; // (undocumented) - op1(body: A, options?: Op1Options): Promise; + op1(body: A, options?: Op1OptionalParams): Promise; readonly pipeline: Pipeline; } @@ -91,7 +91,7 @@ export interface FooClientOptions extends ClientOptions { } // @public (undocumented) -export interface Op1Options extends OperationOptions { +export interface Op1OptionalParams extends OperationOptions { } // (No @packageDocumentation comment for this package) diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts index 64a9cf9d3a..897eca0c0c 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/c/index.ts @@ -8,12 +8,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BCOp1Options } from "../../../models/options.js"; +import { BCOp1OptionalParams } from "../../../models/options.js"; export function _op1Send( context: Client, body: BA, - options: BCOp1Options = { requestOptions: {} }, + options: BCOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b/c") @@ -34,7 +34,7 @@ export async function _op1Deserialize(result: BcOp1204Response): Promise { export async function op1( context: Client, body: BA, - options: BCOp1Options = { requestOptions: {} }, + options: BCOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); return _op1Deserialize(result); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts index f90dbd4427..fa91553e9e 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/e/c/index.ts @@ -11,12 +11,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BECOp1Options } from "../../../../models/options.js"; +import { BECOp1OptionalParams } from "../../../../models/options.js"; export function _op1Send( context: Client, body: BEA, - options: BECOp1Options = { requestOptions: {} }, + options: BECOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b/e") @@ -39,7 +39,7 @@ export async function _op1Deserialize( export async function op1( context: Client, body: BEA, - options: BECOp1Options = { requestOptions: {} }, + options: BECOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); return _op1Deserialize(result); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts index e48ce3064d..de79b87e47 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/b/index.ts @@ -8,12 +8,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BOp1Options } from "../../models/options.js"; +import { BOp1OptionalParams } from "../../models/options.js"; export function _op1Send( context: Client, body: BA, - options: BOp1Options = { requestOptions: {} }, + options: BOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/b") @@ -34,7 +34,7 @@ export async function _op1Deserialize(result: BOp1204Response): Promise { export async function op1( context: Client, body: BA, - options: BOp1Options = { requestOptions: {} }, + options: BOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); return _op1Deserialize(result); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts index d15aaa1037..32d1be3b2a 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/d/index.ts @@ -8,12 +8,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { DOp1Options } from "../../models/options.js"; +import { DOp1OptionalParams } from "../../models/options.js"; export function _op1Send( context: Client, body: A, - options: DOp1Options = { requestOptions: {} }, + options: DOp1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/d") @@ -34,7 +34,7 @@ export async function _op1Deserialize(result: DOp1204Response): Promise { export async function op1( context: Client, body: A, - options: DOp1Options = { requestOptions: {} }, + options: DOp1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); return _op1Deserialize(result); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/FooContext.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/fooContext.ts similarity index 100% rename from packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/FooContext.ts rename to packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/fooContext.ts diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts index 8a27e7596f..ed2c314967 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { createFoo, FooClientOptions, FooContext } from "./FooContext.js"; +export { createFoo, FooClientOptions, FooContext } from "./fooContext.js"; export { op1 } from "./operations.js"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts index 8024fc1fe6..947bed7e80 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/api/operations.ts @@ -8,12 +8,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { Op1Options } from "../models/options.js"; +import { Op1OptionalParams } from "../models/options.js"; export function _op1Send( context: Client, body: A, - options: Op1Options = { requestOptions: {} }, + options: Op1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/") @@ -34,7 +34,7 @@ export async function _op1Deserialize(result: Op1204Response): Promise { export async function op1( context: Client, body: A, - options: Op1Options = { requestOptions: {} }, + options: Op1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _op1Send(context, body, options); return _op1Deserialize(result); diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts index 7f1ebaad08..d5f39b7bb3 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/c/index.ts @@ -1,18 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { FooContext } from "../../../api/FooContext.js"; +import { FooContext } from "../../../api/fooContext.js"; import { BA } from "../../../models/models.js"; import { op1 } from "../../../api/b/c/index.js"; -import { BCOp1Options } from "../../../models/options.js"; +import { BCOp1OptionalParams } from "../../../models/options.js"; export interface BCOperations { - op1: (body: BA, options?: BCOp1Options) => Promise; + op1: (body: BA, options?: BCOp1OptionalParams) => Promise; } export function getBC(context: FooContext) { return { - op1: (body: BA, options?: BCOp1Options) => op1(context, body, options), + op1: (body: BA, options?: BCOp1OptionalParams) => + op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts index 97f1f55ebc..b340af9c0e 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/c/index.ts @@ -1,18 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { FooContext } from "../../../../api/FooContext.js"; +import { FooContext } from "../../../../api/fooContext.js"; import { BEA } from "../../../../models/models.js"; import { op1 } from "../../../../api/b/e/c/index.js"; -import { BECOp1Options } from "../../../../models/options.js"; +import { BECOp1OptionalParams } from "../../../../models/options.js"; export interface BECOperations { - op1: (body: BEA, options?: BECOp1Options) => Promise; + op1: (body: BEA, options?: BECOp1OptionalParams) => Promise; } export function getBEC(context: FooContext) { return { - op1: (body: BEA, options?: BECOp1Options) => op1(context, body, options), + op1: (body: BEA, options?: BECOp1OptionalParams) => + op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/index.ts index a1c6c7f874..9e8a9c1697 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/e/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { FooContext } from "../../../api/FooContext.js"; +import { FooContext } from "../../../api/fooContext.js"; import { BECOperations, getBECOperations } from "./c/index.js"; export interface BEOperations { diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts index 4bf0686286..9f0ec16c1c 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/b/index.ts @@ -1,22 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { FooContext } from "../../api/FooContext.js"; +import { FooContext } from "../../api/fooContext.js"; import { BA } from "../../models/models.js"; import { op1 } from "../../api/b/index.js"; -import { BOp1Options } from "../../models/options.js"; +import { BOp1OptionalParams } from "../../models/options.js"; import { BCOperations, getBCOperations } from "./c/index.js"; import { BEOperations, getBEOperations } from "./e/index.js"; export interface BOperations { - op1: (body: BA, options?: BOp1Options) => Promise; + op1: (body: BA, options?: BOp1OptionalParams) => Promise; e: BEOperations; c: BCOperations; } export function getB(context: FooContext) { return { - op1: (body: BA, options?: BOp1Options) => op1(context, body, options), + op1: (body: BA, options?: BOp1OptionalParams) => + op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/d/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/d/index.ts index 848d9f5a1d..abf39694da 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/d/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/classic/d/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { FooContext } from "../../api/FooContext.js"; +import { FooContext } from "../../api/fooContext.js"; import { A } from "../../models/models.js"; import { op1 } from "../../api/d/index.js"; -import { DOp1Options } from "../../models/options.js"; +import { DOp1OptionalParams } from "../../models/options.js"; export interface DOperations { - op1: (body: A, options?: DOp1Options) => Promise; + op1: (body: A, options?: DOp1OptionalParams) => Promise; } export function getD(context: FooContext) { return { - op1: (body: A, options?: DOp1Options) => op1(context, body, options), + op1: (body: A, options?: DOp1OptionalParams) => op1(context, body, options), }; } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/FooClient.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts similarity index 82% rename from packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/FooClient.ts rename to packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts index 4f847016a8..f4873fb8d8 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/FooClient.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/fooClient.ts @@ -3,12 +3,12 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { A } from "./models/models.js"; -import { Op1Options } from "./models/options.js"; +import { Op1OptionalParams } from "./models/options.js"; import { getBOperations, BOperations } from "./classic/b/index.js"; import { getDOperations, DOperations } from "./classic/d/index.js"; import { createFoo, FooClientOptions, FooContext, op1 } from "./api/index.js"; -export { FooClientOptions } from "./api/FooContext.js"; +export { FooClientOptions } from "./api/fooContext.js"; export class FooClient { private _client: FooContext; @@ -22,7 +22,10 @@ export class FooClient { this.d = getDOperations(this._client); } - op1(body: A, options: Op1Options = { requestOptions: {} }): Promise { + op1( + body: A, + options: Op1OptionalParams = { requestOptions: {} }, + ): Promise { return op1(this._client, body, options); } diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts index 0275fe2f92..fc9f6d57d3 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/index.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { FooClient, FooClientOptions } from "./FooClient.js"; +export { FooClient, FooClientOptions } from "./fooClient.js"; export { A, BA, BEA, - Op1Options, - BOp1Options, - BECOp1Options, - BCOp1Options, - DOp1Options, + Op1OptionalParams, + BOp1OptionalParams, + BECOp1OptionalParams, + BCOp1OptionalParams, + DOp1OptionalParams, } from "./models/index.js"; export { BOperations, diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts index fa5f0b95dd..c658e318bc 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/index.ts @@ -3,9 +3,9 @@ export { A, BA, BEA } from "./models.js"; export { - Op1Options, - BOp1Options, - BECOp1Options, - BCOp1Options, - DOp1Options, + Op1OptionalParams, + BOp1OptionalParams, + BECOp1OptionalParams, + BCOp1OptionalParams, + DOp1OptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/options.ts index 5a35173cfe..a4f65f10e6 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/src/models/options.ts @@ -3,12 +3,12 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface Op1Options extends OperationOptions {} +export interface Op1OptionalParams extends OperationOptions {} -export interface BOp1Options extends OperationOptions {} +export interface BOp1OptionalParams extends OperationOptions {} -export interface BECOp1Options extends OperationOptions {} +export interface BECOp1OptionalParams extends OperationOptions {} -export interface BCOp1Options extends OperationOptions {} +export interface BCOp1OptionalParams extends OperationOptions {} -export interface DOp1Options extends OperationOptions {} +export interface DOp1OptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/hierarchy_generic/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/loadTest/generated/openapi/2022-11-01/openapi.json b/packages/typespec-test/test/loadTest/generated/openapi/2022-11-01/openapi.json index 5715531e6e..e5ea6ebcf5 100644 --- a/packages/typespec-test/test/loadTest/generated/openapi/2022-11-01/openapi.json +++ b/packages/typespec-test/test/loadTest/generated/openapi/2022-11-01/openapi.json @@ -2374,8 +2374,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -2397,8 +2396,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -2420,8 +2418,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -2443,8 +2440,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ @@ -2466,8 +2462,7 @@ "nextLink": { "type": "string", "format": "uri", - "description": "The link to the next page of items", - "readOnly": true + "description": "The link to the next page of items" } }, "required": [ diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/package.json b/packages/typespec-test/test/loadTest/generated/typespec-ts/package.json index c3fb810620..b2eac79144 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md index 5c1f144134..e8431b579c 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/review/load-testing.api.md @@ -22,6 +22,9 @@ import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; import { TokenCredential } from '@azure/core-auth'; +// @public +export type AggregationTypeOutput = "Average" | "Count" | "None" | "Total" | "Percentile90" | "Percentile95" | "Percentile99"; + // @public export interface AppComponent { displayName?: string; @@ -49,17 +52,23 @@ export type AzureLoadTestingClient = Client & { // @public export interface CertificateMetadata { name?: string; - type?: string; + type?: CertificateType; value?: string; } // @public export interface CertificateMetadataOutput { name?: string; - type?: string; + type?: CertificateTypeOutput; value?: string; } +// @public +export type CertificateType = "AKV_CERT_URI"; + +// @public +export type CertificateTypeOutput = "AKV_CERT_URI"; + // @public function createClient(endpointParam: string, credentials: TokenCredential, options?: ClientOptions): AzureLoadTestingClient; export default createClient; @@ -95,22 +104,34 @@ export interface ErrorDetailsOutput { export interface FileInfo { expireDateTime?: string; fileName?: string; - fileType?: string; + fileType?: FileType; url?: string; validationFailureDetails?: string; - validationStatus?: string; + validationStatus?: FileStatus; } // @public export interface FileInfoOutput { expireDateTime?: string; fileName?: string; - fileType?: string; + fileType?: FileTypeOutput; url?: string; validationFailureDetails?: string; - validationStatus?: string; + validationStatus?: FileStatusOutput; } +// @public +export type FileStatus = "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; + +// @public +export type FileStatusOutput = "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; + +// @public +export type FileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + +// @public +export type FileTypeOutput = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; + // @public export type GetArrayType = T extends Array ? TData : never; @@ -123,6 +144,9 @@ export type GetPage = (pageLink: string, maxPageSize?: number) => Promise nextPageLink?: string; }>; +// @public +export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; + // @public (undocumented) export function isUnexpected(response: LoadTestAdministrationCreateOrUpdateTest200Response | LoadTestAdministrationCreateOrUpdateTest201Response | LoadTestAdministrationCreateOrUpdateTestDefaultResponse): response is LoadTestAdministrationCreateOrUpdateTestDefaultResponse; @@ -636,7 +660,7 @@ export interface LoadTestAdministrationUploadTestFileQueryParam { // @public (undocumented) export interface LoadTestAdministrationUploadTestFileQueryParamProperties { - fileType?: string; + fileType?: FileType; } // @public @@ -1029,7 +1053,7 @@ export interface LoadTestRunListMetricDimensionValuesQueryParam { // @public (undocumented) export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { - interval?: string; + interval?: Interval; metricName?: string; metricNamespace: string; timespan?: string; @@ -1111,7 +1135,7 @@ export interface LoadTestRunListMetricsQueryParam { // @public (undocumented) export interface LoadTestRunListMetricsQueryParamProperties { aggregation?: string; - interval?: string; + interval?: Interval; metricName?: string; metricNamespace?: string; timespan?: string; @@ -1224,7 +1248,7 @@ export type LoadTestRunTestRunListServerMetricsConfigParameters = RequestParamet // @public export interface MetricAvailabilityOutput { - timeGrain?: string; + timeGrain?: TimeGrainOutput; } // @public @@ -1239,9 +1263,9 @@ export interface MetricDefinitionOutput { metricAvailabilities?: Array; name?: string; namespace?: string; - primaryAggregationType?: string; + primaryAggregationType?: AggregationTypeOutput; supportedAggregationTypes?: string[]; - unit?: string; + unit?: MetricUnitOutput; } // @public @@ -1260,6 +1284,9 @@ export interface MetricRequestPayload { filters?: Array; } +// @public +export type MetricUnitOutput = "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; + // @public export interface MetricValueOutput { timestamp?: string; @@ -1330,9 +1357,9 @@ export interface PassFailCriteriaOutput { // @public export interface PassFailMetric { - action?: string; - aggregate?: string; - clientMetric?: string; + action?: PFAction; + aggregate?: PFAgFunc; + clientMetric?: PFMetrics; condition?: string; requestName?: string; value?: number; @@ -1340,16 +1367,46 @@ export interface PassFailMetric { // @public export interface PassFailMetricOutput { - action?: string; + action?: PFActionOutput; readonly actualValue?: number; - aggregate?: string; - clientMetric?: string; + aggregate?: PFAgFuncOutput; + clientMetric?: PFMetricsOutput; condition?: string; requestName?: string; - readonly result?: string; + readonly result?: PFResultOutput; value?: number; } +// @public +export type PFAction = "continue" | "stop"; + +// @public +export type PFActionOutput = "continue" | "stop"; + +// @public +export type PFAgFunc = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; + +// @public +export type PFAgFuncOutput = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; + +// @public +export type PFMetrics = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; + +// @public +export type PFMetricsOutput = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; + +// @public +export type PFResult = "passed" | "undetermined" | "failed"; + +// @public +export type PFResultOutput = "passed" | "undetermined" | "failed"; + +// @public +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; + +// @public +export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; + // @public export interface ResourceMetric { aggregation: string; @@ -1395,16 +1452,22 @@ export interface Routes { // @public export interface Secret { - type?: string; + type?: SecretType; value?: string; } // @public export interface SecretOutput { - type?: string; + type?: SecretTypeOutput; value?: string; } +// @public +export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; + +// @public +export type SecretTypeOutput = "AKV_SECRET_URI" | "SECRET_VALUE"; + // @public export interface SimplePollerLike, TResult> { getOperationState(): TState; @@ -1426,6 +1489,12 @@ export interface SimplePollerLike, TResul toString(): string; } +// @public +export type Status = "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" | "PROVISIONED" | "CONFIGURING" | "CONFIGURED" | "EXECUTING" | "EXECUTED" | "DEPROVISIONING" | "DEPROVISIONED" | "DONE" | "CANCELLING" | "CANCELLED" | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; + +// @public +export type StatusOutput = "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" | "PROVISIONED" | "CONFIGURING" | "CONFIGURED" | "EXECUTING" | "EXECUTED" | "DEPROVISIONING" | "DEPROVISIONED" | "DONE" | "CANCELLING" | "CANCELLED" | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; + // @public export interface Test { certificate?: CertificateMetadata; @@ -1575,11 +1644,11 @@ export interface TestRunOutput { readonly portalUrl?: string; secrets?: Record; readonly startDateTime?: string; - readonly status?: string; + readonly status?: StatusOutput; readonly subnetId?: string; readonly testArtifacts?: TestRunArtifactsOutput; testId?: string; - readonly testResult?: string; + readonly testResult?: PFTestResultOutput; readonly testRunId: string; readonly testRunStatistics?: Record; readonly virtualUsers?: number; @@ -1658,6 +1727,9 @@ export interface TestServerMetricConfigOutput { // @public export type TestServerMetricConfigResourceMergeAndPatch = Partial; +// @public +export type TimeGrainOutput = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; + // @public export interface TimeSeriesElementOutput { data?: Array; diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestAdministrationUploadTestFileSample.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestAdministrationUploadTestFileSample.ts index bd5cea52e5..c7eed82527 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestAdministrationUploadTestFileSample.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestAdministrationUploadTestFileSample.ts @@ -22,7 +22,7 @@ async function loadTestAdministrationUploadTestFileSample() { .path("/tests/{testId}/files/{fileName}", testId, fileName) .put({ body: "{Your body}", - queryParameters: { fileType: "{Your fileType}" }, + queryParameters: { fileType: "JMX_FILE" }, contentType: "application/octet-stream", }); console.log(result); diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricDimensionValuesSample.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricDimensionValuesSample.ts index f4af214464..12e4f950c6 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricDimensionValuesSample.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricDimensionValuesSample.ts @@ -28,7 +28,7 @@ async function loadTestRunListMetricDimensionValuesSample() { ) .get({ queryParameters: { - interval: "{Your interval}", + interval: "PT5S", metricName: "{Your metricName}", metricNamespace: "{Your metricNamespace}", timespan: "{Your timespan}", diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricsSample.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricsSample.ts index c39d90232a..734b7b1c30 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricsSample.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/samples-dev/loadTestRunListMetricsSample.ts @@ -25,7 +25,7 @@ async function loadTestRunListMetricsSample() { body: { filters: [{ name: "{Your name}", values: ["{Your values}"] }] }, queryParameters: { aggregation: "{Your aggregation}", - interval: "{Your interval}", + interval: "PT5S", metricName: "{Your metricName}", metricNamespace: "{Your metricNamespace}", timespan: "{Your timespan}", diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts index f316e9a168..a102d07cb8 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/models.ts @@ -39,21 +39,15 @@ export interface PassFailCriteria { /** Pass fail metric */ export interface PassFailMetric { - /** - * The client metric on which the criteria should be applied. - * - * Possible values: "response_time_ms", "latency", "error", "requests", "requests_per_sec" - */ - clientMetric?: string; + /** The client metric on which the criteria should be applied. */ + clientMetric?: PFMetrics; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests - * - * Possible values: "count", "percentage", "avg", "p50", "p90", "p95", "p99", "min", "max" */ - aggregate?: string; + aggregate?: PFAgFunc; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -63,36 +57,24 @@ export interface PassFailMetric { * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. */ value?: number; - /** - * Action taken after the threshold is met. Default is ‘continue’. - * - * Possible values: "continue", "stop" - */ - action?: string; + /** Action taken after the threshold is met. Default is ‘continue’. */ + action?: PFAction; } /** Secret */ export interface Secret { /** The value of the secret for the respective type */ value?: string; - /** - * Type of secret - * - * Possible values: "AKV_SECRET_URI", "SECRET_VALUE" - */ - type?: string; + /** Type of secret */ + type?: SecretType; } /** Certificates metadata */ export interface CertificateMetadata { /** The value of the certificate for respective type */ value?: string; - /** - * Type of certificate - * - * Possible values: "AKV_CERT_URI" - */ - type?: string; + /** Type of certificate */ + type?: CertificateType; /** Name of the certificate. */ name?: string; } @@ -153,20 +135,12 @@ export interface FileInfo { url?: string; /** Name of the file. */ fileName?: string; - /** - * File type - * - * Possible values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" - */ - fileType?: string; + /** File type */ + fileType?: FileType; /** Expiry time of the file (ISO 8601 literal format) */ expireDateTime?: string; - /** - * Validation status of the file - * - * Possible values: "NOT_VALIDATED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", "VALIDATION_NOT_REQUIRED" - */ - validationStatus?: string; + /** Validation status of the file */ + validationStatus?: FileStatus; /** Validation failure error details */ validationFailureDetails?: string; } @@ -324,3 +298,61 @@ export interface TestRunServerMetricConfig { */ metrics?: Record; } + +/** Alias for PFMetrics */ +export type PFMetrics = + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; +/** Alias for PFAgFunc */ +export type PFAgFunc = + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; +/** Alias for PFAction */ +export type PFAction = "continue" | "stop"; +/** Alias for PFResult */ +export type PFResult = "passed" | "undetermined" | "failed"; +/** Alias for SecretType */ +export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; +/** Alias for CertificateType */ +export type CertificateType = "AKV_CERT_URI"; +/** Alias for FileType */ +export type FileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +/** Alias for FileStatus */ +export type FileStatus = + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; +/** Alias for PFTestResult */ +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for Status */ +export type Status = + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; +/** Alias for Interval */ +export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts index 0cc2eb2a69..392e850e81 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/outputModels.ts @@ -53,21 +53,15 @@ export interface PassFailCriteriaOutput { /** Pass fail metric */ export interface PassFailMetricOutput { - /** - * The client metric on which the criteria should be applied. - * - * Possible values: "response_time_ms", "latency", "error", "requests", "requests_per_sec" - */ - clientMetric?: string; + /** The client metric on which the criteria should be applied. */ + clientMetric?: PFMetricsOutput; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests - * - * Possible values: "count", "percentage", "avg", "p50", "p90", "p95", "p99", "min", "max" */ - aggregate?: string; + aggregate?: PFAgFuncOutput; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -77,44 +71,28 @@ export interface PassFailMetricOutput { * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. */ value?: number; - /** - * Action taken after the threshold is met. Default is ‘continue’. - * - * Possible values: "continue", "stop" - */ - action?: string; + /** Action taken after the threshold is met. Default is ‘continue’. */ + action?: PFActionOutput; /** The actual value of the client metric for the test run. */ readonly actualValue?: number; - /** - * Outcome of the test run. - * - * Possible values: "passed", "undetermined", "failed" - */ - readonly result?: string; + /** Outcome of the test run. */ + readonly result?: PFResultOutput; } /** Secret */ export interface SecretOutput { /** The value of the secret for the respective type */ value?: string; - /** - * Type of secret - * - * Possible values: "AKV_SECRET_URI", "SECRET_VALUE" - */ - type?: string; + /** Type of secret */ + type?: SecretTypeOutput; } /** Certificates metadata */ export interface CertificateMetadataOutput { /** The value of the certificate for respective type */ value?: string; - /** - * Type of certificate - * - * Possible values: "AKV_CERT_URI" - */ - type?: string; + /** Type of certificate */ + type?: CertificateTypeOutput; /** Name of the certificate. */ name?: string; } @@ -177,20 +155,12 @@ export interface FileInfoOutput { url?: string; /** Name of the file. */ fileName?: string; - /** - * File type - * - * Possible values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" - */ - fileType?: string; + /** File type */ + fileType?: FileTypeOutput; /** Expiry time of the file (ISO 8601 literal format) */ expireDateTime?: string; - /** - * Validation status of the file - * - * Possible values: "NOT_VALIDATED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", "VALIDATION_NOT_REQUIRED" - */ - validationStatus?: string; + /** Validation status of the file */ + validationStatus?: FileStatusOutput; /** Validation failure error details */ validationFailureDetails?: string; } @@ -309,12 +279,8 @@ export interface TestRunOutput { loadTestConfiguration?: LoadTestConfigurationOutput; /** Collection of test run artifacts */ readonly testArtifacts?: TestRunArtifactsOutput; - /** - * Test result for pass/Fail criteria used during the test run. - * - * Possible values: "PASSED", "NOT_APPLICABLE", "FAILED" - */ - readonly testResult?: string; + /** Test result for pass/Fail criteria used during the test run. */ + readonly testResult?: PFTestResultOutput; /** Number of virtual users, for which test has been run. */ readonly virtualUsers?: number; /** Display name of a testRun. */ @@ -323,12 +289,8 @@ export interface TestRunOutput { testId?: string; /** The test run description. */ description?: string; - /** - * The test run status. - * - * Possible values: "ACCEPTED", "NOTSTARTED", "PROVISIONING", "PROVISIONED", "CONFIGURING", "CONFIGURED", "EXECUTING", "EXECUTED", "DEPROVISIONING", "DEPROVISIONED", "DONE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE" - */ - readonly status?: string; + /** The test run status. */ + readonly status?: StatusOutput; /** The test run start DateTime(ISO 8601 literal format). */ readonly startDateTime?: string; /** The test run end DateTime(ISO 8601 literal format). */ @@ -449,20 +411,12 @@ export interface MetricDefinitionOutput { name?: string; /** The namespace the metric belongs to. */ namespace?: string; - /** - * The primary aggregation type value defining how to use the values for display. - * - * Possible values: "Average", "Count", "None", "Total", "Percentile90", "Percentile95", "Percentile99" - */ - primaryAggregationType?: string; + /** The primary aggregation type value defining how to use the values for display. */ + primaryAggregationType?: AggregationTypeOutput; /** The collection of what all aggregation types are supported. */ supportedAggregationTypes?: string[]; - /** - * The unit of the metric. - * - * Possible values: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond" - */ - unit?: string; + /** The unit of the metric. */ + unit?: MetricUnitOutput; /** * Metric availability specifies the time grain (aggregation interval or * frequency). @@ -483,10 +437,8 @@ export interface MetricAvailabilityOutput { /** * The time grain specifies the aggregation interval for the metric. Expressed as * a duration 'PT1M', 'PT1H', etc. - * - * Possible values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" */ - timeGrain?: string; + timeGrain?: TimeGrainOutput; } /** The time series returned when a data query is performed. */ @@ -557,12 +509,91 @@ export interface TestRunServerMetricConfigOutput { readonly lastModifiedBy?: string; } +/** Alias for PFMetricsOutput */ +export type PFMetricsOutput = + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; +/** Alias for PFAgFuncOutput */ +export type PFAgFuncOutput = + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; +/** Alias for PFActionOutput */ +export type PFActionOutput = "continue" | "stop"; +/** Alias for PFResultOutput */ +export type PFResultOutput = "passed" | "undetermined" | "failed"; +/** Alias for SecretTypeOutput */ +export type SecretTypeOutput = "AKV_SECRET_URI" | "SECRET_VALUE"; +/** Alias for CertificateTypeOutput */ +export type CertificateTypeOutput = "AKV_CERT_URI"; +/** Alias for FileTypeOutput */ +export type FileTypeOutput = + | "JMX_FILE" + | "USER_PROPERTIES" + | "ADDITIONAL_ARTIFACTS"; +/** Alias for FileStatusOutput */ +export type FileStatusOutput = + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; /** Collection of tests */ export type PagedTestOutput = Paged; /** Collection of files. */ export type PagedFileInfoOutput = Paged; +/** Alias for PFTestResultOutput */ +export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for StatusOutput */ +export type StatusOutput = + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; /** Collection of test runs */ export type PagedTestRunOutput = Paged; +/** Alias for AggregationTypeOutput */ +export type AggregationTypeOutput = + | "Average" + | "Count" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; +/** Alias for MetricUnitOutput */ +export type MetricUnitOutput = + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; +/** Alias for TimeGrainOutput */ +export type TimeGrainOutput = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; /** The response to a metrics query. */ export type PagedTimeSeriesElementOutput = Paged; /** Paged collection of DimensionValueList items */ diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/parameters.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/parameters.ts index 606f61de95..9437426616 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/src/parameters.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/src/parameters.ts @@ -4,9 +4,11 @@ import { RequestParameters } from "@azure-rest/core-client"; import { Test, + FileType, TestAppComponents, TestServerMetricConfig, TestRun, + Interval, MetricRequestPayload, TestRunAppComponents, TestRunServerMetricConfig, @@ -78,12 +80,8 @@ export interface LoadTestAdministrationUploadTestFileBodyParam { } export interface LoadTestAdministrationUploadTestFileQueryParamProperties { - /** - * File type - * - * Possible values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" - */ - fileType?: string; + /** File type */ + fileType?: FileType; } export interface LoadTestAdministrationUploadTestFileQueryParam { @@ -228,12 +226,8 @@ export interface LoadTestRunListMetricsBodyParam { export interface LoadTestRunListMetricsQueryParamProperties { /** The aggregation */ aggregation?: string; - /** - * The interval (i.e. timegrain) of the query. - * - * Possible values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" - */ - interval?: string; + /** The interval (i.e. timegrain) of the query. */ + interval?: Interval; /** Metric name */ metricName?: string; /** Metric namespace to query metric definitions for. */ @@ -255,12 +249,8 @@ export type LoadTestRunListMetricsParameters = RequestParameters; export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { - /** - * The interval (i.e. timegrain) of the query. - * - * Possible values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" - */ - interval?: string; + /** The interval (i.e. timegrain) of the query. */ + interval?: Interval; /** Metric name */ metricName?: string; /** Metric namespace to query metric definitions for. */ diff --git a/packages/typespec-test/test/loadTest/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/loadTest/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/loadTest/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/loadTest/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/package.json index 67d5b9f236..318bd0539c 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/package.json @@ -46,7 +46,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -62,8 +62,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md index 07b2f80605..61942047b9 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md @@ -24,28 +24,32 @@ import { TokenCredential } from '@azure/core-auth'; // @public (undocumented) export class AdministrationOperationsClient { - constructor(endpoint: string, credential: TokenCredential, options?: AdministrationOperationsClientOptions); - createOrUpdateAppComponents(testId: string, body: TestAppComponents, options?: CreateOrUpdateAppComponentsOptions): Promise; - createOrUpdateServerMetricsConfig(testId: string, body: TestServerMetricConfig, options?: CreateOrUpdateServerMetricsConfigOptions): Promise; - createOrUpdateTest(testId: string, body: Test, options?: CreateOrUpdateTestOptions): Promise; - deleteTest(testId: string, options?: DeleteTestOptions): Promise; - deleteTestFile(testId: string, fileName: string, options?: DeleteTestFileOptions): Promise; - getAppComponents(testId: string, options?: GetAppComponentsOptions): Promise; - getServerMetricsConfig(testId: string, options?: GetServerMetricsConfigOptions): Promise; - getTest(testId: string, options?: GetTestOptions): Promise; - getTestFile(testId: string, fileName: string, options?: GetTestFileOptions): Promise; - listTestFiles(testId: string, options?: ListTestFilesOptions): PagedAsyncIterableIterator; - listTests(options?: ListTestsOptions): PagedAsyncIterableIterator; + constructor(endpointParam: string, credential: TokenCredential, options?: AdministrationOperationsClientOptions); + createOrUpdateAppComponents(testId: string, body: TestAppComponents, options?: CreateOrUpdateAppComponentsOptionalParams): Promise; + createOrUpdateServerMetricsConfig(testId: string, body: TestServerMetricConfig, options?: CreateOrUpdateServerMetricsConfigOptionalParams): Promise; + createOrUpdateTest(testId: string, body: Test, options?: CreateOrUpdateTestOptionalParams): Promise; + deleteTest(testId: string, options?: DeleteTestOptionalParams): Promise; + deleteTestFile(testId: string, fileName: string, options?: DeleteTestFileOptionalParams): Promise; + getAppComponents(testId: string, options?: GetAppComponentsOptionalParams): Promise; + getServerMetricsConfig(testId: string, options?: GetServerMetricsConfigOptionalParams): Promise; + getTest(testId: string, options?: GetTestOptionalParams): Promise; + getTestFile(testId: string, fileName: string, options?: GetTestFileOptionalParams): Promise; + listTestFiles(testId: string, options?: ListTestFilesOptionalParams): PagedAsyncIterableIterator; + listTests(options?: ListTestsOptionalParams): PagedAsyncIterableIterator; readonly pipeline: Pipeline; - uploadTestFile(testId: string, fileName: string, body: Uint8Array, options?: UploadTestFileOptions): Promise; + uploadTestFile(testId: string, fileName: string, body: Uint8Array, options?: UploadTestFileOptionalParams): Promise; } // @public (undocumented) export interface AdministrationOperationsClientOptions extends ClientOptions { + apiVersion?: string; } -// @public -export type AggregationType = string; +// @public (undocumented) +export type AggregationType = "Average" | "Count" | "None" | "Total" | "Percentile90" | "Percentile95" | "Percentile99"; + +// @public (undocumented) +export type APIVersions = "2022-11-01"; // @public export interface AppComponent { @@ -65,8 +69,8 @@ export interface CertificateMetadata { value?: string; } -// @public -export type CertificateType = string; +// @public (undocumented) +export type CertificateType = "AKV_CERT_URI"; // @public export type ContinuablePage = TPage & { @@ -74,33 +78,33 @@ export type ContinuablePage = TPage & { }; // @public (undocumented) -export interface CreateOrUpdateAppComponentsOptions extends OperationOptions { +export interface CreateOrUpdateAppComponentsOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface CreateOrUpdateServerMetricsConfigOptions extends OperationOptions { +export interface CreateOrUpdateServerMetricsConfigOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface CreateOrUpdateTestOptions extends OperationOptions { +export interface CreateOrUpdateTestOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface DeleteTestFileOptions extends OperationOptions { +export interface DeleteTestFileOptionalParams extends OperationOptions { } // @public (undocumented) -export interface DeleteTestOptions extends OperationOptions { +export interface DeleteTestOptionalParams extends OperationOptions { } // @public (undocumented) -export interface DeleteTestRunOptions extends OperationOptions { +export interface DeleteTestRunOptionalParams extends OperationOptions { } // @public @@ -136,57 +140,57 @@ export interface FileInfo { validationStatus?: FileStatus; } -// @public -export type FileStatus = string; +// @public (undocumented) +export type FileStatus = "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; -// @public -export type FileType = string; +// @public (undocumented) +export type FileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; // @public (undocumented) -export interface GetAppComponentsOptions extends OperationOptions { +export interface GetAppComponentsOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetServerMetricsConfigOptions extends OperationOptions { +export interface GetServerMetricsConfigOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetTestFileOptions extends OperationOptions { +export interface GetTestFileOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetTestOptions extends OperationOptions { +export interface GetTestOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetTestRunFileOptions extends OperationOptions { +export interface GetTestRunFileOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetTestRunOptions extends OperationOptions { +export interface GetTestRunOptionalParams extends OperationOptions { } -// @public -export type Interval = string; +// @public (undocumented) +export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; // @public (undocumented) -export interface ListMetricDefinitionsOptions extends OperationOptions { +export interface ListMetricDefinitionsOptionalParams extends OperationOptions { metricNamespace?: string; } // @public (undocumented) -export interface ListMetricDimensionValuesOptions extends OperationOptions { +export interface ListMetricDimensionValuesOptionalParams extends OperationOptions { interval?: TestRunOperationsClientInterval; metricName?: string; timespan?: string; } // @public (undocumented) -export interface ListMetricNamespacesOptions extends OperationOptions { +export interface ListMetricNamespacesOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ListMetricsOptions extends OperationOptions { +export interface ListMetricsOptionalParams extends OperationOptions { aggregation?: string; interval?: TestRunOperationsClientInterval; metricName?: string; @@ -195,11 +199,11 @@ export interface ListMetricsOptions extends OperationOptions { } // @public (undocumented) -export interface ListTestFilesOptions extends OperationOptions { +export interface ListTestFilesOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ListTestRunsOptions extends OperationOptions { +export interface ListTestRunsOptionalParams extends OperationOptions { executionFrom?: string; executionTo?: string; maxpagesize?: number; @@ -210,7 +214,7 @@ export interface ListTestRunsOptions extends OperationOptions { } // @public (undocumented) -export interface ListTestsOptions extends OperationOptions { +export interface ListTestsOptionalParams extends OperationOptions { lastModifiedEndTime?: string; lastModifiedStartTime?: string; maxpagesize?: number; @@ -249,8 +253,8 @@ export interface MetricNamespace { name?: string; } -// @public -export type MetricUnit = string; +// @public (undocumented) +export type MetricUnit = "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; // @public export interface MetricValue { @@ -281,13 +285,13 @@ export interface PagedAsyncIterableIterator; + createOrUpdateAppComponents(testRunId: string, body: TestRunAppComponents, options?: TestRunOperationsClientCreateOrUpdateAppComponentsOptionalParams): Promise; // Warning: (ae-forgotten-export) The symbol "TestRunServerMetricConfig" needs to be exported by the entry point index.d.ts - createOrUpdateServerMetricsConfig(testRunId: string, body: TestRunServerMetricConfig, options?: TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptions): Promise; - deleteTestRun(testRunId: string, options?: DeleteTestRunOptions): Promise; - getAppComponents(testRunId: string, options?: TestRunOperationsClientGetAppComponentsOptions): Promise; - getServerMetricsConfig(testRunId: string, options?: TestRunOperationsClientGetServerMetricsConfigOptions): Promise; - getTestRun(testRunId: string, options?: GetTestRunOptions): Promise; - getTestRunFile(testRunId: string, fileName: string, options?: GetTestRunFileOptions): Promise; + createOrUpdateServerMetricsConfig(testRunId: string, body: TestRunServerMetricConfig, options?: TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptionalParams): Promise; + deleteTestRun(testRunId: string, options?: DeleteTestRunOptionalParams): Promise; + getAppComponents(testRunId: string, options?: TestRunOperationsClientGetAppComponentsOptionalParams): Promise; + getServerMetricsConfig(testRunId: string, options?: TestRunOperationsClientGetServerMetricsConfigOptionalParams): Promise; + getTestRun(testRunId: string, options?: GetTestRunOptionalParams): Promise; + getTestRunFile(testRunId: string, fileName: string, options?: GetTestRunFileOptionalParams): Promise; // Warning: (ae-forgotten-export) The symbol "MetricDefinitionCollection" needs to be exported by the entry point index.d.ts - listMetricDefinitions(testRunId: string, options?: ListMetricDefinitionsOptions): Promise; - listMetricDimensionValues(testRunId: string, name: string, metricNamespace: string, options?: ListMetricDimensionValuesOptions): TestRunOperationsClientPagedAsyncIterableIterator; + listMetricDefinitions(testRunId: string, options?: ListMetricDefinitionsOptionalParams): Promise; + listMetricDimensionValues(testRunId: string, name: string, metricNamespace: string, options?: ListMetricDimensionValuesOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; // Warning: (ae-forgotten-export) The symbol "MetricNamespaceCollection" needs to be exported by the entry point index.d.ts - listMetricNamespaces(testRunId: string, options?: ListMetricNamespacesOptions): Promise; + listMetricNamespaces(testRunId: string, options?: ListMetricNamespacesOptionalParams): Promise; // Warning: (ae-forgotten-export) The symbol "MetricRequestPayload" needs to be exported by the entry point index.d.ts - listMetrics(testRunId: string, body: MetricRequestPayload, options?: ListMetricsOptions): TestRunOperationsClientPagedAsyncIterableIterator; - listTestRuns(options?: ListTestRunsOptions): TestRunOperationsClientPagedAsyncIterableIterator; + listMetrics(testRunId: string, body: MetricRequestPayload, options?: ListMetricsOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; + listTestRuns(options?: ListTestRunsOptionalParams): TestRunOperationsClientPagedAsyncIterableIterator; readonly pipeline: Pipeline; - stopTestRun(testRunId: string, options?: StopTestRunOptions): Promise; - testRun(testRunId: string, resource: TestRunOperationsClientTestRun, options?: TestRunOptions): PollerLike, TestRunOperationsClientTestRun>; + stopTestRun(testRunId: string, options?: StopTestRunOptionalParams): Promise; + testRun(testRunId: string, resource: TestRunOperationsClientTestRun, options?: TestRunOptionalParams): PollerLike, TestRunOperationsClientTestRun>; } -// @public -export type TestRunOperationsClientAggregationType = string; +// @public (undocumented) +export type TestRunOperationsClientAggregationType = "Average" | "Count" | "None" | "Total" | "Percentile90" | "Percentile95" | "Percentile99"; + +// @public (undocumented) +export type TestRunOperationsClientAPIVersions = "2022-11-01"; // @public export interface TestRunOperationsClientAppComponent { @@ -497,8 +504,8 @@ export interface TestRunOperationsClientCertificateMetadata { value?: string; } -// @public -export type TestRunOperationsClientCertificateType = string; +// @public (undocumented) +export type TestRunOperationsClientCertificateType = "AKV_CERT_URI"; // @public export type TestRunOperationsClientContinuablePage = TPage & { @@ -506,13 +513,13 @@ export type TestRunOperationsClientContinuablePage }; // @public (undocumented) -export interface TestRunOperationsClientCreateOrUpdateAppComponentsOptions extends OperationOptions { +export interface TestRunOperationsClientCreateOrUpdateAppComponentsOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptions extends OperationOptions { +export interface TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -550,22 +557,22 @@ export interface TestRunOperationsClientFileInfo { validationStatus?: TestRunOperationsClientFileStatus; } -// @public -export type TestRunOperationsClientFileStatus = string; +// @public (undocumented) +export type TestRunOperationsClientFileStatus = "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED"; -// @public -export type TestRunOperationsClientFileType = string; +// @public (undocumented) +export type TestRunOperationsClientFileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; // @public (undocumented) -export interface TestRunOperationsClientGetAppComponentsOptions extends OperationOptions { +export interface TestRunOperationsClientGetAppComponentsOptionalParams extends OperationOptions { } // @public (undocumented) -export interface TestRunOperationsClientGetServerMetricsConfigOptions extends OperationOptions { +export interface TestRunOperationsClientGetServerMetricsConfigOptionalParams extends OperationOptions { } -// @public -export type TestRunOperationsClientInterval = string; +// @public (undocumented) +export type TestRunOperationsClientInterval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; // @public export interface TestRunOperationsClientLoadTestConfiguration { @@ -598,8 +605,8 @@ export interface TestRunOperationsClientMetricNamespace { name?: string; } -// @public -export type TestRunOperationsClientMetricUnit = string; +// @public (undocumented) +export type TestRunOperationsClientMetricUnit = "NotSpecified" | "Percent" | "Count" | "Seconds" | "Milliseconds" | "Bytes" | "BytesPerSecond" | "CountPerSecond"; // @public export interface TestRunOperationsClientMetricValue { @@ -623,6 +630,7 @@ export interface TestRunOperationsClientOptionalLoadTestConfig { // @public (undocumented) export interface TestRunOperationsClientOptions extends ClientOptions { + apiVersion?: string; } // @public @@ -654,20 +662,20 @@ export interface TestRunOperationsClientPassFailMetric { value?: number; } -// @public -export type TestRunOperationsClientPFAction = string; +// @public (undocumented) +export type TestRunOperationsClientPFAction = "continue" | "stop"; -// @public -export type TestRunOperationsClientPFAgFunc = string; +// @public (undocumented) +export type TestRunOperationsClientPFAgFunc = "count" | "percentage" | "avg" | "p50" | "p90" | "p95" | "p99" | "min" | "max"; -// @public -export type TestRunOperationsClientPFMetrics = string; +// @public (undocumented) +export type TestRunOperationsClientPFMetrics = "response_time_ms" | "latency" | "error" | "requests" | "requests_per_sec"; -// @public -export type TestRunOperationsClientPFResult = string; +// @public (undocumented) +export type TestRunOperationsClientPFResult = "passed" | "undetermined" | "failed"; -// @public -export type TestRunOperationsClientPFTestResult = string; +// @public (undocumented) +export type TestRunOperationsClientPFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; // @public export interface TestRunOperationsClientResourceMetric { @@ -687,11 +695,11 @@ export interface TestRunOperationsClientSecret { value?: string; } -// @public -export type TestRunOperationsClientSecretType = string; +// @public (undocumented) +export type TestRunOperationsClientSecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; -// @public -export type TestRunOperationsClientStatus = string; +// @public (undocumented) +export type TestRunOperationsClientStatus = "ACCEPTED" | "NOTSTARTED" | "PROVISIONING" | "PROVISIONED" | "CONFIGURING" | "CONFIGURED" | "EXECUTING" | "EXECUTED" | "DEPROVISIONING" | "DEPROVISIONED" | "DONE" | "CANCELLING" | "CANCELLED" | "FAILED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE"; // @public export interface TestRunOperationsClientTest { @@ -790,8 +798,8 @@ export interface TestRunOperationsClientTestRunStatistics { readonly transaction?: string; } -// @public -export type TestRunOperationsClientTimeGrain = string; +// @public (undocumented) +export type TestRunOperationsClientTimeGrain = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; // @public export interface TestRunOperationsClientTimeSeriesElement { @@ -800,7 +808,7 @@ export interface TestRunOperationsClientTimeSeriesElement { } // @public (undocumented) -export interface TestRunOptions extends OperationOptions { +export interface TestRunOptionalParams extends OperationOptions { contentType?: string; oldTestRunId?: string; updateIntervalInMs?: number; @@ -840,8 +848,8 @@ export interface TestServerMetricConfig { readonly testId?: string; } -// @public -export type TimeGrain = string; +// @public (undocumented) +export type TimeGrain = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; // @public export interface TimeSeriesElement { @@ -850,7 +858,7 @@ export interface TimeSeriesElement { } // @public (undocumented) -export interface UploadTestFileOptions extends OperationOptions { +export interface UploadTestFileOptionalParams extends OperationOptions { // (undocumented) contentType?: string; fileType?: FileType; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/AdministrationOperationsClient.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/administrationOperationsClient.ts similarity index 74% rename from packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/AdministrationOperationsClient.ts rename to packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/administrationOperationsClient.ts index f8ddddb5e0..b83a0d4a29 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/AdministrationOperationsClient.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/administrationOperationsClient.ts @@ -10,18 +10,18 @@ import { TestServerMetricConfig, } from "./models/models.js"; import { - CreateOrUpdateTestOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestOptions, - GetTestFileOptions, - ListTestFilesOptions, - ListTestsOptions, - UploadTestFileOptions, - DeleteTestFileOptions, - DeleteTestOptions, + CreateOrUpdateTestOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestOptionalParams, + GetTestFileOptionalParams, + ListTestFilesOptionalParams, + ListTestsOptionalParams, + UploadTestFileOptionalParams, + DeleteTestFileOptionalParams, + DeleteTestOptionalParams, } from "./models/options.js"; import { PagedAsyncIterableIterator } from "./models/pagingTypes.js"; import { @@ -42,7 +42,7 @@ import { deleteTest, } from "./api/index.js"; -export { AdministrationOperationsClientOptions } from "./api/AdministrationOperationsContext.js"; +export { AdministrationOperationsClientOptions } from "./api/administrationOperationsContext.js"; export class AdministrationOperationsClient { private _client: AzureLoadTestingContext; @@ -50,12 +50,12 @@ export class AdministrationOperationsClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, + endpointParam: string, credential: TokenCredential, options: AdministrationOperationsClientOptions = {}, ) { this._client = createAdministrationOperations( - endpoint, + endpointParam, credential, options, ); @@ -66,7 +66,7 @@ export class AdministrationOperationsClient { createOrUpdateTest( testId: string, body: Test, - options: CreateOrUpdateTestOptions = { requestOptions: {} }, + options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, ): Promise { return createOrUpdateTest(this._client, testId, body, options); } @@ -75,7 +75,7 @@ export class AdministrationOperationsClient { createOrUpdateAppComponents( testId: string, body: TestAppComponents, - options: CreateOrUpdateAppComponentsOptions = { requestOptions: {} }, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { return createOrUpdateAppComponents(this._client, testId, body, options); } @@ -84,7 +84,9 @@ export class AdministrationOperationsClient { createOrUpdateServerMetricsConfig( testId: string, body: TestServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptions = { requestOptions: {} }, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): Promise { return createOrUpdateServerMetricsConfig( this._client, @@ -97,7 +99,7 @@ export class AdministrationOperationsClient { /** Get associated app component (collection of azure resources) for the given test. */ getAppComponents( testId: string, - options: GetAppComponentsOptions = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { return getAppComponents(this._client, testId, options); } @@ -105,7 +107,7 @@ export class AdministrationOperationsClient { /** List server metrics configuration for the given test. */ getServerMetricsConfig( testId: string, - options: GetServerMetricsConfigOptions = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): Promise { return getServerMetricsConfig(this._client, testId, options); } @@ -113,7 +115,7 @@ export class AdministrationOperationsClient { /** Get load test details by test name */ getTest( testId: string, - options: GetTestOptions = { requestOptions: {} }, + options: GetTestOptionalParams = { requestOptions: {} }, ): Promise { return getTest(this._client, testId, options); } @@ -122,7 +124,7 @@ export class AdministrationOperationsClient { getTestFile( testId: string, fileName: string, - options: GetTestFileOptions = { requestOptions: {} }, + options: GetTestFileOptionalParams = { requestOptions: {} }, ): Promise { return getTestFile(this._client, testId, fileName, options); } @@ -130,7 +132,7 @@ export class AdministrationOperationsClient { /** Get all test files. */ listTestFiles( testId: string, - options: ListTestFilesOptions = { requestOptions: {} }, + options: ListTestFilesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTestFiles(this._client, testId, options); } @@ -140,7 +142,7 @@ export class AdministrationOperationsClient { * subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}. */ listTests( - options: ListTestsOptions = { requestOptions: {} }, + options: ListTestsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTests(this._client, options); } @@ -154,7 +156,7 @@ export class AdministrationOperationsClient { testId: string, fileName: string, body: Uint8Array, - options: UploadTestFileOptions = { requestOptions: {} }, + options: UploadTestFileOptionalParams = { requestOptions: {} }, ): Promise { return uploadTestFile(this._client, testId, fileName, body, options); } @@ -163,7 +165,7 @@ export class AdministrationOperationsClient { deleteTestFile( testId: string, fileName: string, - options: DeleteTestFileOptions = { requestOptions: {} }, + options: DeleteTestFileOptionalParams = { requestOptions: {} }, ): Promise { return deleteTestFile(this._client, testId, fileName, options); } @@ -171,7 +173,7 @@ export class AdministrationOperationsClient { /** Delete a test by its name. */ deleteTest( testId: string, - options: DeleteTestOptions = { requestOptions: {} }, + options: DeleteTestOptionalParams = { requestOptions: {} }, ): Promise { return deleteTest(this._client, testId, options); } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/AdministrationOperationsContext.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/administrationOperationsContext.ts similarity index 76% rename from packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/AdministrationOperationsContext.ts rename to packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/administrationOperationsContext.ts index 93164ec9a2..b4a3f0c5d7 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/AdministrationOperationsContext.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/administrationOperationsContext.ts @@ -6,15 +6,18 @@ import { ClientOptions } from "@azure-rest/core-client"; import { AzureLoadTestingContext } from "../../rest/index.js"; import getClient from "../../rest/index.js"; -export interface AdministrationOperationsClientOptions extends ClientOptions {} +export interface AdministrationOperationsClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { AzureLoadTestingContext } from "../../rest/index.js"; export function createAdministrationOperations( - endpoint: string, + endpointParam: string, credential: TokenCredential, options: AdministrationOperationsClientOptions = {}, ): AzureLoadTestingContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/index.ts index c595507a92..f7564cbffd 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/index.ts @@ -5,7 +5,7 @@ export { createAdministrationOperations, AdministrationOperationsClientOptions, AzureLoadTestingContext, -} from "./AdministrationOperationsContext.js"; +} from "./administrationOperationsContext.js"; export { createOrUpdateTest, createOrUpdateAppComponents, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/operations.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/operations.ts index 373bded230..3384c98052 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/operations.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/api/operations.ts @@ -48,25 +48,25 @@ import { createRestError, } from "@azure-rest/core-client"; import { - CreateOrUpdateTestOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestOptions, - GetTestFileOptions, - ListTestFilesOptions, - ListTestsOptions, - UploadTestFileOptions, - DeleteTestFileOptions, - DeleteTestOptions, + CreateOrUpdateTestOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestOptionalParams, + GetTestFileOptionalParams, + ListTestFilesOptionalParams, + ListTestsOptionalParams, + UploadTestFileOptionalParams, + DeleteTestFileOptionalParams, + DeleteTestOptionalParams, } from "../models/options.js"; export function _createOrUpdateTestSend( context: Client, testId: string, body: Test, - options: CreateOrUpdateTestOptions = { requestOptions: {} }, + options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationCreateOrUpdateTest200Response | LoadTestAdministrationCreateOrUpdateTest201Response @@ -304,7 +304,7 @@ export async function createOrUpdateTest( context: Client, testId: string, body: Test, - options: CreateOrUpdateTestOptions = { requestOptions: {} }, + options: CreateOrUpdateTestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createOrUpdateTestSend(context, testId, body, options); return _createOrUpdateTestDeserialize(result); @@ -314,7 +314,7 @@ export function _createOrUpdateAppComponentsSend( context: Client, testId: string, body: TestAppComponents, - options: CreateOrUpdateAppComponentsOptions = { requestOptions: {} }, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationCreateOrUpdateAppComponents200Response | LoadTestAdministrationCreateOrUpdateAppComponents201Response @@ -355,7 +355,7 @@ export async function createOrUpdateAppComponents( context: Client, testId: string, body: TestAppComponents, - options: CreateOrUpdateAppComponentsOptions = { requestOptions: {} }, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createOrUpdateAppComponentsSend( context, @@ -370,7 +370,9 @@ export function _createOrUpdateServerMetricsConfigSend( context: Client, testId: string, body: TestServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptions = { requestOptions: {} }, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< | LoadTestAdministrationCreateOrUpdateServerMetricsConfig200Response | LoadTestAdministrationCreateOrUpdateServerMetricsConfig201Response @@ -411,7 +413,9 @@ export async function createOrUpdateServerMetricsConfig( context: Client, testId: string, body: TestServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptions = { requestOptions: {} }, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _createOrUpdateServerMetricsConfigSend( context, @@ -425,7 +429,7 @@ export async function createOrUpdateServerMetricsConfig( export function _getAppComponentsSend( context: Client, testId: string, - options: GetAppComponentsOptions = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationGetAppComponents200Response | LoadTestAdministrationGetAppComponentsDefaultResponse @@ -458,7 +462,7 @@ export async function _getAppComponentsDeserialize( export async function getAppComponents( context: Client, testId: string, - options: GetAppComponentsOptions = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getAppComponentsSend(context, testId, options); return _getAppComponentsDeserialize(result); @@ -467,7 +471,7 @@ export async function getAppComponents( export function _getServerMetricsConfigSend( context: Client, testId: string, - options: GetServerMetricsConfigOptions = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationGetServerMetricsConfig200Response | LoadTestAdministrationGetServerMetricsConfigDefaultResponse @@ -500,7 +504,7 @@ export async function _getServerMetricsConfigDeserialize( export async function getServerMetricsConfig( context: Client, testId: string, - options: GetServerMetricsConfigOptions = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getServerMetricsConfigSend(context, testId, options); return _getServerMetricsConfigDeserialize(result); @@ -509,7 +513,7 @@ export async function getServerMetricsConfig( export function _getTestSend( context: Client, testId: string, - options: GetTestOptions = { requestOptions: {} }, + options: GetTestOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationGetTest200Response | LoadTestAdministrationGetTestDefaultResponse @@ -693,7 +697,7 @@ export async function _getTestDeserialize( export async function getTest( context: Client, testId: string, - options: GetTestOptions = { requestOptions: {} }, + options: GetTestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTestSend(context, testId, options); return _getTestDeserialize(result); @@ -703,7 +707,7 @@ export function _getTestFileSend( context: Client, testId: string, fileName: string, - options: GetTestFileOptions = { requestOptions: {} }, + options: GetTestFileOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationGetTestFile200Response | LoadTestAdministrationGetTestFileDefaultResponse @@ -737,7 +741,7 @@ export async function getTestFile( context: Client, testId: string, fileName: string, - options: GetTestFileOptions = { requestOptions: {} }, + options: GetTestFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTestFileSend(context, testId, fileName, options); return _getTestFileDeserialize(result); @@ -746,7 +750,7 @@ export async function getTestFile( export function _listTestFilesSend( context: Client, testId: string, - options: ListTestFilesOptions = { requestOptions: {} }, + options: ListTestFilesOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationListTestFiles200Response | LoadTestAdministrationListTestFilesDefaultResponse @@ -782,7 +786,7 @@ export async function _listTestFilesDeserialize( export function listTestFiles( context: Client, testId: string, - options: ListTestFilesOptions = { requestOptions: {} }, + options: ListTestFilesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -794,7 +798,7 @@ export function listTestFiles( export function _listTestsSend( context: Client, - options: ListTestsOptions = { requestOptions: {} }, + options: ListTestsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationListTests200Response | LoadTestAdministrationListTestsDefaultResponse @@ -967,7 +971,7 @@ export async function _listTestsDeserialize( */ export function listTests( context: Client, - options: ListTestsOptions = { requestOptions: {} }, + options: ListTestsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -982,7 +986,7 @@ export function _uploadTestFileSend( testId: string, fileName: string, body: Uint8Array, - options: UploadTestFileOptions = { requestOptions: {} }, + options: UploadTestFileOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationUploadTestFile201Response | LoadTestAdministrationUploadTestFileDefaultResponse @@ -1026,7 +1030,7 @@ export async function uploadTestFile( testId: string, fileName: string, body: Uint8Array, - options: UploadTestFileOptions = { requestOptions: {} }, + options: UploadTestFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _uploadTestFileSend( context, @@ -1042,7 +1046,7 @@ export function _deleteTestFileSend( context: Client, testId: string, fileName: string, - options: DeleteTestFileOptions = { requestOptions: {} }, + options: DeleteTestFileOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationDeleteTestFile204Response | LoadTestAdministrationDeleteTestFileDefaultResponse @@ -1069,7 +1073,7 @@ export async function deleteTestFile( context: Client, testId: string, fileName: string, - options: DeleteTestFileOptions = { requestOptions: {} }, + options: DeleteTestFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteTestFileSend(context, testId, fileName, options); return _deleteTestFileDeserialize(result); @@ -1078,7 +1082,7 @@ export async function deleteTestFile( export function _deleteTestSend( context: Client, testId: string, - options: DeleteTestOptions = { requestOptions: {} }, + options: DeleteTestOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestAdministrationDeleteTest204Response | LoadTestAdministrationDeleteTestDefaultResponse @@ -1104,7 +1108,7 @@ export async function _deleteTestDeserialize( export async function deleteTest( context: Client, testId: string, - options: DeleteTestOptions = { requestOptions: {} }, + options: DeleteTestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteTestSend(context, testId, options); return _deleteTestDeserialize(result); diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts index 4571b8fcce..af351a3c5a 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/index.ts @@ -4,7 +4,7 @@ export { AdministrationOperationsClient, AdministrationOperationsClientOptions, -} from "./AdministrationOperationsClient.js"; +} from "./administrationOperationsClient.js"; export { Test, PassFailCriteria, @@ -29,6 +29,7 @@ export { ResourceMetric, PagedFileInfo, PagedTest, + APIVersions, TestRun, ErrorDetails, TestRunStatistics, @@ -37,6 +38,8 @@ export { TestRunOutputArtifacts, PFTestResult, Status, + Interval, + DimensionValueList, MetricDefinition, NameAndDesc, AggregationType, @@ -48,20 +51,18 @@ export { TimeSeriesElement, MetricValue, DimensionValue, - Interval, - DimensionValueList, - CreateOrUpdateTestOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestOptions, - GetTestFileOptions, - ListTestFilesOptions, - ListTestsOptions, - UploadTestFileOptions, - DeleteTestFileOptions, - DeleteTestOptions, + CreateOrUpdateTestOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestOptionalParams, + GetTestFileOptionalParams, + ListTestFilesOptionalParams, + ListTestsOptionalParams, + UploadTestFileOptionalParams, + DeleteTestFileOptionalParams, + DeleteTestOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts index aacefc44c6..f4d3f6c5d1 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/index.ts @@ -25,6 +25,7 @@ export { ResourceMetric, PagedFileInfo, PagedTest, + APIVersions, TestRun, ErrorDetails, TestRunStatistics, @@ -33,6 +34,8 @@ export { TestRunOutputArtifacts, PFTestResult, Status, + Interval, + DimensionValueList, MetricDefinition, NameAndDesc, AggregationType, @@ -44,22 +47,20 @@ export { TimeSeriesElement, MetricValue, DimensionValue, - Interval, - DimensionValueList, } from "./models.js"; export { - CreateOrUpdateTestOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestOptions, - GetTestFileOptions, - ListTestFilesOptions, - ListTestsOptions, - UploadTestFileOptions, - DeleteTestFileOptions, - DeleteTestOptions, + CreateOrUpdateTestOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestOptionalParams, + GetTestFileOptionalParams, + ListTestFilesOptionalParams, + ListTestsOptionalParams, + UploadTestFileOptionalParams, + DeleteTestFileOptionalParams, + DeleteTestOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts index a4a04dc153..71100691e3 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/models.ts @@ -77,14 +77,28 @@ export interface PassFailMetric { readonly result?: PFResult; } -/** "response_time_ms", "latency", "error", "requests", "requests_per_sec" */ -export type PFMetrics = string; -/** "count", "percentage", "avg", "p50", "p90", "p95", "p99", "min", "max" */ -export type PFAgFunc = string; -/** "continue", "stop" */ -export type PFAction = string; -/** "passed", "undetermined", "failed" */ -export type PFResult = string; +/** */ +export type PFMetrics = + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; +/** */ +export type PFAgFunc = + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; +/** */ +export type PFAction = "continue" | "stop"; +/** */ +export type PFResult = "passed" | "undetermined" | "failed"; /** Secret */ export interface Secret { @@ -94,8 +108,8 @@ export interface Secret { type?: SecretType; } -/** "AKV_SECRET_URI", "SECRET_VALUE" */ -export type SecretType = string; +/** */ +export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; /** Certificates metadata */ export interface CertificateMetadata { @@ -107,8 +121,8 @@ export interface CertificateMetadata { name?: string; } -/** "AKV_CERT_URI" */ -export type CertificateType = string; +/** */ +export type CertificateType = "AKV_CERT_URI"; /** The load test configuration. */ export interface LoadTestConfiguration { @@ -178,10 +192,15 @@ export interface FileInfo { validationFailureDetails?: string; } -/** "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" */ -export type FileType = string; -/** "NOT_VALIDATED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", "VALIDATION_NOT_REQUIRED" */ -export type FileStatus = string; +/** */ +export type FileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +/** */ +export type FileStatus = + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; /** Test app component */ export interface TestAppComponents { @@ -276,7 +295,7 @@ export interface PagedFileInfo { /** The FileInfo items on this page */ value: FileInfo[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } /** Collection of tests */ @@ -284,9 +303,12 @@ export interface PagedTest { /** The Test items on this page */ value: Test[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } +/** */ +export type APIVersions = "2022-11-01"; + /** Load test run model */ export interface TestRun { /** Unique test run name as identifier */ @@ -415,10 +437,32 @@ export interface TestRunOutputArtifacts { logsFileInfo?: FileInfo; } -/** "PASSED", "NOT_APPLICABLE", "FAILED" */ -export type PFTestResult = string; -/** "ACCEPTED", "NOTSTARTED", "PROVISIONING", "PROVISIONED", "CONFIGURING", "CONFIGURED", "EXECUTING", "EXECUTED", "DEPROVISIONING", "DEPROVISIONED", "DONE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE" */ -export type Status = string; +/** */ +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** */ +export type Status = + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; +/** */ +export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; + +export interface DimensionValueList { + value: string[]; +} /** Metric definition */ export interface MetricDefinition { @@ -451,10 +495,25 @@ export interface NameAndDesc { name?: string; } -/** "Average", "Count", "None", "Total", "Percentile90", "Percentile95", "Percentile99" */ -export type AggregationType = string; -/** "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond" */ -export type MetricUnit = string; +/** */ +export type AggregationType = + | "Average" + | "Count" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; +/** */ +export type MetricUnit = + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; /** Metric availability specifies the time grain (aggregation interval or frequency) */ export interface MetricAvailability { @@ -465,8 +524,8 @@ export interface MetricAvailability { timeGrain?: TimeGrain; } -/** "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" */ -export type TimeGrain = string; +/** */ +export type TimeGrain = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; /** Metric namespace class specifies the metadata for a metric namespace. */ export interface MetricNamespace { @@ -507,10 +566,3 @@ export interface DimensionValue { /** The value of the dimension. */ value?: string; } - -/** "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" */ -export type Interval = string; - -export interface DimensionValueList { - value: string[]; -} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/options.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/options.ts index 92f797e4dd..17e195ddcf 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/options.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/administrationOperations/models/options.ts @@ -4,30 +4,32 @@ import { OperationOptions } from "@azure-rest/core-client"; import { FileType } from "./models.js"; -export interface CreateOrUpdateTestOptions extends OperationOptions { +export interface CreateOrUpdateTestOptionalParams extends OperationOptions { contentType?: string; } -export interface CreateOrUpdateAppComponentsOptions extends OperationOptions { +export interface CreateOrUpdateAppComponentsOptionalParams + extends OperationOptions { contentType?: string; } -export interface CreateOrUpdateServerMetricsConfigOptions +export interface CreateOrUpdateServerMetricsConfigOptionalParams extends OperationOptions { contentType?: string; } -export interface GetAppComponentsOptions extends OperationOptions {} +export interface GetAppComponentsOptionalParams extends OperationOptions {} -export interface GetServerMetricsConfigOptions extends OperationOptions {} +export interface GetServerMetricsConfigOptionalParams + extends OperationOptions {} -export interface GetTestOptions extends OperationOptions {} +export interface GetTestOptionalParams extends OperationOptions {} -export interface GetTestFileOptions extends OperationOptions {} +export interface GetTestFileOptionalParams extends OperationOptions {} -export interface ListTestFilesOptions extends OperationOptions {} +export interface ListTestFilesOptionalParams extends OperationOptions {} -export interface ListTestsOptions extends OperationOptions { +export interface ListTestsOptionalParams extends OperationOptions { /** * Sort on the supported fields in (field asc/desc) format. eg: * lastModifiedDateTime asc. Supported fields - lastModifiedDateTime @@ -53,12 +55,12 @@ export interface ListTestsOptions extends OperationOptions { maxpagesize?: number; } -export interface UploadTestFileOptions extends OperationOptions { +export interface UploadTestFileOptionalParams extends OperationOptions { contentType?: string; /** File type */ fileType?: FileType; } -export interface DeleteTestFileOptions extends OperationOptions {} +export interface DeleteTestFileOptionalParams extends OperationOptions {} -export interface DeleteTestOptions extends OperationOptions {} +export interface DeleteTestOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts index 9fb1e82db0..121182be3f 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/index.ts @@ -4,7 +4,7 @@ export { AdministrationOperationsClient, AdministrationOperationsClientOptions, -} from "./administrationOperations/AdministrationOperationsClient.js"; +} from "./administrationOperations/administrationOperationsClient.js"; export { Test, PassFailCriteria, @@ -29,6 +29,7 @@ export { ResourceMetric, PagedFileInfo, PagedTest, + APIVersions, TestRun, ErrorDetails, TestRunStatistics, @@ -37,6 +38,8 @@ export { TestRunOutputArtifacts, PFTestResult, Status, + Interval, + DimensionValueList, MetricDefinition, NameAndDesc, AggregationType, @@ -48,20 +51,18 @@ export { TimeSeriesElement, MetricValue, DimensionValue, - Interval, - DimensionValueList, - CreateOrUpdateTestOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestOptions, - GetTestFileOptions, - ListTestFilesOptions, - ListTestsOptions, - UploadTestFileOptions, - DeleteTestFileOptions, - DeleteTestOptions, + CreateOrUpdateTestOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestOptionalParams, + GetTestFileOptionalParams, + ListTestFilesOptionalParams, + ListTestsOptionalParams, + UploadTestFileOptionalParams, + DeleteTestFileOptionalParams, + DeleteTestOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, @@ -69,7 +70,7 @@ export { export { TestRunOperationsClient, TestRunOperationsClientOptions, -} from "./testRunOperations/TestRunOperationsClient.js"; +} from "./testRunOperations/testRunOperationsClient.js"; export { restorePoller, RestorePollerOptions, @@ -94,6 +95,7 @@ export { FileStatus as TestRunOperationsClientFileStatus, AppComponent as TestRunOperationsClientAppComponent, ResourceMetric as TestRunOperationsClientResourceMetric, + APIVersions as TestRunOperationsClientAPIVersions, TestRun as TestRunOperationsClientTestRun, ErrorDetails as TestRunOperationsClientErrorDetails, TestRunStatistics as TestRunOperationsClientTestRunStatistics, @@ -102,6 +104,8 @@ export { TestRunOutputArtifacts as TestRunOperationsClientTestRunOutputArtifacts, PFTestResult as TestRunOperationsClientPFTestResult, Status as TestRunOperationsClientStatus, + Interval as TestRunOperationsClientInterval, + DimensionValueList as TestRunOperationsClientDimensionValueList, MetricDefinition as TestRunOperationsClientMetricDefinition, NameAndDesc as TestRunOperationsClientNameAndDesc, AggregationType as TestRunOperationsClientAggregationType, @@ -113,22 +117,20 @@ export { TimeSeriesElement as TestRunOperationsClientTimeSeriesElement, MetricValue as TestRunOperationsClientMetricValue, DimensionValue as TestRunOperationsClientDimensionValue, - Interval as TestRunOperationsClientInterval, - DimensionValueList as TestRunOperationsClientDimensionValueList, - TestRunOptions, - CreateOrUpdateAppComponentsOptions as TestRunOperationsClientCreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions as TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptions, - DeleteTestRunOptions, - GetAppComponentsOptions as TestRunOperationsClientGetAppComponentsOptions, - GetServerMetricsConfigOptions as TestRunOperationsClientGetServerMetricsConfigOptions, - GetTestRunOptions, - GetTestRunFileOptions, - ListMetricDimensionValuesOptions, - ListMetricDefinitionsOptions, - ListMetricNamespacesOptions, - ListMetricsOptions, - ListTestRunsOptions, - StopTestRunOptions, + TestRunOptionalParams, + CreateOrUpdateAppComponentsOptionalParams as TestRunOperationsClientCreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams as TestRunOperationsClientCreateOrUpdateServerMetricsConfigOptionalParams, + DeleteTestRunOptionalParams, + GetAppComponentsOptionalParams as TestRunOperationsClientGetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams as TestRunOperationsClientGetServerMetricsConfigOptionalParams, + GetTestRunOptionalParams, + GetTestRunFileOptionalParams, + ListMetricDimensionValuesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricsOptionalParams, + ListTestRunsOptionalParams, + StopTestRunOptionalParams, PageSettings as TestRunOperationsClientPageSettings, ContinuablePage as TestRunOperationsClientContinuablePage, PagedAsyncIterableIterator as TestRunOperationsClientPagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/models.ts index f316e9a168..a102d07cb8 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/models.ts @@ -39,21 +39,15 @@ export interface PassFailCriteria { /** Pass fail metric */ export interface PassFailMetric { - /** - * The client metric on which the criteria should be applied. - * - * Possible values: "response_time_ms", "latency", "error", "requests", "requests_per_sec" - */ - clientMetric?: string; + /** The client metric on which the criteria should be applied. */ + clientMetric?: PFMetrics; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests - * - * Possible values: "count", "percentage", "avg", "p50", "p90", "p95", "p99", "min", "max" */ - aggregate?: string; + aggregate?: PFAgFunc; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -63,36 +57,24 @@ export interface PassFailMetric { * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. */ value?: number; - /** - * Action taken after the threshold is met. Default is ‘continue’. - * - * Possible values: "continue", "stop" - */ - action?: string; + /** Action taken after the threshold is met. Default is ‘continue’. */ + action?: PFAction; } /** Secret */ export interface Secret { /** The value of the secret for the respective type */ value?: string; - /** - * Type of secret - * - * Possible values: "AKV_SECRET_URI", "SECRET_VALUE" - */ - type?: string; + /** Type of secret */ + type?: SecretType; } /** Certificates metadata */ export interface CertificateMetadata { /** The value of the certificate for respective type */ value?: string; - /** - * Type of certificate - * - * Possible values: "AKV_CERT_URI" - */ - type?: string; + /** Type of certificate */ + type?: CertificateType; /** Name of the certificate. */ name?: string; } @@ -153,20 +135,12 @@ export interface FileInfo { url?: string; /** Name of the file. */ fileName?: string; - /** - * File type - * - * Possible values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" - */ - fileType?: string; + /** File type */ + fileType?: FileType; /** Expiry time of the file (ISO 8601 literal format) */ expireDateTime?: string; - /** - * Validation status of the file - * - * Possible values: "NOT_VALIDATED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", "VALIDATION_NOT_REQUIRED" - */ - validationStatus?: string; + /** Validation status of the file */ + validationStatus?: FileStatus; /** Validation failure error details */ validationFailureDetails?: string; } @@ -324,3 +298,61 @@ export interface TestRunServerMetricConfig { */ metrics?: Record; } + +/** Alias for PFMetrics */ +export type PFMetrics = + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; +/** Alias for PFAgFunc */ +export type PFAgFunc = + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; +/** Alias for PFAction */ +export type PFAction = "continue" | "stop"; +/** Alias for PFResult */ +export type PFResult = "passed" | "undetermined" | "failed"; +/** Alias for SecretType */ +export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; +/** Alias for CertificateType */ +export type CertificateType = "AKV_CERT_URI"; +/** Alias for FileType */ +export type FileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +/** Alias for FileStatus */ +export type FileStatus = + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; +/** Alias for PFTestResult */ +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for Status */ +export type Status = + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; +/** Alias for Interval */ +export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/outputModels.ts index 0cc2eb2a69..392e850e81 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/outputModels.ts @@ -53,21 +53,15 @@ export interface PassFailCriteriaOutput { /** Pass fail metric */ export interface PassFailMetricOutput { - /** - * The client metric on which the criteria should be applied. - * - * Possible values: "response_time_ms", "latency", "error", "requests", "requests_per_sec" - */ - clientMetric?: string; + /** The client metric on which the criteria should be applied. */ + clientMetric?: PFMetricsOutput; /** * The aggregation function to be applied on the client metric. Allowed functions * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests - * - * Possible values: "count", "percentage", "avg", "p50", "p90", "p95", "p99", "min", "max" */ - aggregate?: string; + aggregate?: PFAgFuncOutput; /** The comparison operator. Supported types ‘>’, ‘<’ */ condition?: string; /** Request name for which the Pass fail criteria has to be applied */ @@ -77,44 +71,28 @@ export interface PassFailMetricOutput { * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. */ value?: number; - /** - * Action taken after the threshold is met. Default is ‘continue’. - * - * Possible values: "continue", "stop" - */ - action?: string; + /** Action taken after the threshold is met. Default is ‘continue’. */ + action?: PFActionOutput; /** The actual value of the client metric for the test run. */ readonly actualValue?: number; - /** - * Outcome of the test run. - * - * Possible values: "passed", "undetermined", "failed" - */ - readonly result?: string; + /** Outcome of the test run. */ + readonly result?: PFResultOutput; } /** Secret */ export interface SecretOutput { /** The value of the secret for the respective type */ value?: string; - /** - * Type of secret - * - * Possible values: "AKV_SECRET_URI", "SECRET_VALUE" - */ - type?: string; + /** Type of secret */ + type?: SecretTypeOutput; } /** Certificates metadata */ export interface CertificateMetadataOutput { /** The value of the certificate for respective type */ value?: string; - /** - * Type of certificate - * - * Possible values: "AKV_CERT_URI" - */ - type?: string; + /** Type of certificate */ + type?: CertificateTypeOutput; /** Name of the certificate. */ name?: string; } @@ -177,20 +155,12 @@ export interface FileInfoOutput { url?: string; /** Name of the file. */ fileName?: string; - /** - * File type - * - * Possible values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" - */ - fileType?: string; + /** File type */ + fileType?: FileTypeOutput; /** Expiry time of the file (ISO 8601 literal format) */ expireDateTime?: string; - /** - * Validation status of the file - * - * Possible values: "NOT_VALIDATED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", "VALIDATION_NOT_REQUIRED" - */ - validationStatus?: string; + /** Validation status of the file */ + validationStatus?: FileStatusOutput; /** Validation failure error details */ validationFailureDetails?: string; } @@ -309,12 +279,8 @@ export interface TestRunOutput { loadTestConfiguration?: LoadTestConfigurationOutput; /** Collection of test run artifacts */ readonly testArtifacts?: TestRunArtifactsOutput; - /** - * Test result for pass/Fail criteria used during the test run. - * - * Possible values: "PASSED", "NOT_APPLICABLE", "FAILED" - */ - readonly testResult?: string; + /** Test result for pass/Fail criteria used during the test run. */ + readonly testResult?: PFTestResultOutput; /** Number of virtual users, for which test has been run. */ readonly virtualUsers?: number; /** Display name of a testRun. */ @@ -323,12 +289,8 @@ export interface TestRunOutput { testId?: string; /** The test run description. */ description?: string; - /** - * The test run status. - * - * Possible values: "ACCEPTED", "NOTSTARTED", "PROVISIONING", "PROVISIONED", "CONFIGURING", "CONFIGURED", "EXECUTING", "EXECUTED", "DEPROVISIONING", "DEPROVISIONED", "DONE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE" - */ - readonly status?: string; + /** The test run status. */ + readonly status?: StatusOutput; /** The test run start DateTime(ISO 8601 literal format). */ readonly startDateTime?: string; /** The test run end DateTime(ISO 8601 literal format). */ @@ -449,20 +411,12 @@ export interface MetricDefinitionOutput { name?: string; /** The namespace the metric belongs to. */ namespace?: string; - /** - * The primary aggregation type value defining how to use the values for display. - * - * Possible values: "Average", "Count", "None", "Total", "Percentile90", "Percentile95", "Percentile99" - */ - primaryAggregationType?: string; + /** The primary aggregation type value defining how to use the values for display. */ + primaryAggregationType?: AggregationTypeOutput; /** The collection of what all aggregation types are supported. */ supportedAggregationTypes?: string[]; - /** - * The unit of the metric. - * - * Possible values: "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond" - */ - unit?: string; + /** The unit of the metric. */ + unit?: MetricUnitOutput; /** * Metric availability specifies the time grain (aggregation interval or * frequency). @@ -483,10 +437,8 @@ export interface MetricAvailabilityOutput { /** * The time grain specifies the aggregation interval for the metric. Expressed as * a duration 'PT1M', 'PT1H', etc. - * - * Possible values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" */ - timeGrain?: string; + timeGrain?: TimeGrainOutput; } /** The time series returned when a data query is performed. */ @@ -557,12 +509,91 @@ export interface TestRunServerMetricConfigOutput { readonly lastModifiedBy?: string; } +/** Alias for PFMetricsOutput */ +export type PFMetricsOutput = + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; +/** Alias for PFAgFuncOutput */ +export type PFAgFuncOutput = + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; +/** Alias for PFActionOutput */ +export type PFActionOutput = "continue" | "stop"; +/** Alias for PFResultOutput */ +export type PFResultOutput = "passed" | "undetermined" | "failed"; +/** Alias for SecretTypeOutput */ +export type SecretTypeOutput = "AKV_SECRET_URI" | "SECRET_VALUE"; +/** Alias for CertificateTypeOutput */ +export type CertificateTypeOutput = "AKV_CERT_URI"; +/** Alias for FileTypeOutput */ +export type FileTypeOutput = + | "JMX_FILE" + | "USER_PROPERTIES" + | "ADDITIONAL_ARTIFACTS"; +/** Alias for FileStatusOutput */ +export type FileStatusOutput = + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; /** Collection of tests */ export type PagedTestOutput = Paged; /** Collection of files. */ export type PagedFileInfoOutput = Paged; +/** Alias for PFTestResultOutput */ +export type PFTestResultOutput = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** Alias for StatusOutput */ +export type StatusOutput = + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; /** Collection of test runs */ export type PagedTestRunOutput = Paged; +/** Alias for AggregationTypeOutput */ +export type AggregationTypeOutput = + | "Average" + | "Count" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; +/** Alias for MetricUnitOutput */ +export type MetricUnitOutput = + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; +/** Alias for TimeGrainOutput */ +export type TimeGrainOutput = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; /** The response to a metrics query. */ export type PagedTimeSeriesElementOutput = Paged; /** Paged collection of DimensionValueList items */ diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/parameters.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/parameters.ts index 606f61de95..9437426616 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/parameters.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/rest/parameters.ts @@ -4,9 +4,11 @@ import { RequestParameters } from "@azure-rest/core-client"; import { Test, + FileType, TestAppComponents, TestServerMetricConfig, TestRun, + Interval, MetricRequestPayload, TestRunAppComponents, TestRunServerMetricConfig, @@ -78,12 +80,8 @@ export interface LoadTestAdministrationUploadTestFileBodyParam { } export interface LoadTestAdministrationUploadTestFileQueryParamProperties { - /** - * File type - * - * Possible values: "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" - */ - fileType?: string; + /** File type */ + fileType?: FileType; } export interface LoadTestAdministrationUploadTestFileQueryParam { @@ -228,12 +226,8 @@ export interface LoadTestRunListMetricsBodyParam { export interface LoadTestRunListMetricsQueryParamProperties { /** The aggregation */ aggregation?: string; - /** - * The interval (i.e. timegrain) of the query. - * - * Possible values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" - */ - interval?: string; + /** The interval (i.e. timegrain) of the query. */ + interval?: Interval; /** Metric name */ metricName?: string; /** Metric namespace to query metric definitions for. */ @@ -255,12 +249,8 @@ export type LoadTestRunListMetricsParameters = RequestParameters; export interface LoadTestRunListMetricDimensionValuesQueryParamProperties { - /** - * The interval (i.e. timegrain) of the query. - * - * Possible values: "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" - */ - interval?: string; + /** The interval (i.e. timegrain) of the query. */ + interval?: Interval; /** Metric name */ metricName?: string; /** Metric namespace to query metric definitions for. */ diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/index.ts index 2be167da7a..53a26b11df 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/index.ts @@ -21,4 +21,4 @@ export { createTestRunOperations, TestRunOperationsClientOptions, AzureLoadTestingContext, -} from "./TestRunOperationsContext.js"; +} from "./testRunOperationsContext.js"; diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/operations.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/operations.ts index 1270b0fb50..5771618dc5 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/operations.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/operations.ts @@ -8,6 +8,7 @@ import { TestRun, TestRunAppComponents, TestRunServerMetricConfig, + DimensionValueList, MetricDefinitionCollection, MetricNamespaceCollection, MetricRequestPayload, @@ -15,7 +16,6 @@ import { TimeSeriesElement, PagedTestRun, PagedDimensionValueList, - DimensionValueList, } from "../models/models.js"; import { PagedAsyncIterableIterator } from "../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "./pagingHelpers.js"; @@ -61,27 +61,27 @@ import { createRestError, } from "@azure-rest/core-client"; import { - TestRunOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - DeleteTestRunOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestRunOptions, - GetTestRunFileOptions, - ListMetricDimensionValuesOptions, - ListMetricDefinitionsOptions, - ListMetricNamespacesOptions, - ListMetricsOptions, - ListTestRunsOptions, - StopTestRunOptions, + TestRunOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + DeleteTestRunOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestRunOptionalParams, + GetTestRunFileOptionalParams, + ListMetricDimensionValuesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricsOptionalParams, + ListTestRunsOptionalParams, + StopTestRunOptionalParams, } from "../models/options.js"; export function _testRunSend( context: Client, testRunId: string, resource: TestRun, - options: TestRunOptions = { requestOptions: {} }, + options: TestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunCreateOrUpdateTestRun200Response | LoadTestRunCreateOrUpdateTestRun201Response @@ -392,7 +392,7 @@ export function testRun( context: Client, testRunId: string, resource: TestRun, - options: TestRunOptions = { requestOptions: {} }, + options: TestRunOptionalParams = { requestOptions: {} }, ): PollerLike, TestRun> { return getLongRunningPoller(context, _testRunDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, @@ -406,7 +406,7 @@ export function _createOrUpdateAppComponentsSend( context: Client, testRunId: string, body: TestRunAppComponents, - options: CreateOrUpdateAppComponentsOptions = { requestOptions: {} }, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunCreateOrUpdateAppComponents200Response | LoadTestRunCreateOrUpdateAppComponents201Response @@ -447,7 +447,7 @@ export async function createOrUpdateAppComponents( context: Client, testRunId: string, body: TestRunAppComponents, - options: CreateOrUpdateAppComponentsOptions = { requestOptions: {} }, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createOrUpdateAppComponentsSend( context, @@ -462,7 +462,9 @@ export function _createOrUpdateServerMetricsConfigSend( context: Client, testRunId: string, body: TestRunServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptions = { requestOptions: {} }, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< | LoadTestRunCreateOrUpdateServerMetricsConfig200Response | LoadTestRunCreateOrUpdateServerMetricsConfig201Response @@ -503,7 +505,9 @@ export async function createOrUpdateServerMetricsConfig( context: Client, testRunId: string, body: TestRunServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptions = { requestOptions: {} }, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _createOrUpdateServerMetricsConfigSend( context, @@ -517,7 +521,7 @@ export async function createOrUpdateServerMetricsConfig( export function _deleteTestRunSend( context: Client, testRunId: string, - options: DeleteTestRunOptions = { requestOptions: {} }, + options: DeleteTestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod< LoadTestRunDeleteTestRun204Response | LoadTestRunDeleteTestRunDefaultResponse > { @@ -542,7 +546,7 @@ export async function _deleteTestRunDeserialize( export async function deleteTestRun( context: Client, testRunId: string, - options: DeleteTestRunOptions = { requestOptions: {} }, + options: DeleteTestRunOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteTestRunSend(context, testRunId, options); return _deleteTestRunDeserialize(result); @@ -551,7 +555,7 @@ export async function deleteTestRun( export function _getAppComponentsSend( context: Client, testRunId: string, - options: GetAppComponentsOptions = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunGetAppComponents200Response | LoadTestRunGetAppComponentsDefaultResponse @@ -587,7 +591,7 @@ export async function _getAppComponentsDeserialize( export async function getAppComponents( context: Client, testRunId: string, - options: GetAppComponentsOptions = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getAppComponentsSend(context, testRunId, options); return _getAppComponentsDeserialize(result); @@ -596,7 +600,7 @@ export async function getAppComponents( export function _getServerMetricsConfigSend( context: Client, testRunId: string, - options: GetServerMetricsConfigOptions = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunTestRunListServerMetricsConfig200Response | LoadTestRunTestRunListServerMetricsConfigDefaultResponse @@ -629,7 +633,7 @@ export async function _getServerMetricsConfigDeserialize( export async function getServerMetricsConfig( context: Client, testRunId: string, - options: GetServerMetricsConfigOptions = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getServerMetricsConfigSend(context, testRunId, options); return _getServerMetricsConfigDeserialize(result); @@ -638,7 +642,7 @@ export async function getServerMetricsConfig( export function _getTestRunSend( context: Client, testRunId: string, - options: GetTestRunOptions = { requestOptions: {} }, + options: GetTestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod< LoadTestRunGetTestRun200Response | LoadTestRunGetTestRunDefaultResponse > { @@ -890,7 +894,7 @@ export async function _getTestRunDeserialize( export async function getTestRun( context: Client, testRunId: string, - options: GetTestRunOptions = { requestOptions: {} }, + options: GetTestRunOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTestRunSend(context, testRunId, options); return _getTestRunDeserialize(result); @@ -900,7 +904,7 @@ export function _getTestRunFileSend( context: Client, testRunId: string, fileName: string, - options: GetTestRunFileOptions = { requestOptions: {} }, + options: GetTestRunFileOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunGetTestRunFile200Response | LoadTestRunGetTestRunFileDefaultResponse @@ -934,7 +938,7 @@ export async function getTestRunFile( context: Client, testRunId: string, fileName: string, - options: GetTestRunFileOptions = { requestOptions: {} }, + options: GetTestRunFileOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getTestRunFileSend( context, @@ -950,7 +954,7 @@ export function _listMetricDimensionValuesSend( testRunId: string, name: string, metricNamespace: string, - options: ListMetricDimensionValuesOptions = { requestOptions: {} }, + options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunListMetricDimensionValues200Response | LoadTestRunListMetricDimensionValuesDefaultResponse @@ -993,7 +997,7 @@ export function listMetricDimensionValues( testRunId: string, name: string, metricNamespace: string, - options: ListMetricDimensionValuesOptions = { requestOptions: {} }, + options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -1013,7 +1017,7 @@ export function listMetricDimensionValues( export function _listMetricDefinitionsSend( context: Client, testRunId: string, - options: ListMetricDefinitionsOptions = { requestOptions: {} }, + options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunListMetricDefinitions200Response | LoadTestRunListMetricDefinitionsDefaultResponse @@ -1064,7 +1068,7 @@ export async function _listMetricDefinitionsDeserialize( export async function listMetricDefinitions( context: Client, testRunId: string, - options: ListMetricDefinitionsOptions = { requestOptions: {} }, + options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listMetricDefinitionsSend(context, testRunId, options); return _listMetricDefinitionsDeserialize(result); @@ -1073,7 +1077,7 @@ export async function listMetricDefinitions( export function _listMetricNamespacesSend( context: Client, testRunId: string, - options: ListMetricNamespacesOptions = { requestOptions: {} }, + options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LoadTestRunListMetricNamespaces200Response | LoadTestRunListMetricNamespacesDefaultResponse @@ -1104,7 +1108,7 @@ export async function _listMetricNamespacesDeserialize( export async function listMetricNamespaces( context: Client, testRunId: string, - options: ListMetricNamespacesOptions = { requestOptions: {} }, + options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listMetricNamespacesSend(context, testRunId, options); return _listMetricNamespacesDeserialize(result); @@ -1114,7 +1118,7 @@ export function _listMetricsSend( context: Client, testRunId: string, body: MetricRequestPayload, - options: ListMetricsOptions = { requestOptions: {} }, + options: ListMetricsOptionalParams = { requestOptions: {} }, ): StreamableMethod< LoadTestRunListMetrics200Response | LoadTestRunListMetricsDefaultResponse > { @@ -1176,7 +1180,7 @@ export function listMetrics( context: Client, testRunId: string, body: MetricRequestPayload, - options: ListMetricsOptions = { requestOptions: {} }, + options: ListMetricsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -1188,7 +1192,7 @@ export function listMetrics( export function _listTestRunsSend( context: Client, - options: ListTestRunsOptions = { requestOptions: {} }, + options: ListTestRunsOptionalParams = { requestOptions: {} }, ): StreamableMethod< LoadTestRunListTestRuns200Response | LoadTestRunListTestRunsDefaultResponse > { @@ -1477,7 +1481,7 @@ export async function _listTestRunsDeserialize( /** Get all test runs with given filters */ export function listTestRuns( context: Client, - options: ListTestRunsOptions = { requestOptions: {} }, + options: ListTestRunsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -1490,7 +1494,7 @@ export function listTestRuns( export function _stopTestRunSend( context: Client, testRunId: string, - options: StopTestRunOptions = { requestOptions: {} }, + options: StopTestRunOptionalParams = { requestOptions: {} }, ): StreamableMethod< LoadTestRunStopTestRun200Response | LoadTestRunStopTestRunDefaultResponse > { @@ -1742,7 +1746,7 @@ export async function _stopTestRunDeserialize( export async function stopTestRun( context: Client, testRunId: string, - options: StopTestRunOptions = { requestOptions: {} }, + options: StopTestRunOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stopTestRunSend(context, testRunId, options); return _stopTestRunDeserialize(result); diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/TestRunOperationsContext.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/testRunOperationsContext.ts similarity index 76% rename from packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/TestRunOperationsContext.ts rename to packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/testRunOperationsContext.ts index e1be234a22..f71af753dd 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/TestRunOperationsContext.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/api/testRunOperationsContext.ts @@ -6,15 +6,18 @@ import { ClientOptions } from "@azure-rest/core-client"; import { AzureLoadTestingContext } from "../../rest/index.js"; import getClient from "../../rest/index.js"; -export interface TestRunOperationsClientOptions extends ClientOptions {} +export interface TestRunOperationsClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { AzureLoadTestingContext } from "../../rest/index.js"; export function createTestRunOperations( - endpoint: string, + endpointParam: string, credential: TokenCredential, options: TestRunOperationsClientOptions = {}, ): AzureLoadTestingContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts index 6dfff23061..ff36c8792c 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/index.ts @@ -4,7 +4,7 @@ export { TestRunOperationsClient, TestRunOperationsClientOptions, -} from "./TestRunOperationsClient.js"; +} from "./testRunOperationsClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { Test, @@ -26,6 +26,7 @@ export { FileStatus, AppComponent, ResourceMetric, + APIVersions, TestRun, ErrorDetails, TestRunStatistics, @@ -36,6 +37,8 @@ export { Status, TestRunAppComponents, TestRunServerMetricConfig, + Interval, + DimensionValueList, MetricDefinitionCollection, MetricDefinition, NameAndDesc, @@ -52,23 +55,21 @@ export { MetricValue, DimensionValue, PagedTestRun, - Interval, PagedDimensionValueList, - DimensionValueList, - TestRunOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - DeleteTestRunOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestRunOptions, - GetTestRunFileOptions, - ListMetricDimensionValuesOptions, - ListMetricDefinitionsOptions, - ListMetricNamespacesOptions, - ListMetricsOptions, - ListTestRunsOptions, - StopTestRunOptions, + TestRunOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + DeleteTestRunOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestRunOptionalParams, + GetTestRunFileOptionalParams, + ListMetricDimensionValuesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricsOptionalParams, + ListTestRunsOptionalParams, + StopTestRunOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts index a9153d686d..c12b48b77f 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/index.ts @@ -21,6 +21,7 @@ export { FileStatus, AppComponent, ResourceMetric, + APIVersions, TestRun, ErrorDetails, TestRunStatistics, @@ -31,6 +32,8 @@ export { Status, TestRunAppComponents, TestRunServerMetricConfig, + Interval, + DimensionValueList, MetricDefinitionCollection, MetricDefinition, NameAndDesc, @@ -47,25 +50,23 @@ export { MetricValue, DimensionValue, PagedTestRun, - Interval, PagedDimensionValueList, - DimensionValueList, } from "./models.js"; export { - TestRunOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - DeleteTestRunOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestRunOptions, - GetTestRunFileOptions, - ListMetricDimensionValuesOptions, - ListMetricDefinitionsOptions, - ListMetricNamespacesOptions, - ListMetricsOptions, - ListTestRunsOptions, - StopTestRunOptions, + TestRunOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + DeleteTestRunOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestRunOptionalParams, + GetTestRunFileOptionalParams, + ListMetricDimensionValuesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricsOptionalParams, + ListTestRunsOptionalParams, + StopTestRunOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts index 7ab0dc3ada..813ee32d3b 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/models.ts @@ -77,14 +77,28 @@ export interface PassFailMetric { readonly result?: PFResult; } -/** "response_time_ms", "latency", "error", "requests", "requests_per_sec" */ -export type PFMetrics = string; -/** "count", "percentage", "avg", "p50", "p90", "p95", "p99", "min", "max" */ -export type PFAgFunc = string; -/** "continue", "stop" */ -export type PFAction = string; -/** "passed", "undetermined", "failed" */ -export type PFResult = string; +/** */ +export type PFMetrics = + | "response_time_ms" + | "latency" + | "error" + | "requests" + | "requests_per_sec"; +/** */ +export type PFAgFunc = + | "count" + | "percentage" + | "avg" + | "p50" + | "p90" + | "p95" + | "p99" + | "min" + | "max"; +/** */ +export type PFAction = "continue" | "stop"; +/** */ +export type PFResult = "passed" | "undetermined" | "failed"; /** Secret */ export interface Secret { @@ -94,8 +108,8 @@ export interface Secret { type?: SecretType; } -/** "AKV_SECRET_URI", "SECRET_VALUE" */ -export type SecretType = string; +/** */ +export type SecretType = "AKV_SECRET_URI" | "SECRET_VALUE"; /** Certificates metadata */ export interface CertificateMetadata { @@ -107,8 +121,8 @@ export interface CertificateMetadata { name?: string; } -/** "AKV_CERT_URI" */ -export type CertificateType = string; +/** */ +export type CertificateType = "AKV_CERT_URI"; /** The load test configuration. */ export interface LoadTestConfiguration { @@ -178,10 +192,15 @@ export interface FileInfo { validationFailureDetails?: string; } -/** "JMX_FILE", "USER_PROPERTIES", "ADDITIONAL_ARTIFACTS" */ -export type FileType = string; -/** "NOT_VALIDATED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE", "VALIDATION_INITIATED", "VALIDATION_NOT_REQUIRED" */ -export type FileStatus = string; +/** */ +export type FileType = "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS"; +/** */ +export type FileStatus = + | "NOT_VALIDATED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE" + | "VALIDATION_INITIATED" + | "VALIDATION_NOT_REQUIRED"; /** * An Azure resource object (Refer azure generic resource model : @@ -231,6 +250,9 @@ export interface ResourceMetric { resourceType: string; } +/** */ +export type APIVersions = "2022-11-01"; + /** Load test run model */ export interface TestRun { /** Unique test run name as identifier */ @@ -359,10 +381,26 @@ export interface TestRunOutputArtifacts { logsFileInfo?: FileInfo; } -/** "PASSED", "NOT_APPLICABLE", "FAILED" */ -export type PFTestResult = string; -/** "ACCEPTED", "NOTSTARTED", "PROVISIONING", "PROVISIONED", "CONFIGURING", "CONFIGURED", "EXECUTING", "EXECUTED", "DEPROVISIONING", "DEPROVISIONED", "DONE", "CANCELLING", "CANCELLED", "FAILED", "VALIDATION_SUCCESS", "VALIDATION_FAILURE" */ -export type Status = string; +/** */ +export type PFTestResult = "PASSED" | "NOT_APPLICABLE" | "FAILED"; +/** */ +export type Status = + | "ACCEPTED" + | "NOTSTARTED" + | "PROVISIONING" + | "PROVISIONED" + | "CONFIGURING" + | "CONFIGURED" + | "EXECUTING" + | "EXECUTED" + | "DEPROVISIONING" + | "DEPROVISIONED" + | "DONE" + | "CANCELLING" + | "CANCELLED" + | "FAILED" + | "VALIDATION_SUCCESS" + | "VALIDATION_FAILURE"; /** Test run app component */ export interface TestRunAppComponents { @@ -404,6 +442,13 @@ export interface TestRunServerMetricConfig { readonly lastModifiedBy?: string; } +/** */ +export type Interval = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; + +export interface DimensionValueList { + value: string[]; +} + /** Represents collection of metric definitions. */ export interface MetricDefinitionCollection { /** the values for the metric definitions. */ @@ -441,10 +486,25 @@ export interface NameAndDesc { name?: string; } -/** "Average", "Count", "None", "Total", "Percentile90", "Percentile95", "Percentile99" */ -export type AggregationType = string; -/** "NotSpecified", "Percent", "Count", "Seconds", "Milliseconds", "Bytes", "BytesPerSecond", "CountPerSecond" */ -export type MetricUnit = string; +/** */ +export type AggregationType = + | "Average" + | "Count" + | "None" + | "Total" + | "Percentile90" + | "Percentile95" + | "Percentile99"; +/** */ +export type MetricUnit = + | "NotSpecified" + | "Percent" + | "Count" + | "Seconds" + | "Milliseconds" + | "Bytes" + | "BytesPerSecond" + | "CountPerSecond"; /** Metric availability specifies the time grain (aggregation interval or frequency) */ export interface MetricAvailability { @@ -455,8 +515,8 @@ export interface MetricAvailability { timeGrain?: TimeGrain; } -/** "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" */ -export type TimeGrain = string; +/** */ +export type TimeGrain = "PT5S" | "PT10S" | "PT1M" | "PT5M" | "PT1H"; /** Represents collection of metric namespaces. */ export interface MetricNamespaceCollection { @@ -496,7 +556,7 @@ export interface PagedTimeSeriesElement { /** The TimeSeriesElement items on this page */ value: TimeSeriesElement[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } /** The time series returned when a data query is performed. */ @@ -528,20 +588,13 @@ export interface PagedTestRun { /** The TestRun items on this page */ value: TestRun[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } -/** "PT5S", "PT10S", "PT1M", "PT5M", "PT1H" */ -export type Interval = string; - /** Paged collection of DimensionValueList items */ export interface PagedDimensionValueList { /** The DimensionValueList items on this page */ value: DimensionValueList[]; /** The link to the next page of items */ - readonly nextLink?: string; -} - -export interface DimensionValueList { - value: string[]; + nextLink?: string; } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/options.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/options.ts index 4304f5951c..84eb77cd52 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/options.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/models/options.ts @@ -4,7 +4,7 @@ import { OperationOptions } from "@azure-rest/core-client"; import { Interval } from "./models.js"; -export interface TestRunOptions extends OperationOptions { +export interface TestRunOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** This request has a JSON Merge Patch body. */ @@ -18,26 +18,29 @@ export interface TestRunOptions extends OperationOptions { oldTestRunId?: string; } -export interface CreateOrUpdateAppComponentsOptions extends OperationOptions { +export interface CreateOrUpdateAppComponentsOptionalParams + extends OperationOptions { contentType?: string; } -export interface CreateOrUpdateServerMetricsConfigOptions +export interface CreateOrUpdateServerMetricsConfigOptionalParams extends OperationOptions { contentType?: string; } -export interface DeleteTestRunOptions extends OperationOptions {} +export interface DeleteTestRunOptionalParams extends OperationOptions {} -export interface GetAppComponentsOptions extends OperationOptions {} +export interface GetAppComponentsOptionalParams extends OperationOptions {} -export interface GetServerMetricsConfigOptions extends OperationOptions {} +export interface GetServerMetricsConfigOptionalParams + extends OperationOptions {} -export interface GetTestRunOptions extends OperationOptions {} +export interface GetTestRunOptionalParams extends OperationOptions {} -export interface GetTestRunFileOptions extends OperationOptions {} +export interface GetTestRunFileOptionalParams extends OperationOptions {} -export interface ListMetricDimensionValuesOptions extends OperationOptions { +export interface ListMetricDimensionValuesOptionalParams + extends OperationOptions { /** The interval (i.e. timegrain) of the query. */ interval?: Interval; /** Metric name */ @@ -49,14 +52,14 @@ export interface ListMetricDimensionValuesOptions extends OperationOptions { timespan?: string; } -export interface ListMetricDefinitionsOptions extends OperationOptions { +export interface ListMetricDefinitionsOptionalParams extends OperationOptions { /** Metric namespace to query metric definitions for. */ metricNamespace?: string; } -export interface ListMetricNamespacesOptions extends OperationOptions {} +export interface ListMetricNamespacesOptionalParams extends OperationOptions {} -export interface ListMetricsOptions extends OperationOptions { +export interface ListMetricsOptionalParams extends OperationOptions { /** The aggregation */ aggregation?: string; /** The interval (i.e. timegrain) of the query. */ @@ -72,7 +75,7 @@ export interface ListMetricsOptions extends OperationOptions { timespan?: string; } -export interface ListTestRunsOptions extends OperationOptions { +export interface ListTestRunsOptionalParams extends OperationOptions { /** * Sort on the supported fields in (field asc/desc) format. eg: executedDateTime * asc. Supported fields - executedDateTime @@ -96,4 +99,4 @@ export interface ListTestRunsOptions extends OperationOptions { maxpagesize?: number; } -export interface StopTestRunOptions extends OperationOptions {} +export interface StopTestRunOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/restorePollerHelpers.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/restorePollerHelpers.ts index 7566d01632..62d3571d35 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/restorePollerHelpers.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/restorePollerHelpers.ts @@ -7,8 +7,8 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { AzureLoadTestingContext } from "./api/TestRunOperationsContext.js"; -import { TestRunOperationsClient } from "./TestRunOperationsClient.js"; +import { AzureLoadTestingContext } from "./api/testRunOperationsContext.js"; +import { TestRunOperationsClient } from "./testRunOperationsClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _testRunDeserialize } from "./api/operations.js"; import { diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/TestRunOperationsClient.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/testRunOperationsClient.ts similarity index 73% rename from packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/TestRunOperationsClient.ts rename to packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/testRunOperationsClient.ts index 5164b05ab2..af36f1eef8 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/TestRunOperationsClient.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/src/testRunOperations/testRunOperationsClient.ts @@ -9,27 +9,27 @@ import { TestRun, TestRunAppComponents, TestRunServerMetricConfig, + DimensionValueList, MetricDefinitionCollection, MetricNamespaceCollection, MetricRequestPayload, TimeSeriesElement, - DimensionValueList, } from "./models/models.js"; import { - TestRunOptions, - CreateOrUpdateAppComponentsOptions, - CreateOrUpdateServerMetricsConfigOptions, - DeleteTestRunOptions, - GetAppComponentsOptions, - GetServerMetricsConfigOptions, - GetTestRunOptions, - GetTestRunFileOptions, - ListMetricDimensionValuesOptions, - ListMetricDefinitionsOptions, - ListMetricNamespacesOptions, - ListMetricsOptions, - ListTestRunsOptions, - StopTestRunOptions, + TestRunOptionalParams, + CreateOrUpdateAppComponentsOptionalParams, + CreateOrUpdateServerMetricsConfigOptionalParams, + DeleteTestRunOptionalParams, + GetAppComponentsOptionalParams, + GetServerMetricsConfigOptionalParams, + GetTestRunOptionalParams, + GetTestRunFileOptionalParams, + ListMetricDimensionValuesOptionalParams, + ListMetricDefinitionsOptionalParams, + ListMetricNamespacesOptionalParams, + ListMetricsOptionalParams, + ListTestRunsOptionalParams, + StopTestRunOptionalParams, } from "./models/options.js"; import { PagedAsyncIterableIterator } from "./models/pagingTypes.js"; import { @@ -52,7 +52,7 @@ import { AzureLoadTestingContext, } from "./api/index.js"; -export { TestRunOperationsClientOptions } from "./api/TestRunOperationsContext.js"; +export { TestRunOperationsClientOptions } from "./api/testRunOperationsContext.js"; export class TestRunOperationsClient { private _client: AzureLoadTestingContext; @@ -60,11 +60,11 @@ export class TestRunOperationsClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, + endpointParam: string, credential: TokenCredential, options: TestRunOperationsClientOptions = {}, ) { - this._client = createTestRunOperations(endpoint, credential, options); + this._client = createTestRunOperations(endpointParam, credential, options); this.pipeline = this._client.pipeline; } @@ -72,7 +72,7 @@ export class TestRunOperationsClient { testRun( testRunId: string, resource: TestRun, - options: TestRunOptions = { requestOptions: {} }, + options: TestRunOptionalParams = { requestOptions: {} }, ): PollerLike, TestRun> { return testRun(this._client, testRunId, resource, options); } @@ -81,7 +81,7 @@ export class TestRunOperationsClient { createOrUpdateAppComponents( testRunId: string, body: TestRunAppComponents, - options: CreateOrUpdateAppComponentsOptions = { requestOptions: {} }, + options: CreateOrUpdateAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { return createOrUpdateAppComponents(this._client, testRunId, body, options); } @@ -90,7 +90,9 @@ export class TestRunOperationsClient { createOrUpdateServerMetricsConfig( testRunId: string, body: TestRunServerMetricConfig, - options: CreateOrUpdateServerMetricsConfigOptions = { requestOptions: {} }, + options: CreateOrUpdateServerMetricsConfigOptionalParams = { + requestOptions: {}, + }, ): Promise { return createOrUpdateServerMetricsConfig( this._client, @@ -103,7 +105,7 @@ export class TestRunOperationsClient { /** Delete a test run by its name. */ deleteTestRun( testRunId: string, - options: DeleteTestRunOptions = { requestOptions: {} }, + options: DeleteTestRunOptionalParams = { requestOptions: {} }, ): Promise { return deleteTestRun(this._client, testRunId, options); } @@ -114,7 +116,7 @@ export class TestRunOperationsClient { */ getAppComponents( testRunId: string, - options: GetAppComponentsOptions = { requestOptions: {} }, + options: GetAppComponentsOptionalParams = { requestOptions: {} }, ): Promise { return getAppComponents(this._client, testRunId, options); } @@ -122,7 +124,7 @@ export class TestRunOperationsClient { /** List server metrics configuration for the given test run. */ getServerMetricsConfig( testRunId: string, - options: GetServerMetricsConfigOptions = { requestOptions: {} }, + options: GetServerMetricsConfigOptionalParams = { requestOptions: {} }, ): Promise { return getServerMetricsConfig(this._client, testRunId, options); } @@ -130,7 +132,7 @@ export class TestRunOperationsClient { /** Get test run details by name. */ getTestRun( testRunId: string, - options: GetTestRunOptions = { requestOptions: {} }, + options: GetTestRunOptionalParams = { requestOptions: {} }, ): Promise { return getTestRun(this._client, testRunId, options); } @@ -139,7 +141,7 @@ export class TestRunOperationsClient { getTestRunFile( testRunId: string, fileName: string, - options: GetTestRunFileOptions = { requestOptions: {} }, + options: GetTestRunFileOptionalParams = { requestOptions: {} }, ): Promise { return getTestRunFile(this._client, testRunId, fileName, options); } @@ -149,7 +151,7 @@ export class TestRunOperationsClient { testRunId: string, name: string, metricNamespace: string, - options: ListMetricDimensionValuesOptions = { requestOptions: {} }, + options: ListMetricDimensionValuesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listMetricDimensionValues( this._client, @@ -163,7 +165,7 @@ export class TestRunOperationsClient { /** List the metric definitions for a load test run. */ listMetricDefinitions( testRunId: string, - options: ListMetricDefinitionsOptions = { requestOptions: {} }, + options: ListMetricDefinitionsOptionalParams = { requestOptions: {} }, ): Promise { return listMetricDefinitions(this._client, testRunId, options); } @@ -171,7 +173,7 @@ export class TestRunOperationsClient { /** List the metric namespaces for a load test run. */ listMetricNamespaces( testRunId: string, - options: ListMetricNamespacesOptions = { requestOptions: {} }, + options: ListMetricNamespacesOptionalParams = { requestOptions: {} }, ): Promise { return listMetricNamespaces(this._client, testRunId, options); } @@ -180,14 +182,14 @@ export class TestRunOperationsClient { listMetrics( testRunId: string, body: MetricRequestPayload, - options: ListMetricsOptions = { requestOptions: {} }, + options: ListMetricsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listMetrics(this._client, testRunId, body, options); } /** Get all test runs with given filters */ listTestRuns( - options: ListTestRunsOptions = { requestOptions: {} }, + options: ListTestRunsOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listTestRuns(this._client, options); } @@ -195,7 +197,7 @@ export class TestRunOperationsClient { /** Stop test run by name. */ stopTestRun( testRunId: string, - options: StopTestRunOptions = { requestOptions: {} }, + options: StopTestRunOptionalParams = { requestOptions: {} }, ): Promise { return stopTestRun(this._client, testRunId, options); } diff --git a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/package.json b/packages/typespec-test/test/openai/generated/typespec-ts/package.json index d4f197cf3d..4271159b69 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -55,8 +55,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md b/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md index 33f67900e0..d64a6006b8 100644 --- a/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md +++ b/packages/typespec-test/test/openai/generated/typespec-ts/review/openai.api.md @@ -22,7 +22,7 @@ import { TokenCredential } from '@azure/core-auth'; // @public export interface AzureChatExtensionConfiguration { parameters: unknown; - type: string; + type: AzureChatExtensionType; } // @public @@ -35,6 +35,12 @@ export interface AzureChatExtensionsMessageContextOutput { messages?: Array; } +// @public +export type AzureChatExtensionType = "AzureCognitiveSearch"; + +// @public +export type AzureOpenAIOperationStateOutput = "notRunning" | "running" | "succeeded" | "canceled" | "failed"; + // @public export interface BatchImageGenerationOperationResponseOutput { created: number; @@ -42,7 +48,7 @@ export interface BatchImageGenerationOperationResponseOutput { expires?: number; id: string; result?: ImageGenerationsOutput; - status: string; + status: AzureOpenAIOperationStateOutput; } // @public (undocumented) @@ -101,7 +107,7 @@ export type BeginAzureBatchImageGenerationParameters = BeginAzureBatchImageGener export interface ChatChoiceOutput { content_filter_results?: ContentFilterResultsOutput; delta?: ChatMessageOutput; - finish_reason: string | null; + finish_reason: CompletionsFinishReasonOutput | null; index: number; message?: ChatMessageOutput; } @@ -110,7 +116,7 @@ export interface ChatChoiceOutput { export interface ChatCompletionsOptions { dataSources?: Array; frequency_penalty?: number; - function_call?: string | FunctionName; + function_call?: FunctionCallPreset | FunctionName; functions?: Array; logit_bias?: Record; max_tokens?: number; @@ -140,7 +146,7 @@ export interface ChatMessage { context?: AzureChatExtensionsMessageContext; function_call?: FunctionCall; name?: string; - role: string; + role: ChatRole; } // @public @@ -149,18 +155,27 @@ export interface ChatMessageOutput { context?: AzureChatExtensionsMessageContextOutput; function_call?: FunctionCallOutput; name?: string; - role: string; + role: ChatRoleOutput; } +// @public +export type ChatRole = "system" | "assistant" | "user" | "function" | "tool"; + +// @public +export type ChatRoleOutput = "system" | "assistant" | "user" | "function" | "tool"; + // @public export interface ChoiceOutput { content_filter_results?: ContentFilterResultsOutput; - finish_reason: string | null; + finish_reason: CompletionsFinishReasonOutput | null; index: number; logprobs: CompletionsLogProbabilityModelOutput | null; text: string; } +// @public +export type CompletionsFinishReasonOutput = "stop" | "length" | "content_filter" | "function_call"; + // @public export interface CompletionsLogProbabilityModelOutput { text_offset: number[]; @@ -207,7 +222,7 @@ export interface CompletionsUsageOutput { // @public export interface ContentFilterResultOutput { filtered: boolean; - severity: string; + severity: ContentFilterSeverityOutput; } // @public @@ -219,13 +234,11 @@ export interface ContentFilterResultsOutput { } // @public -function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, options?: ClientOptions): OpenAIClient; -export default createClient; +export type ContentFilterSeverityOutput = "safe" | "low" | "medium" | "high"; // @public -export interface DeploymentOutput { - readonly deploymentId: string; -} +function createClient(endpointParam: string, credentials: TokenCredential | KeyCredential, options?: ClientOptions): OpenAIClient; +export default createClient; // @public export interface EmbeddingItemOutput { @@ -264,6 +277,9 @@ export interface FunctionCallOutput { name: string; } +// @public +export type FunctionCallPreset = "auto" | "none"; + // @public export interface FunctionDefinition { description?: string; @@ -462,19 +478,13 @@ export function getLongRunningPoller Promise; + create: (audio: CreateTranscriptionRequest, options?: AudioTranscriptionsCreateOptionalParams) => Promise; } // @public (undocumented) -export interface AudioTranslationsCreateOptions extends OperationOptions { +export interface AudioTranslationsCreateOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -38,7 +38,7 @@ export interface AudioTranslationsCreateOptions extends OperationOptions { // @public (undocumented) export interface AudioTranslationsOperations { // (undocumented) - create: (audio: CreateTranslationRequest, options?: AudioTranslationsCreateOptions) => Promise; + create: (audio: CreateTranslationRequest, options?: AudioTranslationsCreateOptionalParams) => Promise; } // @public (undocumented) @@ -75,13 +75,13 @@ export interface ChatCompletionResponseMessage { } // @public (undocumented) -export interface ChatCompletionsCreateOptions extends OperationOptions { +export interface ChatCompletionsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface ChatCompletionsOperations { // (undocumented) - create: (body: CreateChatCompletionRequest, options?: ChatCompletionsCreateOptions) => Promise; + create: (body: CreateChatCompletionRequest, options?: ChatCompletionsCreateOptionalParams) => Promise; } // @public (undocumented) @@ -91,13 +91,13 @@ export interface ChatOperations { } // @public (undocumented) -export interface CompletionsCreateOptions extends OperationOptions { +export interface CompletionsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface CompletionsOperations { // (undocumented) - create: (body: CreateCompletionRequest, options?: CompletionsCreateOptions) => Promise; + create: (body: CreateCompletionRequest, options?: CompletionsCreateOptionalParams) => Promise; } // @public @@ -381,13 +381,13 @@ export interface DeleteModelResponse { } // @public (undocumented) -export interface EditsCreateOptions extends OperationOptions { +export interface EditsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface EditsOperations { // (undocumented) - create: (edit: CreateEditRequest, options?: EditsCreateOptions) => Promise; + create: (edit: CreateEditRequest, options?: EditsCreateOptionalParams) => Promise; } // @public @@ -398,17 +398,17 @@ export interface Embedding { } // @public (undocumented) -export interface EmbeddingsCreateOptions extends OperationOptions { +export interface EmbeddingsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface EmbeddingsOperations { // (undocumented) - create: (embedding: CreateEmbeddingRequest, options?: EmbeddingsCreateOptions) => Promise; + create: (embedding: CreateEmbeddingRequest, options?: EmbeddingsCreateOptionalParams) => Promise; } // @public (undocumented) -interface Error_2 { +export interface ErrorModel { // (undocumented) code: string | null; // (undocumented) @@ -418,42 +418,41 @@ interface Error_2 { // (undocumented) type: string; } -export { Error_2 as Error } // @public (undocumented) -export interface FilesCreateOptions extends OperationOptions { +export interface FilesCreateOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface FilesDeleteOperationOptions extends OperationOptions { +export interface FilesDeleteOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FilesDownloadOptions extends OperationOptions { +export interface FilesDownloadOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FilesListOptions extends OperationOptions { +export interface FilesListOptionalParams extends OperationOptions { } // @public (undocumented) export interface FilesOperations { // (undocumented) - create: (file: CreateFileRequest, options?: FilesCreateOptions) => Promise; + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; // (undocumented) - deleteOperation: (fileId: string, options?: FilesDeleteOperationOptions) => Promise; + delete: (fileId: string, options?: FilesDeleteOptionalParams) => Promise; // (undocumented) - download: (fileId: string, options?: FilesDownloadOptions) => Promise; + download: (fileId: string, options?: FilesDownloadOptionalParams) => Promise; // (undocumented) - list: (options?: FilesListOptions) => Promise; + list: (options?: FilesListOptionalParams) => Promise; // (undocumented) - retrieve: (fileId: string, options?: FilesRetrieveOptions) => Promise; + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface FilesRetrieveOptions extends OperationOptions { +export interface FilesRetrieveOptionalParams extends OperationOptions { } // @public @@ -494,38 +493,38 @@ export interface FineTuneEvent { } // @public (undocumented) -export interface FineTunesCancelOptions extends OperationOptions { +export interface FineTunesCancelOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTunesCreateOptions extends OperationOptions { +export interface FineTunesCreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTunesListEventsOptions extends OperationOptions { +export interface FineTunesListEventsOptionalParams extends OperationOptions { stream?: boolean; } // @public (undocumented) -export interface FineTunesListOptions extends OperationOptions { +export interface FineTunesListOptionalParams extends OperationOptions { } // @public (undocumented) export interface FineTunesOperations { // (undocumented) - cancel: (fineTuneId: string, options?: FineTunesCancelOptions) => Promise; + cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => Promise; // (undocumented) - create: (fineTune: CreateFineTuneRequest, options?: FineTunesCreateOptions) => Promise; + create: (fineTune: CreateFineTuneRequest, options?: FineTunesCreateOptionalParams) => Promise; // (undocumented) - list: (options?: FineTunesListOptions) => Promise; + list: (options?: FineTunesListOptionalParams) => Promise; // (undocumented) - listEvents: (fineTuneId: string, options?: FineTunesListEventsOptions) => Promise; + listEvents: (fineTuneId: string, options?: FineTunesListEventsOptionalParams) => Promise; // (undocumented) - retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptions) => Promise; + retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface FineTunesRetrieveOptions extends OperationOptions { +export interface FineTunesRetrieveOptionalParams extends OperationOptions { } // @public (undocumented) @@ -567,21 +566,21 @@ export interface FineTuningJobEvent { } // @public (undocumented) -export interface FineTuningJobsCancelOptions extends OperationOptions { +export interface FineTuningJobsCancelOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTuningJobsCreateOptions extends OperationOptions { +export interface FineTuningJobsCreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTuningJobsListEventsOptions extends OperationOptions { +export interface FineTuningJobsListEventsOptionalParams extends OperationOptions { after?: string; limit?: number; } // @public (undocumented) -export interface FineTuningJobsListOptions extends OperationOptions { +export interface FineTuningJobsListOptionalParams extends OperationOptions { after?: string; limit?: number; } @@ -589,19 +588,19 @@ export interface FineTuningJobsListOptions extends OperationOptions { // @public (undocumented) export interface FineTuningJobsOperations { // (undocumented) - cancel: (fineTuningJobId: string, options?: FineTuningJobsCancelOptions) => Promise; + cancel: (fineTuningJobId: string, options?: FineTuningJobsCancelOptionalParams) => Promise; // (undocumented) - create: (job: CreateFineTuningJobRequest, options?: FineTuningJobsCreateOptions) => Promise; + create: (job: CreateFineTuningJobRequest, options?: FineTuningJobsCreateOptionalParams) => Promise; // (undocumented) - list: (options?: FineTuningJobsListOptions) => Promise; + list: (options?: FineTuningJobsListOptionalParams) => Promise; // (undocumented) - listEvents: (fineTuningJobId: string, options?: FineTuningJobsListEventsOptions) => Promise; + listEvents: (fineTuningJobId: string, options?: FineTuningJobsListEventsOptionalParams) => Promise; // (undocumented) - retrieve: (fineTuningJobId: string, options?: FineTuningJobsRetrieveOptions) => Promise; + retrieve: (fineTuningJobId: string, options?: FineTuningJobsRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface FineTuningJobsRetrieveOptions extends OperationOptions { +export interface FineTuningJobsRetrieveOptionalParams extends OperationOptions { } // @public (undocumented) @@ -617,17 +616,17 @@ export interface Image { } // @public (undocumented) -export interface ImagesCreateEditOptions extends OperationOptions { +export interface ImagesCreateEditOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface ImagesCreateOptions extends OperationOptions { +export interface ImagesCreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ImagesCreateVariationOptions extends OperationOptions { +export interface ImagesCreateVariationOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -635,11 +634,11 @@ export interface ImagesCreateVariationOptions extends OperationOptions { // @public (undocumented) export interface ImagesOperations { // (undocumented) - create: (image: CreateImageRequest, options?: ImagesCreateOptions) => Promise; + create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => Promise; // (undocumented) - createEdit: (image: CreateImageEditRequest, options?: ImagesCreateEditOptions) => Promise; + createEdit: (image: CreateImageEditRequest, options?: ImagesCreateEditOptionalParams) => Promise; // (undocumented) - createVariation: (image: CreateImageVariationRequest, options?: ImagesCreateVariationOptions) => Promise; + createVariation: (image: CreateImageVariationRequest, options?: ImagesCreateVariationOptionalParams) => Promise; } // @public (undocumented) @@ -709,35 +708,35 @@ export interface Model { } // @public (undocumented) -export interface ModelsDeleteOperationOptions extends OperationOptions { +export interface ModelsDeleteOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ModelsListOptions extends OperationOptions { +export interface ModelsListOptionalParams extends OperationOptions { } // @public (undocumented) export interface ModelsOperations { // (undocumented) - deleteOperation: (model: string, options?: ModelsDeleteOperationOptions) => Promise; + delete: (model: string, options?: ModelsDeleteOptionalParams) => Promise; // (undocumented) - list: (options?: ModelsListOptions) => Promise; + list: (options?: ModelsListOptionalParams) => Promise; // (undocumented) - retrieve: (model: string, options?: ModelsRetrieveOptions) => Promise; + retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface ModelsRetrieveOptions extends OperationOptions { +export interface ModelsRetrieveOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ModerationsCreateOptions extends OperationOptions { +export interface ModerationsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface ModerationsOperations { // (undocumented) - create: (content: CreateModerationRequest, options?: ModerationsCreateOptions) => Promise; + create: (content: CreateModerationRequest, options?: ModerationsCreateOptionalParams) => Promise; } // @public (undocumented) diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts index 0f17a1d599..a34072b6df 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/transcriptions/index.ts @@ -17,12 +17,12 @@ import { createRestError, } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; -import { AudioTranscriptionsCreateOptions } from "../../../models/options.js"; +import { AudioTranscriptionsCreateOptionalParams } from "../../../models/options.js"; export function _createSend( context: Client, audio: CreateTranscriptionRequest, - options: AudioTranscriptionsCreateOptions = { requestOptions: {} }, + options: AudioTranscriptionsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< | AudioTranscriptionsCreate200Response | AudioTranscriptionsCreateDefaultResponse @@ -60,7 +60,7 @@ export async function _createDeserialize( export async function create( context: Client, audio: CreateTranscriptionRequest, - options: AudioTranscriptionsCreateOptions = { requestOptions: {} }, + options: AudioTranscriptionsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, audio, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts index ff31d26d5e..9750506bee 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/audio/translations/index.ts @@ -17,12 +17,12 @@ import { createRestError, } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; -import { AudioTranslationsCreateOptions } from "../../../models/options.js"; +import { AudioTranslationsCreateOptionalParams } from "../../../models/options.js"; export function _createSend( context: Client, audio: CreateTranslationRequest, - options: AudioTranslationsCreateOptions = { requestOptions: {} }, + options: AudioTranslationsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< AudioTranslationsCreate200Response | AudioTranslationsCreateDefaultResponse > { @@ -58,7 +58,7 @@ export async function _createDeserialize( export async function create( context: Client, audio: CreateTranslationRequest, - options: AudioTranslationsCreateOptions = { requestOptions: {} }, + options: AudioTranslationsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, audio, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts index 39f3dc285a..db3c80e77e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/chat/completions/index.ts @@ -16,12 +16,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ChatCompletionsCreateOptions } from "../../../models/options.js"; +import { ChatCompletionsCreateOptionalParams } from "../../../models/options.js"; export function _createSend( context: Client, body: CreateChatCompletionRequest, - options: ChatCompletionsCreateOptions = { requestOptions: {} }, + options: ChatCompletionsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< ChatCompletionsCreate200Response | ChatCompletionsCreateDefaultResponse > { @@ -106,7 +106,7 @@ export async function _createDeserialize( export async function create( context: Client, body: CreateChatCompletionRequest, - options: ChatCompletionsCreateOptions = { requestOptions: {} }, + options: ChatCompletionsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, body, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts index c14f4920ce..634fff501c 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/completions/index.ts @@ -16,12 +16,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { CompletionsCreateOptions } from "../../models/options.js"; +import { CompletionsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, body: CreateCompletionRequest, - options: CompletionsCreateOptions = { requestOptions: {} }, + options: CompletionsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< CompletionsCreate200Response | CompletionsCreateDefaultResponse > { @@ -89,7 +89,7 @@ export async function _createDeserialize( export async function create( context: Client, body: CreateCompletionRequest, - options: CompletionsCreateOptions = { requestOptions: {} }, + options: CompletionsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, body, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts index c1545057c9..c17956c0cc 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/edits/index.ts @@ -13,12 +13,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { EditsCreateOptions } from "../../models/options.js"; +import { EditsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, edit: CreateEditRequest, - options: EditsCreateOptions = { requestOptions: {} }, + options: EditsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/edits") @@ -61,7 +61,7 @@ export async function _createDeserialize( export async function create( context: Client, edit: CreateEditRequest, - options: EditsCreateOptions = { requestOptions: {} }, + options: EditsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, edit, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts index 7562fe9c1f..110c12d7ae 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/embeddings/index.ts @@ -16,12 +16,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { EmbeddingsCreateOptions } from "../../models/options.js"; +import { EmbeddingsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, embedding: CreateEmbeddingRequest, - options: EmbeddingsCreateOptions = { requestOptions: {} }, + options: EmbeddingsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< EmbeddingsCreate200Response | EmbeddingsCreateDefaultResponse > { @@ -62,7 +62,7 @@ export async function _createDeserialize( export async function create( context: Client, embedding: CreateEmbeddingRequest, - options: EmbeddingsCreateOptions = { requestOptions: {} }, + options: EmbeddingsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, embedding, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts index 44912bd426..d645237c6f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/files/index.ts @@ -10,8 +10,8 @@ import { import { FilesCreate200Response, FilesCreateDefaultResponse, - FilesDeleteOperation200Response, - FilesDeleteOperationDefaultResponse, + FilesDelete200Response, + FilesDeleteDefaultResponse, FilesDownload200Response, FilesDownloadDefaultResponse, FilesList200Response, @@ -28,16 +28,16 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, } from "../../models/options.js"; export function _listSend( context: Client, - options: FilesListOptions = { requestOptions: {} }, + options: FilesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files") @@ -68,7 +68,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: FilesListOptions = { requestOptions: {} }, + options: FilesListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -77,7 +77,7 @@ export async function list( export function _createSend( context: Client, file: CreateFileRequest, - options: FilesCreateOptions = { requestOptions: {} }, + options: FilesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files") @@ -113,7 +113,7 @@ export async function _createDeserialize( export async function create( context: Client, file: CreateFileRequest, - options: FilesCreateOptions = { requestOptions: {} }, + options: FilesCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, file, options); return _createDeserialize(result); @@ -122,7 +122,7 @@ export async function create( export function _retrieveSend( context: Client, fileId: string, - options: FilesRetrieveOptions = { requestOptions: {} }, + options: FilesRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files/files/{file_id}", fileId) @@ -151,26 +151,24 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, fileId: string, - options: FilesRetrieveOptions = { requestOptions: {} }, + options: FilesRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, fileId, options); return _retrieveDeserialize(result); } -export function _deleteOperationSend( +export function _$deleteSend( context: Client, fileId: string, - options: FilesDeleteOperationOptions = { requestOptions: {} }, -): StreamableMethod< - FilesDeleteOperation200Response | FilesDeleteOperationDefaultResponse -> { + options: FilesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/files/files/{file_id}", fileId) .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteOperationDeserialize( - result: FilesDeleteOperation200Response | FilesDeleteOperationDefaultResponse, +export async function _$deleteDeserialize( + result: FilesDelete200Response | FilesDeleteDefaultResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -183,19 +181,24 @@ export async function _deleteOperationDeserialize( }; } -export async function deleteOperation( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, fileId: string, - options: FilesDeleteOperationOptions = { requestOptions: {} }, + options: FilesDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteOperationSend(context, fileId, options); - return _deleteOperationDeserialize(result); + const result = await _$deleteSend(context, fileId, options); + return _$deleteDeserialize(result); } export function _downloadSend( context: Client, fileId: string, - options: FilesDownloadOptions = { requestOptions: {} }, + options: FilesDownloadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files/files/{file_id}/content", fileId) @@ -215,7 +218,7 @@ export async function _downloadDeserialize( export async function download( context: Client, fileId: string, - options: FilesDownloadOptions = { requestOptions: {} }, + options: FilesDownloadOptionalParams = { requestOptions: {} }, ): Promise { const result = await _downloadSend(context, fileId, options); return _downloadDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts index 426678fd59..ff96ee9b61 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTunes/index.ts @@ -27,17 +27,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, } from "../../models/options.js"; export function _createSend( context: Client, fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptions = { requestOptions: {} }, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesCreate200Response | FineTunesCreateDefaultResponse > { @@ -137,7 +137,7 @@ export async function _createDeserialize( export async function create( context: Client, fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptions = { requestOptions: {} }, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, fineTune, options); return _createDeserialize(result); @@ -145,7 +145,7 @@ export async function create( export function _listSend( context: Client, - options: FineTunesListOptions = { requestOptions: {} }, + options: FineTunesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/fine-tunes") @@ -226,7 +226,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: FineTunesListOptions = { requestOptions: {} }, + options: FineTunesListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -235,7 +235,7 @@ export async function list( export function _retrieveSend( context: Client, fineTuneId: string, - options: FineTunesRetrieveOptions = { requestOptions: {} }, + options: FineTunesRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesRetrieve200Response | FineTunesRetrieveDefaultResponse > { @@ -318,7 +318,7 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, fineTuneId: string, - options: FineTunesRetrieveOptions = { requestOptions: {} }, + options: FineTunesRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, fineTuneId, options); return _retrieveDeserialize(result); @@ -327,7 +327,7 @@ export async function retrieve( export function _listEventsSend( context: Client, fineTuneId: string, - options: FineTunesListEventsOptions = { requestOptions: {} }, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesListEvents200Response | FineTunesListEventsDefaultResponse > { @@ -360,7 +360,7 @@ export async function _listEventsDeserialize( export async function listEvents( context: Client, fineTuneId: string, - options: FineTunesListEventsOptions = { requestOptions: {} }, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listEventsSend(context, fineTuneId, options); return _listEventsDeserialize(result); @@ -369,7 +369,7 @@ export async function listEvents( export function _cancelSend( context: Client, fineTuneId: string, - options: FineTunesCancelOptions = { requestOptions: {} }, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesCancel200Response | FineTunesCancelDefaultResponse > { @@ -452,7 +452,7 @@ export async function _cancelDeserialize( export async function cancel( context: Client, fineTuneId: string, - options: FineTunesCancelOptions = { requestOptions: {} }, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _cancelSend(context, fineTuneId, options); return _cancelDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts index 54030d46cf..21c77d63d8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/fineTuning/jobs/index.ts @@ -27,17 +27,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, } from "../../../models/options.js"; export function _createSend( context: Client, job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptions = { requestOptions: {} }, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsCreate200Response | FineTuningJobsCreateDefaultResponse > { @@ -103,7 +103,7 @@ export async function _createDeserialize( export async function create( context: Client, job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptions = { requestOptions: {} }, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, job, options); return _createDeserialize(result); @@ -111,7 +111,7 @@ export async function create( export function _listSend( context: Client, - options: FineTuningJobsListOptions = { requestOptions: {} }, + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsList200Response | FineTuningJobsListDefaultResponse > { @@ -161,7 +161,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: FineTuningJobsListOptions = { requestOptions: {} }, + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -170,7 +170,7 @@ export async function list( export function _retrieveSend( context: Client, fineTuningJobId: string, - options: FineTuningJobsRetrieveOptions = { requestOptions: {} }, + options: FineTuningJobsRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsRetrieve200Response | FineTuningJobsRetrieveDefaultResponse > { @@ -219,7 +219,7 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, fineTuningJobId: string, - options: FineTuningJobsRetrieveOptions = { requestOptions: {} }, + options: FineTuningJobsRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, fineTuningJobId, options); return _retrieveDeserialize(result); @@ -228,7 +228,7 @@ export async function retrieve( export function _listEventsSend( context: Client, fineTuningJobId: string, - options: FineTuningJobsListEventsOptions = { requestOptions: {} }, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsListEvents200Response | FineTuningJobsListEventsDefaultResponse > { @@ -264,7 +264,7 @@ export async function _listEventsDeserialize( export async function listEvents( context: Client, fineTuningJobId: string, - options: FineTuningJobsListEventsOptions = { requestOptions: {} }, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listEventsSend(context, fineTuningJobId, options); return _listEventsDeserialize(result); @@ -273,7 +273,7 @@ export async function listEvents( export function _cancelSend( context: Client, fineTuningJobId: string, - options: FineTuningJobsCancelOptions = { requestOptions: {} }, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsCancel200Response | FineTuningJobsCancelDefaultResponse > { @@ -320,7 +320,7 @@ export async function _cancelDeserialize( export async function cancel( context: Client, fineTuningJobId: string, - options: FineTuningJobsCancelOptions = { requestOptions: {} }, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _cancelSend(context, fineTuningJobId, options); return _cancelDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts index 2a64169a3e..31a203c294 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/images/index.ts @@ -24,15 +24,15 @@ import { } from "@azure-rest/core-client"; import { stringToUint8Array, uint8ArrayToString } from "@azure/core-util"; import { - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, } from "../../models/options.js"; export function _createSend( context: Client, image: CreateImageRequest, - options: ImagesCreateOptions = { requestOptions: {} }, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/images/generations") @@ -70,7 +70,7 @@ export async function _createDeserialize( export async function create( context: Client, image: CreateImageRequest, - options: ImagesCreateOptions = { requestOptions: {} }, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, image, options); return _createDeserialize(result); @@ -79,7 +79,7 @@ export async function create( export function _createEditSend( context: Client, image: CreateImageEditRequest, - options: ImagesCreateEditOptions = { requestOptions: {} }, + options: ImagesCreateEditOptionalParams = { requestOptions: {} }, ): StreamableMethod< ImagesCreateEdit200Response | ImagesCreateEditDefaultResponse > { @@ -125,7 +125,7 @@ export async function _createEditDeserialize( export async function createEdit( context: Client, image: CreateImageEditRequest, - options: ImagesCreateEditOptions = { requestOptions: {} }, + options: ImagesCreateEditOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createEditSend(context, image, options); return _createEditDeserialize(result); @@ -134,7 +134,7 @@ export async function createEdit( export function _createVariationSend( context: Client, image: CreateImageVariationRequest, - options: ImagesCreateVariationOptions = { requestOptions: {} }, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): StreamableMethod< ImagesCreateVariation200Response | ImagesCreateVariationDefaultResponse > { @@ -177,7 +177,7 @@ export async function _createVariationDeserialize( export async function createVariation( context: Client, image: CreateImageVariationRequest, - options: ImagesCreateVariationOptions = { requestOptions: {} }, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createVariationSend(context, image, options); return _createVariationDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts index 7e52c3e77f..cc25f913fe 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/index.ts @@ -5,4 +5,4 @@ export { createOpenAI, OpenAIClientOptions, OpenAIContext, -} from "./OpenAIContext.js"; +} from "./openAIContext.js"; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts index 2dd7b80604..3b160ce5e4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/models/index.ts @@ -8,8 +8,8 @@ import { } from "../../models/models.js"; import { isUnexpected, - ModelsDeleteOperation200Response, - ModelsDeleteOperationDefaultResponse, + ModelsDelete200Response, + ModelsDeleteDefaultResponse, ModelsList200Response, ModelsListDefaultResponse, ModelsRetrieve200Response, @@ -22,14 +22,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, } from "../../models/options.js"; export function _listSend( context: Client, - options: ModelsListOptions = { requestOptions: {} }, + options: ModelsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/models") @@ -56,7 +56,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: ModelsListOptions = { requestOptions: {} }, + options: ModelsListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -65,7 +65,7 @@ export async function list( export function _retrieveSend( context: Client, model: string, - options: ModelsRetrieveOptions = { requestOptions: {} }, + options: ModelsRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/models/{model}", model) @@ -90,28 +90,24 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, model: string, - options: ModelsRetrieveOptions = { requestOptions: {} }, + options: ModelsRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, model, options); return _retrieveDeserialize(result); } -export function _deleteOperationSend( +export function _$deleteSend( context: Client, model: string, - options: ModelsDeleteOperationOptions = { requestOptions: {} }, -): StreamableMethod< - ModelsDeleteOperation200Response | ModelsDeleteOperationDefaultResponse -> { + options: ModelsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/models/{model}", model) .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteOperationDeserialize( - result: - | ModelsDeleteOperation200Response - | ModelsDeleteOperationDefaultResponse, +export async function _$deleteDeserialize( + result: ModelsDelete200Response | ModelsDeleteDefaultResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -124,11 +120,16 @@ export async function _deleteOperationDeserialize( }; } -export async function deleteOperation( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, model: string, - options: ModelsDeleteOperationOptions = { requestOptions: {} }, + options: ModelsDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteOperationSend(context, model, options); - return _deleteOperationDeserialize(result); + const result = await _$deleteSend(context, model, options); + return _$deleteDeserialize(result); } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts index efaa3e2492..4b0cb15ac6 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/moderations/index.ts @@ -16,12 +16,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ModerationsCreateOptions } from "../../models/options.js"; +import { ModerationsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, content: CreateModerationRequest, - options: ModerationsCreateOptions = { requestOptions: {} }, + options: ModerationsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< ModerationsCreate200Response | ModerationsCreateDefaultResponse > { @@ -78,7 +78,7 @@ export async function _createDeserialize( export async function create( context: Client, content: CreateModerationRequest, - options: ModerationsCreateOptions = { requestOptions: {} }, + options: ModerationsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, content, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/OpenAIContext.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts similarity index 100% rename from packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/OpenAIContext.ts rename to packages/typespec-test/test/openai_generic/generated/typespec-ts/src/api/openAIContext.ts diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts index 1350e15202..c0a04121a8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { AudioTranscriptionsOperations, getAudioTranscriptionsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts index ce2ffeb654..db43a341dd 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/transcriptions/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateTranscriptionRequest, CreateTranscriptionResponse, } from "../../../models/models.js"; import { create } from "../../../api/audio/transcriptions/index.js"; -import { AudioTranscriptionsCreateOptions } from "../../../models/options.js"; +import { AudioTranscriptionsCreateOptionalParams } from "../../../models/options.js"; export interface AudioTranscriptionsOperations { create: ( audio: CreateTranscriptionRequest, - options?: AudioTranscriptionsCreateOptions, + options?: AudioTranscriptionsCreateOptionalParams, ) => Promise; } @@ -20,7 +20,7 @@ export function getAudioTranscriptions(context: OpenAIContext) { return { create: ( audio: CreateTranscriptionRequest, - options?: AudioTranscriptionsCreateOptions, + options?: AudioTranscriptionsCreateOptionalParams, ) => create(context, audio, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts index bc54ab855a..63f7dc1409 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/audio/translations/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateTranslationRequest, CreateTranslationResponse, } from "../../../models/models.js"; import { create } from "../../../api/audio/translations/index.js"; -import { AudioTranslationsCreateOptions } from "../../../models/options.js"; +import { AudioTranslationsCreateOptionalParams } from "../../../models/options.js"; export interface AudioTranslationsOperations { create: ( audio: CreateTranslationRequest, - options?: AudioTranslationsCreateOptions, + options?: AudioTranslationsCreateOptionalParams, ) => Promise; } @@ -20,7 +20,7 @@ export function getAudioTranslations(context: OpenAIContext) { return { create: ( audio: CreateTranslationRequest, - options?: AudioTranslationsCreateOptions, + options?: AudioTranslationsCreateOptionalParams, ) => create(context, audio, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts index 1fe629deec..2a77e8911d 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/completions/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateChatCompletionRequest, CreateChatCompletionResponse, } from "../../../models/models.js"; import { create } from "../../../api/chat/completions/index.js"; -import { ChatCompletionsCreateOptions } from "../../../models/options.js"; +import { ChatCompletionsCreateOptionalParams } from "../../../models/options.js"; export interface ChatCompletionsOperations { create: ( body: CreateChatCompletionRequest, - options?: ChatCompletionsCreateOptions, + options?: ChatCompletionsCreateOptionalParams, ) => Promise; } @@ -20,7 +20,7 @@ export function getChatCompletions(context: OpenAIContext) { return { create: ( body: CreateChatCompletionRequest, - options?: ChatCompletionsCreateOptions, + options?: ChatCompletionsCreateOptionalParams, ) => create(context, body, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts index 8a44e3a848..4bb844f0fe 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/chat/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { ChatCompletionsOperations, getChatCompletionsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts index a7c50b0f77..8ed5b2f942 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/completions/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateCompletionRequest, CreateCompletionResponse, } from "../../models/models.js"; import { create } from "../../api/completions/index.js"; -import { CompletionsCreateOptions } from "../../models/options.js"; +import { CompletionsCreateOptionalParams } from "../../models/options.js"; export interface CompletionsOperations { create: ( body: CreateCompletionRequest, - options?: CompletionsCreateOptions, + options?: CompletionsCreateOptionalParams, ) => Promise; } @@ -20,7 +20,7 @@ export function getCompletions(context: OpenAIContext) { return { create: ( body: CreateCompletionRequest, - options?: CompletionsCreateOptions, + options?: CompletionsCreateOptionalParams, ) => create(context, body, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts index e0dbc1b3b0..cb5243dd3c 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/edits/index.ts @@ -1,21 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateEditRequest, CreateEditResponse } from "../../models/models.js"; import { create } from "../../api/edits/index.js"; -import { EditsCreateOptions } from "../../models/options.js"; +import { EditsCreateOptionalParams } from "../../models/options.js"; export interface EditsOperations { create: ( edit: CreateEditRequest, - options?: EditsCreateOptions, + options?: EditsCreateOptionalParams, ) => Promise; } export function getEdits(context: OpenAIContext) { return { - create: (edit: CreateEditRequest, options?: EditsCreateOptions) => + create: (edit: CreateEditRequest, options?: EditsCreateOptionalParams) => create(context, edit, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts index 54df2ce6c1..bfaaad7c87 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/embeddings/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateEmbeddingRequest, CreateEmbeddingResponse, } from "../../models/models.js"; import { create } from "../../api/embeddings/index.js"; -import { EmbeddingsCreateOptions } from "../../models/options.js"; +import { EmbeddingsCreateOptionalParams } from "../../models/options.js"; export interface EmbeddingsOperations { create: ( embedding: CreateEmbeddingRequest, - options?: EmbeddingsCreateOptions, + options?: EmbeddingsCreateOptionalParams, ) => Promise; } @@ -20,7 +20,7 @@ export function getEmbeddings(context: OpenAIContext) { return { create: ( embedding: CreateEmbeddingRequest, - options?: EmbeddingsCreateOptions, + options?: EmbeddingsCreateOptionalParams, ) => create(context, embedding, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts index 18de510bd8..d455636df8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/files/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { OpenAIFile, ListFilesResponse, @@ -12,44 +12,47 @@ import { list, create, retrieve, - deleteOperation, + $delete, download, } from "../../api/files/index.js"; import { - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, } from "../../models/options.js"; export interface FilesOperations { - list: (options?: FilesListOptions) => Promise; + list: (options?: FilesListOptionalParams) => Promise; create: ( file: CreateFileRequest, - options?: FilesCreateOptions, + options?: FilesCreateOptionalParams, ) => Promise; retrieve: ( fileId: string, - options?: FilesRetrieveOptions, + options?: FilesRetrieveOptionalParams, ) => Promise; - deleteOperation: ( + delete: ( fileId: string, - options?: FilesDeleteOperationOptions, + options?: FilesDeleteOptionalParams, ) => Promise; - download: (fileId: string, options?: FilesDownloadOptions) => Promise; + download: ( + fileId: string, + options?: FilesDownloadOptionalParams, + ) => Promise; } export function getFiles(context: OpenAIContext) { return { - list: (options?: FilesListOptions) => list(context, options), - create: (file: CreateFileRequest, options?: FilesCreateOptions) => + list: (options?: FilesListOptionalParams) => list(context, options), + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => create(context, file, options), - retrieve: (fileId: string, options?: FilesRetrieveOptions) => + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => retrieve(context, fileId, options), - deleteOperation: (fileId: string, options?: FilesDeleteOperationOptions) => - deleteOperation(context, fileId, options), - download: (fileId: string, options?: FilesDownloadOptions) => + delete: (fileId: string, options?: FilesDeleteOptionalParams) => + $delete(context, fileId, options), + download: (fileId: string, options?: FilesDownloadOptionalParams) => download(context, fileId, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts index 6582380a7f..f199327d75 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateFineTuneRequest, FineTune, @@ -16,30 +16,32 @@ import { cancel, } from "../../api/fineTunes/index.js"; import { - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, } from "../../models/options.js"; export interface FineTunesOperations { create: ( fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptions, + options?: FineTunesCreateOptionalParams, ) => Promise; - list: (options?: FineTunesListOptions) => Promise; + list: ( + options?: FineTunesListOptionalParams, + ) => Promise; retrieve: ( fineTuneId: string, - options?: FineTunesRetrieveOptions, + options?: FineTunesRetrieveOptionalParams, ) => Promise; listEvents: ( fineTuneId: string, - options?: FineTunesListEventsOptions, + options?: FineTunesListEventsOptionalParams, ) => Promise; cancel: ( fineTuneId: string, - options?: FineTunesCancelOptions, + options?: FineTunesCancelOptionalParams, ) => Promise; } @@ -47,14 +49,16 @@ export function getFineTunes(context: OpenAIContext) { return { create: ( fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptions, + options?: FineTunesCreateOptionalParams, ) => create(context, fineTune, options), - list: (options?: FineTunesListOptions) => list(context, options), - retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptions) => + list: (options?: FineTunesListOptionalParams) => list(context, options), + retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => retrieve(context, fineTuneId, options), - listEvents: (fineTuneId: string, options?: FineTunesListEventsOptions) => - listEvents(context, fineTuneId, options), - cancel: (fineTuneId: string, options?: FineTunesCancelOptions) => + listEvents: ( + fineTuneId: string, + options?: FineTunesListEventsOptionalParams, + ) => listEvents(context, fineTuneId, options), + cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => cancel(context, fineTuneId, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts index d74beb6da0..03f25e1129 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { FineTuningJobsOperations, getFineTuningJobsOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index 6966788fc6..c083412f8f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateFineTuningJobRequest, FineTuningJob, @@ -16,32 +16,32 @@ import { cancel, } from "../../../api/fineTuning/jobs/index.js"; import { - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, } from "../../../models/options.js"; export interface FineTuningJobsOperations { create: ( job: CreateFineTuningJobRequest, - options?: FineTuningJobsCreateOptions, + options?: FineTuningJobsCreateOptionalParams, ) => Promise; list: ( - options?: FineTuningJobsListOptions, + options?: FineTuningJobsListOptionalParams, ) => Promise; retrieve: ( fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptions, + options?: FineTuningJobsRetrieveOptionalParams, ) => Promise; listEvents: ( fineTuningJobId: string, - options?: FineTuningJobsListEventsOptions, + options?: FineTuningJobsListEventsOptionalParams, ) => Promise; cancel: ( fineTuningJobId: string, - options?: FineTuningJobsCancelOptions, + options?: FineTuningJobsCancelOptionalParams, ) => Promise; } @@ -49,19 +49,22 @@ export function getFineTuningJobs(context: OpenAIContext) { return { create: ( job: CreateFineTuningJobRequest, - options?: FineTuningJobsCreateOptions, + options?: FineTuningJobsCreateOptionalParams, ) => create(context, job, options), - list: (options?: FineTuningJobsListOptions) => list(context, options), + list: (options?: FineTuningJobsListOptionalParams) => + list(context, options), retrieve: ( fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptions, + options?: FineTuningJobsRetrieveOptionalParams, ) => retrieve(context, fineTuningJobId, options), listEvents: ( fineTuningJobId: string, - options?: FineTuningJobsListEventsOptions, + options?: FineTuningJobsListEventsOptionalParams, ) => listEvents(context, fineTuningJobId, options), - cancel: (fineTuningJobId: string, options?: FineTuningJobsCancelOptions) => - cancel(context, fineTuningJobId, options), + cancel: ( + fineTuningJobId: string, + options?: FineTuningJobsCancelOptionalParams, + ) => cancel(context, fineTuningJobId, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts index 4580dadc14..7558487b9b 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/images/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateImageRequest, ImagesResponse, @@ -10,37 +10,37 @@ import { } from "../../models/models.js"; import { create, createEdit, createVariation } from "../../api/images/index.js"; import { - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, } from "../../models/options.js"; export interface ImagesOperations { create: ( image: CreateImageRequest, - options?: ImagesCreateOptions, + options?: ImagesCreateOptionalParams, ) => Promise; createEdit: ( image: CreateImageEditRequest, - options?: ImagesCreateEditOptions, + options?: ImagesCreateEditOptionalParams, ) => Promise; createVariation: ( image: CreateImageVariationRequest, - options?: ImagesCreateVariationOptions, + options?: ImagesCreateVariationOptionalParams, ) => Promise; } export function getImages(context: OpenAIContext) { return { - create: (image: CreateImageRequest, options?: ImagesCreateOptions) => + create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => create(context, image, options), createEdit: ( image: CreateImageEditRequest, - options?: ImagesCreateEditOptions, + options?: ImagesCreateEditOptionalParams, ) => createEdit(context, image, options), createVariation: ( image: CreateImageVariationRequest, - options?: ImagesCreateVariationOptions, + options?: ImagesCreateVariationOptionalParams, ) => createVariation(context, image, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts index 0b67d9de9d..5e1a082e71 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/models/index.ts @@ -1,35 +1,38 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { ListModelsResponse, Model, DeleteModelResponse, } from "../../models/models.js"; -import { list, retrieve, deleteOperation } from "../../api/models/index.js"; +import { list, retrieve, $delete } from "../../api/models/index.js"; import { - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, } from "../../models/options.js"; export interface ModelsOperations { - list: (options?: ModelsListOptions) => Promise; - retrieve: (model: string, options?: ModelsRetrieveOptions) => Promise; - deleteOperation: ( + list: (options?: ModelsListOptionalParams) => Promise; + retrieve: ( model: string, - options?: ModelsDeleteOperationOptions, + options?: ModelsRetrieveOptionalParams, + ) => Promise; + delete: ( + model: string, + options?: ModelsDeleteOptionalParams, ) => Promise; } export function getModels(context: OpenAIContext) { return { - list: (options?: ModelsListOptions) => list(context, options), - retrieve: (model: string, options?: ModelsRetrieveOptions) => + list: (options?: ModelsListOptionalParams) => list(context, options), + retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => retrieve(context, model, options), - deleteOperation: (model: string, options?: ModelsDeleteOperationOptions) => - deleteOperation(context, model, options), + delete: (model: string, options?: ModelsDeleteOptionalParams) => + $delete(context, model, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts index 1845ad1856..05763c6bd1 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/classic/moderations/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateModerationRequest, CreateModerationResponse, } from "../../models/models.js"; import { create } from "../../api/moderations/index.js"; -import { ModerationsCreateOptions } from "../../models/options.js"; +import { ModerationsCreateOptionalParams } from "../../models/options.js"; export interface ModerationsOperations { create: ( content: CreateModerationRequest, - options?: ModerationsCreateOptions, + options?: ModerationsCreateOptionalParams, ) => Promise; } @@ -20,7 +20,7 @@ export function getModerations(context: OpenAIContext) { return { create: ( content: CreateModerationRequest, - options?: ModerationsCreateOptions, + options?: ModerationsCreateOptionalParams, ) => create(context, content, options), }; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts index ada475f0e6..e007f2f3e8 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { OpenAIClient, OpenAIClientOptions } from "./OpenAIClient.js"; +export { OpenAIClient, OpenAIClientOptions } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, - Error, + ErrorModel, CreateImageRequest, ImagesResponse, Image, @@ -36,10 +36,10 @@ export { ListPaginatedFineTuningJobsResponse, ListFineTuningJobEventsResponse, FineTuningJobEvent, - CreateChatCompletionRequest, ChatCompletionRequestMessage, ChatCompletionFunctions, ChatCompletionFunctionCallOption, + CreateChatCompletionRequest, CreateChatCompletionResponse, ChatCompletionResponseMessage, CreateTranslationRequest, @@ -48,34 +48,34 @@ export { CreateTranscriptionResponse, Prompt, Stop, - AudioTranscriptionsCreateOptions, - AudioTranslationsCreateOptions, - ChatCompletionsCreateOptions, - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, - CompletionsCreateOptions, - EditsCreateOptions, - EmbeddingsCreateOptions, - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, - ModerationsCreateOptions, + AudioTranscriptionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, + CompletionsCreateOptionalParams, + EditsCreateOptionalParams, + EmbeddingsCreateOptionalParams, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, + ModerationsCreateOptionalParams, } from "./models/index.js"; export { AudioOperations, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts index 7f0a2a2385..8e4000d7cd 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts @@ -4,7 +4,7 @@ export { CreateModerationRequest, CreateModerationResponse, - Error, + ErrorModel, CreateImageRequest, ImagesResponse, Image, @@ -35,10 +35,10 @@ export { ListPaginatedFineTuningJobsResponse, ListFineTuningJobEventsResponse, FineTuningJobEvent, - CreateChatCompletionRequest, ChatCompletionRequestMessage, ChatCompletionFunctions, ChatCompletionFunctionCallOption, + CreateChatCompletionRequest, CreateChatCompletionResponse, ChatCompletionResponseMessage, CreateTranslationRequest, @@ -49,32 +49,32 @@ export { Stop, } from "./models.js"; export { - AudioTranscriptionsCreateOptions, - AudioTranslationsCreateOptions, - ChatCompletionsCreateOptions, - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, - CompletionsCreateOptions, - EditsCreateOptions, - EmbeddingsCreateOptions, - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, - ModerationsCreateOptions, + AudioTranscriptionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, + CompletionsCreateOptionalParams, + EditsCreateOptionalParams, + EmbeddingsCreateOptionalParams, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, + ModerationsCreateOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts index 402857cf87..fbab89d2a3 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts @@ -51,7 +51,7 @@ export interface CreateModerationResponse { }[]; } -export interface Error { +export interface ErrorModel { type: string; message: string; param: string | null; @@ -730,6 +730,50 @@ export interface FineTuningJobEvent { message: string; } +export interface ChatCompletionRequestMessage { + /** The role of the messages author. One of `system`, `user`, `assistant`, or `function`. */ + role: "system" | "user" | "assistant" | "function"; + /** + * The contents of the message. `content` is required for all messages, and may be null for + * assistant messages with function calls. + */ + content: string | null; + /** + * The name of the author of this message. `name` is required if role is `function`, and it + * should be the name of the function whose response is in the `content`. May contain a-z, + * A-Z, 0-9, and underscores, with a maximum length of 64 characters. + */ + name?: string; + /** The name and arguments of a function that should be called, as generated by the model. */ + functionCall?: { name: string; arguments: string }; +} + +export interface ChatCompletionFunctions { + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and + * dashes, with a maximum length of 64. + */ + name: string; + /** + * A description of what the function does, used by the model to choose when and how to call the + * function. + */ + description?: string; + /** + * The parameters the functions accepts, described as a JSON Schema object. See the + * [guide](/docs/guides/gpt/function-calling) for examples, and the + * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation + * about the format.\n\nTo describe a function that accepts no parameters, provide the value + * `{\"type\": \"object\", \"properties\": {}}`. + */ + parameters: Record; +} + +export interface ChatCompletionFunctionCallOption { + /** The name of the function to call. */ + name: string; +} + export interface CreateChatCompletionRequest { /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) @@ -832,50 +876,6 @@ export interface CreateChatCompletionRequest { stream?: boolean | null; } -export interface ChatCompletionRequestMessage { - /** The role of the messages author. One of `system`, `user`, `assistant`, or `function`. */ - role: "system" | "user" | "assistant" | "function"; - /** - * The contents of the message. `content` is required for all messages, and may be null for - * assistant messages with function calls. - */ - content: string | null; - /** - * The name of the author of this message. `name` is required if role is `function`, and it - * should be the name of the function whose response is in the `content`. May contain a-z, - * A-Z, 0-9, and underscores, with a maximum length of 64 characters. - */ - name?: string; - /** The name and arguments of a function that should be called, as generated by the model. */ - functionCall?: { name: string; arguments: string }; -} - -export interface ChatCompletionFunctions { - /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and - * dashes, with a maximum length of 64. - */ - name: string; - /** - * A description of what the function does, used by the model to choose when and how to call the - * function. - */ - description?: string; - /** - * The parameters the functions accepts, described as a JSON Schema object. See the - * [guide](/docs/guides/gpt/function-calling) for examples, and the - * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation - * about the format.\n\nTo describe a function that accepts no parameters, provide the value - * `{\"type\": \"object\", \"properties\": {}}`. - */ - parameters: Record; -} - -export interface ChatCompletionFunctionCallOption { - /** The name of the function to call. */ - name: string; -} - /** Represents a chat completion response returned by model, based on the provided input. */ export interface CreateChatCompletionResponse { /** A unique identifier for the chat completion. */ diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/options.ts index 42e2b2f697..b8ce393d38 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/options.ts @@ -3,61 +3,65 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface AudioTranscriptionsCreateOptions extends OperationOptions { +export interface AudioTranscriptionsCreateOptionalParams + extends OperationOptions { contentType?: string; } -export interface AudioTranslationsCreateOptions extends OperationOptions { +export interface AudioTranslationsCreateOptionalParams + extends OperationOptions { contentType?: string; } -export interface ChatCompletionsCreateOptions extends OperationOptions {} +export interface ChatCompletionsCreateOptionalParams extends OperationOptions {} -export interface FineTuningJobsCreateOptions extends OperationOptions {} +export interface FineTuningJobsCreateOptionalParams extends OperationOptions {} -export interface FineTuningJobsListOptions extends OperationOptions { +export interface FineTuningJobsListOptionalParams extends OperationOptions { /** Identifier for the last job from the previous pagination request. */ after?: string; /** Number of fine-tuning jobs to retrieve. */ limit?: number; } -export interface FineTuningJobsRetrieveOptions extends OperationOptions {} +export interface FineTuningJobsRetrieveOptionalParams + extends OperationOptions {} -export interface FineTuningJobsListEventsOptions extends OperationOptions { +export interface FineTuningJobsListEventsOptionalParams + extends OperationOptions { /** Identifier for the last event from the previous pagination request. */ after?: string; /** Number of events to retrieve. */ limit?: number; } -export interface FineTuningJobsCancelOptions extends OperationOptions {} +export interface FineTuningJobsCancelOptionalParams extends OperationOptions {} -export interface CompletionsCreateOptions extends OperationOptions {} +export interface CompletionsCreateOptionalParams extends OperationOptions {} -export interface EditsCreateOptions extends OperationOptions {} +export interface EditsCreateOptionalParams extends OperationOptions {} -export interface EmbeddingsCreateOptions extends OperationOptions {} +export interface EmbeddingsCreateOptionalParams extends OperationOptions {} -export interface FilesListOptions extends OperationOptions {} +export interface FilesListOptionalParams extends OperationOptions {} -export interface FilesCreateOptions extends OperationOptions { +export interface FilesCreateOptionalParams extends OperationOptions { contentType?: string; } -export interface FilesRetrieveOptions extends OperationOptions {} +export interface FilesRetrieveOptionalParams extends OperationOptions {} -export interface FilesDeleteOperationOptions extends OperationOptions {} +export interface FilesDeleteOptionalParams extends OperationOptions {} -export interface FilesDownloadOptions extends OperationOptions {} +export interface FilesDownloadOptionalParams extends OperationOptions {} -export interface FineTunesCreateOptions extends OperationOptions {} +export interface FineTunesCreateOptionalParams extends OperationOptions {} -export interface FineTunesListOptions extends OperationOptions {} +export interface FineTunesListOptionalParams extends OperationOptions {} -export interface FineTunesRetrieveOptions extends OperationOptions {} +export interface FineTunesRetrieveOptionalParams extends OperationOptions {} -export interface FineTunesListEventsOptions extends OperationOptions { +export interface FineTunesListEventsOptionalParams extends OperationOptions { /** * Whether to stream events for the fine-tune job. If set to true, events will be sent as * data-only @@ -70,22 +74,22 @@ export interface FineTunesListEventsOptions extends OperationOptions { stream?: boolean; } -export interface FineTunesCancelOptions extends OperationOptions {} +export interface FineTunesCancelOptionalParams extends OperationOptions {} -export interface ModelsListOptions extends OperationOptions {} +export interface ModelsListOptionalParams extends OperationOptions {} -export interface ModelsRetrieveOptions extends OperationOptions {} +export interface ModelsRetrieveOptionalParams extends OperationOptions {} -export interface ModelsDeleteOperationOptions extends OperationOptions {} +export interface ModelsDeleteOptionalParams extends OperationOptions {} -export interface ImagesCreateOptions extends OperationOptions {} +export interface ImagesCreateOptionalParams extends OperationOptions {} -export interface ImagesCreateEditOptions extends OperationOptions { +export interface ImagesCreateEditOptionalParams extends OperationOptions { contentType?: string; } -export interface ImagesCreateVariationOptions extends OperationOptions { +export interface ImagesCreateVariationOptionalParams extends OperationOptions { contentType?: string; } -export interface ModerationsCreateOptions extends OperationOptions {} +export interface ModerationsCreateOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/OpenAIClient.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts similarity index 98% rename from packages/typespec-test/test/openai_generic/generated/typespec-ts/src/OpenAIClient.ts rename to packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts index 6867aff1b4..2a714805be 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/OpenAIClient.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/openAIClient.ts @@ -41,7 +41,7 @@ import { OpenAIContext, } from "./api/index.js"; -export { OpenAIClientOptions } from "./api/OpenAIContext.js"; +export { OpenAIClientOptions } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/clientDefinitions.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/clientDefinitions.ts index b9c8cba329..3bd9f34878 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/clientDefinitions.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/clientDefinitions.ts @@ -60,8 +60,8 @@ import { FilesCreateDefaultResponse, FilesRetrieve200Response, FilesRetrieveDefaultResponse, - FilesDeleteOperation200Response, - FilesDeleteOperationDefaultResponse, + FilesDelete200Response, + FilesDeleteDefaultResponse, FilesDownload200Response, FilesDownloadDefaultResponse, FineTunesCreate200Response, @@ -78,8 +78,8 @@ import { ModelsListDefaultResponse, ModelsRetrieve200Response, ModelsRetrieveDefaultResponse, - ModelsDeleteOperation200Response, - ModelsDeleteOperationDefaultResponse, + ModelsDelete200Response, + ModelsDeleteDefaultResponse, ImagesCreate200Response, ImagesCreateDefaultResponse, ImagesCreateEdit200Response, @@ -199,9 +199,7 @@ export interface FilesRetrieve { ): StreamableMethod; delete( options?: FilesDeleteParameters, - ): StreamableMethod< - FilesDeleteOperation200Response | FilesDeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface FilesDownload { @@ -259,9 +257,7 @@ export interface ModelsRetrieve { >; delete( options?: ModelsDeleteParameters, - ): StreamableMethod< - ModelsDeleteOperation200Response | ModelsDeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface ImagesCreate { diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/isUnexpected.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/isUnexpected.ts index 2bd76705cf..a76d158acd 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/isUnexpected.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/isUnexpected.ts @@ -30,8 +30,8 @@ import { FilesCreateDefaultResponse, FilesRetrieve200Response, FilesRetrieveDefaultResponse, - FilesDeleteOperation200Response, - FilesDeleteOperationDefaultResponse, + FilesDelete200Response, + FilesDeleteDefaultResponse, FilesDownload200Response, FilesDownloadDefaultResponse, FineTunesCreate200Response, @@ -48,8 +48,8 @@ import { ModelsListDefaultResponse, ModelsRetrieve200Response, ModelsRetrieveDefaultResponse, - ModelsDeleteOperation200Response, - ModelsDeleteOperationDefaultResponse, + ModelsDelete200Response, + ModelsDeleteDefaultResponse, ImagesCreate200Response, ImagesCreateDefaultResponse, ImagesCreateEdit200Response, @@ -148,10 +148,8 @@ export function isUnexpected( response: FilesRetrieve200Response | FilesRetrieveDefaultResponse, ): response is FilesRetrieveDefaultResponse; export function isUnexpected( - response: - | FilesDeleteOperation200Response - | FilesDeleteOperationDefaultResponse, -): response is FilesDeleteOperationDefaultResponse; + response: FilesDelete200Response | FilesDeleteDefaultResponse, +): response is FilesDeleteDefaultResponse; export function isUnexpected( response: FilesDownload200Response | FilesDownloadDefaultResponse, ): response is FilesDownloadDefaultResponse; @@ -177,10 +175,8 @@ export function isUnexpected( response: ModelsRetrieve200Response | ModelsRetrieveDefaultResponse, ): response is ModelsRetrieveDefaultResponse; export function isUnexpected( - response: - | ModelsDeleteOperation200Response - | ModelsDeleteOperationDefaultResponse, -): response is ModelsDeleteOperationDefaultResponse; + response: ModelsDelete200Response | ModelsDeleteDefaultResponse, +): response is ModelsDeleteDefaultResponse; export function isUnexpected( response: ImagesCreate200Response | ImagesCreateDefaultResponse, ): response is ImagesCreateDefaultResponse; @@ -225,8 +221,8 @@ export function isUnexpected( | FilesCreateDefaultResponse | FilesRetrieve200Response | FilesRetrieveDefaultResponse - | FilesDeleteOperation200Response - | FilesDeleteOperationDefaultResponse + | FilesDelete200Response + | FilesDeleteDefaultResponse | FilesDownload200Response | FilesDownloadDefaultResponse | FineTunesCreate200Response @@ -243,8 +239,8 @@ export function isUnexpected( | ModelsListDefaultResponse | ModelsRetrieve200Response | ModelsRetrieveDefaultResponse - | ModelsDeleteOperation200Response - | ModelsDeleteOperationDefaultResponse + | ModelsDelete200Response + | ModelsDeleteDefaultResponse | ImagesCreate200Response | ImagesCreateDefaultResponse | ImagesCreateEdit200Response @@ -268,7 +264,7 @@ export function isUnexpected( | FilesListDefaultResponse | FilesCreateDefaultResponse | FilesRetrieveDefaultResponse - | FilesDeleteOperationDefaultResponse + | FilesDeleteDefaultResponse | FilesDownloadDefaultResponse | FineTunesCreateDefaultResponse | FineTunesListDefaultResponse @@ -277,7 +273,7 @@ export function isUnexpected( | FineTunesCancelDefaultResponse | ModelsListDefaultResponse | ModelsRetrieveDefaultResponse - | ModelsDeleteOperationDefaultResponse + | ModelsDeleteDefaultResponse | ImagesCreateDefaultResponse | ImagesCreateEditDefaultResponse | ImagesCreateVariationDefaultResponse diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/outputModels.ts index e6f3b95063..6c0b802d8d 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/outputModels.ts @@ -69,7 +69,7 @@ export interface FineTuningJobOutput { * The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be * null if the fine-tuning job is still running. */ - finished_at: string | null; + finished_at: number | null; /** The base model that is being fine-tuned. */ model: string; /** diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/responses.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/responses.ts index e5d8f3c30a..dfcf365c02 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/responses.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/rest/responses.ts @@ -181,12 +181,12 @@ export interface FilesRetrieveDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface FilesDeleteOperation200Response extends HttpResponse { +export interface FilesDelete200Response extends HttpResponse { status: "200"; body: DeleteFileResponseOutput; } -export interface FilesDeleteOperationDefaultResponse extends HttpResponse { +export interface FilesDeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -280,12 +280,12 @@ export interface ModelsRetrieveDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface ModelsDeleteOperation200Response extends HttpResponse { +export interface ModelsDelete200Response extends HttpResponse { status: "200"; body: DeleteModelResponseOutput; } -export interface ModelsDeleteOperationDefaultResponse extends HttpResponse { +export interface ModelsDeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json index b1d2928bfb..dfef5c47c6 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/package.json @@ -42,7 +42,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -57,8 +57,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md index a99de58623..1521659d64 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/review/openai_modular.api.md @@ -19,14 +19,14 @@ export interface AudioSpeechOptions { voice: AudioSpeechVoice; } -// @public -export type AudioSpeechOutputFormat = string; +// @public (undocumented) +export type AudioSpeechOutputFormat = "mp3" | "opus" | "aac" | "flac"; -// @public -export type AudioSpeechVoice = string; +// @public (undocumented) +export type AudioSpeechVoice = "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer"; -// @public -export type AudioTaskLabel = string; +// @public (undocumented) +export type AudioTaskLabel = "transcribe" | "translate"; // @public export interface AudioTranscription { @@ -37,8 +37,8 @@ export interface AudioTranscription { text: string; } -// @public -export type AudioTranscriptionFormat = string; +// @public (undocumented) +export type AudioTranscriptionFormat = "json" | "verbose_json" | "text" | "srt" | "vtt"; // @public export interface AudioTranscriptionOptions { @@ -74,8 +74,8 @@ export interface AudioTranslation { text: string; } -// @public -export type AudioTranslationFormat = string; +// @public (undocumented) +export type AudioTranslationFormat = "json" | "verbose_json" | "text" | "srt" | "vtt"; // @public export interface AudioTranslationOptions { @@ -135,8 +135,8 @@ export interface AzureChatExtensionsMessageContext { intent?: string; } -// @public -export type AzureChatExtensionType = string; +// @public (undocumented) +export type AzureChatExtensionType = "azure_search" | "azure_ml_index" | "azure_cosmos_db" | "elasticsearch" | "Pinecone"; // @public export interface AzureChatGroundingEnhancementConfiguration { @@ -255,8 +255,8 @@ export interface AzureSearchIndexFieldMappingOptions { vectorFields?: string[]; } -// @public -export type AzureSearchQueryType = string; +// @public (undocumented) +export type AzureSearchQueryType = "simple" | "semantic" | "vector" | "vector_simple_hybrid" | "vector_semantic_hybrid"; // @public export interface ChatChoice { @@ -382,8 +382,8 @@ export interface ChatCompletionsToolDefinition { // @public export type ChatCompletionsToolDefinitionUnion = ChatCompletionsFunctionToolDefinition | ChatCompletionsToolDefinition; -// @public -export type ChatCompletionsToolSelectionPreset = string; +// @public (undocumented) +export type ChatCompletionsToolSelectionPreset = "auto" | "none"; // @public export interface ChatFinishDetails { @@ -407,8 +407,8 @@ export interface ChatMessageImageContentItem extends ChatMessageContentItem { type: "image_url"; } -// @public -export type ChatMessageImageDetailLevel = string; +// @public (undocumented) +export type ChatMessageImageDetailLevel = "auto" | "low" | "high"; // @public export interface ChatMessageImageUrl { @@ -476,8 +476,8 @@ export interface ChatResponseMessage { toolCalls?: ChatCompletionsToolCallUnion[]; } -// @public -export type ChatRole = string; +// @public (undocumented) +export type ChatRole = "system" | "assistant" | "user" | "function" | "tool"; // @public export interface ChatTokenLogProbabilityInfo { @@ -512,8 +512,8 @@ export interface Completions { usage: CompletionsUsage; } -// @public -export type CompletionsFinishReason = string; +// @public (undocumented) +export type CompletionsFinishReason = "stop" | "length" | "content_filter" | "function_call" | "tool_calls"; // @public export interface CompletionsLogProbabilityModel { @@ -614,8 +614,8 @@ export interface ContentFilterResultsForPrompt { promptIndex: number; } -// @public -export type ContentFilterSeverity = string; +// @public (undocumented) +export type ContentFilterSeverity = "safe" | "low" | "medium" | "high"; // @public export interface ElasticsearchChatExtensionConfiguration extends AzureChatExtensionConfiguration { @@ -647,8 +647,8 @@ export interface ElasticsearchIndexFieldMappingOptions { vectorFields?: string[]; } -// @public -export type ElasticsearchQueryType = string; +// @public (undocumented) +export type ElasticsearchQueryType = "simple" | "vector"; // @public export interface EmbeddingItem { @@ -682,8 +682,8 @@ export interface FunctionCall { name: string; } -// @public -export type FunctionCallPreset = string; +// @public (undocumented) +export type FunctionCallPreset = "auto" | "none"; // @public export interface FunctionDefinition { @@ -698,43 +698,43 @@ export interface FunctionName { } // @public (undocumented) -export interface GetAudioSpeechOptions extends OperationOptions { +export interface GetAudioSpeechOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetAudioTranscriptionAsPlainTextOptions extends OperationOptions { +export interface GetAudioTranscriptionAsPlainTextOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface GetAudioTranscriptionAsResponseObjectOptions extends OperationOptions { +export interface GetAudioTranscriptionAsResponseObjectOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface GetAudioTranslationAsPlainTextOptions extends OperationOptions { +export interface GetAudioTranslationAsPlainTextOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface GetAudioTranslationAsResponseObjectOptions extends OperationOptions { +export interface GetAudioTranslationAsResponseObjectOptionalParams extends OperationOptions { contentType?: string; } // @public (undocumented) -export interface GetChatCompletionsOptions extends OperationOptions { +export interface GetChatCompletionsOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetCompletionsOptions extends OperationOptions { +export interface GetCompletionsOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetEmbeddingsOptions extends OperationOptions { +export interface GetEmbeddingsOptionalParams extends OperationOptions { } // @public (undocumented) -export interface GetImageGenerationsOptions extends OperationOptions { +export interface GetImageGenerationsOptionalParams extends OperationOptions { } // @public @@ -756,11 +756,11 @@ export interface ImageGenerationOptions { user?: string; } -// @public -export type ImageGenerationQuality = string; +// @public (undocumented) +export type ImageGenerationQuality = "standard" | "hd"; -// @public -export type ImageGenerationResponseFormat = string; +// @public (undocumented) +export type ImageGenerationResponseFormat = "url" | "b64_json"; // @public export interface ImageGenerations { @@ -768,11 +768,11 @@ export interface ImageGenerations { data: ImageGenerationData[]; } -// @public -export type ImageGenerationStyle = string; +// @public (undocumented) +export type ImageGenerationStyle = "natural" | "vivid"; -// @public -export type ImageSize = string; +// @public (undocumented) +export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792"; // @public export interface MaxTokensFinishDetails extends ChatFinishDetails { @@ -799,8 +799,8 @@ export interface OnYourDataAuthenticationOptions { // @public export type OnYourDataAuthenticationOptionsUnion = OnYourDataApiKeyAuthenticationOptions | OnYourDataConnectionStringAuthenticationOptions | OnYourDataKeyAndKeyIdAuthenticationOptions | OnYourDataEncodedApiKeyAuthenticationOptions | OnYourDataAccessTokenAuthenticationOptions | OnYourDataSystemAssignedManagedIdentityAuthenticationOptions | OnYourDataUserAssignedManagedIdentityAuthenticationOptions | OnYourDataAuthenticationOptions; -// @public -export type OnYourDataAuthenticationType = string; +// @public (undocumented) +export type OnYourDataAuthenticationType = "api_key" | "connection_string" | "key_and_key_id" | "encoded_api_key" | "access_token" | "system_assigned_managed_identity" | "user_assigned_managed_identity"; // @public export interface OnYourDataConnectionStringAuthenticationOptions extends OnYourDataAuthenticationOptions { @@ -856,29 +856,30 @@ export interface OnYourDataVectorizationSource { type: OnYourDataVectorizationSourceType; } -// @public -export type OnYourDataVectorizationSourceType = string; +// @public (undocumented) +export type OnYourDataVectorizationSourceType = "endpoint" | "deployment_name" | "model_id"; // @public export type OnYourDataVectorizationSourceUnion = OnYourDataEndpointVectorizationSource | OnYourDataDeploymentNameVectorizationSource | OnYourDataModelIdVectorizationSource | OnYourDataVectorizationSource; // @public (undocumented) export class OpenAIClient { - constructor(endpoint: string, credential: KeyCredential | TokenCredential, options?: OpenAIClientOptions); - getAudioSpeech(deploymentId: string, body: AudioSpeechOptions, options?: GetAudioSpeechOptions): Promise; - getAudioTranscriptionAsPlainText(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsPlainTextOptions): Promise; - getAudioTranscriptionAsResponseObject(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsResponseObjectOptions): Promise; - getAudioTranslationAsPlainText(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsPlainTextOptions): Promise; - getAudioTranslationAsResponseObject(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsResponseObjectOptions): Promise; - getChatCompletions(deploymentId: string, body: ChatCompletionsOptions, options?: GetChatCompletionsOptions): Promise; - getCompletions(deploymentId: string, body: CompletionsOptions, options?: GetCompletionsOptions): Promise; - getEmbeddings(deploymentId: string, body: EmbeddingsOptions, options?: GetEmbeddingsOptions): Promise; - getImageGenerations(deploymentId: string, body: ImageGenerationOptions, options?: GetImageGenerationsOptions): Promise; + constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: OpenAIClientOptions); + getAudioSpeech(deploymentId: string, body: AudioSpeechOptions, options?: GetAudioSpeechOptionalParams): Promise; + getAudioTranscriptionAsPlainText(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsPlainTextOptionalParams): Promise; + getAudioTranscriptionAsResponseObject(deploymentId: string, body: AudioTranscriptionOptions, options?: GetAudioTranscriptionAsResponseObjectOptionalParams): Promise; + getAudioTranslationAsPlainText(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsPlainTextOptionalParams): Promise; + getAudioTranslationAsResponseObject(deploymentId: string, body: AudioTranslationOptions, options?: GetAudioTranslationAsResponseObjectOptionalParams): Promise; + getChatCompletions(deploymentId: string, body: ChatCompletionsOptions, options?: GetChatCompletionsOptionalParams): Promise; + getCompletions(deploymentId: string, body: CompletionsOptions, options?: GetCompletionsOptionalParams): Promise; + getEmbeddings(deploymentId: string, body: EmbeddingsOptions, options?: GetEmbeddingsOptionalParams): Promise; + getImageGenerations(deploymentId: string, body: ImageGenerationOptions, options?: GetImageGenerationsOptionalParams): Promise; readonly pipeline: Pipeline; } // @public (undocumented) export interface OpenAIClientOptions extends ClientOptions { + apiVersion?: string; } // @public @@ -909,6 +910,9 @@ export interface PineconeFieldMappingOptions { urlField?: string; } +// @public (undocumented) +export type ServiceApiVersions = "2022-12-01" | "2023-05-15" | "2023-06-01-preview" | "2023-07-01-preview" | "2024-02-15-preview"; + // @public export interface StopFinishDetails extends ChatFinishDetails { stop: string; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts index 30130a86a2..5d3b0016e6 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/index.ts @@ -5,7 +5,7 @@ export { createOpenAI, OpenAIClientOptions, OpenAIContext, -} from "./OpenAIContext.js"; +} from "./openAIContext.js"; export { getAudioTranscriptionAsPlainText, getAudioTranscriptionAsResponseObject, diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/OpenAIContext.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts similarity index 68% rename from packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/OpenAIContext.ts rename to packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts index 0c1c89790b..1a906baa11 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/OpenAIContext.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/openAIContext.ts @@ -6,15 +6,18 @@ import { ClientOptions } from "@azure-rest/core-client"; import { OpenAIContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface OpenAIClientOptions extends ClientOptions {} +export interface OpenAIClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { OpenAIContext } from "../rest/index.js"; export function createOpenAI( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: OpenAIClientOptions = {}, ): OpenAIContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts index bc7c92758a..c90dc4a31a 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/api/operations.ts @@ -49,22 +49,24 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - GetAudioTranscriptionAsPlainTextOptions, - GetAudioTranscriptionAsResponseObjectOptions, - GetAudioTranslationAsPlainTextOptions, - GetAudioTranslationAsResponseObjectOptions, - GetCompletionsOptions, - GetChatCompletionsOptions, - GetImageGenerationsOptions, - GetAudioSpeechOptions, - GetEmbeddingsOptions, + GetAudioTranscriptionAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetCompletionsOptionalParams, + GetChatCompletionsOptionalParams, + GetImageGenerationsOptionalParams, + GetAudioSpeechOptionalParams, + GetEmbeddingsOptionalParams, } from "../models/options.js"; export function _getAudioTranscriptionAsPlainTextSend( context: Client, deploymentId: string, body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptions = { requestOptions: {} }, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< | GetAudioTranscriptionAsPlainText200Response | GetAudioTranscriptionAsPlainTextDefaultResponse @@ -109,7 +111,9 @@ export async function getAudioTranscriptionAsPlainText( context: Client, deploymentId: string, body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptions = { requestOptions: {} }, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getAudioTranscriptionAsPlainTextSend( context, @@ -124,7 +128,7 @@ export function _getAudioTranscriptionAsResponseObjectSend( context: Client, deploymentId: string, body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptions = { + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { requestOptions: {}, }, ): StreamableMethod< @@ -191,7 +195,7 @@ export async function getAudioTranscriptionAsResponseObject( context: Client, deploymentId: string, body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptions = { + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { requestOptions: {}, }, ): Promise { @@ -208,7 +212,9 @@ export function _getAudioTranslationAsPlainTextSend( context: Client, deploymentId: string, body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptions = { requestOptions: {} }, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< | GetAudioTranslationAsPlainText200Response | GetAudioTranslationAsPlainTextDefaultResponse @@ -249,7 +255,9 @@ export async function getAudioTranslationAsPlainText( context: Client, deploymentId: string, body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptions = { requestOptions: {} }, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getAudioTranslationAsPlainTextSend( context, @@ -264,7 +272,9 @@ export function _getAudioTranslationAsResponseObjectSend( context: Client, deploymentId: string, body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptions = { requestOptions: {} }, + options: GetAudioTranslationAsResponseObjectOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< | GetAudioTranslationAsResponseObject200Response | GetAudioTranslationAsResponseObjectDefaultResponse @@ -325,7 +335,9 @@ export async function getAudioTranslationAsResponseObject( context: Client, deploymentId: string, body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptions = { requestOptions: {} }, + options: GetAudioTranslationAsResponseObjectOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getAudioTranslationAsResponseObjectSend( context, @@ -340,7 +352,7 @@ export function _getCompletionsSend( context: Client, deploymentId: string, body: CompletionsOptions, - options: GetCompletionsOptions = { requestOptions: {} }, + options: GetCompletionsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/deployments/{deploymentId}/completions", deploymentId) @@ -538,7 +550,7 @@ export async function getCompletions( context: Client, deploymentId: string, body: CompletionsOptions, - options: GetCompletionsOptions = { requestOptions: {} }, + options: GetCompletionsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getCompletionsSend( context, @@ -553,7 +565,7 @@ export function _getChatCompletionsSend( context: Client, deploymentId: string, body: ChatCompletionsOptions, - options: GetChatCompletionsOptions = { requestOptions: {} }, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetChatCompletions200Response | GetChatCompletionsDefaultResponse > { @@ -882,7 +894,7 @@ export async function getChatCompletions( context: Client, deploymentId: string, body: ChatCompletionsOptions, - options: GetChatCompletionsOptions = { requestOptions: {} }, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getChatCompletionsSend( context, @@ -897,7 +909,7 @@ export function _getImageGenerationsSend( context: Client, deploymentId: string, body: ImageGenerationOptions, - options: GetImageGenerationsOptions = { requestOptions: {} }, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetImageGenerations200Response | GetImageGenerationsDefaultResponse > { @@ -940,7 +952,7 @@ export async function getImageGenerations( context: Client, deploymentId: string, body: ImageGenerationOptions, - options: GetImageGenerationsOptions = { requestOptions: {} }, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getImageGenerationsSend( context, @@ -955,7 +967,7 @@ export function _getAudioSpeechSend( context: Client, deploymentId: string, body: AudioSpeechOptions, - options: GetAudioSpeechOptions = { requestOptions: {} }, + options: GetAudioSpeechOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/deployments/{deploymentId}/audio/speech", deploymentId) @@ -985,7 +997,7 @@ export async function getAudioSpeech( context: Client, deploymentId: string, body: AudioSpeechOptions, - options: GetAudioSpeechOptions = { requestOptions: {} }, + options: GetAudioSpeechOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getAudioSpeechSend( context, @@ -1000,7 +1012,7 @@ export function _getEmbeddingsSend( context: Client, deploymentId: string, body: EmbeddingsOptions, - options: GetEmbeddingsOptions = { requestOptions: {} }, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/deployments/{deploymentId}/embeddings", deploymentId) @@ -1039,7 +1051,7 @@ export async function getEmbeddings( context: Client, deploymentId: string, body: EmbeddingsOptions, - options: GetEmbeddingsOptions = { requestOptions: {} }, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getEmbeddingsSend(context, deploymentId, body, options); return _getEmbeddingsDeserialize(result); diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts index 36a1840ccf..8ad4f22605 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/index.ts @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { OpenAIClient, OpenAIClientOptions } from "./OpenAIClient.js"; +export { OpenAIClient, OpenAIClientOptions } from "./openAIClient.js"; export { - AudioTranscriptionOptions, AudioTranscriptionFormat, + AudioTranscriptionOptions, AudioTranscription, AudioTaskLabel, AudioTranscriptionSegment, - AudioTranslationOptions, AudioTranslationFormat, + AudioTranslationOptions, AudioTranslation, AudioTranslationSegment, CompletionsOptions, @@ -26,7 +26,6 @@ export { CompletionsLogProbabilityModel, CompletionsFinishReason, CompletionsUsage, - ChatCompletionsOptions, ChatRequestMessage, ChatRequestSystemMessage, ChatRequestUserMessage, @@ -89,6 +88,7 @@ export { ChatCompletionsNamedToolSelection, ChatCompletionsNamedFunctionToolSelection, ChatCompletionsFunctionToolSelection, + ChatCompletionsOptions, ChatCompletions, ChatChoice, ChatResponseMessage, @@ -105,20 +105,21 @@ export { AzureGroundingEnhancementLine, AzureGroundingEnhancementLineSpan, AzureGroundingEnhancementCoordinatePoint, - ImageGenerationOptions, ImageSize, ImageGenerationResponseFormat, ImageGenerationQuality, ImageGenerationStyle, + ImageGenerationOptions, ImageGenerations, ImageGenerationData, - AudioSpeechOptions, AudioSpeechVoice, AudioSpeechOutputFormat, + AudioSpeechOptions, EmbeddingsOptions, Embeddings, EmbeddingItem, EmbeddingsUsage, + ServiceApiVersions, ChatRequestMessageUnion, ChatMessageContentItemUnion, ChatCompletionsToolCallUnion, @@ -129,13 +130,13 @@ export { ChatCompletionsToolDefinitionUnion, ChatCompletionsNamedToolSelectionUnion, ChatFinishDetailsUnion, - GetAudioTranscriptionAsPlainTextOptions, - GetAudioTranscriptionAsResponseObjectOptions, - GetAudioTranslationAsPlainTextOptions, - GetAudioTranslationAsResponseObjectOptions, - GetCompletionsOptions, - GetChatCompletionsOptions, - GetImageGenerationsOptions, - GetAudioSpeechOptions, - GetEmbeddingsOptions, + GetAudioTranscriptionAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetCompletionsOptionalParams, + GetChatCompletionsOptionalParams, + GetImageGenerationsOptionalParams, + GetAudioSpeechOptionalParams, + GetEmbeddingsOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts index 897b90f806..b535cb3b28 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/index.ts @@ -2,13 +2,13 @@ // Licensed under the MIT license. export { - AudioTranscriptionOptions, AudioTranscriptionFormat, + AudioTranscriptionOptions, AudioTranscription, AudioTaskLabel, AudioTranscriptionSegment, - AudioTranslationOptions, AudioTranslationFormat, + AudioTranslationOptions, AudioTranslation, AudioTranslationSegment, CompletionsOptions, @@ -25,7 +25,6 @@ export { CompletionsLogProbabilityModel, CompletionsFinishReason, CompletionsUsage, - ChatCompletionsOptions, ChatRequestMessage, ChatRequestSystemMessage, ChatRequestUserMessage, @@ -88,6 +87,7 @@ export { ChatCompletionsNamedToolSelection, ChatCompletionsNamedFunctionToolSelection, ChatCompletionsFunctionToolSelection, + ChatCompletionsOptions, ChatCompletions, ChatChoice, ChatResponseMessage, @@ -104,20 +104,21 @@ export { AzureGroundingEnhancementLine, AzureGroundingEnhancementLineSpan, AzureGroundingEnhancementCoordinatePoint, - ImageGenerationOptions, ImageSize, ImageGenerationResponseFormat, ImageGenerationQuality, ImageGenerationStyle, + ImageGenerationOptions, ImageGenerations, ImageGenerationData, - AudioSpeechOptions, AudioSpeechVoice, AudioSpeechOutputFormat, + AudioSpeechOptions, EmbeddingsOptions, Embeddings, EmbeddingItem, EmbeddingsUsage, + ServiceApiVersions, ChatRequestMessageUnion, ChatMessageContentItemUnion, ChatCompletionsToolCallUnion, @@ -130,13 +131,13 @@ export { ChatFinishDetailsUnion, } from "./models.js"; export { - GetAudioTranscriptionAsPlainTextOptions, - GetAudioTranscriptionAsResponseObjectOptions, - GetAudioTranslationAsPlainTextOptions, - GetAudioTranslationAsResponseObjectOptions, - GetCompletionsOptions, - GetChatCompletionsOptions, - GetImageGenerationsOptions, - GetAudioSpeechOptions, - GetEmbeddingsOptions, + GetAudioTranscriptionAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetCompletionsOptionalParams, + GetChatCompletionsOptionalParams, + GetImageGenerationsOptionalParams, + GetAudioSpeechOptionalParams, + GetEmbeddingsOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts index 58d48d8c89..e43bbec48a 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/models.ts @@ -3,6 +3,15 @@ import { ErrorModel } from "@azure-rest/core-client"; +/** Defines available options for the underlying response format of output transcription information. */ +/** */ +export type AudioTranscriptionFormat = + | "json" + | "verbose_json" + | "text" + | "srt" + | "vtt"; + /** The configuration information for an audio transcription request. */ export interface AudioTranscriptionOptions { /** @@ -35,10 +44,6 @@ export interface AudioTranscriptionOptions { model?: string; } -/** Defines available options for the underlying response format of output transcription information. */ -/** "json", "verbose_json", "text", "srt", "vtt" */ -export type AudioTranscriptionFormat = string; - /** Result information for an operation that transcribed spoken audio into written text. */ export interface AudioTranscription { /** The transcribed text for the provided audio data. */ @@ -57,8 +62,8 @@ export interface AudioTranscription { } /** Defines the possible descriptors for available audio operation responses. */ -/** "transcribe", "translate" */ -export type AudioTaskLabel = string; +/** */ +export type AudioTaskLabel = "transcribe" | "translate"; /** * Extended information about a single segment of transcribed audio data. @@ -94,6 +99,15 @@ export interface AudioTranscriptionSegment { seek: number; } +/** Defines available options for the underlying response format of output translation information. */ +/** */ +export type AudioTranslationFormat = + | "json" + | "verbose_json" + | "text" + | "srt" + | "vtt"; + /** The configuration information for an audio translation request. */ export interface AudioTranslationOptions { /** @@ -120,10 +134,6 @@ export interface AudioTranslationOptions { model?: string; } -/** Defines available options for the underlying response format of output translation information. */ -/** "json", "verbose_json", "text", "srt", "vtt" */ -export type AudioTranslationFormat = string; - /** Result information for an operation that translated spoken audio into written text. */ export interface AudioTranslation { /** The translated text for the provided audio data. */ @@ -352,8 +362,8 @@ export interface ContentFilterResult { } /** Ratings for the intensity and risk level of harmful content. */ -/** "safe", "low", "medium", "high" */ -export type ContentFilterSeverity = string; +/** */ +export type ContentFilterSeverity = "safe" | "low" | "medium" | "high"; /** Represents the outcome of a detection operation performed by content filtering. */ export interface ContentFilterDetectionResult { @@ -472,8 +482,13 @@ export interface CompletionsLogProbabilityModel { } /** Representation of the manner in which a completions response concluded. */ -/** "stop", "length", "content_filter", "function_call", "tool_calls" */ -export type CompletionsFinishReason = string; +/** */ +export type CompletionsFinishReason = + | "stop" + | "length" + | "content_filter" + | "function_call" + | "tool_calls"; /** * Representation of the token counts processed for a completions request. @@ -489,118 +504,6 @@ export interface CompletionsUsage { totalTokens: number; } -/** - * The configuration information for a chat completions request. - * Completions support a wide variety of tasks and generate text that continues from or "completes" - * provided prompt data. - */ -export interface ChatCompletionsOptions { - /** - * The collection of context messages associated with this chat completions request. - * Typical usage begins with a chat message for the System role that provides instructions for - * the behavior of the assistant, followed by alternating messages between the User and - * Assistant roles. - */ - messages: ChatRequestMessageUnion[]; - /** A list of functions the model may generate JSON inputs for. */ - functions?: FunctionDefinition[]; - /** - * Controls how the model responds to function calls. "none" means the model does not call a function, - * and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. - * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - * "none" is the default when no functions are present. "auto" is the default if functions are present. - */ - functionCall?: FunctionCallPreset | FunctionName; - /** The maximum number of tokens to generate. */ - maxTokens?: number; - /** - * The sampling temperature to use that controls the apparent creativity of generated completions. - * Higher values will make output more random while lower values will make results more focused - * and deterministic. - * It is not recommended to modify temperature and top_p for the same completions request as the - * interaction of these two settings is difficult to predict. - */ - temperature?: number; - /** - * An alternative to sampling with temperature called nucleus sampling. This value causes the - * model to consider the results of tokens with the provided probability mass. As an example, a - * value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be - * considered. - * It is not recommended to modify temperature and top_p for the same completions request as the - * interaction of these two settings is difficult to predict. - */ - topP?: number; - /** - * A map between GPT token IDs and bias scores that influences the probability of specific tokens - * appearing in a completions response. Token IDs are computed via external tokenizer tools, while - * bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to - * a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias - * score varies by model. - */ - logitBias?: Record; - /** - * An identifier for the caller or end user of the operation. This may be used for tracking - * or rate-limiting purposes. - */ - user?: string; - /** - * The number of chat completions choices that should be generated for a chat completions - * response. - * Because this setting can generate many completions, it may quickly consume your token quota. - * Use carefully and ensure reasonable settings for max_tokens and stop. - */ - n?: number; - /** A collection of textual sequences that will end completions generation. */ - stop?: string[]; - /** - * A value that influences the probability of generated tokens appearing based on their existing - * presence in generated text. - * Positive values will make tokens less likely to appear when they already exist and increase the - * model's likelihood to output new topics. - */ - presencePenalty?: number; - /** - * A value that influences the probability of generated tokens appearing based on their cumulative - * frequency in generated text. - * Positive values will make tokens less likely to appear as their frequency increases and - * decrease the likelihood of the model repeating the same statements verbatim. - */ - frequencyPenalty?: number; - /** A value indicating whether chat completions should be streamed for this request. */ - stream?: boolean; - /** - * The model name to provide as part of this completions request. - * Not applicable to Azure OpenAI, where deployment information should be included in the Azure - * resource URI that's connected to. - */ - model?: string; - /** - * The configuration entries for Azure OpenAI chat extensions that use them. - * This additional specification is only compatible with Azure OpenAI. - */ - dataSources?: AzureChatExtensionConfigurationUnion[]; - /** If provided, the configuration options for available Azure OpenAI chat enhancements. */ - enhancements?: AzureChatEnhancementConfiguration; - /** - * If specified, the system will make a best effort to sample deterministically such that repeated requests with the - * same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the - * system_fingerprint response parameter to monitor changes in the backend." - */ - seed?: number; - /** Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. */ - logprobs?: boolean | null; - /** An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. */ - topLogprobs?: number | null; - /** An object specifying the format that the model must output. Used to enable JSON mode. */ - responseFormat?: ChatCompletionsResponseFormatUnion; - /** The available tool definitions that the chat completions request can use, including caller-defined functions. */ - tools?: ChatCompletionsToolDefinitionUnion[]; - /** If specified, the model will configure which of the provided tools it can use for the chat completions response. */ - toolChoice?: - | ChatCompletionsToolSelectionPreset - | ChatCompletionsNamedToolSelectionUnion; -} - /** An abstract representation of a chat message as provided in a request. */ export interface ChatRequestMessage { /** the discriminator possible values: system, user, assistant, tool, function */ @@ -664,8 +567,8 @@ export interface ChatMessageImageUrl { } /** A representation of the possible image detail levels for image-based chat completions message content. */ -/** "auto", "low", "high" */ -export type ChatMessageImageDetailLevel = string; +/** */ +export type ChatMessageImageDetailLevel = "auto" | "low" | "high"; /** A request chat message representing response or action from the assistant. */ export interface ChatRequestAssistantMessage extends ChatRequestMessage { @@ -744,8 +647,8 @@ export interface ChatRequestFunctionMessage extends ChatRequestMessage { } /** A description of the intended purpose of a message within a chat completions interaction. */ -/** "system", "assistant", "user", "function", "tool" */ -export type ChatRole = string; +/** */ +export type ChatRole = "system" | "assistant" | "user" | "function" | "tool"; /** The definition of a caller-specified function that chat completions may invoke in response to matching user input. */ export interface FunctionDefinition { @@ -764,8 +667,8 @@ export interface FunctionDefinition { * The collection of predefined behaviors for handling request-provided function information in a chat completions * operation. */ -/** "auto", "none" */ -export type FunctionCallPreset = string; +/** */ +export type FunctionCallPreset = "auto" | "none"; /** * A structure that specifies the exact name of a specific, request-provided function to use when processing a chat @@ -905,8 +808,15 @@ export interface OnYourDataUserAssignedManagedIdentityAuthenticationOptions } /** The authentication types supported with Azure OpenAI On Your Data. */ -/** "api_key", "connection_string", "key_and_key_id", "encoded_api_key", "access_token", "system_assigned_managed_identity", "user_assigned_managed_identity" */ -export type OnYourDataAuthenticationType = string; +/** */ +export type OnYourDataAuthenticationType = + | "api_key" + | "connection_string" + | "key_and_key_id" + | "encoded_api_key" + | "access_token" + | "system_assigned_managed_identity" + | "user_assigned_managed_identity"; /** Optional settings to control how fields are processed when using a configured Azure Search resource. */ export interface AzureSearchIndexFieldMappingOptions { @@ -927,8 +837,13 @@ export interface AzureSearchIndexFieldMappingOptions { } /** The type of Azure Search retrieval query that should be executed when using it as an Azure OpenAI chat extension. */ -/** "simple", "semantic", "vector", "vector_simple_hybrid", "vector_semantic_hybrid" */ -export type AzureSearchQueryType = string; +/** */ +export type AzureSearchQueryType = + | "simple" + | "semantic" + | "vector" + | "vector_simple_hybrid" + | "vector_semantic_hybrid"; /** An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search. */ export interface OnYourDataVectorizationSource { @@ -978,8 +893,11 @@ export interface OnYourDataModelIdVectorizationSource * Represents the available sources Azure OpenAI On Your Data can use to configure vectorization of data for use with * vector search. */ -/** "endpoint", "deployment_name", "model_id" */ -export type OnYourDataVectorizationSourceType = string; +/** */ +export type OnYourDataVectorizationSourceType = + | "endpoint" + | "deployment_name" + | "model_id"; /** * A specific representation of configurable options for Azure Machine Learning vector index when using it as an Azure @@ -1150,8 +1068,8 @@ export interface ElasticsearchIndexFieldMappingOptions { } /** The type of Elasticsearch® retrieval query that should be executed when using it as an Azure OpenAI chat extension. */ -/** "simple", "vector" */ -export type ElasticsearchQueryType = string; +/** */ +export type ElasticsearchQueryType = "simple" | "vector"; /** * A specific representation of configurable options for Pinecone when using it as an Azure OpenAI chat @@ -1215,8 +1133,13 @@ export interface PineconeFieldMappingOptions { * completions request that should use Azure OpenAI chat extensions to augment the response behavior. * The use of this configuration is compatible only with Azure OpenAI. */ -/** "azure_search", "azure_ml_index", "azure_cosmos_db", "elasticsearch", "Pinecone" */ -export type AzureChatExtensionType = string; +/** */ +export type AzureChatExtensionType = + | "azure_search" + | "azure_ml_index" + | "azure_cosmos_db" + | "elasticsearch" + | "Pinecone"; /** A representation of the available Azure OpenAI enhancement configurations. */ export interface AzureChatEnhancementConfiguration { @@ -1280,8 +1203,8 @@ export interface ChatCompletionsFunctionToolDefinition } /** Represents a generic policy for how a chat completions tool may be selected. */ -/** "auto", "none" */ -export type ChatCompletionsToolSelectionPreset = string; +/** */ +export type ChatCompletionsToolSelectionPreset = "auto" | "none"; /** An abstract representation of an explicit, named tool selection to use for a chat completions request. */ export interface ChatCompletionsNamedToolSelection { @@ -1304,6 +1227,118 @@ export interface ChatCompletionsFunctionToolSelection { name: string; } +/** + * The configuration information for a chat completions request. + * Completions support a wide variety of tasks and generate text that continues from or "completes" + * provided prompt data. + */ +export interface ChatCompletionsOptions { + /** + * The collection of context messages associated with this chat completions request. + * Typical usage begins with a chat message for the System role that provides instructions for + * the behavior of the assistant, followed by alternating messages between the User and + * Assistant roles. + */ + messages: ChatRequestMessageUnion[]; + /** A list of functions the model may generate JSON inputs for. */ + functions?: FunctionDefinition[]; + /** + * Controls how the model responds to function calls. "none" means the model does not call a function, + * and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. + * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + */ + functionCall?: FunctionCallPreset | FunctionName; + /** The maximum number of tokens to generate. */ + maxTokens?: number; + /** + * The sampling temperature to use that controls the apparent creativity of generated completions. + * Higher values will make output more random while lower values will make results more focused + * and deterministic. + * It is not recommended to modify temperature and top_p for the same completions request as the + * interaction of these two settings is difficult to predict. + */ + temperature?: number; + /** + * An alternative to sampling with temperature called nucleus sampling. This value causes the + * model to consider the results of tokens with the provided probability mass. As an example, a + * value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be + * considered. + * It is not recommended to modify temperature and top_p for the same completions request as the + * interaction of these two settings is difficult to predict. + */ + topP?: number; + /** + * A map between GPT token IDs and bias scores that influences the probability of specific tokens + * appearing in a completions response. Token IDs are computed via external tokenizer tools, while + * bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to + * a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias + * score varies by model. + */ + logitBias?: Record; + /** + * An identifier for the caller or end user of the operation. This may be used for tracking + * or rate-limiting purposes. + */ + user?: string; + /** + * The number of chat completions choices that should be generated for a chat completions + * response. + * Because this setting can generate many completions, it may quickly consume your token quota. + * Use carefully and ensure reasonable settings for max_tokens and stop. + */ + n?: number; + /** A collection of textual sequences that will end completions generation. */ + stop?: string[]; + /** + * A value that influences the probability of generated tokens appearing based on their existing + * presence in generated text. + * Positive values will make tokens less likely to appear when they already exist and increase the + * model's likelihood to output new topics. + */ + presencePenalty?: number; + /** + * A value that influences the probability of generated tokens appearing based on their cumulative + * frequency in generated text. + * Positive values will make tokens less likely to appear as their frequency increases and + * decrease the likelihood of the model repeating the same statements verbatim. + */ + frequencyPenalty?: number; + /** A value indicating whether chat completions should be streamed for this request. */ + stream?: boolean; + /** + * The model name to provide as part of this completions request. + * Not applicable to Azure OpenAI, where deployment information should be included in the Azure + * resource URI that's connected to. + */ + model?: string; + /** + * The configuration entries for Azure OpenAI chat extensions that use them. + * This additional specification is only compatible with Azure OpenAI. + */ + dataSources?: AzureChatExtensionConfigurationUnion[]; + /** If provided, the configuration options for available Azure OpenAI chat enhancements. */ + enhancements?: AzureChatEnhancementConfiguration; + /** + * If specified, the system will make a best effort to sample deterministically such that repeated requests with the + * same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the + * system_fingerprint response parameter to monitor changes in the backend." + */ + seed?: number; + /** Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. */ + logprobs?: boolean | null; + /** An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. */ + topLogprobs?: number | null; + /** An object specifying the format that the model must output. Used to enable JSON mode. */ + responseFormat?: ChatCompletionsResponseFormatUnion; + /** The available tool definitions that the chat completions request can use, including caller-defined functions. */ + tools?: ChatCompletionsToolDefinitionUnion[]; + /** If specified, the model will configure which of the provided tools it can use for the chat completions response. */ + toolChoice?: + | ChatCompletionsToolSelectionPreset + | ChatCompletionsNamedToolSelectionUnion; +} + /** * Representation of the response data from a chat completions request. * Completions support a wide variety of tasks and generate text that continues from or "completes" @@ -1533,6 +1568,30 @@ export interface AzureGroundingEnhancementCoordinatePoint { y: number; } +/** The desired size of generated images. */ +/** */ +export type ImageSize = + | "256x256" + | "512x512" + | "1024x1024" + | "1792x1024" + | "1024x1792"; +/** The format in which the generated images are returned. */ +/** */ +export type ImageGenerationResponseFormat = "url" | "b64_json"; +/** + * An image generation configuration that specifies how the model should prioritize quality, cost, and speed. + * Only configurable with dall-e-3 models. + */ +/** */ +export type ImageGenerationQuality = "standard" | "hd"; +/** + * An image generation configuration that specifies how the model should incorporate realism and other visual characteristics. + * Only configurable with dall-e-3 models. + */ +/** */ +export type ImageGenerationStyle = "natural" | "vivid"; + /** Represents the request data used to generate images. */ export interface ImageGenerationOptions { /** @@ -1570,25 +1629,6 @@ export interface ImageGenerationOptions { user?: string; } -/** The desired size of generated images. */ -/** "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792" */ -export type ImageSize = string; -/** The format in which the generated images are returned. */ -/** "url", "b64_json" */ -export type ImageGenerationResponseFormat = string; -/** - * An image generation configuration that specifies how the model should prioritize quality, cost, and speed. - * Only configurable with dall-e-3 models. - */ -/** "standard", "hd" */ -export type ImageGenerationQuality = string; -/** - * An image generation configuration that specifies how the model should incorporate realism and other visual characteristics. - * Only configurable with dall-e-3 models. - */ -/** "natural", "vivid" */ -export type ImageGenerationStyle = string; - /** The result of a successful image generation operation. */ export interface ImageGenerations { /** @@ -1616,6 +1656,19 @@ export interface ImageGenerationData { revisedPrompt?: string; } +/** The available voices for text-to-speech. */ +/** */ +export type AudioSpeechVoice = + | "alloy" + | "echo" + | "fable" + | "onyx" + | "nova" + | "shimmer"; +/** The supported audio output formats for text-to-speech. */ +/** */ +export type AudioSpeechOutputFormat = "mp3" | "opus" | "aac" | "flac"; + /** A representation of the request options that control the behavior of a text-to-speech operation. */ export interface AudioSpeechOptions { /** The text to generate audio for. The maximum length is 4096 characters. */ @@ -1628,13 +1681,6 @@ export interface AudioSpeechOptions { speed?: number; } -/** The available voices for text-to-speech. */ -/** "alloy", "echo", "fable", "onyx", "nova", "shimmer" */ -export type AudioSpeechVoice = string; -/** The supported audio output formats for text-to-speech. */ -/** "mp3", "opus", "aac", "flac" */ -export type AudioSpeechOutputFormat = string; - /** * The configuration information for an embeddings request. * Embeddings measure the relatedness of text strings and are commonly used for search, clustering, @@ -1695,6 +1741,13 @@ export interface EmbeddingsUsage { totalTokens: number; } +/** */ +export type ServiceApiVersions = + | "2022-12-01" + | "2023-05-15" + | "2023-06-01-preview" + | "2023-07-01-preview" + | "2024-02-15-preview"; /** Alias for ChatRequestMessageUnion */ export type ChatRequestMessageUnion = | ChatRequestSystemMessage diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/options.ts index 43d982207e..159debeebb 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/models/options.ts @@ -3,36 +3,36 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface GetAudioTranscriptionAsPlainTextOptions +export interface GetAudioTranscriptionAsPlainTextOptionalParams extends OperationOptions { /** The content type for the operation. Always multipart/form-data for this operation. */ contentType?: string; } -export interface GetAudioTranscriptionAsResponseObjectOptions +export interface GetAudioTranscriptionAsResponseObjectOptionalParams extends OperationOptions { /** The content type for the operation. Always multipart/form-data for this operation. */ contentType?: string; } -export interface GetAudioTranslationAsPlainTextOptions +export interface GetAudioTranslationAsPlainTextOptionalParams extends OperationOptions { /** The content type for the operation. Always multipart/form-data for this operation. */ contentType?: string; } -export interface GetAudioTranslationAsResponseObjectOptions +export interface GetAudioTranslationAsResponseObjectOptionalParams extends OperationOptions { /** The content type for the operation. Always multipart/form-data for this operation. */ contentType?: string; } -export interface GetCompletionsOptions extends OperationOptions {} +export interface GetCompletionsOptionalParams extends OperationOptions {} -export interface GetChatCompletionsOptions extends OperationOptions {} +export interface GetChatCompletionsOptionalParams extends OperationOptions {} -export interface GetImageGenerationsOptions extends OperationOptions {} +export interface GetImageGenerationsOptionalParams extends OperationOptions {} -export interface GetAudioSpeechOptions extends OperationOptions {} +export interface GetAudioSpeechOptionalParams extends OperationOptions {} -export interface GetEmbeddingsOptions extends OperationOptions {} +export interface GetEmbeddingsOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/OpenAIClient.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts similarity index 78% rename from packages/typespec-test/test/openai_modular/generated/typespec-ts/src/OpenAIClient.ts rename to packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts index 8ffbd0e805..3240e3b997 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/OpenAIClient.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/openAIClient.ts @@ -19,15 +19,15 @@ import { Embeddings, } from "./models/models.js"; import { - GetAudioTranscriptionAsPlainTextOptions, - GetAudioTranscriptionAsResponseObjectOptions, - GetAudioTranslationAsPlainTextOptions, - GetAudioTranslationAsResponseObjectOptions, - GetCompletionsOptions, - GetChatCompletionsOptions, - GetImageGenerationsOptions, - GetAudioSpeechOptions, - GetEmbeddingsOptions, + GetAudioTranscriptionAsPlainTextOptionalParams, + GetAudioTranscriptionAsResponseObjectOptionalParams, + GetAudioTranslationAsPlainTextOptionalParams, + GetAudioTranslationAsResponseObjectOptionalParams, + GetCompletionsOptionalParams, + GetChatCompletionsOptionalParams, + GetImageGenerationsOptionalParams, + GetAudioSpeechOptionalParams, + GetEmbeddingsOptionalParams, } from "./models/options.js"; import { createOpenAI, @@ -44,7 +44,7 @@ import { getEmbeddings, } from "./api/index.js"; -export { OpenAIClientOptions } from "./api/OpenAIContext.js"; +export { OpenAIClientOptions } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; @@ -52,11 +52,11 @@ export class OpenAIClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: OpenAIClientOptions = {}, ) { - this._client = createOpenAI(endpoint, credential, options); + this._client = createOpenAI(endpointParam, credential, options); this.pipeline = this._client.pipeline; } @@ -67,7 +67,9 @@ export class OpenAIClient { getAudioTranscriptionAsPlainText( deploymentId: string, body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsPlainTextOptions = { requestOptions: {} }, + options: GetAudioTranscriptionAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): Promise { return getAudioTranscriptionAsPlainText( this._client, @@ -84,7 +86,7 @@ export class OpenAIClient { getAudioTranscriptionAsResponseObject( deploymentId: string, body: AudioTranscriptionOptions, - options: GetAudioTranscriptionAsResponseObjectOptions = { + options: GetAudioTranscriptionAsResponseObjectOptionalParams = { requestOptions: {}, }, ): Promise { @@ -100,7 +102,9 @@ export class OpenAIClient { getAudioTranslationAsPlainText( deploymentId: string, body: AudioTranslationOptions, - options: GetAudioTranslationAsPlainTextOptions = { requestOptions: {} }, + options: GetAudioTranslationAsPlainTextOptionalParams = { + requestOptions: {}, + }, ): Promise { return getAudioTranslationAsPlainText( this._client, @@ -114,7 +118,7 @@ export class OpenAIClient { getAudioTranslationAsResponseObject( deploymentId: string, body: AudioTranslationOptions, - options: GetAudioTranslationAsResponseObjectOptions = { + options: GetAudioTranslationAsResponseObjectOptionalParams = { requestOptions: {}, }, ): Promise { @@ -134,7 +138,7 @@ export class OpenAIClient { getCompletions( deploymentId: string, body: CompletionsOptions, - options: GetCompletionsOptions = { requestOptions: {} }, + options: GetCompletionsOptionalParams = { requestOptions: {} }, ): Promise { return getCompletions(this._client, deploymentId, body, options); } @@ -147,7 +151,7 @@ export class OpenAIClient { getChatCompletions( deploymentId: string, body: ChatCompletionsOptions, - options: GetChatCompletionsOptions = { requestOptions: {} }, + options: GetChatCompletionsOptionalParams = { requestOptions: {} }, ): Promise { return getChatCompletions(this._client, deploymentId, body, options); } @@ -156,7 +160,7 @@ export class OpenAIClient { getImageGenerations( deploymentId: string, body: ImageGenerationOptions, - options: GetImageGenerationsOptions = { requestOptions: {} }, + options: GetImageGenerationsOptionalParams = { requestOptions: {} }, ): Promise { return getImageGenerations(this._client, deploymentId, body, options); } @@ -165,7 +169,7 @@ export class OpenAIClient { getAudioSpeech( deploymentId: string, body: AudioSpeechOptions, - options: GetAudioSpeechOptions = { requestOptions: {} }, + options: GetAudioSpeechOptionalParams = { requestOptions: {} }, ): Promise { return getAudioSpeech(this._client, deploymentId, body, options); } @@ -174,7 +178,7 @@ export class OpenAIClient { getEmbeddings( deploymentId: string, body: EmbeddingsOptions, - options: GetEmbeddingsOptions = { requestOptions: {} }, + options: GetEmbeddingsOptionalParams = { requestOptions: {} }, ): Promise { return getEmbeddings(this._client, deploymentId, body, options); } diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/models.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/models.ts index 15b1b50f73..e16e952307 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/models.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/models.ts @@ -18,12 +18,8 @@ export interface AudioTranscriptionOptions { | File; /** The optional filename or descriptive identifier to associate with with the audio data. */ filename?: string; - /** - * The requested format of the transcription response data, which will influence the content and detail of the result. - * - * Possible values: "json", "verbose_json", "text", "srt", "vtt" - */ - response_format?: string; + /** The requested format of the transcription response data, which will influence the content and detail of the result. */ + response_format?: AudioTranscriptionFormat; /** * The primary spoken language of the audio data to be transcribed, supplied as a two-letter ISO-639-1 language code * such as 'en' or 'fr'. @@ -62,12 +58,8 @@ export interface AudioTranslationOptions { | File; /** The optional filename or descriptive identifier to associate with with the audio data. */ filename?: string; - /** - * The requested format of the translation response data, which will influence the content and detail of the result. - * - * Possible values: "json", "verbose_json", "text", "srt", "vtt" - */ - response_format?: string; + /** The requested format of the translation response data, which will influence the content and detail of the result. */ + response_format?: AudioTranslationFormat; /** * An optional hint to guide the model's style or continue from a prior audio segment. The written language of the * prompt should match the primary spoken language of the audio data. @@ -196,7 +188,7 @@ export interface ChatCompletionsOptions { * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. * "none" is the default when no functions are present. "auto" is the default if functions are present. */ - function_call?: string | FunctionName; + function_call?: FunctionCallPreset | FunctionName; /** The maximum number of tokens to generate. */ max_tokens?: number; /** @@ -282,12 +274,14 @@ export interface ChatCompletionsOptions { /** The available tool definitions that the chat completions request can use, including caller-defined functions. */ tools?: Array; /** If specified, the model will configure which of the provided tools it can use for the chat completions response. */ - tool_choice?: string | ChatCompletionsNamedToolSelection; + tool_choice?: + | ChatCompletionsToolSelectionPreset + | ChatCompletionsNamedToolSelection; } /** An abstract representation of a chat message as provided in a request. */ export interface ChatRequestMessageParent { - role: string; + role: ChatRole; } /** @@ -343,10 +337,8 @@ export interface ChatMessageImageUrl { /** * The evaluation quality setting to use, which controls relative prioritization of speed, token consumption, and * accuracy. - * - * Possible values: "auto", "low", "high" */ - detail?: string; + detail?: ChatMessageImageDetailLevel; } /** A request chat message representing response or action from the assistant. */ @@ -452,7 +444,7 @@ export interface FunctionName { * The use of this configuration is compatible only with Azure OpenAI. */ export interface AzureChatExtensionConfigurationParent { - type: string; + type: AzureChatExtensionType; } /** @@ -494,12 +486,8 @@ export interface AzureSearchChatExtensionParameters { index_name: string; /** Customized field mapping behavior to use when interacting with the search index. */ fields_mapping?: AzureSearchIndexFieldMappingOptions; - /** - * The query type to use with Azure Cognitive Search. - * - * Possible values: "simple", "semantic", "vector", "vector_simple_hybrid", "vector_semantic_hybrid" - */ - query_type?: string; + /** The query type to use with Azure Cognitive Search. */ + query_type?: AzureSearchQueryType; /** The additional semantic configuration for the query. */ semantic_configuration?: string; /** Search filter. */ @@ -510,7 +498,7 @@ export interface AzureSearchChatExtensionParameters { /** The authentication options for Azure OpenAI On Your Data. */ export interface OnYourDataAuthenticationOptionsParent { - type: string; + type: OnYourDataAuthenticationType; } /** The authentication options for Azure OpenAI On Your Data when using an API key. */ @@ -596,7 +584,7 @@ export interface AzureSearchIndexFieldMappingOptions { /** An abstract representation of a vectorization source for Azure OpenAI On Your Data with vector search. */ export interface OnYourDataVectorizationSourceParent { - type: string; + type: OnYourDataVectorizationSourceType; } /** @@ -783,12 +771,8 @@ export interface ElasticsearchChatExtensionParameters { index_name: string; /** The index field mapping options of Elasticsearch®. */ fields_mapping?: ElasticsearchIndexFieldMappingOptions; - /** - * The query type of Elasticsearch®. - * - * Possible values: "simple", "vector" - */ - query_type?: string; + /** The query type of Elasticsearch®. */ + query_type?: ElasticsearchQueryType; /** The embedding dependency for vector search. */ embedding_dependency?: OnYourDataVectorizationSource; } @@ -964,30 +948,20 @@ export interface ImageGenerationOptions { * The desired dimensions for generated images. * Dall-e-2 models support 256x256, 512x512, or 1024x1024. * Dall-e-3 models support 1024x1024, 1792x1024, or 1024x1792. - * - * Possible values: "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792" */ - size?: string; - /** - * The format in which image generation response items should be presented. - * - * Possible values: "url", "b64_json" - */ - response_format?: string; + size?: ImageSize; + /** The format in which image generation response items should be presented. */ + response_format?: ImageGenerationResponseFormat; /** * The desired image generation quality level to use. * Only configurable with dall-e-3 models. - * - * Possible values: "standard", "hd" */ - quality?: string; + quality?: ImageGenerationQuality; /** * The desired image generation style to use. * Only configurable with dall-e-3 models. - * - * Possible values: "natural", "vivid" */ - style?: string; + style?: ImageGenerationStyle; /** A unique identifier representing your end-user, which can help to monitor and detect abuse. */ user?: string; } @@ -996,18 +970,10 @@ export interface ImageGenerationOptions { export interface AudioSpeechOptions { /** The text to generate audio for. The maximum length is 4096 characters. */ input: string; - /** - * The voice to use for text-to-speech. - * - * Possible values: "alloy", "echo", "fable", "onyx", "nova", "shimmer" - */ - voice: string; - /** - * The audio output format for the spoken text. By default, the MP3 format will be used. - * - * Possible values: "mp3", "opus", "aac", "flac" - */ - response_format?: string; + /** The voice to use for text-to-speech. */ + voice: AudioSpeechVoice; + /** The audio output format for the spoken text. By default, the MP3 format will be used. */ + response_format?: AudioSpeechOutputFormat; /** The speed of speech for generated audio. Values are valid in the range from 0.25 to 4.0, with 1.0 the default and higher values corresponding to faster speech. */ speed?: number; } @@ -1105,3 +1071,94 @@ export type ChatCompletionsToolDefinition = export type ChatCompletionsNamedToolSelection = | ChatCompletionsNamedToolSelectionParent | ChatCompletionsNamedFunctionToolSelection; +/** Defines available options for the underlying response format of output transcription information. */ +export type AudioTranscriptionFormat = + | "json" + | "verbose_json" + | "text" + | "srt" + | "vtt"; +/** Defines available options for the underlying response format of output translation information. */ +export type AudioTranslationFormat = + | "json" + | "verbose_json" + | "text" + | "srt" + | "vtt"; +/** A description of the intended purpose of a message within a chat completions interaction. */ +export type ChatRole = "system" | "assistant" | "user" | "function" | "tool"; +/** A representation of the possible image detail levels for image-based chat completions message content. */ +export type ChatMessageImageDetailLevel = "auto" | "low" | "high"; +/** + * The collection of predefined behaviors for handling request-provided function information in a chat completions + * operation. + */ +export type FunctionCallPreset = "auto" | "none"; +/** + * A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat + * completions request that should use Azure OpenAI chat extensions to augment the response behavior. + * The use of this configuration is compatible only with Azure OpenAI. + */ +export type AzureChatExtensionType = + | "azure_search" + | "azure_ml_index" + | "azure_cosmos_db" + | "elasticsearch" + | "Pinecone"; +/** The authentication types supported with Azure OpenAI On Your Data. */ +export type OnYourDataAuthenticationType = + | "api_key" + | "connection_string" + | "key_and_key_id" + | "encoded_api_key" + | "access_token" + | "system_assigned_managed_identity" + | "user_assigned_managed_identity"; +/** The type of Azure Search retrieval query that should be executed when using it as an Azure OpenAI chat extension. */ +export type AzureSearchQueryType = + | "simple" + | "semantic" + | "vector" + | "vector_simple_hybrid" + | "vector_semantic_hybrid"; +/** + * Represents the available sources Azure OpenAI On Your Data can use to configure vectorization of data for use with + * vector search. + */ +export type OnYourDataVectorizationSourceType = + | "endpoint" + | "deployment_name" + | "model_id"; +/** The type of Elasticsearch® retrieval query that should be executed when using it as an Azure OpenAI chat extension. */ +export type ElasticsearchQueryType = "simple" | "vector"; +/** Represents a generic policy for how a chat completions tool may be selected. */ +export type ChatCompletionsToolSelectionPreset = "auto" | "none"; +/** The desired size of generated images. */ +export type ImageSize = + | "256x256" + | "512x512" + | "1024x1024" + | "1792x1024" + | "1024x1792"; +/** The format in which the generated images are returned. */ +export type ImageGenerationResponseFormat = "url" | "b64_json"; +/** + * An image generation configuration that specifies how the model should prioritize quality, cost, and speed. + * Only configurable with dall-e-3 models. + */ +export type ImageGenerationQuality = "standard" | "hd"; +/** + * An image generation configuration that specifies how the model should incorporate realism and other visual characteristics. + * Only configurable with dall-e-3 models. + */ +export type ImageGenerationStyle = "natural" | "vivid"; +/** The available voices for text-to-speech. */ +export type AudioSpeechVoice = + | "alloy" + | "echo" + | "fable" + | "onyx" + | "nova" + | "shimmer"; +/** The supported audio output formats for text-to-speech. */ +export type AudioSpeechOutputFormat = "mp3" | "opus" | "aac" | "flac"; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/outputModels.ts index 0e842e839f..962e47e1ad 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/src/rest/outputModels.ts @@ -3,22 +3,12 @@ import { ErrorModel } from "@azure-rest/core-client"; -/** A specific deployment */ -export interface DeploymentOutput { - /** Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request. */ - readonly deploymentId: string; -} - /** Result information for an operation that transcribed spoken audio into written text. */ export interface AudioTranscriptionOutput { /** The transcribed text for the provided audio data. */ text: string; - /** - * The label that describes which operation type generated the accompanying response data. - * - * Possible values: "transcribe", "translate" - */ - task?: string; + /** The label that describes which operation type generated the accompanying response data. */ + task?: AudioTaskLabelOutput; /** * The spoken language that was detected in the transcribed audio data. * This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. @@ -68,12 +58,8 @@ export interface AudioTranscriptionSegmentOutput { export interface AudioTranslationOutput { /** The translated text for the provided audio data. */ text: string; - /** - * The label that describes which operation type generated the accompanying response data. - * - * Possible values: "transcribe", "translate" - */ - task?: string; + /** The label that describes which operation type generated the accompanying response data. */ + task?: AudioTaskLabelOutput; /** * The spoken language that was detected in the translated audio data. * This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. @@ -197,12 +183,8 @@ export interface ContentFilterResultDetailsForPromptOutput { /** Information about filtered content severity level and if it has been filtered or not. */ export interface ContentFilterResultOutput { - /** - * Ratings for the intensity and risk level of filtered content. - * - * Possible values: "safe", "low", "medium", "high" - */ - severity: string; + /** Ratings for the intensity and risk level of filtered content. */ + severity: ContentFilterSeverityOutput; /** A value indicating whether or not the content has been filtered. */ filtered: boolean; } @@ -242,7 +224,7 @@ export interface ChoiceOutput { /** The log probabilities model for tokens associated with this completions choice. */ logprobs: CompletionsLogProbabilityModelOutput | null; /** Reason for finishing */ - finish_reason: string | null; + finish_reason: CompletionsFinishReasonOutput | null; } /** Information about content filtering evaluated against generated model output. */ @@ -406,7 +388,7 @@ export interface ChatChoiceOutput { /** The ordered index associated with this chat completions choice. */ index: number; /** The reason that this chat completions choice completed its generated. */ - finish_reason: string | null; + finish_reason: CompletionsFinishReasonOutput | null; /** * The reason the model stopped generating tokens, together with any applicable details. * This structured representation replaces 'finish_reason' for some models. @@ -430,12 +412,8 @@ export interface ChatChoiceOutput { /** A representation of a chat message as received in a response. */ export interface ChatResponseMessageOutput { - /** - * The chat role associated with the message. - * - * Possible values: "system", "assistant", "user", "function", "tool" - */ - role: string; + /** The chat role associated with the message. */ + role: ChatRoleOutput; /** The content of the message. */ content: string | null; /** @@ -587,53 +565,6 @@ export interface AzureGroundingEnhancementCoordinatePointOutput { y: number; } -/** Represents the request data used to generate images. */ -export interface ImageGenerationOptionsOutput { - /** - * The model name or Azure OpenAI model deployment name to use for image generation. If not specified, dall-e-2 will be - * inferred as a default. - */ - model?: string; - /** A description of the desired images. */ - prompt: string; - /** - * The number of images to generate. - * Dall-e-2 models support values between 1 and 10. - * Dall-e-3 models only support a value of 1. - */ - n?: number; - /** - * The desired dimensions for generated images. - * Dall-e-2 models support 256x256, 512x512, or 1024x1024. - * Dall-e-3 models support 1024x1024, 1792x1024, or 1024x1792. - * - * Possible values: "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792" - */ - size?: string; - /** - * The format in which image generation response items should be presented. - * - * Possible values: "url", "b64_json" - */ - response_format?: string; - /** - * The desired image generation quality level to use. - * Only configurable with dall-e-3 models. - * - * Possible values: "standard", "hd" - */ - quality?: string; - /** - * The desired image generation style to use. - * Only configurable with dall-e-3 models. - * - * Possible values: "natural", "vivid" - */ - style?: string; - /** A unique identifier representing your end-user, which can help to monitor and detect abuse. */ - user?: string; -} - /** The result of a successful image generation operation. */ export interface ImageGenerationsOutput { /** @@ -702,12 +633,8 @@ export interface BatchImageGenerationOperationResponseOutput { expires?: number; /** The result of the operation if the operation succeeded. */ result?: ImageGenerationsOutput; - /** - * The status of the operation - * - * Possible values: "notRunning", "running", "succeeded", "canceled", "failed" - */ - status: string; + /** The status of the operation */ + status: AzureOpenAIOperationStateOutput; /** The error if the operation failed. */ error?: ErrorModel; } @@ -724,3 +651,28 @@ export type ChatFinishDetailsOutput = | ChatFinishDetailsOutputParent | StopFinishDetailsOutput | MaxTokensFinishDetailsOutput; +/** Defines the possible descriptors for available audio operation responses. */ +export type AudioTaskLabelOutput = "transcribe" | "translate"; +/** Ratings for the intensity and risk level of harmful content. */ +export type ContentFilterSeverityOutput = "safe" | "low" | "medium" | "high"; +/** Representation of the manner in which a completions response concluded. */ +export type CompletionsFinishReasonOutput = + | "stop" + | "length" + | "content_filter" + | "function_call" + | "tool_calls"; +/** A description of the intended purpose of a message within a chat completions interaction. */ +export type ChatRoleOutput = + | "system" + | "assistant" + | "user" + | "function" + | "tool"; +/** The state of a job or item. */ +export type AzureOpenAIOperationStateOutput = + | "notRunning" + | "running" + | "succeeded" + | "canceled" + | "failed"; diff --git a/packages/typespec-test/test/openai_modular/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/openai_modular/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/openai_modular/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/openai_modular/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json index 5c4463e8db..55e71dd33f 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/package.json @@ -52,8 +52,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "dependencies": { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index cbfe3aba37..ebb053fdbe 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -18,7 +18,7 @@ export interface AudioOperations { } // @public (undocumented) -export interface AudioTranscriptionsCreateOptions extends OperationOptions { +export interface AudioTranscriptionsCreateOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -26,11 +26,11 @@ export interface AudioTranscriptionsCreateOptions extends OperationOptions { // @public (undocumented) export interface AudioTranscriptionsOperations { // (undocumented) - create: (audio: CreateTranscriptionRequest, options?: AudioTranscriptionsCreateOptions) => Promise; + create: (audio: CreateTranscriptionRequest, options?: AudioTranscriptionsCreateOptionalParams) => Promise; } // @public (undocumented) -export interface AudioTranslationsCreateOptions extends OperationOptions { +export interface AudioTranslationsCreateOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -38,7 +38,7 @@ export interface AudioTranslationsCreateOptions extends OperationOptions { // @public (undocumented) export interface AudioTranslationsOperations { // (undocumented) - create: (audio: CreateTranslationRequest, options?: AudioTranslationsCreateOptions) => Promise; + create: (audio: CreateTranslationRequest, options?: AudioTranslationsCreateOptionalParams) => Promise; } // @public (undocumented) @@ -75,13 +75,13 @@ export interface ChatCompletionResponseMessage { } // @public (undocumented) -export interface ChatCompletionsCreateOptions extends OperationOptions { +export interface ChatCompletionsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface ChatCompletionsOperations { // (undocumented) - create: (body: CreateChatCompletionRequest, options?: ChatCompletionsCreateOptions) => Promise; + create: (body: CreateChatCompletionRequest, options?: ChatCompletionsCreateOptionalParams) => Promise; } // @public (undocumented) @@ -91,13 +91,13 @@ export interface ChatOperations { } // @public (undocumented) -export interface CompletionsCreateOptions extends OperationOptions { +export interface CompletionsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface CompletionsOperations { // (undocumented) - create: (body: CreateCompletionRequest, options?: CompletionsCreateOptions) => Promise; + create: (body: CreateCompletionRequest, options?: CompletionsCreateOptionalParams) => Promise; } // @public @@ -381,13 +381,13 @@ export interface DeleteModelResponse { } // @public (undocumented) -export interface EditsCreateOptions extends OperationOptions { +export interface EditsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface EditsOperations { // (undocumented) - create: (edit: CreateEditRequest, options?: EditsCreateOptions) => Promise; + create: (edit: CreateEditRequest, options?: EditsCreateOptionalParams) => Promise; } // @public @@ -398,17 +398,17 @@ export interface Embedding { } // @public (undocumented) -export interface EmbeddingsCreateOptions extends OperationOptions { +export interface EmbeddingsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface EmbeddingsOperations { // (undocumented) - create: (embedding: CreateEmbeddingRequest, options?: EmbeddingsCreateOptions) => Promise; + create: (embedding: CreateEmbeddingRequest, options?: EmbeddingsCreateOptionalParams) => Promise; } // @public (undocumented) -interface Error_2 { +export interface ErrorModel { // (undocumented) code: string | null; // (undocumented) @@ -418,42 +418,41 @@ interface Error_2 { // (undocumented) type: string; } -export { Error_2 as Error } // @public (undocumented) -export interface FilesCreateOptions extends OperationOptions { +export interface FilesCreateOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface FilesDeleteOperationOptions extends OperationOptions { +export interface FilesDeleteOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FilesDownloadOptions extends OperationOptions { +export interface FilesDownloadOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FilesListOptions extends OperationOptions { +export interface FilesListOptionalParams extends OperationOptions { } // @public (undocumented) export interface FilesOperations { // (undocumented) - create: (file: CreateFileRequest, options?: FilesCreateOptions) => Promise; + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => Promise; // (undocumented) - deleteOperation: (fileId: string, options?: FilesDeleteOperationOptions) => Promise; + delete: (fileId: string, options?: FilesDeleteOptionalParams) => Promise; // (undocumented) - download: (fileId: string, options?: FilesDownloadOptions) => Promise; + download: (fileId: string, options?: FilesDownloadOptionalParams) => Promise; // (undocumented) - list: (options?: FilesListOptions) => Promise; + list: (options?: FilesListOptionalParams) => Promise; // (undocumented) - retrieve: (fileId: string, options?: FilesRetrieveOptions) => Promise; + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface FilesRetrieveOptions extends OperationOptions { +export interface FilesRetrieveOptionalParams extends OperationOptions { } // @public @@ -494,38 +493,38 @@ export interface FineTuneEvent { } // @public (undocumented) -export interface FineTunesCancelOptions extends OperationOptions { +export interface FineTunesCancelOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTunesCreateOptions extends OperationOptions { +export interface FineTunesCreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTunesListEventsOptions extends OperationOptions { +export interface FineTunesListEventsOptionalParams extends OperationOptions { stream?: boolean; } // @public (undocumented) -export interface FineTunesListOptions extends OperationOptions { +export interface FineTunesListOptionalParams extends OperationOptions { } // @public (undocumented) export interface FineTunesOperations { // (undocumented) - cancel: (fineTuneId: string, options?: FineTunesCancelOptions) => Promise; + cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => Promise; // (undocumented) - create: (fineTune: CreateFineTuneRequest, options?: FineTunesCreateOptions) => Promise; + create: (fineTune: CreateFineTuneRequest, options?: FineTunesCreateOptionalParams) => Promise; // (undocumented) - list: (options?: FineTunesListOptions) => Promise; + list: (options?: FineTunesListOptionalParams) => Promise; // (undocumented) - listEvents: (fineTuneId: string, options?: FineTunesListEventsOptions) => Promise; + listEvents: (fineTuneId: string, options?: FineTunesListEventsOptionalParams) => Promise; // (undocumented) - retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptions) => Promise; + retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface FineTunesRetrieveOptions extends OperationOptions { +export interface FineTunesRetrieveOptionalParams extends OperationOptions { } // @public (undocumented) @@ -567,21 +566,21 @@ export interface FineTuningJobEvent { } // @public (undocumented) -export interface FineTuningJobsCancelOptions extends OperationOptions { +export interface FineTuningJobsCancelOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTuningJobsCreateOptions extends OperationOptions { +export interface FineTuningJobsCreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface FineTuningJobsListEventsOptions extends OperationOptions { +export interface FineTuningJobsListEventsOptionalParams extends OperationOptions { after?: string; limit?: number; } // @public (undocumented) -export interface FineTuningJobsListOptions extends OperationOptions { +export interface FineTuningJobsListOptionalParams extends OperationOptions { after?: string; limit?: number; } @@ -589,19 +588,19 @@ export interface FineTuningJobsListOptions extends OperationOptions { // @public (undocumented) export interface FineTuningJobsOperations { // (undocumented) - cancel: (fineTuningJobId: string, options?: FineTuningJobsCancelOptions) => Promise; + cancel: (fineTuningJobId: string, options?: FineTuningJobsCancelOptionalParams) => Promise; // (undocumented) - create: (job: CreateFineTuningJobRequest, options?: FineTuningJobsCreateOptions) => Promise; + create: (job: CreateFineTuningJobRequest, options?: FineTuningJobsCreateOptionalParams) => Promise; // (undocumented) - list: (options?: FineTuningJobsListOptions) => Promise; + list: (options?: FineTuningJobsListOptionalParams) => Promise; // (undocumented) - listEvents: (fineTuningJobId: string, options?: FineTuningJobsListEventsOptions) => Promise; + listEvents: (fineTuningJobId: string, options?: FineTuningJobsListEventsOptionalParams) => Promise; // (undocumented) - retrieve: (fineTuningJobId: string, options?: FineTuningJobsRetrieveOptions) => Promise; + retrieve: (fineTuningJobId: string, options?: FineTuningJobsRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface FineTuningJobsRetrieveOptions extends OperationOptions { +export interface FineTuningJobsRetrieveOptionalParams extends OperationOptions { } // @public (undocumented) @@ -617,17 +616,17 @@ export interface Image { } // @public (undocumented) -export interface ImagesCreateEditOptions extends OperationOptions { +export interface ImagesCreateEditOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface ImagesCreateOptions extends OperationOptions { +export interface ImagesCreateOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ImagesCreateVariationOptions extends OperationOptions { +export interface ImagesCreateVariationOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -635,11 +634,11 @@ export interface ImagesCreateVariationOptions extends OperationOptions { // @public (undocumented) export interface ImagesOperations { // (undocumented) - create: (image: CreateImageRequest, options?: ImagesCreateOptions) => Promise; + create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => Promise; // (undocumented) - createEdit: (image: CreateImageEditRequest, options?: ImagesCreateEditOptions) => Promise; + createEdit: (image: CreateImageEditRequest, options?: ImagesCreateEditOptionalParams) => Promise; // (undocumented) - createVariation: (image: CreateImageVariationRequest, options?: ImagesCreateVariationOptions) => Promise; + createVariation: (image: CreateImageVariationRequest, options?: ImagesCreateVariationOptionalParams) => Promise; } // @public (undocumented) @@ -709,35 +708,35 @@ export interface Model { } // @public (undocumented) -export interface ModelsDeleteOperationOptions extends OperationOptions { +export interface ModelsDeleteOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ModelsListOptions extends OperationOptions { +export interface ModelsListOptionalParams extends OperationOptions { } // @public (undocumented) export interface ModelsOperations { // (undocumented) - deleteOperation: (model: string, options?: ModelsDeleteOperationOptions) => Promise; + delete: (model: string, options?: ModelsDeleteOptionalParams) => Promise; // (undocumented) - list: (options?: ModelsListOptions) => Promise; + list: (options?: ModelsListOptionalParams) => Promise; // (undocumented) - retrieve: (model: string, options?: ModelsRetrieveOptions) => Promise; + retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => Promise; } // @public (undocumented) -export interface ModelsRetrieveOptions extends OperationOptions { +export interface ModelsRetrieveOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ModerationsCreateOptions extends OperationOptions { +export interface ModerationsCreateOptionalParams extends OperationOptions { } // @public (undocumented) export interface ModerationsOperations { // (undocumented) - create: (content: CreateModerationRequest, options?: ModerationsCreateOptions) => Promise; + create: (content: CreateModerationRequest, options?: ModerationsCreateOptionalParams) => Promise; } // @public (undocumented) diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts index 67353d4c27..ee2e470dce 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/transcriptions/index.ts @@ -16,12 +16,12 @@ import { uint8ArrayToString, createRestError, } from "@typespec/ts-http-runtime"; -import { AudioTranscriptionsCreateOptions } from "../../../models/options.js"; +import { AudioTranscriptionsCreateOptionalParams } from "../../../models/options.js"; export function _createSend( context: Client, audio: CreateTranscriptionRequest, - options: AudioTranscriptionsCreateOptions = { requestOptions: {} }, + options: AudioTranscriptionsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< | AudioTranscriptionsCreate200Response | AudioTranscriptionsCreateDefaultResponse @@ -59,7 +59,7 @@ export async function _createDeserialize( export async function create( context: Client, audio: CreateTranscriptionRequest, - options: AudioTranscriptionsCreateOptions = { requestOptions: {} }, + options: AudioTranscriptionsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, audio, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts index 7584b229f0..d4f9b27eb4 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/audio/translations/index.ts @@ -16,12 +16,12 @@ import { uint8ArrayToString, createRestError, } from "@typespec/ts-http-runtime"; -import { AudioTranslationsCreateOptions } from "../../../models/options.js"; +import { AudioTranslationsCreateOptionalParams } from "../../../models/options.js"; export function _createSend( context: Client, audio: CreateTranslationRequest, - options: AudioTranslationsCreateOptions = { requestOptions: {} }, + options: AudioTranslationsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< AudioTranslationsCreate200Response | AudioTranslationsCreateDefaultResponse > { @@ -57,7 +57,7 @@ export async function _createDeserialize( export async function create( context: Client, audio: CreateTranslationRequest, - options: AudioTranslationsCreateOptions = { requestOptions: {} }, + options: AudioTranslationsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, audio, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts index 142daf30fd..b2badb0a3f 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/chat/completions/index.ts @@ -15,12 +15,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@typespec/ts-http-runtime"; -import { ChatCompletionsCreateOptions } from "../../../models/options.js"; +import { ChatCompletionsCreateOptionalParams } from "../../../models/options.js"; export function _createSend( context: Client, body: CreateChatCompletionRequest, - options: ChatCompletionsCreateOptions = { requestOptions: {} }, + options: ChatCompletionsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< ChatCompletionsCreate200Response | ChatCompletionsCreateDefaultResponse > { @@ -105,7 +105,7 @@ export async function _createDeserialize( export async function create( context: Client, body: CreateChatCompletionRequest, - options: ChatCompletionsCreateOptions = { requestOptions: {} }, + options: ChatCompletionsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, body, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts index a584404ee5..cf5ddcb6af 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/completions/index.ts @@ -15,12 +15,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@typespec/ts-http-runtime"; -import { CompletionsCreateOptions } from "../../models/options.js"; +import { CompletionsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, body: CreateCompletionRequest, - options: CompletionsCreateOptions = { requestOptions: {} }, + options: CompletionsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< CompletionsCreate200Response | CompletionsCreateDefaultResponse > { @@ -88,7 +88,7 @@ export async function _createDeserialize( export async function create( context: Client, body: CreateCompletionRequest, - options: CompletionsCreateOptions = { requestOptions: {} }, + options: CompletionsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, body, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts index b33c9f99bc..ed5e89d803 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/edits/index.ts @@ -12,12 +12,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@typespec/ts-http-runtime"; -import { EditsCreateOptions } from "../../models/options.js"; +import { EditsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, edit: CreateEditRequest, - options: EditsCreateOptions = { requestOptions: {} }, + options: EditsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/edits") @@ -60,7 +60,7 @@ export async function _createDeserialize( export async function create( context: Client, edit: CreateEditRequest, - options: EditsCreateOptions = { requestOptions: {} }, + options: EditsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, edit, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts index d52b891bf2..179eb9959d 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/embeddings/index.ts @@ -15,12 +15,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@typespec/ts-http-runtime"; -import { EmbeddingsCreateOptions } from "../../models/options.js"; +import { EmbeddingsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, embedding: CreateEmbeddingRequest, - options: EmbeddingsCreateOptions = { requestOptions: {} }, + options: EmbeddingsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< EmbeddingsCreate200Response | EmbeddingsCreateDefaultResponse > { @@ -61,7 +61,7 @@ export async function _createDeserialize( export async function create( context: Client, embedding: CreateEmbeddingRequest, - options: EmbeddingsCreateOptions = { requestOptions: {} }, + options: EmbeddingsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, embedding, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts index 92082f08e7..4140b8e346 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/files/index.ts @@ -9,8 +9,8 @@ import { import { FilesCreate200Response, FilesCreateDefaultResponse, - FilesDeleteOperation200Response, - FilesDeleteOperationDefaultResponse, + FilesDelete200Response, + FilesDeleteDefaultResponse, FilesDownload200Response, FilesDownloadDefaultResponse, FilesList200Response, @@ -27,16 +27,16 @@ import { createRestError, } from "@typespec/ts-http-runtime"; import { - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, } from "../../models/options.js"; export function _listSend( context: Client, - options: FilesListOptions = { requestOptions: {} }, + options: FilesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files") @@ -67,7 +67,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: FilesListOptions = { requestOptions: {} }, + options: FilesListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -76,7 +76,7 @@ export async function list( export function _createSend( context: Client, file: CreateFileRequest, - options: FilesCreateOptions = { requestOptions: {} }, + options: FilesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files") @@ -112,7 +112,7 @@ export async function _createDeserialize( export async function create( context: Client, file: CreateFileRequest, - options: FilesCreateOptions = { requestOptions: {} }, + options: FilesCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, file, options); return _createDeserialize(result); @@ -121,7 +121,7 @@ export async function create( export function _retrieveSend( context: Client, fileId: string, - options: FilesRetrieveOptions = { requestOptions: {} }, + options: FilesRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files/files/{file_id}", fileId) @@ -150,26 +150,24 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, fileId: string, - options: FilesRetrieveOptions = { requestOptions: {} }, + options: FilesRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, fileId, options); return _retrieveDeserialize(result); } -export function _deleteOperationSend( +export function _$deleteSend( context: Client, fileId: string, - options: FilesDeleteOperationOptions = { requestOptions: {} }, -): StreamableMethod< - FilesDeleteOperation200Response | FilesDeleteOperationDefaultResponse -> { + options: FilesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/files/files/{file_id}", fileId) .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteOperationDeserialize( - result: FilesDeleteOperation200Response | FilesDeleteOperationDefaultResponse, +export async function _$deleteDeserialize( + result: FilesDelete200Response | FilesDeleteDefaultResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -182,19 +180,24 @@ export async function _deleteOperationDeserialize( }; } -export async function deleteOperation( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, fileId: string, - options: FilesDeleteOperationOptions = { requestOptions: {} }, + options: FilesDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteOperationSend(context, fileId, options); - return _deleteOperationDeserialize(result); + const result = await _$deleteSend(context, fileId, options); + return _$deleteDeserialize(result); } export function _downloadSend( context: Client, fileId: string, - options: FilesDownloadOptions = { requestOptions: {} }, + options: FilesDownloadOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/files/files/{file_id}/content", fileId) @@ -214,7 +217,7 @@ export async function _downloadDeserialize( export async function download( context: Client, fileId: string, - options: FilesDownloadOptions = { requestOptions: {} }, + options: FilesDownloadOptionalParams = { requestOptions: {} }, ): Promise { const result = await _downloadSend(context, fileId, options); return _downloadDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts index ea51860afe..dee6614171 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTunes/index.ts @@ -26,17 +26,17 @@ import { createRestError, } from "@typespec/ts-http-runtime"; import { - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, } from "../../models/options.js"; export function _createSend( context: Client, fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptions = { requestOptions: {} }, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesCreate200Response | FineTunesCreateDefaultResponse > { @@ -136,7 +136,7 @@ export async function _createDeserialize( export async function create( context: Client, fineTune: CreateFineTuneRequest, - options: FineTunesCreateOptions = { requestOptions: {} }, + options: FineTunesCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, fineTune, options); return _createDeserialize(result); @@ -144,7 +144,7 @@ export async function create( export function _listSend( context: Client, - options: FineTunesListOptions = { requestOptions: {} }, + options: FineTunesListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/fine-tunes") @@ -225,7 +225,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: FineTunesListOptions = { requestOptions: {} }, + options: FineTunesListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -234,7 +234,7 @@ export async function list( export function _retrieveSend( context: Client, fineTuneId: string, - options: FineTunesRetrieveOptions = { requestOptions: {} }, + options: FineTunesRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesRetrieve200Response | FineTunesRetrieveDefaultResponse > { @@ -317,7 +317,7 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, fineTuneId: string, - options: FineTunesRetrieveOptions = { requestOptions: {} }, + options: FineTunesRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, fineTuneId, options); return _retrieveDeserialize(result); @@ -326,7 +326,7 @@ export async function retrieve( export function _listEventsSend( context: Client, fineTuneId: string, - options: FineTunesListEventsOptions = { requestOptions: {} }, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesListEvents200Response | FineTunesListEventsDefaultResponse > { @@ -359,7 +359,7 @@ export async function _listEventsDeserialize( export async function listEvents( context: Client, fineTuneId: string, - options: FineTunesListEventsOptions = { requestOptions: {} }, + options: FineTunesListEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listEventsSend(context, fineTuneId, options); return _listEventsDeserialize(result); @@ -368,7 +368,7 @@ export async function listEvents( export function _cancelSend( context: Client, fineTuneId: string, - options: FineTunesCancelOptions = { requestOptions: {} }, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTunesCancel200Response | FineTunesCancelDefaultResponse > { @@ -451,7 +451,7 @@ export async function _cancelDeserialize( export async function cancel( context: Client, fineTuneId: string, - options: FineTunesCancelOptions = { requestOptions: {} }, + options: FineTunesCancelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _cancelSend(context, fineTuneId, options); return _cancelDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts index 8a72a16d29..b7f7d036d2 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/fineTuning/jobs/index.ts @@ -26,17 +26,17 @@ import { createRestError, } from "@typespec/ts-http-runtime"; import { - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, } from "../../../models/options.js"; export function _createSend( context: Client, job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptions = { requestOptions: {} }, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsCreate200Response | FineTuningJobsCreateDefaultResponse > { @@ -102,7 +102,7 @@ export async function _createDeserialize( export async function create( context: Client, job: CreateFineTuningJobRequest, - options: FineTuningJobsCreateOptions = { requestOptions: {} }, + options: FineTuningJobsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, job, options); return _createDeserialize(result); @@ -110,7 +110,7 @@ export async function create( export function _listSend( context: Client, - options: FineTuningJobsListOptions = { requestOptions: {} }, + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsList200Response | FineTuningJobsListDefaultResponse > { @@ -160,7 +160,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: FineTuningJobsListOptions = { requestOptions: {} }, + options: FineTuningJobsListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -169,7 +169,7 @@ export async function list( export function _retrieveSend( context: Client, fineTuningJobId: string, - options: FineTuningJobsRetrieveOptions = { requestOptions: {} }, + options: FineTuningJobsRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsRetrieve200Response | FineTuningJobsRetrieveDefaultResponse > { @@ -218,7 +218,7 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, fineTuningJobId: string, - options: FineTuningJobsRetrieveOptions = { requestOptions: {} }, + options: FineTuningJobsRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, fineTuningJobId, options); return _retrieveDeserialize(result); @@ -227,7 +227,7 @@ export async function retrieve( export function _listEventsSend( context: Client, fineTuningJobId: string, - options: FineTuningJobsListEventsOptions = { requestOptions: {} }, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsListEvents200Response | FineTuningJobsListEventsDefaultResponse > { @@ -263,7 +263,7 @@ export async function _listEventsDeserialize( export async function listEvents( context: Client, fineTuningJobId: string, - options: FineTuningJobsListEventsOptions = { requestOptions: {} }, + options: FineTuningJobsListEventsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listEventsSend(context, fineTuningJobId, options); return _listEventsDeserialize(result); @@ -272,7 +272,7 @@ export async function listEvents( export function _cancelSend( context: Client, fineTuningJobId: string, - options: FineTuningJobsCancelOptions = { requestOptions: {} }, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): StreamableMethod< FineTuningJobsCancel200Response | FineTuningJobsCancelDefaultResponse > { @@ -319,7 +319,7 @@ export async function _cancelDeserialize( export async function cancel( context: Client, fineTuningJobId: string, - options: FineTuningJobsCancelOptions = { requestOptions: {} }, + options: FineTuningJobsCancelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _cancelSend(context, fineTuningJobId, options); return _cancelDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts index caf4a40dca..b7645cf0a6 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/images/index.ts @@ -24,15 +24,15 @@ import { createRestError, } from "@typespec/ts-http-runtime"; import { - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, } from "../../models/options.js"; export function _createSend( context: Client, image: CreateImageRequest, - options: ImagesCreateOptions = { requestOptions: {} }, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/images/generations") @@ -70,7 +70,7 @@ export async function _createDeserialize( export async function create( context: Client, image: CreateImageRequest, - options: ImagesCreateOptions = { requestOptions: {} }, + options: ImagesCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, image, options); return _createDeserialize(result); @@ -79,7 +79,7 @@ export async function create( export function _createEditSend( context: Client, image: CreateImageEditRequest, - options: ImagesCreateEditOptions = { requestOptions: {} }, + options: ImagesCreateEditOptionalParams = { requestOptions: {} }, ): StreamableMethod< ImagesCreateEdit200Response | ImagesCreateEditDefaultResponse > { @@ -125,7 +125,7 @@ export async function _createEditDeserialize( export async function createEdit( context: Client, image: CreateImageEditRequest, - options: ImagesCreateEditOptions = { requestOptions: {} }, + options: ImagesCreateEditOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createEditSend(context, image, options); return _createEditDeserialize(result); @@ -134,7 +134,7 @@ export async function createEdit( export function _createVariationSend( context: Client, image: CreateImageVariationRequest, - options: ImagesCreateVariationOptions = { requestOptions: {} }, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): StreamableMethod< ImagesCreateVariation200Response | ImagesCreateVariationDefaultResponse > { @@ -177,7 +177,7 @@ export async function _createVariationDeserialize( export async function createVariation( context: Client, image: CreateImageVariationRequest, - options: ImagesCreateVariationOptions = { requestOptions: {} }, + options: ImagesCreateVariationOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createVariationSend(context, image, options); return _createVariationDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts index f498745b13..6b0f928e47 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/index.ts @@ -4,4 +4,4 @@ export { createOpenAI, OpenAIClientOptions, OpenAIContext, -} from "./OpenAIContext.js"; +} from "./openAIContext.js"; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts index 14dc74a883..e6a7055cd0 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/models/index.ts @@ -7,8 +7,8 @@ import { } from "../../models/models.js"; import { isUnexpected, - ModelsDeleteOperation200Response, - ModelsDeleteOperationDefaultResponse, + ModelsDelete200Response, + ModelsDeleteDefaultResponse, ModelsList200Response, ModelsListDefaultResponse, ModelsRetrieve200Response, @@ -21,14 +21,14 @@ import { createRestError, } from "@typespec/ts-http-runtime"; import { - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, } from "../../models/options.js"; export function _listSend( context: Client, - options: ModelsListOptions = { requestOptions: {} }, + options: ModelsListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/models") @@ -55,7 +55,7 @@ export async function _listDeserialize( export async function list( context: Client, - options: ModelsListOptions = { requestOptions: {} }, + options: ModelsListOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listSend(context, options); return _listDeserialize(result); @@ -64,7 +64,7 @@ export async function list( export function _retrieveSend( context: Client, model: string, - options: ModelsRetrieveOptions = { requestOptions: {} }, + options: ModelsRetrieveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/models/{model}", model) @@ -89,28 +89,24 @@ export async function _retrieveDeserialize( export async function retrieve( context: Client, model: string, - options: ModelsRetrieveOptions = { requestOptions: {} }, + options: ModelsRetrieveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _retrieveSend(context, model, options); return _retrieveDeserialize(result); } -export function _deleteOperationSend( +export function _$deleteSend( context: Client, model: string, - options: ModelsDeleteOperationOptions = { requestOptions: {} }, -): StreamableMethod< - ModelsDeleteOperation200Response | ModelsDeleteOperationDefaultResponse -> { + options: ModelsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/models/{model}", model) .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteOperationDeserialize( - result: - | ModelsDeleteOperation200Response - | ModelsDeleteOperationDefaultResponse, +export async function _$deleteDeserialize( + result: ModelsDelete200Response | ModelsDeleteDefaultResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -123,11 +119,16 @@ export async function _deleteOperationDeserialize( }; } -export async function deleteOperation( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, model: string, - options: ModelsDeleteOperationOptions = { requestOptions: {} }, + options: ModelsDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteOperationSend(context, model, options); - return _deleteOperationDeserialize(result); + const result = await _$deleteSend(context, model, options); + return _$deleteDeserialize(result); } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts index d8d3955fd3..e390a9f9d3 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/moderations/index.ts @@ -15,12 +15,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@typespec/ts-http-runtime"; -import { ModerationsCreateOptions } from "../../models/options.js"; +import { ModerationsCreateOptionalParams } from "../../models/options.js"; export function _createSend( context: Client, content: CreateModerationRequest, - options: ModerationsCreateOptions = { requestOptions: {} }, + options: ModerationsCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod< ModerationsCreate200Response | ModerationsCreateDefaultResponse > { @@ -77,7 +77,7 @@ export async function _createDeserialize( export async function create( context: Client, content: CreateModerationRequest, - options: ModerationsCreateOptions = { requestOptions: {} }, + options: ModerationsCreateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createSend(context, content, options); return _createDeserialize(result); diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/OpenAIContext.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts similarity index 100% rename from packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/OpenAIContext.ts rename to packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/api/openAIContext.ts diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts index 02d0b97cbc..26612f2539 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { AudioTranscriptionsOperations, getAudioTranscriptionsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts index 021e44baf2..6dfe00bdfa 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/transcriptions/index.ts @@ -1,17 +1,17 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateTranscriptionRequest, CreateTranscriptionResponse, } from "../../../models/models.js"; import { create } from "../../../api/audio/transcriptions/index.js"; -import { AudioTranscriptionsCreateOptions } from "../../../models/options.js"; +import { AudioTranscriptionsCreateOptionalParams } from "../../../models/options.js"; export interface AudioTranscriptionsOperations { create: ( audio: CreateTranscriptionRequest, - options?: AudioTranscriptionsCreateOptions, + options?: AudioTranscriptionsCreateOptionalParams, ) => Promise; } @@ -19,7 +19,7 @@ export function getAudioTranscriptions(context: OpenAIContext) { return { create: ( audio: CreateTranscriptionRequest, - options?: AudioTranscriptionsCreateOptions, + options?: AudioTranscriptionsCreateOptionalParams, ) => create(context, audio, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts index 00f8ee19f4..a36f24b95c 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/audio/translations/index.ts @@ -1,17 +1,17 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateTranslationRequest, CreateTranslationResponse, } from "../../../models/models.js"; import { create } from "../../../api/audio/translations/index.js"; -import { AudioTranslationsCreateOptions } from "../../../models/options.js"; +import { AudioTranslationsCreateOptionalParams } from "../../../models/options.js"; export interface AudioTranslationsOperations { create: ( audio: CreateTranslationRequest, - options?: AudioTranslationsCreateOptions, + options?: AudioTranslationsCreateOptionalParams, ) => Promise; } @@ -19,7 +19,7 @@ export function getAudioTranslations(context: OpenAIContext) { return { create: ( audio: CreateTranslationRequest, - options?: AudioTranslationsCreateOptions, + options?: AudioTranslationsCreateOptionalParams, ) => create(context, audio, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts index d102600eda..778b440e6e 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/completions/index.ts @@ -1,17 +1,17 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateChatCompletionRequest, CreateChatCompletionResponse, } from "../../../models/models.js"; import { create } from "../../../api/chat/completions/index.js"; -import { ChatCompletionsCreateOptions } from "../../../models/options.js"; +import { ChatCompletionsCreateOptionalParams } from "../../../models/options.js"; export interface ChatCompletionsOperations { create: ( body: CreateChatCompletionRequest, - options?: ChatCompletionsCreateOptions, + options?: ChatCompletionsCreateOptionalParams, ) => Promise; } @@ -19,7 +19,7 @@ export function getChatCompletions(context: OpenAIContext) { return { create: ( body: CreateChatCompletionRequest, - options?: ChatCompletionsCreateOptions, + options?: ChatCompletionsCreateOptionalParams, ) => create(context, body, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts index 8a6408e0d3..7659d96eeb 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/chat/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { ChatCompletionsOperations, getChatCompletionsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts index 54c446a033..d7bd15b3a5 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/completions/index.ts @@ -1,17 +1,17 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateCompletionRequest, CreateCompletionResponse, } from "../../models/models.js"; import { create } from "../../api/completions/index.js"; -import { CompletionsCreateOptions } from "../../models/options.js"; +import { CompletionsCreateOptionalParams } from "../../models/options.js"; export interface CompletionsOperations { create: ( body: CreateCompletionRequest, - options?: CompletionsCreateOptions, + options?: CompletionsCreateOptionalParams, ) => Promise; } @@ -19,7 +19,7 @@ export function getCompletions(context: OpenAIContext) { return { create: ( body: CreateCompletionRequest, - options?: CompletionsCreateOptions, + options?: CompletionsCreateOptionalParams, ) => create(context, body, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts index f74e364c7b..14e1b19270 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/edits/index.ts @@ -1,20 +1,20 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateEditRequest, CreateEditResponse } from "../../models/models.js"; import { create } from "../../api/edits/index.js"; -import { EditsCreateOptions } from "../../models/options.js"; +import { EditsCreateOptionalParams } from "../../models/options.js"; export interface EditsOperations { create: ( edit: CreateEditRequest, - options?: EditsCreateOptions, + options?: EditsCreateOptionalParams, ) => Promise; } export function getEdits(context: OpenAIContext) { return { - create: (edit: CreateEditRequest, options?: EditsCreateOptions) => + create: (edit: CreateEditRequest, options?: EditsCreateOptionalParams) => create(context, edit, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts index 45d4e7ca3e..bd886d5e74 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/embeddings/index.ts @@ -1,17 +1,17 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateEmbeddingRequest, CreateEmbeddingResponse, } from "../../models/models.js"; import { create } from "../../api/embeddings/index.js"; -import { EmbeddingsCreateOptions } from "../../models/options.js"; +import { EmbeddingsCreateOptionalParams } from "../../models/options.js"; export interface EmbeddingsOperations { create: ( embedding: CreateEmbeddingRequest, - options?: EmbeddingsCreateOptions, + options?: EmbeddingsCreateOptionalParams, ) => Promise; } @@ -19,7 +19,7 @@ export function getEmbeddings(context: OpenAIContext) { return { create: ( embedding: CreateEmbeddingRequest, - options?: EmbeddingsCreateOptions, + options?: EmbeddingsCreateOptionalParams, ) => create(context, embedding, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts index 2e5401e880..5321e2ebfd 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/files/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { OpenAIFile, ListFilesResponse, @@ -11,44 +11,47 @@ import { list, create, retrieve, - deleteOperation, + $delete, download, } from "../../api/files/index.js"; import { - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, } from "../../models/options.js"; export interface FilesOperations { - list: (options?: FilesListOptions) => Promise; + list: (options?: FilesListOptionalParams) => Promise; create: ( file: CreateFileRequest, - options?: FilesCreateOptions, + options?: FilesCreateOptionalParams, ) => Promise; retrieve: ( fileId: string, - options?: FilesRetrieveOptions, + options?: FilesRetrieveOptionalParams, ) => Promise; - deleteOperation: ( + delete: ( fileId: string, - options?: FilesDeleteOperationOptions, + options?: FilesDeleteOptionalParams, ) => Promise; - download: (fileId: string, options?: FilesDownloadOptions) => Promise; + download: ( + fileId: string, + options?: FilesDownloadOptionalParams, + ) => Promise; } export function getFiles(context: OpenAIContext) { return { - list: (options?: FilesListOptions) => list(context, options), - create: (file: CreateFileRequest, options?: FilesCreateOptions) => + list: (options?: FilesListOptionalParams) => list(context, options), + create: (file: CreateFileRequest, options?: FilesCreateOptionalParams) => create(context, file, options), - retrieve: (fileId: string, options?: FilesRetrieveOptions) => + retrieve: (fileId: string, options?: FilesRetrieveOptionalParams) => retrieve(context, fileId, options), - deleteOperation: (fileId: string, options?: FilesDeleteOperationOptions) => - deleteOperation(context, fileId, options), - download: (fileId: string, options?: FilesDownloadOptions) => + delete: (fileId: string, options?: FilesDeleteOptionalParams) => + $delete(context, fileId, options), + download: (fileId: string, options?: FilesDownloadOptionalParams) => download(context, fileId, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts index ada3ab04d5..4455356413 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTunes/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateFineTuneRequest, FineTune, @@ -15,30 +15,32 @@ import { cancel, } from "../../api/fineTunes/index.js"; import { - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, } from "../../models/options.js"; export interface FineTunesOperations { create: ( fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptions, + options?: FineTunesCreateOptionalParams, ) => Promise; - list: (options?: FineTunesListOptions) => Promise; + list: ( + options?: FineTunesListOptionalParams, + ) => Promise; retrieve: ( fineTuneId: string, - options?: FineTunesRetrieveOptions, + options?: FineTunesRetrieveOptionalParams, ) => Promise; listEvents: ( fineTuneId: string, - options?: FineTunesListEventsOptions, + options?: FineTunesListEventsOptionalParams, ) => Promise; cancel: ( fineTuneId: string, - options?: FineTunesCancelOptions, + options?: FineTunesCancelOptionalParams, ) => Promise; } @@ -46,14 +48,16 @@ export function getFineTunes(context: OpenAIContext) { return { create: ( fineTune: CreateFineTuneRequest, - options?: FineTunesCreateOptions, + options?: FineTunesCreateOptionalParams, ) => create(context, fineTune, options), - list: (options?: FineTunesListOptions) => list(context, options), - retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptions) => + list: (options?: FineTunesListOptionalParams) => list(context, options), + retrieve: (fineTuneId: string, options?: FineTunesRetrieveOptionalParams) => retrieve(context, fineTuneId, options), - listEvents: (fineTuneId: string, options?: FineTunesListEventsOptions) => - listEvents(context, fineTuneId, options), - cancel: (fineTuneId: string, options?: FineTunesCancelOptions) => + listEvents: ( + fineTuneId: string, + options?: FineTunesListEventsOptionalParams, + ) => listEvents(context, fineTuneId, options), + cancel: (fineTuneId: string, options?: FineTunesCancelOptionalParams) => cancel(context, fineTuneId, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts index 8101ff9025..536038cdf1 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { FineTuningJobsOperations, getFineTuningJobsOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts index b9a9f1f0af..35b7e19ee1 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/fineTuning/jobs/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../../api/openAIContext.js"; import { CreateFineTuningJobRequest, FineTuningJob, @@ -15,32 +15,32 @@ import { cancel, } from "../../../api/fineTuning/jobs/index.js"; import { - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, } from "../../../models/options.js"; export interface FineTuningJobsOperations { create: ( job: CreateFineTuningJobRequest, - options?: FineTuningJobsCreateOptions, + options?: FineTuningJobsCreateOptionalParams, ) => Promise; list: ( - options?: FineTuningJobsListOptions, + options?: FineTuningJobsListOptionalParams, ) => Promise; retrieve: ( fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptions, + options?: FineTuningJobsRetrieveOptionalParams, ) => Promise; listEvents: ( fineTuningJobId: string, - options?: FineTuningJobsListEventsOptions, + options?: FineTuningJobsListEventsOptionalParams, ) => Promise; cancel: ( fineTuningJobId: string, - options?: FineTuningJobsCancelOptions, + options?: FineTuningJobsCancelOptionalParams, ) => Promise; } @@ -48,19 +48,22 @@ export function getFineTuningJobs(context: OpenAIContext) { return { create: ( job: CreateFineTuningJobRequest, - options?: FineTuningJobsCreateOptions, + options?: FineTuningJobsCreateOptionalParams, ) => create(context, job, options), - list: (options?: FineTuningJobsListOptions) => list(context, options), + list: (options?: FineTuningJobsListOptionalParams) => + list(context, options), retrieve: ( fineTuningJobId: string, - options?: FineTuningJobsRetrieveOptions, + options?: FineTuningJobsRetrieveOptionalParams, ) => retrieve(context, fineTuningJobId, options), listEvents: ( fineTuningJobId: string, - options?: FineTuningJobsListEventsOptions, + options?: FineTuningJobsListEventsOptionalParams, ) => listEvents(context, fineTuningJobId, options), - cancel: (fineTuningJobId: string, options?: FineTuningJobsCancelOptions) => - cancel(context, fineTuningJobId, options), + cancel: ( + fineTuningJobId: string, + options?: FineTuningJobsCancelOptionalParams, + ) => cancel(context, fineTuningJobId, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts index 37279141f5..13dc794f5b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/images/index.ts @@ -1,6 +1,6 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateImageRequest, ImagesResponse, @@ -9,37 +9,37 @@ import { } from "../../models/models.js"; import { create, createEdit, createVariation } from "../../api/images/index.js"; import { - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, } from "../../models/options.js"; export interface ImagesOperations { create: ( image: CreateImageRequest, - options?: ImagesCreateOptions, + options?: ImagesCreateOptionalParams, ) => Promise; createEdit: ( image: CreateImageEditRequest, - options?: ImagesCreateEditOptions, + options?: ImagesCreateEditOptionalParams, ) => Promise; createVariation: ( image: CreateImageVariationRequest, - options?: ImagesCreateVariationOptions, + options?: ImagesCreateVariationOptionalParams, ) => Promise; } export function getImages(context: OpenAIContext) { return { - create: (image: CreateImageRequest, options?: ImagesCreateOptions) => + create: (image: CreateImageRequest, options?: ImagesCreateOptionalParams) => create(context, image, options), createEdit: ( image: CreateImageEditRequest, - options?: ImagesCreateEditOptions, + options?: ImagesCreateEditOptionalParams, ) => createEdit(context, image, options), createVariation: ( image: CreateImageVariationRequest, - options?: ImagesCreateVariationOptions, + options?: ImagesCreateVariationOptionalParams, ) => createVariation(context, image, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts index 7793ad7585..a872034d5a 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/models/index.ts @@ -1,34 +1,37 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { ListModelsResponse, Model, DeleteModelResponse, } from "../../models/models.js"; -import { list, retrieve, deleteOperation } from "../../api/models/index.js"; +import { list, retrieve, $delete } from "../../api/models/index.js"; import { - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, } from "../../models/options.js"; export interface ModelsOperations { - list: (options?: ModelsListOptions) => Promise; - retrieve: (model: string, options?: ModelsRetrieveOptions) => Promise; - deleteOperation: ( + list: (options?: ModelsListOptionalParams) => Promise; + retrieve: ( model: string, - options?: ModelsDeleteOperationOptions, + options?: ModelsRetrieveOptionalParams, + ) => Promise; + delete: ( + model: string, + options?: ModelsDeleteOptionalParams, ) => Promise; } export function getModels(context: OpenAIContext) { return { - list: (options?: ModelsListOptions) => list(context, options), - retrieve: (model: string, options?: ModelsRetrieveOptions) => + list: (options?: ModelsListOptionalParams) => list(context, options), + retrieve: (model: string, options?: ModelsRetrieveOptionalParams) => retrieve(context, model, options), - deleteOperation: (model: string, options?: ModelsDeleteOperationOptions) => - deleteOperation(context, model, options), + delete: (model: string, options?: ModelsDeleteOptionalParams) => + $delete(context, model, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts index 2f20ac0b3f..6a3d49725e 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/classic/moderations/index.ts @@ -1,17 +1,17 @@ // Licensed under the MIT license. -import { OpenAIContext } from "../../api/OpenAIContext.js"; +import { OpenAIContext } from "../../api/openAIContext.js"; import { CreateModerationRequest, CreateModerationResponse, } from "../../models/models.js"; import { create } from "../../api/moderations/index.js"; -import { ModerationsCreateOptions } from "../../models/options.js"; +import { ModerationsCreateOptionalParams } from "../../models/options.js"; export interface ModerationsOperations { create: ( content: CreateModerationRequest, - options?: ModerationsCreateOptions, + options?: ModerationsCreateOptionalParams, ) => Promise; } @@ -19,7 +19,7 @@ export function getModerations(context: OpenAIContext) { return { create: ( content: CreateModerationRequest, - options?: ModerationsCreateOptions, + options?: ModerationsCreateOptionalParams, ) => create(context, content, options), }; } diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts index 473adfd3af..8b1fcb807a 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts @@ -1,10 +1,10 @@ // Licensed under the MIT license. -export { OpenAIClient, OpenAIClientOptions } from "./OpenAIClient.js"; +export { OpenAIClient, OpenAIClientOptions } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, - Error, + ErrorModel, CreateImageRequest, ImagesResponse, Image, @@ -35,10 +35,10 @@ export { ListPaginatedFineTuningJobsResponse, ListFineTuningJobEventsResponse, FineTuningJobEvent, - CreateChatCompletionRequest, ChatCompletionRequestMessage, ChatCompletionFunctions, ChatCompletionFunctionCallOption, + CreateChatCompletionRequest, CreateChatCompletionResponse, ChatCompletionResponseMessage, CreateTranslationRequest, @@ -47,34 +47,34 @@ export { CreateTranscriptionResponse, Prompt, Stop, - AudioTranscriptionsCreateOptions, - AudioTranslationsCreateOptions, - ChatCompletionsCreateOptions, - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, - CompletionsCreateOptions, - EditsCreateOptions, - EmbeddingsCreateOptions, - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, - ModerationsCreateOptions, + AudioTranscriptionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, + CompletionsCreateOptionalParams, + EditsCreateOptionalParams, + EmbeddingsCreateOptionalParams, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, + ModerationsCreateOptionalParams, } from "./models/index.js"; export { AudioOperations, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts index b816237bf8..89945dca55 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts @@ -3,7 +3,7 @@ export { CreateModerationRequest, CreateModerationResponse, - Error, + ErrorModel, CreateImageRequest, ImagesResponse, Image, @@ -34,10 +34,10 @@ export { ListPaginatedFineTuningJobsResponse, ListFineTuningJobEventsResponse, FineTuningJobEvent, - CreateChatCompletionRequest, ChatCompletionRequestMessage, ChatCompletionFunctions, ChatCompletionFunctionCallOption, + CreateChatCompletionRequest, CreateChatCompletionResponse, ChatCompletionResponseMessage, CreateTranslationRequest, @@ -48,32 +48,32 @@ export { Stop, } from "./models.js"; export { - AudioTranscriptionsCreateOptions, - AudioTranslationsCreateOptions, - ChatCompletionsCreateOptions, - FineTuningJobsCreateOptions, - FineTuningJobsListOptions, - FineTuningJobsRetrieveOptions, - FineTuningJobsListEventsOptions, - FineTuningJobsCancelOptions, - CompletionsCreateOptions, - EditsCreateOptions, - EmbeddingsCreateOptions, - FilesListOptions, - FilesCreateOptions, - FilesRetrieveOptions, - FilesDeleteOperationOptions, - FilesDownloadOptions, - FineTunesCreateOptions, - FineTunesListOptions, - FineTunesRetrieveOptions, - FineTunesListEventsOptions, - FineTunesCancelOptions, - ModelsListOptions, - ModelsRetrieveOptions, - ModelsDeleteOperationOptions, - ImagesCreateOptions, - ImagesCreateEditOptions, - ImagesCreateVariationOptions, - ModerationsCreateOptions, + AudioTranscriptionsCreateOptionalParams, + AudioTranslationsCreateOptionalParams, + ChatCompletionsCreateOptionalParams, + FineTuningJobsCreateOptionalParams, + FineTuningJobsListOptionalParams, + FineTuningJobsRetrieveOptionalParams, + FineTuningJobsListEventsOptionalParams, + FineTuningJobsCancelOptionalParams, + CompletionsCreateOptionalParams, + EditsCreateOptionalParams, + EmbeddingsCreateOptionalParams, + FilesListOptionalParams, + FilesCreateOptionalParams, + FilesRetrieveOptionalParams, + FilesDeleteOptionalParams, + FilesDownloadOptionalParams, + FineTunesCreateOptionalParams, + FineTunesListOptionalParams, + FineTunesRetrieveOptionalParams, + FineTunesListEventsOptionalParams, + FineTunesCancelOptionalParams, + ModelsListOptionalParams, + ModelsRetrieveOptionalParams, + ModelsDeleteOptionalParams, + ImagesCreateOptionalParams, + ImagesCreateEditOptionalParams, + ImagesCreateVariationOptionalParams, + ModerationsCreateOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 6a7b23468a..c95b175ac9 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -50,7 +50,7 @@ export interface CreateModerationResponse { }[]; } -export interface Error { +export interface ErrorModel { type: string; message: string; param: string | null; @@ -729,6 +729,50 @@ export interface FineTuningJobEvent { message: string; } +export interface ChatCompletionRequestMessage { + /** The role of the messages author. One of `system`, `user`, `assistant`, or `function`. */ + role: "system" | "user" | "assistant" | "function"; + /** + * The contents of the message. `content` is required for all messages, and may be null for + * assistant messages with function calls. + */ + content: string | null; + /** + * The name of the author of this message. `name` is required if role is `function`, and it + * should be the name of the function whose response is in the `content`. May contain a-z, + * A-Z, 0-9, and underscores, with a maximum length of 64 characters. + */ + name?: string; + /** The name and arguments of a function that should be called, as generated by the model. */ + functionCall?: { name: string; arguments: string }; +} + +export interface ChatCompletionFunctions { + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and + * dashes, with a maximum length of 64. + */ + name: string; + /** + * A description of what the function does, used by the model to choose when and how to call the + * function. + */ + description?: string; + /** + * The parameters the functions accepts, described as a JSON Schema object. See the + * [guide](/docs/guides/gpt/function-calling) for examples, and the + * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation + * about the format.\n\nTo describe a function that accepts no parameters, provide the value + * `{\"type\": \"object\", \"properties\": {}}`. + */ + parameters: Record; +} + +export interface ChatCompletionFunctionCallOption { + /** The name of the function to call. */ + name: string; +} + export interface CreateChatCompletionRequest { /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) @@ -831,50 +875,6 @@ export interface CreateChatCompletionRequest { stream?: boolean | null; } -export interface ChatCompletionRequestMessage { - /** The role of the messages author. One of `system`, `user`, `assistant`, or `function`. */ - role: "system" | "user" | "assistant" | "function"; - /** - * The contents of the message. `content` is required for all messages, and may be null for - * assistant messages with function calls. - */ - content: string | null; - /** - * The name of the author of this message. `name` is required if role is `function`, and it - * should be the name of the function whose response is in the `content`. May contain a-z, - * A-Z, 0-9, and underscores, with a maximum length of 64 characters. - */ - name?: string; - /** The name and arguments of a function that should be called, as generated by the model. */ - functionCall?: { name: string; arguments: string }; -} - -export interface ChatCompletionFunctions { - /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and - * dashes, with a maximum length of 64. - */ - name: string; - /** - * A description of what the function does, used by the model to choose when and how to call the - * function. - */ - description?: string; - /** - * The parameters the functions accepts, described as a JSON Schema object. See the - * [guide](/docs/guides/gpt/function-calling) for examples, and the - * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation - * about the format.\n\nTo describe a function that accepts no parameters, provide the value - * `{\"type\": \"object\", \"properties\": {}}`. - */ - parameters: Record; -} - -export interface ChatCompletionFunctionCallOption { - /** The name of the function to call. */ - name: string; -} - /** Represents a chat completion response returned by model, based on the provided input. */ export interface CreateChatCompletionResponse { /** A unique identifier for the chat completion. */ diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/options.ts index e53a35ce55..8185ee1cf7 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/options.ts @@ -2,61 +2,65 @@ import { OperationOptions } from "@typespec/ts-http-runtime"; -export interface AudioTranscriptionsCreateOptions extends OperationOptions { +export interface AudioTranscriptionsCreateOptionalParams + extends OperationOptions { contentType?: string; } -export interface AudioTranslationsCreateOptions extends OperationOptions { +export interface AudioTranslationsCreateOptionalParams + extends OperationOptions { contentType?: string; } -export interface ChatCompletionsCreateOptions extends OperationOptions {} +export interface ChatCompletionsCreateOptionalParams extends OperationOptions {} -export interface FineTuningJobsCreateOptions extends OperationOptions {} +export interface FineTuningJobsCreateOptionalParams extends OperationOptions {} -export interface FineTuningJobsListOptions extends OperationOptions { +export interface FineTuningJobsListOptionalParams extends OperationOptions { /** Identifier for the last job from the previous pagination request. */ after?: string; /** Number of fine-tuning jobs to retrieve. */ limit?: number; } -export interface FineTuningJobsRetrieveOptions extends OperationOptions {} +export interface FineTuningJobsRetrieveOptionalParams + extends OperationOptions {} -export interface FineTuningJobsListEventsOptions extends OperationOptions { +export interface FineTuningJobsListEventsOptionalParams + extends OperationOptions { /** Identifier for the last event from the previous pagination request. */ after?: string; /** Number of events to retrieve. */ limit?: number; } -export interface FineTuningJobsCancelOptions extends OperationOptions {} +export interface FineTuningJobsCancelOptionalParams extends OperationOptions {} -export interface CompletionsCreateOptions extends OperationOptions {} +export interface CompletionsCreateOptionalParams extends OperationOptions {} -export interface EditsCreateOptions extends OperationOptions {} +export interface EditsCreateOptionalParams extends OperationOptions {} -export interface EmbeddingsCreateOptions extends OperationOptions {} +export interface EmbeddingsCreateOptionalParams extends OperationOptions {} -export interface FilesListOptions extends OperationOptions {} +export interface FilesListOptionalParams extends OperationOptions {} -export interface FilesCreateOptions extends OperationOptions { +export interface FilesCreateOptionalParams extends OperationOptions { contentType?: string; } -export interface FilesRetrieveOptions extends OperationOptions {} +export interface FilesRetrieveOptionalParams extends OperationOptions {} -export interface FilesDeleteOperationOptions extends OperationOptions {} +export interface FilesDeleteOptionalParams extends OperationOptions {} -export interface FilesDownloadOptions extends OperationOptions {} +export interface FilesDownloadOptionalParams extends OperationOptions {} -export interface FineTunesCreateOptions extends OperationOptions {} +export interface FineTunesCreateOptionalParams extends OperationOptions {} -export interface FineTunesListOptions extends OperationOptions {} +export interface FineTunesListOptionalParams extends OperationOptions {} -export interface FineTunesRetrieveOptions extends OperationOptions {} +export interface FineTunesRetrieveOptionalParams extends OperationOptions {} -export interface FineTunesListEventsOptions extends OperationOptions { +export interface FineTunesListEventsOptionalParams extends OperationOptions { /** * Whether to stream events for the fine-tune job. If set to true, events will be sent as * data-only @@ -69,22 +73,22 @@ export interface FineTunesListEventsOptions extends OperationOptions { stream?: boolean; } -export interface FineTunesCancelOptions extends OperationOptions {} +export interface FineTunesCancelOptionalParams extends OperationOptions {} -export interface ModelsListOptions extends OperationOptions {} +export interface ModelsListOptionalParams extends OperationOptions {} -export interface ModelsRetrieveOptions extends OperationOptions {} +export interface ModelsRetrieveOptionalParams extends OperationOptions {} -export interface ModelsDeleteOperationOptions extends OperationOptions {} +export interface ModelsDeleteOptionalParams extends OperationOptions {} -export interface ImagesCreateOptions extends OperationOptions {} +export interface ImagesCreateOptionalParams extends OperationOptions {} -export interface ImagesCreateEditOptions extends OperationOptions { +export interface ImagesCreateEditOptionalParams extends OperationOptions { contentType?: string; } -export interface ImagesCreateVariationOptions extends OperationOptions { +export interface ImagesCreateVariationOptionalParams extends OperationOptions { contentType?: string; } -export interface ModerationsCreateOptions extends OperationOptions {} +export interface ModerationsCreateOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/OpenAIClient.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts similarity index 98% rename from packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/OpenAIClient.ts rename to packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts index e98dfb6796..53775d701b 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/OpenAIClient.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/openAIClient.ts @@ -40,7 +40,7 @@ import { OpenAIContext, } from "./api/index.js"; -export { OpenAIClientOptions } from "./api/OpenAIContext.js"; +export { OpenAIClientOptions } from "./api/openAIContext.js"; export class OpenAIClient { private _client: OpenAIContext; diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/clientDefinitions.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/clientDefinitions.ts index 4ebda64121..1cd9417a3e 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/clientDefinitions.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/clientDefinitions.ts @@ -59,8 +59,8 @@ import { FilesCreateDefaultResponse, FilesRetrieve200Response, FilesRetrieveDefaultResponse, - FilesDeleteOperation200Response, - FilesDeleteOperationDefaultResponse, + FilesDelete200Response, + FilesDeleteDefaultResponse, FilesDownload200Response, FilesDownloadDefaultResponse, FineTunesCreate200Response, @@ -77,8 +77,8 @@ import { ModelsListDefaultResponse, ModelsRetrieve200Response, ModelsRetrieveDefaultResponse, - ModelsDeleteOperation200Response, - ModelsDeleteOperationDefaultResponse, + ModelsDelete200Response, + ModelsDeleteDefaultResponse, ImagesCreate200Response, ImagesCreateDefaultResponse, ImagesCreateEdit200Response, @@ -198,9 +198,7 @@ export interface FilesRetrieve { ): StreamableMethod; delete( options?: FilesDeleteParameters, - ): StreamableMethod< - FilesDeleteOperation200Response | FilesDeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface FilesDownload { @@ -258,9 +256,7 @@ export interface ModelsRetrieve { >; delete( options?: ModelsDeleteParameters, - ): StreamableMethod< - ModelsDeleteOperation200Response | ModelsDeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface ImagesCreate { diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/isUnexpected.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/isUnexpected.ts index 02f446616e..e8fa350ca3 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/isUnexpected.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/isUnexpected.ts @@ -29,8 +29,8 @@ import { FilesCreateDefaultResponse, FilesRetrieve200Response, FilesRetrieveDefaultResponse, - FilesDeleteOperation200Response, - FilesDeleteOperationDefaultResponse, + FilesDelete200Response, + FilesDeleteDefaultResponse, FilesDownload200Response, FilesDownloadDefaultResponse, FineTunesCreate200Response, @@ -47,8 +47,8 @@ import { ModelsListDefaultResponse, ModelsRetrieve200Response, ModelsRetrieveDefaultResponse, - ModelsDeleteOperation200Response, - ModelsDeleteOperationDefaultResponse, + ModelsDelete200Response, + ModelsDeleteDefaultResponse, ImagesCreate200Response, ImagesCreateDefaultResponse, ImagesCreateEdit200Response, @@ -147,10 +147,8 @@ export function isUnexpected( response: FilesRetrieve200Response | FilesRetrieveDefaultResponse, ): response is FilesRetrieveDefaultResponse; export function isUnexpected( - response: - | FilesDeleteOperation200Response - | FilesDeleteOperationDefaultResponse, -): response is FilesDeleteOperationDefaultResponse; + response: FilesDelete200Response | FilesDeleteDefaultResponse, +): response is FilesDeleteDefaultResponse; export function isUnexpected( response: FilesDownload200Response | FilesDownloadDefaultResponse, ): response is FilesDownloadDefaultResponse; @@ -176,10 +174,8 @@ export function isUnexpected( response: ModelsRetrieve200Response | ModelsRetrieveDefaultResponse, ): response is ModelsRetrieveDefaultResponse; export function isUnexpected( - response: - | ModelsDeleteOperation200Response - | ModelsDeleteOperationDefaultResponse, -): response is ModelsDeleteOperationDefaultResponse; + response: ModelsDelete200Response | ModelsDeleteDefaultResponse, +): response is ModelsDeleteDefaultResponse; export function isUnexpected( response: ImagesCreate200Response | ImagesCreateDefaultResponse, ): response is ImagesCreateDefaultResponse; @@ -224,8 +220,8 @@ export function isUnexpected( | FilesCreateDefaultResponse | FilesRetrieve200Response | FilesRetrieveDefaultResponse - | FilesDeleteOperation200Response - | FilesDeleteOperationDefaultResponse + | FilesDelete200Response + | FilesDeleteDefaultResponse | FilesDownload200Response | FilesDownloadDefaultResponse | FineTunesCreate200Response @@ -242,8 +238,8 @@ export function isUnexpected( | ModelsListDefaultResponse | ModelsRetrieve200Response | ModelsRetrieveDefaultResponse - | ModelsDeleteOperation200Response - | ModelsDeleteOperationDefaultResponse + | ModelsDelete200Response + | ModelsDeleteDefaultResponse | ImagesCreate200Response | ImagesCreateDefaultResponse | ImagesCreateEdit200Response @@ -267,7 +263,7 @@ export function isUnexpected( | FilesListDefaultResponse | FilesCreateDefaultResponse | FilesRetrieveDefaultResponse - | FilesDeleteOperationDefaultResponse + | FilesDeleteDefaultResponse | FilesDownloadDefaultResponse | FineTunesCreateDefaultResponse | FineTunesListDefaultResponse @@ -276,7 +272,7 @@ export function isUnexpected( | FineTunesCancelDefaultResponse | ModelsListDefaultResponse | ModelsRetrieveDefaultResponse - | ModelsDeleteOperationDefaultResponse + | ModelsDeleteDefaultResponse | ImagesCreateDefaultResponse | ImagesCreateEditDefaultResponse | ImagesCreateVariationDefaultResponse diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/outputModels.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/outputModels.ts index 40cb6942f7..7c37da0b82 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/outputModels.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/outputModels.ts @@ -68,7 +68,7 @@ export interface FineTuningJobOutput { * The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be * null if the fine-tuning job is still running. */ - finished_at: string | null; + finished_at: number | null; /** The base model that is being fine-tuned. */ model: string; /** diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/responses.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/responses.ts index 143e164584..044487d2f7 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/responses.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/rest/responses.ts @@ -180,12 +180,12 @@ export interface FilesRetrieveDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface FilesDeleteOperation200Response extends HttpResponse { +export interface FilesDelete200Response extends HttpResponse { status: "200"; body: DeleteFileResponseOutput; } -export interface FilesDeleteOperationDefaultResponse extends HttpResponse { +export interface FilesDeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -279,12 +279,12 @@ export interface ModelsRetrieveDefaultResponse extends HttpResponse { } /** The request has succeeded. */ -export interface ModelsDeleteOperation200Response extends HttpResponse { +export interface ModelsDelete200Response extends HttpResponse { status: "200"; body: DeleteModelResponseOutput; } -export interface ModelsDeleteOperationDefaultResponse extends HttpResponse { +export interface ModelsDeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/package.json b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/package.json index b3d2fa91f0..b9aed834cc 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/package.json @@ -43,7 +43,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -56,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md index 493233b42a..c87e48635f 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/review/overload_modular.api.md @@ -11,13 +11,13 @@ import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; // @public (undocumented) -export interface FooOperationsGetAvatarAsJpegOptions extends OperationOptions { +export interface FooOperationsGetAvatarAsJpegOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } // @public (undocumented) -export interface FooOperationsGetAvatarAsPngOptions extends OperationOptions { +export interface FooOperationsGetAvatarAsPngOptionalParams extends OperationOptions { // (undocumented) contentType?: string; } @@ -25,20 +25,24 @@ export interface FooOperationsGetAvatarAsPngOptions extends OperationOptions { // @public (undocumented) export interface FooOperationsOperations { // (undocumented) - getAvatarAsJpeg: (image: Uint8Array, options?: FooOperationsGetAvatarAsJpegOptions) => Promise; + getAvatarAsJpeg: (image: Uint8Array, options?: FooOperationsGetAvatarAsJpegOptionalParams) => Promise; // (undocumented) - getAvatarAsPng: (image: Uint8Array, options?: FooOperationsGetAvatarAsPngOptions) => Promise; + getAvatarAsPng: (image: Uint8Array, options?: FooOperationsGetAvatarAsPngOptionalParams) => Promise; } +// @public (undocumented) +export type Versions = "2022-08-30"; + // @public (undocumented) export class WidgetManagerClient { - constructor(endpoint: string, credential: KeyCredential | TokenCredential, options?: WidgetManagerClientOptions); + constructor(endpointParam: string, credential: KeyCredential | TokenCredential, options?: WidgetManagerClientOptions); readonly fooOperations: FooOperationsOperations; readonly pipeline: Pipeline; } // @public (undocumented) export interface WidgetManagerClientOptions extends ClientOptions { + apiVersion?: string; } // (No @packageDocumentation comment for this package) diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts index 3a10c42594..318d27c253 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/fooOperations/index.ts @@ -15,14 +15,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - FooOperationsGetAvatarAsPngOptions, - FooOperationsGetAvatarAsJpegOptions, + FooOperationsGetAvatarAsPngOptionalParams, + FooOperationsGetAvatarAsJpegOptionalParams, } from "../../models/options.js"; export function _getAvatarAsPngSend( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsPngOptions = { requestOptions: {} }, + options: FooOperationsGetAvatarAsPngOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/avatar") @@ -49,7 +49,7 @@ export async function _getAvatarAsPngDeserialize( export async function getAvatarAsPng( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsPngOptions = { requestOptions: {} }, + options: FooOperationsGetAvatarAsPngOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getAvatarAsPngSend(context, image, options); return _getAvatarAsPngDeserialize(result); @@ -58,7 +58,7 @@ export async function getAvatarAsPng( export function _getAvatarAsJpegSend( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsJpegOptions = { requestOptions: {} }, + options: FooOperationsGetAvatarAsJpegOptionalParams = { requestOptions: {} }, ): StreamableMethod< GetAvatarAsJpeg204Response | GetAvatarAsJpegDefaultResponse > { @@ -87,7 +87,7 @@ export async function _getAvatarAsJpegDeserialize( export async function getAvatarAsJpeg( context: Client, image: Uint8Array, - options: FooOperationsGetAvatarAsJpegOptions = { requestOptions: {} }, + options: FooOperationsGetAvatarAsJpegOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getAvatarAsJpegSend(context, image, options); return _getAvatarAsJpegDeserialize(result); diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts index d6e33d197e..38b0783e58 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/index.ts @@ -5,4 +5,4 @@ export { createWidgetManager, WidgetManagerClientOptions, WidgetManagerContext, -} from "./WidgetManagerContext.js"; +} from "./widgetManagerContext.js"; diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/WidgetManagerContext.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts similarity index 77% rename from packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/WidgetManagerContext.ts rename to packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts index fcc24ce43a..53916935e3 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/WidgetManagerContext.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/api/widgetManagerContext.ts @@ -6,15 +6,18 @@ import { ClientOptions } from "@azure-rest/core-client"; import { WidgetManagerContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface WidgetManagerClientOptions extends ClientOptions {} +export interface WidgetManagerClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { WidgetManagerContext } from "../rest/index.js"; export function createWidgetManager( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: WidgetManagerClientOptions = {}, ): WidgetManagerContext { - const clientContext = getClient(endpoint, credential, options); + const clientContext = getClient(endpointParam, credential, options); return clientContext; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts index 2ca1e48f4d..324c8a1bf0 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/classic/fooOperations/index.ts @@ -1,24 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { WidgetManagerContext } from "../../api/WidgetManagerContext.js"; +import { WidgetManagerContext } from "../../api/widgetManagerContext.js"; import { getAvatarAsPng, getAvatarAsJpeg, } from "../../api/fooOperations/index.js"; import { - FooOperationsGetAvatarAsPngOptions, - FooOperationsGetAvatarAsJpegOptions, + FooOperationsGetAvatarAsPngOptionalParams, + FooOperationsGetAvatarAsJpegOptionalParams, } from "../../models/options.js"; export interface FooOperationsOperations { getAvatarAsPng: ( image: Uint8Array, - options?: FooOperationsGetAvatarAsPngOptions, + options?: FooOperationsGetAvatarAsPngOptionalParams, ) => Promise; getAvatarAsJpeg: ( image: Uint8Array, - options?: FooOperationsGetAvatarAsJpegOptions, + options?: FooOperationsGetAvatarAsJpegOptionalParams, ) => Promise; } @@ -26,11 +26,11 @@ export function getFooOperations(context: WidgetManagerContext) { return { getAvatarAsPng: ( image: Uint8Array, - options?: FooOperationsGetAvatarAsPngOptions, + options?: FooOperationsGetAvatarAsPngOptionalParams, ) => getAvatarAsPng(context, image, options), getAvatarAsJpeg: ( image: Uint8Array, - options?: FooOperationsGetAvatarAsJpegOptions, + options?: FooOperationsGetAvatarAsJpegOptionalParams, ) => getAvatarAsJpeg(context, image, options), }; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts index 8f7d6f02c9..726850fbd7 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/index.ts @@ -4,9 +4,10 @@ export { WidgetManagerClient, WidgetManagerClientOptions, -} from "./WidgetManagerClient.js"; +} from "./widgetManagerClient.js"; export { - FooOperationsGetAvatarAsPngOptions, - FooOperationsGetAvatarAsJpegOptions, + Versions, + FooOperationsGetAvatarAsPngOptionalParams, + FooOperationsGetAvatarAsJpegOptionalParams, } from "./models/index.js"; export { FooOperationsOperations } from "./classic/index.js"; diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/index.ts index 3f4555dd3c..7fa4bae05d 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/index.ts @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +export { Versions } from "./models.js"; export { - FooOperationsGetAvatarAsPngOptions, - FooOperationsGetAvatarAsJpegOptions, + FooOperationsGetAvatarAsPngOptionalParams, + FooOperationsGetAvatarAsJpegOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts new file mode 100644 index 0000000000..f6a8c2c70b --- /dev/null +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/models.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** The Contoso Widget Manager service version. */ +/** */ +export type Versions = "2022-08-30"; diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/options.ts index 85c624fa63..2c77f1bd22 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/models/options.ts @@ -3,10 +3,12 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface FooOperationsGetAvatarAsPngOptions extends OperationOptions { +export interface FooOperationsGetAvatarAsPngOptionalParams + extends OperationOptions { contentType?: string; } -export interface FooOperationsGetAvatarAsJpegOptions extends OperationOptions { +export interface FooOperationsGetAvatarAsJpegOptionalParams + extends OperationOptions { contentType?: string; } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/WidgetManagerClient.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts similarity index 84% rename from packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/WidgetManagerClient.ts rename to packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts index f6e8db5473..f91a890b43 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/WidgetManagerClient.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/src/widgetManagerClient.ts @@ -13,7 +13,7 @@ import { WidgetManagerContext, } from "./api/index.js"; -export { WidgetManagerClientOptions } from "./api/WidgetManagerContext.js"; +export { WidgetManagerClientOptions } from "./api/widgetManagerContext.js"; export class WidgetManagerClient { private _client: WidgetManagerContext; @@ -21,11 +21,11 @@ export class WidgetManagerClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, + endpointParam: string, credential: KeyCredential | TokenCredential, options: WidgetManagerClientOptions = {}, ) { - this._client = createWidgetManager(endpoint, credential, options); + this._client = createWidgetManager(endpointParam, credential, options); this.pipeline = this._client.pipeline; this.fooOperations = getFooOperationsOperations(this._client); } diff --git a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/overloads_modular/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/overloads_modular/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/package.json b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/package.json index 4b04ea7bd3..fc86da9fde 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/package.json @@ -10,7 +10,10 @@ "tshy": { "exports": { "./package.json": "./package.json", - ".": "./src/index.ts" + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./models": "./src/models/index.ts", + "./api/confidentialLedger": "./src/api/confidentialLedger/index.ts" }, "dialects": [ "esm", @@ -40,7 +43,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +56,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { @@ -86,6 +89,60 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + }, + "./api/confidentialLedger": { + "browser": { + "types": "./dist/browser/api/confidentialLedger/index.d.ts", + "default": "./dist/browser/api/confidentialLedger/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/confidentialLedger/index.d.ts", + "default": "./dist/react-native/api/confidentialLedger/index.js" + }, + "import": { + "types": "./dist/esm/api/confidentialLedger/index.d.ts", + "default": "./dist/esm/api/confidentialLedger/index.js" + }, + "require": { + "types": "./dist/commonjs/api/confidentialLedger/index.d.ts", + "default": "./dist/commonjs/api/confidentialLedger/index.js" + } } }, "main": "./dist/commonjs/index.js", diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/review/parametrized-host.api.md b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/review/parametrized-host.api.md index 1465ac2f13..b1e8b86b8b 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/review/parametrized-host.api.md +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/review/parametrized-host.api.md @@ -4,75 +4,34 @@ ```ts -import { Client } from '@azure-rest/core-client'; import { ClientOptions } from '@azure-rest/core-client'; -import { ErrorResponse } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; // @public -export interface CollectionOutput { +export interface Collection { // (undocumented) readonly collectionId: string; } -// @public -function createClient(credentials: TokenCredential, options?: ParametrizedHostClientOptions): ParametrizedHostClient; -export default createClient; - -// @public (undocumented) -export function isUnexpected(response: ListCollections200Response | ListCollectionsDefaultResponse): response is ListCollectionsDefaultResponse; - // @public (undocumented) -export interface ListCollections { - get(options?: ListCollectionsParameters): StreamableMethod; -} - -// @public -export interface ListCollections200Response extends HttpResponse { - // (undocumented) - body: Array; - // (undocumented) - status: "200"; -} - -// @public (undocumented) -export interface ListCollectionsDefaultHeaders { - "x-ms-error-code"?: string; +export interface ConfidentialLedgerListCollectionsOptionalParams extends OperationOptions { } // @public (undocumented) -export interface ListCollectionsDefaultResponse extends HttpResponse { - // (undocumented) - body: ErrorResponse; +export interface ConfidentialLedgerOperations { // (undocumented) - headers: RawHttpHeaders & ListCollectionsDefaultHeaders; - // (undocumented) - status: string; -} - -// @public (undocumented) -export type ListCollectionsParameters = ListCollectionsQueryParam & RequestParameters; - -// @public (undocumented) -export interface ListCollectionsQueryParam { - // (undocumented) - queryParameters: ListCollectionsQueryParamProperties; + listCollections: (apiVersion: string, options?: ConfidentialLedgerListCollectionsOptionalParams) => Promise; } // @public (undocumented) -export interface ListCollectionsQueryParamProperties { - "api-version": string; +export class ParametrizedHostClient { + constructor(credential: TokenCredential, options?: ParametrizedHostClientOptions); + readonly confidentialLedger: ConfidentialLedgerOperations; + readonly pipeline: Pipeline; } -// @public (undocumented) -export type ParametrizedHostClient = Client & { - path: Routes; -}; - // @public (undocumented) export interface ParametrizedHostClientOptions extends ClientOptions { // (undocumented) @@ -85,11 +44,6 @@ export interface ParametrizedHostClientOptions extends ClientOptions { sufix?: string; } -// @public (undocumented) -export interface Routes { - (path: "/app/collections"): ListCollections; -} - // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts new file mode 100644 index 0000000000..a915188de2 --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/confidentialLedger/index.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Collection } from "../../models/models.js"; +import { + isUnexpected, + ListCollections200Response, + ListCollectionsDefaultResponse, + ParametrizedHostContext as Client, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { ConfidentialLedgerListCollectionsOptionalParams } from "../../models/options.js"; + +export function _listCollectionsSend( + context: Client, + apiVersion: string, + options: ConfidentialLedgerListCollectionsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod< + ListCollections200Response | ListCollectionsDefaultResponse +> { + return context + .path("/app/collections") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { "api-version": apiVersion }, + }); +} + +export async function _listCollectionsDeserialize( + result: ListCollections200Response | ListCollectionsDefaultResponse, +): Promise { + if (isUnexpected(result)) { + throw createRestError(result); + } + + return result.body === undefined + ? result.body + : result.body.map((p) => ({ collectionId: p["collectionId"] })); +} + +/** Collection ids are user-created collections of ledger entries */ +export async function listCollections( + context: Client, + apiVersion: string, + options: ConfidentialLedgerListCollectionsOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _listCollectionsSend(context, apiVersion, options); + return _listCollectionsDeserialize(result); +} diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/index.ts new file mode 100644 index 0000000000..73d5216fd5 --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createParametrizedHost, + ParametrizedHostClientOptions, + ParametrizedHostContext, +} from "./parametrizedHostContext.js"; diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts new file mode 100644 index 0000000000..3a9761d74c --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/api/parametrizedHostContext.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { TokenCredential } from "@azure/core-auth"; +import { ClientOptions } from "@azure-rest/core-client"; +import { ParametrizedHostContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface ParametrizedHostClientOptions extends ClientOptions { + host?: string; + subdomain?: string; + sufix?: string; + apiVersion?: string; +} + +export { ParametrizedHostContext } from "../rest/index.js"; + +export function createParametrizedHost( + credential: TokenCredential, + options: ParametrizedHostClientOptions = {}, +): ParametrizedHostContext { + const clientContext = getClient(credential, options); + return clientContext; +} diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/confidentialLedger/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/confidentialLedger/index.ts new file mode 100644 index 0000000000..6e80a926da --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/confidentialLedger/index.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ParametrizedHostContext } from "../../api/parametrizedHostContext.js"; +import { Collection } from "../../models/models.js"; +import { listCollections } from "../../api/confidentialLedger/index.js"; +import { ConfidentialLedgerListCollectionsOptionalParams } from "../../models/options.js"; + +export interface ConfidentialLedgerOperations { + listCollections: ( + apiVersion: string, + options?: ConfidentialLedgerListCollectionsOptionalParams, + ) => Promise; +} + +export function getConfidentialLedger(context: ParametrizedHostContext) { + return { + listCollections: ( + apiVersion: string, + options?: ConfidentialLedgerListCollectionsOptionalParams, + ) => listCollections(context, apiVersion, options), + }; +} + +export function getConfidentialLedgerOperations( + context: ParametrizedHostContext, +): ConfidentialLedgerOperations { + return { + ...getConfidentialLedger(context), + }; +} diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/index.ts new file mode 100644 index 0000000000..42babe7d2a --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/classic/index.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { ConfidentialLedgerOperations } from "./confidentialLedger/index.js"; diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/index.ts index 38b1eb4806..f0f9441cb2 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/index.ts @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import ParametrizedHostClient from "./parametrizedHostClient.js"; - -export * from "./parametrizedHostClient.js"; -export * from "./parameters.js"; -export * from "./responses.js"; -export * from "./clientDefinitions.js"; -export * from "./isUnexpected.js"; -export * from "./outputModels.js"; - -export default ParametrizedHostClient; +export { + ParametrizedHostClient, + ParametrizedHostClientOptions, +} from "./parametrizedHostClient.js"; +export { + Collection, + ConfidentialLedgerListCollectionsOptionalParams, +} from "./models/index.js"; +export { ConfidentialLedgerOperations } from "./classic/index.js"; diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/index.ts new file mode 100644 index 0000000000..11322f8103 --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { Collection } from "./models.js"; +export { ConfidentialLedgerListCollectionsOptionalParams } from "./options.js"; diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/models.ts new file mode 100644 index 0000000000..8294157aef --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/models.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Identifier for collections. */ +export interface Collection { + readonly collectionId: string; +} diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/options.ts new file mode 100644 index 0000000000..46323eb0b3 --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/models/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface ConfidentialLedgerListCollectionsOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts index 58558e95f1..b28fea68be 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parametrizedHostClient.ts @@ -1,63 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "./logger.js"; import { TokenCredential } from "@azure/core-auth"; -import { ParametrizedHostClient } from "./clientDefinitions.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { + getConfidentialLedgerOperations, + ConfidentialLedgerOperations, +} from "./classic/confidentialLedger/index.js"; +import { + createParametrizedHost, + ParametrizedHostClientOptions, + ParametrizedHostContext, +} from "./api/index.js"; -export interface ParametrizedHostClientOptions extends ClientOptions { - host?: string; - subdomain?: string; - sufix?: string; - apiVersion?: string; -} - -/** - * Initialize a new instance of `ParametrizedHostClient` - * @param credentials - uniquely identify client credential - * @param options - the parameter for all optional parameters - */ -export default function createClient( - credentials: TokenCredential, - options: ParametrizedHostClientOptions = {}, -): ParametrizedHostClient { - const host = options.host ?? "one"; - const subdomain = options.subdomain ?? "two"; - const sufix = options.sufix ?? "three"; - const apiVersion = options.apiVersion ?? "v1"; - const endpointUrl = - options.endpoint ?? - options.baseUrl ?? - `${host}.${subdomain}.${sufix}.com/${apiVersion}`; - - const userAgentInfo = `azsdk-js-parametrized-host-rest/1.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - credentials: { - scopes: options.credentials?.scopes ?? [ - "https://parametrized-host.azure.com/.default", - ], - }, - }; +export { ParametrizedHostClientOptions } from "./api/parametrizedHostContext.js"; - const client = getClient( - endpointUrl, - credentials, - options, - ) as ParametrizedHostClient; +export class ParametrizedHostClient { + private _client: ParametrizedHostContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + constructor( + credential: TokenCredential, + options: ParametrizedHostClientOptions = {}, + ) { + this._client = createParametrizedHost(credential, options); + this.pipeline = this._client.pipeline; + this.confidentialLedger = getConfidentialLedgerOperations(this._client); + } - return client; + /** The operation groups for ConfidentialLedger */ + public readonly confidentialLedger: ConfidentialLedgerOperations; } diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/clientDefinitions.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/clientDefinitions.ts similarity index 93% rename from packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/clientDefinitions.ts rename to packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/clientDefinitions.ts index fb8426fe82..2435dc7e3b 100644 --- a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/clientDefinitions.ts +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/clientDefinitions.ts @@ -22,6 +22,6 @@ export interface Routes { (path: "/app/collections"): ListCollections; } -export type ParametrizedHostClient = Client & { +export type ParametrizedHostContext = Client & { path: Routes; }; diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/index.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/index.ts new file mode 100644 index 0000000000..38b1eb4806 --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import ParametrizedHostClient from "./parametrizedHostClient.js"; + +export * from "./parametrizedHostClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./isUnexpected.js"; +export * from "./outputModels.js"; + +export default ParametrizedHostClient; diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/isUnexpected.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/isUnexpected.ts similarity index 100% rename from packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/isUnexpected.ts rename to packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/isUnexpected.ts diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/outputModels.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/outputModels.ts similarity index 100% rename from packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/outputModels.ts rename to packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/outputModels.ts diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parameters.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/parameters.ts similarity index 100% rename from packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/parameters.ts rename to packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/parameters.ts diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/parametrizedHostClient.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/parametrizedHostClient.ts new file mode 100644 index 0000000000..194152242a --- /dev/null +++ b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/parametrizedHostClient.ts @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { TokenCredential } from "@azure/core-auth"; +import { ParametrizedHostContext } from "./clientDefinitions.js"; + +export interface ParametrizedHostContextOptions extends ClientOptions { + host?: string; + subdomain?: string; + sufix?: string; + apiVersion?: string; +} + +/** + * Initialize a new instance of `ParametrizedHostContext` + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ +export default function createClient( + credentials: TokenCredential, + options: ParametrizedHostContextOptions = {}, +): ParametrizedHostContext { + const host = options.host ?? "one"; + const subdomain = options.subdomain ?? "two"; + const sufix = options.sufix ?? "three"; + const apiVersion = options.apiVersion ?? "v1"; + const endpointUrl = + options.endpoint ?? + options.baseUrl ?? + `${host}.${subdomain}.${sufix}.com/${apiVersion}`; + + const userAgentInfo = `azsdk-js-parametrized-host-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://parametrized-host.azure.com/.default", + ], + }, + }; + + const client = getClient( + endpointUrl, + credentials, + options, + ) as ParametrizedHostContext; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + + return client; +} diff --git a/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/responses.ts similarity index 100% rename from packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/responses.ts rename to packages/typespec-test/test/parametrizedHost/generated/typespec-ts/src/rest/responses.ts diff --git a/packages/typespec-test/test/parametrizedHost/tspconfig.yaml b/packages/typespec-test/test/parametrizedHost/tspconfig.yaml index f63820d993..9d9f9c184d 100644 --- a/packages/typespec-test/test/parametrizedHost/tspconfig.yaml +++ b/packages/typespec-test/test/parametrizedHost/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false azureSdkForJs: false + isModularLibrary: true "emitter-output-dir": "{project-root}/generated/typespec-ts" packageDetails: name: "@msinternal/parametrized-host" diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json index 8559d3fc00..c74a06e576 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json @@ -43,7 +43,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -57,8 +57,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md index d6fab97171..e02968fc26 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md @@ -9,8 +9,8 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; -// @public -export type ContentTypeEnum = string; +// @public (undocumented) +export type ContentTypeEnum = "application/octet-stream" | "application/json; serialization=Avro" | "application/json; serialization=json" | "text/vnd.ms.protobuf"; // @public export type ContinuablePage = TPage & { @@ -26,13 +26,13 @@ export interface PagedAsyncIterableIterator Promise; + getSchemaById: (id: string, options?: SchemaOperationsGetSchemaByIdOptionalParams) => Promise; // (undocumented) - getSchemaByVersion: (groupName: string, name: string, schemaVersion: number, options?: SchemaOperationsGetSchemaByVersionOptions) => Promise; + getSchemaByVersion: (groupName: string, name: string, schemaVersion: number, options?: SchemaOperationsGetSchemaByVersionOptionalParams) => Promise; // (undocumented) - getSchemaIdByContent: (groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, options?: SchemaOperationsGetSchemaIdByContentOptions) => Promise; + getSchemaIdByContent: (groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, options?: SchemaOperationsGetSchemaIdByContentOptionalParams) => Promise; // (undocumented) - listSchemaGroups: (options?: SchemaOperationsListSchemaGroupsOptions) => PagedAsyncIterableIterator; + listSchemaGroups: (options?: SchemaOperationsListSchemaGroupsOptionalParams) => PagedAsyncIterableIterator; // (undocumented) - listSchemaVersions: (groupName: string, name: string, options?: SchemaOperationsListSchemaVersionsOptions) => PagedAsyncIterableIterator; + listSchemaVersions: (groupName: string, name: string, options?: SchemaOperationsListSchemaVersionsOptionalParams) => PagedAsyncIterableIterator; // (undocumented) - registerSchema: (groupName: string, name: string, contentType: SchemaContentTypeValues, content: Uint8Array, options?: SchemaOperationsRegisterSchemaOptions) => Promise; + registerSchema: (groupName: string, name: string, contentType: SchemaContentTypeValues, content: Uint8Array, options?: SchemaOperationsRegisterSchemaOptionalParams) => Promise; } // @public (undocumented) -export interface SchemaOperationsRegisterSchemaOptions extends OperationOptions { +export interface SchemaOperationsRegisterSchemaOptionalParams extends OperationOptions { } // @public @@ -110,6 +110,7 @@ export class SchemaRegistryClient { // @public (undocumented) export interface SchemaRegistryClientOptions extends ClientOptions { + apiVersion?: string; } // @public @@ -117,6 +118,9 @@ export interface SchemaVersion { readonly schemaVersion: number; } +// @public (undocumented) +export type ServiceApiVersions = "2021-10" | "2022-10" | "2023-07-01"; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts index ab9748dd59..0b4a4da7e1 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/index.ts @@ -5,4 +5,4 @@ export { createSchemaRegistry, SchemaRegistryClientOptions, SchemaRegistryContext, -} from "./SchemaRegistryContext.js"; +} from "./schemaRegistryContext.js"; diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts index bdce38c829..7988212116 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaOperations/index.ts @@ -2,11 +2,11 @@ // Licensed under the MIT license. import { - PagedSchemaGroup, SchemaGroup, + SchemaVersion, SchemaContentTypeValues, + PagedSchemaGroup, PagedVersion, - SchemaVersion, } from "../../models/models.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "../pagingHelpers.js"; @@ -33,17 +33,19 @@ import { } from "@azure-rest/core-client"; import { stringToUint8Array, uint8ArrayToString } from "@azure/core-util"; import { - SchemaOperationsListSchemaGroupsOptions, - SchemaOperationsGetSchemaByIdOptions, - SchemaOperationsListSchemaVersionsOptions, - SchemaOperationsGetSchemaByVersionOptions, - SchemaOperationsGetSchemaIdByContentOptions, - SchemaOperationsRegisterSchemaOptions, + SchemaOperationsListSchemaGroupsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsRegisterSchemaOptionalParams, } from "../../models/options.js"; export function _listSchemaGroupsSend( context: Client, - options: SchemaOperationsListSchemaGroupsOptions = { requestOptions: {} }, + options: SchemaOperationsListSchemaGroupsOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< ListSchemaGroups200Response | ListSchemaGroupsDefaultResponse > { @@ -72,7 +74,9 @@ export async function _listSchemaGroupsDeserialize( /** Gets the list of schema groups user is authorized to access. */ export function listSchemaGroups( context: Client, - options: SchemaOperationsListSchemaGroupsOptions = { requestOptions: {} }, + options: SchemaOperationsListSchemaGroupsOptionalParams = { + requestOptions: {}, + }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -85,7 +89,7 @@ export function listSchemaGroups( export function _getSchemaByIdSend( context: Client, id: string, - options: SchemaOperationsGetSchemaByIdOptions = { requestOptions: {} }, + options: SchemaOperationsGetSchemaByIdOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/$schemaGroups/$schemas/{id}", id) @@ -108,7 +112,7 @@ export async function _getSchemaByIdDeserialize( export async function getSchemaById( context: Client, id: string, - options: SchemaOperationsGetSchemaByIdOptions = { requestOptions: {} }, + options: SchemaOperationsGetSchemaByIdOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSchemaByIdSend(context, id, options); return _getSchemaByIdDeserialize(result); @@ -118,7 +122,9 @@ export function _listSchemaVersionsSend( context: Client, groupName: string, name: string, - options: SchemaOperationsListSchemaVersionsOptions = { requestOptions: {} }, + options: SchemaOperationsListSchemaVersionsOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< ListSchemaVersions200Response | ListSchemaVersionsDefaultResponse > { @@ -147,7 +153,9 @@ export function listSchemaVersions( context: Client, groupName: string, name: string, - options: SchemaOperationsListSchemaVersionsOptions = { requestOptions: {} }, + options: SchemaOperationsListSchemaVersionsOptionalParams = { + requestOptions: {}, + }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -162,7 +170,9 @@ export function _getSchemaByVersionSend( groupName: string, name: string, schemaVersion: number, - options: SchemaOperationsGetSchemaByVersionOptions = { requestOptions: {} }, + options: SchemaOperationsGetSchemaByVersionOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< GetSchemaByVersion200Response | GetSchemaByVersionDefaultResponse > { @@ -194,7 +204,9 @@ export async function getSchemaByVersion( groupName: string, name: string, schemaVersion: number, - options: SchemaOperationsGetSchemaByVersionOptions = { requestOptions: {} }, + options: SchemaOperationsGetSchemaByVersionOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getSchemaByVersionSend( context, @@ -212,7 +224,9 @@ export function _getSchemaIdByContentSend( name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, - options: SchemaOperationsGetSchemaIdByContentOptions = { requestOptions: {} }, + options: SchemaOperationsGetSchemaIdByContentOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod< GetSchemaIdByContent204Response | GetSchemaIdByContentDefaultResponse > { @@ -242,7 +256,9 @@ export async function getSchemaIdByContent( name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, - options: SchemaOperationsGetSchemaIdByContentOptions = { requestOptions: {} }, + options: SchemaOperationsGetSchemaIdByContentOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getSchemaIdByContentSend( context, @@ -261,7 +277,9 @@ export function _registerSchemaSend( name: string, contentType: SchemaContentTypeValues, content: Uint8Array, - options: SchemaOperationsRegisterSchemaOptions = { requestOptions: {} }, + options: SchemaOperationsRegisterSchemaOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path("/$schemaGroups/{groupName}/schemas/{name}", groupName, name) @@ -289,7 +307,9 @@ export async function registerSchema( name: string, contentType: SchemaContentTypeValues, content: Uint8Array, - options: SchemaOperationsRegisterSchemaOptions = { requestOptions: {} }, + options: SchemaOperationsRegisterSchemaOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _registerSchemaSend( context, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/SchemaRegistryContext.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts similarity index 90% rename from packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/SchemaRegistryContext.ts rename to packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts index d43494f2b1..eb65bf77f7 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/SchemaRegistryContext.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/api/schemaRegistryContext.ts @@ -6,7 +6,10 @@ import { ClientOptions } from "@azure-rest/core-client"; import { SchemaRegistryContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface SchemaRegistryClientOptions extends ClientOptions {} +export interface SchemaRegistryClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { SchemaRegistryContext } from "../rest/index.js"; diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts index cfdec264d3..04fa3780e4 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/classic/schemaOperations/index.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { SchemaRegistryContext } from "../../api/SchemaRegistryContext.js"; +import { SchemaRegistryContext } from "../../api/schemaRegistryContext.js"; import { SchemaGroup, - SchemaContentTypeValues, SchemaVersion, + SchemaContentTypeValues, } from "../../models/models.js"; import { listSchemaGroups, @@ -17,74 +17,75 @@ import { } from "../../api/schemaOperations/index.js"; import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { - SchemaOperationsListSchemaGroupsOptions, - SchemaOperationsGetSchemaByIdOptions, - SchemaOperationsListSchemaVersionsOptions, - SchemaOperationsGetSchemaByVersionOptions, - SchemaOperationsGetSchemaIdByContentOptions, - SchemaOperationsRegisterSchemaOptions, + SchemaOperationsListSchemaGroupsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsRegisterSchemaOptionalParams, } from "../../models/options.js"; export interface SchemaOperationsOperations { listSchemaGroups: ( - options?: SchemaOperationsListSchemaGroupsOptions, + options?: SchemaOperationsListSchemaGroupsOptionalParams, ) => PagedAsyncIterableIterator; getSchemaById: ( id: string, - options?: SchemaOperationsGetSchemaByIdOptions, + options?: SchemaOperationsGetSchemaByIdOptionalParams, ) => Promise; listSchemaVersions: ( groupName: string, name: string, - options?: SchemaOperationsListSchemaVersionsOptions, + options?: SchemaOperationsListSchemaVersionsOptionalParams, ) => PagedAsyncIterableIterator; getSchemaByVersion: ( groupName: string, name: string, schemaVersion: number, - options?: SchemaOperationsGetSchemaByVersionOptions, + options?: SchemaOperationsGetSchemaByVersionOptionalParams, ) => Promise; getSchemaIdByContent: ( groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, - options?: SchemaOperationsGetSchemaIdByContentOptions, + options?: SchemaOperationsGetSchemaIdByContentOptionalParams, ) => Promise; registerSchema: ( groupName: string, name: string, contentType: SchemaContentTypeValues, content: Uint8Array, - options?: SchemaOperationsRegisterSchemaOptions, + options?: SchemaOperationsRegisterSchemaOptionalParams, ) => Promise; } export function getSchemaOperations(context: SchemaRegistryContext) { return { - listSchemaGroups: (options?: SchemaOperationsListSchemaGroupsOptions) => - listSchemaGroups(context, options), + listSchemaGroups: ( + options?: SchemaOperationsListSchemaGroupsOptionalParams, + ) => listSchemaGroups(context, options), getSchemaById: ( id: string, - options?: SchemaOperationsGetSchemaByIdOptions, + options?: SchemaOperationsGetSchemaByIdOptionalParams, ) => getSchemaById(context, id, options), listSchemaVersions: ( groupName: string, name: string, - options?: SchemaOperationsListSchemaVersionsOptions, + options?: SchemaOperationsListSchemaVersionsOptionalParams, ) => listSchemaVersions(context, groupName, name, options), getSchemaByVersion: ( groupName: string, name: string, schemaVersion: number, - options?: SchemaOperationsGetSchemaByVersionOptions, + options?: SchemaOperationsGetSchemaByVersionOptionalParams, ) => getSchemaByVersion(context, groupName, name, schemaVersion, options), getSchemaIdByContent: ( groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, - options?: SchemaOperationsGetSchemaIdByContentOptions, + options?: SchemaOperationsGetSchemaIdByContentOptionalParams, ) => getSchemaIdByContent( context, @@ -99,7 +100,7 @@ export function getSchemaOperations(context: SchemaRegistryContext) { name: string, contentType: SchemaContentTypeValues, content: Uint8Array, - options?: SchemaOperationsRegisterSchemaOptions, + options?: SchemaOperationsRegisterSchemaOptionalParams, ) => registerSchema(context, groupName, name, contentType, content, options), }; diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts index f38724e615..7fd47eeb61 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts @@ -4,22 +4,23 @@ export { SchemaRegistryClient, SchemaRegistryClientOptions, -} from "./SchemaRegistryClient.js"; +} from "./schemaRegistryClient.js"; export { + SchemaGroup, + SchemaVersion, + SchemaContentTypeValues, SchemaProperties, SchemaFormat, ContentTypeEnum, + ServiceApiVersions, PagedSchemaGroup, - SchemaGroup, - SchemaContentTypeValues, PagedVersion, - SchemaVersion, - SchemaOperationsListSchemaGroupsOptions, - SchemaOperationsGetSchemaByIdOptions, - SchemaOperationsListSchemaVersionsOptions, - SchemaOperationsGetSchemaByVersionOptions, - SchemaOperationsGetSchemaIdByContentOptions, - SchemaOperationsRegisterSchemaOptions, + SchemaOperationsListSchemaGroupsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsRegisterSchemaOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts index fa4f281ca3..8fd80bfa05 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts @@ -2,22 +2,23 @@ // Licensed under the MIT license. export { + SchemaGroup, + SchemaVersion, + SchemaContentTypeValues, SchemaProperties, SchemaFormat, ContentTypeEnum, + ServiceApiVersions, PagedSchemaGroup, - SchemaGroup, - SchemaContentTypeValues, PagedVersion, - SchemaVersion, } from "./models.js"; export { - SchemaOperationsListSchemaGroupsOptions, - SchemaOperationsGetSchemaByIdOptions, - SchemaOperationsListSchemaVersionsOptions, - SchemaOperationsGetSchemaByVersionOptions, - SchemaOperationsGetSchemaIdByContentOptions, - SchemaOperationsRegisterSchemaOptions, + SchemaOperationsListSchemaGroupsOptionalParams, + SchemaOperationsGetSchemaByIdOptionalParams, + SchemaOperationsListSchemaVersionsOptionalParams, + SchemaOperationsGetSchemaByVersionOptionalParams, + SchemaOperationsGetSchemaIdByContentOptionalParams, + SchemaOperationsRegisterSchemaOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts index 811960728f..778a6d7f36 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts @@ -1,6 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +/** Schema Group resource. */ +export interface SchemaGroup { + /** Name of schema group. */ + readonly groupName: string; +} + +/** Schema versions resource. */ +export interface SchemaVersion { + /** Version number of specific schema. */ + readonly schemaVersion: number; +} + +/** Type of SchemaContentTypeValues */ +/** */ +export type SchemaContentTypeValues = + | "application/json; serialization=Avro" + | "application/json; serialization=json" + | "text/plain; charset=utf-8" + | "text/vnd.ms.protobuf"; + /** Meta properties of a schema. */ export interface SchemaProperties { /** References a specific schema in the registry namespace. */ @@ -16,44 +36,31 @@ export interface SchemaProperties { } /** Represents the format of the schema to be stored by the Schema Registry service. */ -/** "Avro", "Json", "Custom", "Protobuf" */ -export type SchemaFormat = string; +/** */ +export type SchemaFormat = "Avro" | "Json" | "Custom" | "Protobuf"; /** The content type for the schema. */ -/** "application/octet-stream", "application/json; serialization=Avro", "application/json; serialization=json", "text/vnd.ms.protobuf" */ -export type ContentTypeEnum = string; +/** */ +export type ContentTypeEnum = + | "application/octet-stream" + | "application/json; serialization=Avro" + | "application/json; serialization=json" + | "text/vnd.ms.protobuf"; +/** Represents the Schema Registry API version to use for requests. */ +/** */ +export type ServiceApiVersions = "2021-10" | "2022-10" | "2023-07-01"; /** Paged collection of SchemaGroup items */ export interface PagedSchemaGroup { /** The SchemaGroup items on this page */ value: SchemaGroup[]; /** The link to the next page of items */ - readonly nextLink?: string; -} - -/** Schema Group resource. */ -export interface SchemaGroup { - /** Name of schema group. */ - readonly groupName: string; + nextLink?: string; } -/** Type of SchemaContentTypeValues */ -/** */ -export type SchemaContentTypeValues = - | "application/json; serialization=Avro" - | "application/json; serialization=json" - | "text/plain; charset=utf-8" - | "text/vnd.ms.protobuf"; - /** Paged collection of Version items */ export interface PagedVersion { /** The Version items on this page */ value: SchemaVersion[]; /** The link to the next page of items */ - readonly nextLink?: string; -} - -/** Schema versions resource. */ -export interface SchemaVersion { - /** Version number of specific schema. */ - readonly schemaVersion: number; + nextLink?: string; } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/options.ts index bd28dc5a34..c314c5cca1 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/options.ts @@ -3,20 +3,20 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface SchemaOperationsListSchemaGroupsOptions +export interface SchemaOperationsListSchemaGroupsOptionalParams extends OperationOptions {} -export interface SchemaOperationsGetSchemaByIdOptions +export interface SchemaOperationsGetSchemaByIdOptionalParams extends OperationOptions {} -export interface SchemaOperationsListSchemaVersionsOptions +export interface SchemaOperationsListSchemaVersionsOptionalParams extends OperationOptions {} -export interface SchemaOperationsGetSchemaByVersionOptions +export interface SchemaOperationsGetSchemaByVersionOptionalParams extends OperationOptions {} -export interface SchemaOperationsGetSchemaIdByContentOptions +export interface SchemaOperationsGetSchemaIdByContentOptionalParams extends OperationOptions {} -export interface SchemaOperationsRegisterSchemaOptions +export interface SchemaOperationsRegisterSchemaOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/SchemaRegistryClient.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts similarity index 94% rename from packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/SchemaRegistryClient.ts rename to packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts index 4d1afd79b8..63b48aea03 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/SchemaRegistryClient.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/schemaRegistryClient.ts @@ -13,7 +13,7 @@ import { SchemaRegistryContext, } from "./api/index.js"; -export { SchemaRegistryClientOptions } from "./api/SchemaRegistryContext.js"; +export { SchemaRegistryClientOptions } from "./api/schemaRegistryContext.js"; export class SchemaRegistryClient { private _client: SchemaRegistryContext; diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json index 7002249a58..b1cf75d290 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/package.json @@ -38,8 +38,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "dependencies": { diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md index f92f5f560f..b0cbcbea47 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/review/todo-non-branded.api.md @@ -260,13 +260,13 @@ export interface TodoItemsCreateJsonMediaTypesParam { export type TodoItemsCreateJsonParameters = TodoItemsCreateJsonMediaTypesParam & TodoItemsCreateJsonBodyParam & RequestParameters; // @public -export interface TodoItemsDeleteOperation200Response extends HttpResponse { +export interface TodoItemsDelete200Response extends HttpResponse { // (undocumented) status: "200"; } // @public -export interface TodoItemsDeleteOperation404Response extends HttpResponse { +export interface TodoItemsDelete404Response extends HttpResponse { // (undocumented) status: "404"; } @@ -277,7 +277,7 @@ export type TodoItemsDeleteParameters = RequestParameters; // @public (undocumented) export interface TodoItemsGet { // (undocumented) - delete(options?: TodoItemsDeleteParameters): StreamableMethod; + delete(options?: TodoItemsDeleteParameters): StreamableMethod; // (undocumented) get(options?: TodoItemsGetParameters): StreamableMethod; // (undocumented) diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/clientDefinitions.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/clientDefinitions.ts index accd91da36..da3a208a4a 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/clientDefinitions.ts +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/clientDefinitions.ts @@ -38,8 +38,8 @@ import { TodoItemsGet200Response, TodoItemsGet404Response, TodoItemsUpdate200Response, - TodoItemsDeleteOperation200Response, - TodoItemsDeleteOperation404Response, + TodoItemsDelete200Response, + TodoItemsDelete404Response, TodoItemsAttachmentsList200Response, TodoItemsAttachmentsList404Response, TodoItemsAttachmentsCreateUrlAttachment200Response, @@ -117,9 +117,7 @@ export interface TodoItemsGet { ): StreamableMethod; delete( options?: TodoItemsDeleteParameters, - ): StreamableMethod< - TodoItemsDeleteOperation200Response | TodoItemsDeleteOperation404Response - >; + ): StreamableMethod; } export interface TodoItemsAttachmentsList { diff --git a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/responses.ts b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/responses.ts index 6eba03281d..3985106aa7 100644 --- a/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/responses.ts +++ b/packages/typespec-test/test/todo_non_branded/generated/typespec-ts/src/responses.ts @@ -123,12 +123,12 @@ export interface TodoItemsUpdate200Response extends HttpResponse { } /** The request has succeeded. */ -export interface TodoItemsDeleteOperation200Response extends HttpResponse { +export interface TodoItemsDelete200Response extends HttpResponse { status: "200"; } /** The server cannot find the requested resource. */ -export interface TodoItemsDeleteOperation404Response extends HttpResponse { +export interface TodoItemsDelete404Response extends HttpResponse { status: "404"; } diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/package.json b/packages/typespec-test/test/translator/generated/typespec-ts/package.json index 5d5e64a43f..8c47cc7a09 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/translator/generated/typespec-ts/package.json @@ -40,7 +40,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -53,8 +53,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/review/cognitiveservices-translator.api.md b/packages/typespec-test/test/translator/generated/typespec-ts/review/cognitiveservices-translator.api.md index 425e7e4d73..32b0493e0b 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/review/cognitiveservices-translator.api.md +++ b/packages/typespec-test/test/translator/generated/typespec-ts/review/cognitiveservices-translator.api.md @@ -463,6 +463,12 @@ export interface MtErrorResponseOutput { error: ErrorDetailsOutput; } +// @public +export type ProfanityActions = "NoAction" | "Marked" | "Deleted"; + +// @public +export type ProfanityMarkers = "Asterisk" | "Tag"; + // @public (undocumented) export interface Routes { (path: "/languages"): GetLanguages; @@ -501,6 +507,9 @@ export interface TargetDictionaryLanguageOutput { nativeName: string; } +// @public +export type TextTypes = "plain" | "html"; + // @public (undocumented) export interface Translate { post(options: TranslateParameters): StreamableMethod; @@ -578,10 +587,10 @@ export interface TranslateQueryParamProperties { fromScript?: string; includeAlignment?: boolean; includeSentenceLength?: boolean; - profanityAction?: "NoAction" | "Marked" | "Deleted"; - profanityMarker?: "Asterisk" | "Tag"; + profanityAction?: ProfanityActions; + profanityMarker?: ProfanityMarkers; suggestedFrom?: string; - textType?: "plain" | "html"; + textType?: TextTypes; to: string; toScript?: string; } diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/src/models.ts b/packages/typespec-test/test/translator/generated/typespec-ts/src/models.ts index 1f92c7e56f..41ed1832f3 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/src/models.ts +++ b/packages/typespec-test/test/translator/generated/typespec-ts/src/models.ts @@ -16,3 +16,10 @@ export interface DictionaryExampleTextElement extends InputTextElement { */ translation: string; } + +/** Translation text type */ +export type TextTypes = "plain" | "html"; +/** Translator profanity actions */ +export type ProfanityActions = "NoAction" | "Marked" | "Deleted"; +/** Translator profanity markers */ +export type ProfanityMarkers = "Asterisk" | "Tag"; diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/src/parameters.ts b/packages/typespec-test/test/translator/generated/typespec-ts/src/parameters.ts index c2fbee7376..1f6d5ab255 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/src/parameters.ts +++ b/packages/typespec-test/test/translator/generated/typespec-ts/src/parameters.ts @@ -3,7 +3,13 @@ import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; import { RequestParameters } from "@azure-rest/core-client"; -import { InputTextElement, DictionaryExampleTextElement } from "./models.js"; +import { + TextTypes, + ProfanityActions, + ProfanityMarkers, + InputTextElement, + DictionaryExampleTextElement, +} from "./models.js"; export interface GetLanguagesHeaders { /** A client-generated GUID to uniquely identify the request. */ @@ -78,7 +84,7 @@ export interface TranslateQueryParamProperties { * Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, * complete element. Possible values are: plain (default) or html. */ - textType?: "plain" | "html"; + textType?: TextTypes; /** * A string specifying the category (domain) of the translation. This parameter is used to get translations * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator @@ -89,12 +95,12 @@ export interface TranslateQueryParamProperties { * Specifies how profanities should be treated in translations. * Possible values are: NoAction (default), Marked or Deleted. */ - profanityAction?: "NoAction" | "Marked" | "Deleted"; + profanityAction?: ProfanityActions; /** * Specifies how profanities should be marked in translations. * Possible values are: Asterisk (default) or Tag. */ - profanityMarker?: "Asterisk" | "Tag"; + profanityMarker?: ProfanityMarkers; /** * Specifies whether to include alignment projection from source text to translated text. * Possible values are: true or false (default). diff --git a/packages/typespec-test/test/translator/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/translator/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/translator/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/translator/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json index 13e524bc15..6aafd28705 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/package.json @@ -44,7 +44,7 @@ "review/*" ], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -60,8 +60,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md index 4fc232be20..384a38867b 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md @@ -12,7 +12,7 @@ import { ErrorResponse } from '@azure-rest/core-client'; import { HttpResponse } from '@azure-rest/core-client'; import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { OperationStatus as OperationStatus_2 } from '@azure/core-lro'; +import { OperationStatus } from '@azure/core-lro'; import { PathUncheckedResponse } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { PollerLike } from '@azure/core-lro'; @@ -28,13 +28,13 @@ export interface AnalyzeResult { } // @public (undocumented) -export interface BudgetsCreateOrReplaceOptions extends OperationOptions { +export interface BudgetsCreateOrReplaceOptionalParams extends OperationOptions { apiVersion?: string; updateIntervalInMs?: number; } // @public (undocumented) -export interface BudgetsCreateOrUpdateOptions extends OperationOptions { +export interface BudgetsCreateOrUpdateOptionalParams extends OperationOptions { apiVersion?: string; contentType?: string; updateIntervalInMs?: number; @@ -43,9 +43,9 @@ export interface BudgetsCreateOrUpdateOptions extends OperationOptions { // @public (undocumented) export interface BudgetsOperations { // (undocumented) - createOrReplace: (name: string, resource: User, options?: BudgetsCreateOrReplaceOptions) => PollerLike, User>; + createOrReplace: (name: string, resource: User, options?: BudgetsCreateOrReplaceOptionalParams) => PollerLike, User>; // (undocumented) - createOrUpdate: (name: string, resource: User, options?: BudgetsCreateOrUpdateOptions) => PollerLike, User>; + createOrUpdate: (name: string, resource: User, options?: BudgetsCreateOrUpdateOptionalParams) => PollerLike, User>; } // @public @@ -72,11 +72,11 @@ export interface NonReferencedModel { } // @public -export interface OperationStatus { +export interface OperationStatusUserError { error?: ErrorModel; id: string; result?: User; - status: OperationStatus_2; + status: OperationStatus; } // @public @@ -116,6 +116,9 @@ export interface User { role: string; } +// @public (undocumented) +export type Versions = "1.0.0"; + // @public (undocumented) export interface Widget { color: "red" | "blue"; @@ -130,21 +133,21 @@ export interface WidgetError { } // @public (undocumented) -export interface WidgetsAnalyzeWidgetOptions extends OperationOptions { +export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions { } // @public (undocumented) -export interface WidgetsCreateOrReplaceOptions extends OperationOptions { +export interface WidgetsCreateOrReplaceOptionalParams extends OperationOptions { apiVersion?: string; updateIntervalInMs?: number; } // @public (undocumented) -export interface WidgetsCreateWidgetOptions extends OperationOptions { +export interface WidgetsCreateWidgetOptionalParams extends OperationOptions { } // @public (undocumented) -export interface WidgetsDeleteWidgetOptions extends OperationOptions { +export interface WidgetsDeleteWidgetOptionalParams extends OperationOptions { } // @public (undocumented) @@ -160,11 +163,11 @@ export interface WidgetServiceClientOptions extends ClientOptions { } // @public (undocumented) -export interface WidgetsGetWidgetOptions extends OperationOptions { +export interface WidgetsGetWidgetOptionalParams extends OperationOptions { } // @public (undocumented) -export interface WidgetsListWidgetsOptions extends OperationOptions { +export interface WidgetsListWidgetsOptionalParams extends OperationOptions { // (undocumented) nullableDateHeader?: Date | null; // (undocumented) @@ -176,37 +179,37 @@ export interface WidgetsListWidgetsOptions extends OperationOptions { } // @public (undocumented) -export interface WidgetsListWidgetsPagesOptions extends OperationOptions { +export interface WidgetsListWidgetsPagesOptionalParams extends OperationOptions { } // @public (undocumented) export interface WidgetsOperations { // (undocumented) - analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptions) => Promise; + analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptionalParams) => Promise; // (undocumented) - createOrReplace: (name: string, resource: User, options?: WidgetsCreateOrReplaceOptions) => PollerLike, User>; + createOrReplace: (name: string, resource: User, options?: WidgetsCreateOrReplaceOptionalParams) => PollerLike, User>; // (undocumented) - createWidget: (body: CreateWidget, options?: WidgetsCreateWidgetOptions) => Promise; + createWidget: (body: CreateWidget, options?: WidgetsCreateWidgetOptionalParams) => Promise; // (undocumented) - deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptions) => Promise; + deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptionalParams) => Promise; // (undocumented) - getWidget: (id: string, options?: WidgetsGetWidgetOptions) => Promise; + getWidget: (id: string, options?: WidgetsGetWidgetOptionalParams) => Promise; // (undocumented) - listWidgets: (requiredHeader: string, bytesHeader: Uint8Array, value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, options?: WidgetsListWidgetsOptions) => Promise; + listWidgets: (requiredHeader: string, bytesHeader: Uint8Array, value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, options?: WidgetsListWidgetsOptionalParams) => Promise; // (undocumented) - listWidgetsPages: (page: number, pageSize: number, options?: WidgetsListWidgetsPagesOptions) => PagedAsyncIterableIterator; + listWidgetsPages: (page: number, pageSize: number, options?: WidgetsListWidgetsPagesOptionalParams) => PagedAsyncIterableIterator; // (undocumented) - queryWidgetsPages: (page: number, pageSize: number, options?: WidgetsQueryWidgetsPagesOptions) => PagedAsyncIterableIterator; + queryWidgetsPages: (page: number, pageSize: number, options?: WidgetsQueryWidgetsPagesOptionalParams) => PagedAsyncIterableIterator; // (undocumented) - updateWidget: (id: string, body: UpdateWidget, options?: WidgetsUpdateWidgetOptions) => Promise; + updateWidget: (id: string, body: UpdateWidget, options?: WidgetsUpdateWidgetOptionalParams) => Promise; } // @public (undocumented) -export interface WidgetsQueryWidgetsPagesOptions extends OperationOptions { +export interface WidgetsQueryWidgetsPagesOptionalParams extends OperationOptions { } // @public (undocumented) -export interface WidgetsUpdateWidgetOptions extends OperationOptions { +export interface WidgetsUpdateWidgetOptionalParams extends OperationOptions { } // (No @packageDocumentation comment for this package) diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/budgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/budgets/index.ts index bedd7d5cd5..cb9ddda7eb 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/budgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/budgets/index.ts @@ -22,15 +22,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, } from "../../models/options.js"; export function _createOrReplaceSend( context: Client, name: string, resource: User, - options: BudgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: BudgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod< | BudgetsCreateOrReplace200Response | BudgetsCreateOrReplace201Response @@ -70,7 +70,7 @@ export function createOrReplace( context: Client, name: string, resource: User, - options: BudgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: BudgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrReplaceDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, @@ -84,7 +84,7 @@ export function _createOrUpdateSend( context: Client, name: string, resource: User, - options: BudgetsCreateOrUpdateOptions = { requestOptions: {} }, + options: BudgetsCreateOrUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod< | BudgetsCreateOrUpdate200Response | BudgetsCreateOrUpdate201Response @@ -126,7 +126,7 @@ export function createOrUpdate( context: Client, name: string, resource: User, - options: BudgetsCreateOrUpdateOptions = { requestOptions: {} }, + options: BudgetsCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrUpdateDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/index.ts index 2f4abd0ea6..5302c48e31 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/index.ts @@ -5,4 +5,4 @@ export { createWidgetService, WidgetServiceClientOptions, WidgetServiceContext, -} from "./WidgetServiceContext.js"; +} from "./widgetServiceContext.js"; diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/WidgetServiceContext.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/widgetServiceContext.ts similarity index 100% rename from packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/WidgetServiceContext.ts rename to packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/widgetServiceContext.ts diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/widgets/index.ts index a220e7595d..5872a4ad97 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/api/widgets/index.ts @@ -45,15 +45,15 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, } from "../../models/options.js"; export function _listWidgetsSend( @@ -63,7 +63,7 @@ export function _listWidgetsSend( value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options: WidgetsListWidgetsOptions = { requestOptions: {} }, + options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsListWidgets200Response | WidgetsListWidgetsDefaultResponse > { @@ -131,7 +131,7 @@ export async function listWidgets( value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options: WidgetsListWidgetsOptions = { requestOptions: {} }, + options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listWidgetsSend( context, @@ -149,7 +149,7 @@ export function _listWidgetsPagesSend( context: Client, page: number, pageSize: number, - options: WidgetsListWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsListWidgetsPages200Response | WidgetsListWidgetsPagesDefaultResponse > { @@ -184,7 +184,7 @@ export function listWidgetsPages( context: Client, page: number, pageSize: number, - options: WidgetsListWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -198,7 +198,7 @@ export function _queryWidgetsPagesSend( context: Client, page: number, pageSize: number, - options: WidgetsQueryWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsQueryWidgetsPages200Response | WidgetsQueryWidgetsPagesDefaultResponse > { @@ -233,7 +233,7 @@ export function queryWidgetsPages( context: Client, page: number, pageSize: number, - options: WidgetsQueryWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -246,7 +246,7 @@ export function queryWidgetsPages( export function _getWidgetSend( context: Client, id: string, - options: WidgetsGetWidgetOptions = { requestOptions: {} }, + options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsGetWidget200Response | WidgetsGetWidgetDefaultResponse > { @@ -273,7 +273,7 @@ export async function _getWidgetDeserialize( export async function getWidget( context: Client, id: string, - options: WidgetsGetWidgetOptions = { requestOptions: {} }, + options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getWidgetSend(context, id, options); return _getWidgetDeserialize(result); @@ -282,7 +282,7 @@ export async function getWidget( export function _createWidgetSend( context: Client, body: CreateWidget, - options: WidgetsCreateWidgetOptions = { requestOptions: {} }, + options: WidgetsCreateWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsCreateWidget201Response | WidgetsCreateWidgetDefaultResponse > { @@ -317,7 +317,7 @@ export async function _createWidgetDeserialize( export async function createWidget( context: Client, body: CreateWidget, - options: WidgetsCreateWidgetOptions = { requestOptions: {} }, + options: WidgetsCreateWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createWidgetSend(context, body, options); return _createWidgetDeserialize(result); @@ -327,7 +327,7 @@ export function _createOrReplaceSend( context: Client, name: string, resource: User, - options: WidgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod< | WidgetsCreateOrReplace200Response | WidgetsCreateOrReplace201Response @@ -367,7 +367,7 @@ export function createOrReplace( context: Client, name: string, resource: User, - options: WidgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrReplaceDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, @@ -381,7 +381,7 @@ export function _updateWidgetSend( context: Client, id: string, body: UpdateWidget, - options: WidgetsUpdateWidgetOptions = { requestOptions: {} }, + options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsUpdateWidget200Response | WidgetsUpdateWidgetDefaultResponse > { @@ -415,7 +415,7 @@ export async function updateWidget( context: Client, id: string, body: UpdateWidget, - options: WidgetsUpdateWidgetOptions = { requestOptions: {} }, + options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _updateWidgetSend(context, id, body, options); return _updateWidgetDeserialize(result); @@ -424,7 +424,7 @@ export async function updateWidget( export function _deleteWidgetSend( context: Client, id: string, - options: WidgetsDeleteWidgetOptions = { requestOptions: {} }, + options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsDeleteWidget204Response | WidgetsDeleteWidgetDefaultResponse > { @@ -447,7 +447,7 @@ export async function _deleteWidgetDeserialize( export async function deleteWidget( context: Client, id: string, - options: WidgetsDeleteWidgetOptions = { requestOptions: {} }, + options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteWidgetSend(context, id, options); return _deleteWidgetDeserialize(result); @@ -456,7 +456,7 @@ export async function deleteWidget( export function _analyzeWidgetSend( context: Client, id: string, - options: WidgetsAnalyzeWidgetOptions = { requestOptions: {} }, + options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsAnalyzeWidget200Response | WidgetsAnalyzeWidgetDefaultResponse > { @@ -481,7 +481,7 @@ export async function _analyzeWidgetDeserialize( export async function analyzeWidget( context: Client, id: string, - options: WidgetsAnalyzeWidgetOptions = { requestOptions: {} }, + options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _analyzeWidgetSend(context, id, options); return _analyzeWidgetDeserialize(result); diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/budgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/budgets/index.ts index bb4fe3efbc..2ed6f2c4f6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/budgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/budgets/index.ts @@ -1,25 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { WidgetServiceContext } from "../../api/WidgetServiceContext.js"; +import { WidgetServiceContext } from "../../api/widgetServiceContext.js"; import { User } from "../../models/models.js"; import { createOrReplace, createOrUpdate } from "../../api/budgets/index.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, } from "../../models/options.js"; export interface BudgetsOperations { createOrReplace: ( name: string, resource: User, - options?: BudgetsCreateOrReplaceOptions, + options?: BudgetsCreateOrReplaceOptionalParams, ) => PollerLike, User>; createOrUpdate: ( name: string, resource: User, - options?: BudgetsCreateOrUpdateOptions, + options?: BudgetsCreateOrUpdateOptionalParams, ) => PollerLike, User>; } @@ -28,12 +28,12 @@ export function getBudgets(context: WidgetServiceContext) { createOrReplace: ( name: string, resource: User, - options?: BudgetsCreateOrReplaceOptions, + options?: BudgetsCreateOrReplaceOptionalParams, ) => createOrReplace(context, name, resource, options), createOrUpdate: ( name: string, resource: User, - options?: BudgetsCreateOrUpdateOptions, + options?: BudgetsCreateOrUpdateOptionalParams, ) => createOrUpdate(context, name, resource, options), }; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/widgets/index.ts index ed7a68360e..9d408f19d6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/classic/widgets/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { WidgetServiceContext } from "../../api/WidgetServiceContext.js"; +import { WidgetServiceContext } from "../../api/widgetServiceContext.js"; import { User, Widget, @@ -23,15 +23,15 @@ import { import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, } from "../../models/options.js"; export interface WidgetsOperations { @@ -41,40 +41,43 @@ export interface WidgetsOperations { value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options?: WidgetsListWidgetsOptions, + options?: WidgetsListWidgetsOptionalParams, ) => Promise; listWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsListWidgetsPagesOptions, + options?: WidgetsListWidgetsPagesOptionalParams, ) => PagedAsyncIterableIterator; queryWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsQueryWidgetsPagesOptions, + options?: WidgetsQueryWidgetsPagesOptionalParams, ) => PagedAsyncIterableIterator; - getWidget: (id: string, options?: WidgetsGetWidgetOptions) => Promise; + getWidget: ( + id: string, + options?: WidgetsGetWidgetOptionalParams, + ) => Promise; createWidget: ( body: CreateWidget, - options?: WidgetsCreateWidgetOptions, + options?: WidgetsCreateWidgetOptionalParams, ) => Promise; createOrReplace: ( name: string, resource: User, - options?: WidgetsCreateOrReplaceOptions, + options?: WidgetsCreateOrReplaceOptionalParams, ) => PollerLike, User>; updateWidget: ( id: string, body: UpdateWidget, - options?: WidgetsUpdateWidgetOptions, + options?: WidgetsUpdateWidgetOptionalParams, ) => Promise; deleteWidget: ( id: string, - options?: WidgetsDeleteWidgetOptions, + options?: WidgetsDeleteWidgetOptionalParams, ) => Promise; analyzeWidget: ( id: string, - options?: WidgetsAnalyzeWidgetOptions, + options?: WidgetsAnalyzeWidgetOptionalParams, ) => Promise; } @@ -86,7 +89,7 @@ export function getWidgets(context: WidgetServiceContext) { value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options?: WidgetsListWidgetsOptions, + options?: WidgetsListWidgetsOptionalParams, ) => listWidgets( context, @@ -100,30 +103,32 @@ export function getWidgets(context: WidgetServiceContext) { listWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsListWidgetsPagesOptions, + options?: WidgetsListWidgetsPagesOptionalParams, ) => listWidgetsPages(context, page, pageSize, options), queryWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsQueryWidgetsPagesOptions, + options?: WidgetsQueryWidgetsPagesOptionalParams, ) => queryWidgetsPages(context, page, pageSize, options), - getWidget: (id: string, options?: WidgetsGetWidgetOptions) => + getWidget: (id: string, options?: WidgetsGetWidgetOptionalParams) => getWidget(context, id, options), - createWidget: (body: CreateWidget, options?: WidgetsCreateWidgetOptions) => - createWidget(context, body, options), + createWidget: ( + body: CreateWidget, + options?: WidgetsCreateWidgetOptionalParams, + ) => createWidget(context, body, options), createOrReplace: ( name: string, resource: User, - options?: WidgetsCreateOrReplaceOptions, + options?: WidgetsCreateOrReplaceOptionalParams, ) => createOrReplace(context, name, resource, options), updateWidget: ( id: string, body: UpdateWidget, - options?: WidgetsUpdateWidgetOptions, + options?: WidgetsUpdateWidgetOptionalParams, ) => updateWidget(context, id, body, options), - deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptions) => + deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptionalParams) => deleteWidget(context, id, options), - analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptions) => + analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptionalParams) => analyzeWidget(context, id, options), }; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/index.ts index 4c3c2eecc5..0253c55e8c 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/index.ts @@ -4,7 +4,7 @@ export { WidgetServiceClient, WidgetServiceClientOptions, -} from "./WidgetServiceClient.js"; +} from "./widgetServiceClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { User, @@ -15,18 +15,19 @@ export { UpdateWidget, AnalyzeResult, NonReferencedModel, - OperationStatus, - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + Versions, + OperationStatusUserError, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/index.ts index 22b6877bfa..0158847d32 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/index.ts @@ -10,20 +10,21 @@ export { UpdateWidget, AnalyzeResult, NonReferencedModel, - OperationStatus, + Versions, + OperationStatusUserError, } from "./models.js"; export { - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/models.ts index 54ba417f62..5ff77b92ad 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/models.ts @@ -62,8 +62,12 @@ export interface NonReferencedModel { prop2: string; } +/** The Contoso Widget Manager service version. */ +/** */ +export type Versions = "1.0.0"; + /** Provides status details for long running operations. */ -export interface OperationStatus { +export interface OperationStatusUserError { /** The unique ID of the operation. */ id: string; /** The status of the operation */ diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/options.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/options.ts index 4bdde68cad..e9041d06ba 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/options.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/models/options.ts @@ -3,42 +3,44 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface WidgetsListWidgetsOptions extends OperationOptions { +export interface WidgetsListWidgetsOptionalParams extends OperationOptions { optionalHeader?: string; nullableOptionalHeader?: string | null; optionalDateHeader?: Date; nullableDateHeader?: Date | null; } -export interface WidgetsListWidgetsPagesOptions extends OperationOptions {} +export interface WidgetsListWidgetsPagesOptionalParams + extends OperationOptions {} -export interface WidgetsQueryWidgetsPagesOptions extends OperationOptions {} +export interface WidgetsQueryWidgetsPagesOptionalParams + extends OperationOptions {} -export interface WidgetsGetWidgetOptions extends OperationOptions {} +export interface WidgetsGetWidgetOptionalParams extends OperationOptions {} -export interface WidgetsCreateWidgetOptions extends OperationOptions {} +export interface WidgetsCreateWidgetOptionalParams extends OperationOptions {} -export interface WidgetsCreateOrReplaceOptions extends OperationOptions { +export interface WidgetsCreateOrReplaceOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** The API version to use for this operation. */ apiVersion?: string; } -export interface WidgetsUpdateWidgetOptions extends OperationOptions {} +export interface WidgetsUpdateWidgetOptionalParams extends OperationOptions {} -export interface WidgetsDeleteWidgetOptions extends OperationOptions {} +export interface WidgetsDeleteWidgetOptionalParams extends OperationOptions {} -export interface WidgetsAnalyzeWidgetOptions extends OperationOptions {} +export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions {} -export interface BudgetsCreateOrReplaceOptions extends OperationOptions { +export interface BudgetsCreateOrReplaceOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** The API version to use for this operation. */ apiVersion?: string; } -export interface BudgetsCreateOrUpdateOptions extends OperationOptions { +export interface BudgetsCreateOrUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** The API version to use for this operation. */ diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/restorePollerHelpers.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/restorePollerHelpers.ts index 53e84594ac..7d8aa31902 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/restorePollerHelpers.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/restorePollerHelpers.ts @@ -7,8 +7,8 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { WidgetServiceContext } from "./api/WidgetServiceContext.js"; -import { WidgetServiceClient } from "./WidgetServiceClient.js"; +import { WidgetServiceContext } from "./api/widgetServiceContext.js"; +import { WidgetServiceClient } from "./widgetServiceClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _createOrReplaceDeserialize } from "./api/widgets/index.js"; import { diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/WidgetServiceClient.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/widgetServiceClient.ts similarity index 94% rename from packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/WidgetServiceClient.ts rename to packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/widgetServiceClient.ts index 75eba14421..88e2f3c566 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/WidgetServiceClient.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/sources/generated/src/widgetServiceClient.ts @@ -16,7 +16,7 @@ import { WidgetServiceContext, } from "./api/index.js"; -export { WidgetServiceClientOptions } from "./api/WidgetServiceContext.js"; +export { WidgetServiceClientOptions } from "./api/widgetServiceContext.js"; export class WidgetServiceClient { private _client: WidgetServiceContext; diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts index bedd7d5cd5..cb9ddda7eb 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/budgets/index.ts @@ -22,15 +22,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, } from "../../models/options.js"; export function _createOrReplaceSend( context: Client, name: string, resource: User, - options: BudgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: BudgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod< | BudgetsCreateOrReplace200Response | BudgetsCreateOrReplace201Response @@ -70,7 +70,7 @@ export function createOrReplace( context: Client, name: string, resource: User, - options: BudgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: BudgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrReplaceDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, @@ -84,7 +84,7 @@ export function _createOrUpdateSend( context: Client, name: string, resource: User, - options: BudgetsCreateOrUpdateOptions = { requestOptions: {} }, + options: BudgetsCreateOrUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod< | BudgetsCreateOrUpdate200Response | BudgetsCreateOrUpdate201Response @@ -126,7 +126,7 @@ export function createOrUpdate( context: Client, name: string, resource: User, - options: BudgetsCreateOrUpdateOptions = { requestOptions: {} }, + options: BudgetsCreateOrUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrUpdateDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts index 2f4abd0ea6..5302c48e31 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/index.ts @@ -5,4 +5,4 @@ export { createWidgetService, WidgetServiceClientOptions, WidgetServiceContext, -} from "./WidgetServiceContext.js"; +} from "./widgetServiceContext.js"; diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/WidgetServiceContext.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgetServiceContext.ts similarity index 100% rename from packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/WidgetServiceContext.ts rename to packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgetServiceContext.ts diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts index a220e7595d..5872a4ad97 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/api/widgets/index.ts @@ -45,15 +45,15 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, } from "../../models/options.js"; export function _listWidgetsSend( @@ -63,7 +63,7 @@ export function _listWidgetsSend( value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options: WidgetsListWidgetsOptions = { requestOptions: {} }, + options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsListWidgets200Response | WidgetsListWidgetsDefaultResponse > { @@ -131,7 +131,7 @@ export async function listWidgets( value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options: WidgetsListWidgetsOptions = { requestOptions: {} }, + options: WidgetsListWidgetsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _listWidgetsSend( context, @@ -149,7 +149,7 @@ export function _listWidgetsPagesSend( context: Client, page: number, pageSize: number, - options: WidgetsListWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsListWidgetsPages200Response | WidgetsListWidgetsPagesDefaultResponse > { @@ -184,7 +184,7 @@ export function listWidgetsPages( context: Client, page: number, pageSize: number, - options: WidgetsListWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsListWidgetsPagesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -198,7 +198,7 @@ export function _queryWidgetsPagesSend( context: Client, page: number, pageSize: number, - options: WidgetsQueryWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsQueryWidgetsPages200Response | WidgetsQueryWidgetsPagesDefaultResponse > { @@ -233,7 +233,7 @@ export function queryWidgetsPages( context: Client, page: number, pageSize: number, - options: WidgetsQueryWidgetsPagesOptions = { requestOptions: {} }, + options: WidgetsQueryWidgetsPagesOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -246,7 +246,7 @@ export function queryWidgetsPages( export function _getWidgetSend( context: Client, id: string, - options: WidgetsGetWidgetOptions = { requestOptions: {} }, + options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsGetWidget200Response | WidgetsGetWidgetDefaultResponse > { @@ -273,7 +273,7 @@ export async function _getWidgetDeserialize( export async function getWidget( context: Client, id: string, - options: WidgetsGetWidgetOptions = { requestOptions: {} }, + options: WidgetsGetWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getWidgetSend(context, id, options); return _getWidgetDeserialize(result); @@ -282,7 +282,7 @@ export async function getWidget( export function _createWidgetSend( context: Client, body: CreateWidget, - options: WidgetsCreateWidgetOptions = { requestOptions: {} }, + options: WidgetsCreateWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsCreateWidget201Response | WidgetsCreateWidgetDefaultResponse > { @@ -317,7 +317,7 @@ export async function _createWidgetDeserialize( export async function createWidget( context: Client, body: CreateWidget, - options: WidgetsCreateWidgetOptions = { requestOptions: {} }, + options: WidgetsCreateWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createWidgetSend(context, body, options); return _createWidgetDeserialize(result); @@ -327,7 +327,7 @@ export function _createOrReplaceSend( context: Client, name: string, resource: User, - options: WidgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod< | WidgetsCreateOrReplace200Response | WidgetsCreateOrReplace201Response @@ -367,7 +367,7 @@ export function createOrReplace( context: Client, name: string, resource: User, - options: WidgetsCreateOrReplaceOptions = { requestOptions: {} }, + options: WidgetsCreateOrReplaceOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrReplaceDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, @@ -381,7 +381,7 @@ export function _updateWidgetSend( context: Client, id: string, body: UpdateWidget, - options: WidgetsUpdateWidgetOptions = { requestOptions: {} }, + options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsUpdateWidget200Response | WidgetsUpdateWidgetDefaultResponse > { @@ -415,7 +415,7 @@ export async function updateWidget( context: Client, id: string, body: UpdateWidget, - options: WidgetsUpdateWidgetOptions = { requestOptions: {} }, + options: WidgetsUpdateWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _updateWidgetSend(context, id, body, options); return _updateWidgetDeserialize(result); @@ -424,7 +424,7 @@ export async function updateWidget( export function _deleteWidgetSend( context: Client, id: string, - options: WidgetsDeleteWidgetOptions = { requestOptions: {} }, + options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsDeleteWidget204Response | WidgetsDeleteWidgetDefaultResponse > { @@ -447,7 +447,7 @@ export async function _deleteWidgetDeserialize( export async function deleteWidget( context: Client, id: string, - options: WidgetsDeleteWidgetOptions = { requestOptions: {} }, + options: WidgetsDeleteWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _deleteWidgetSend(context, id, options); return _deleteWidgetDeserialize(result); @@ -456,7 +456,7 @@ export async function deleteWidget( export function _analyzeWidgetSend( context: Client, id: string, - options: WidgetsAnalyzeWidgetOptions = { requestOptions: {} }, + options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, ): StreamableMethod< WidgetsAnalyzeWidget200Response | WidgetsAnalyzeWidgetDefaultResponse > { @@ -481,7 +481,7 @@ export async function _analyzeWidgetDeserialize( export async function analyzeWidget( context: Client, id: string, - options: WidgetsAnalyzeWidgetOptions = { requestOptions: {} }, + options: WidgetsAnalyzeWidgetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _analyzeWidgetSend(context, id, options); return _analyzeWidgetDeserialize(result); diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/budgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/budgets/index.ts index bb4fe3efbc..2ed6f2c4f6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/budgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/budgets/index.ts @@ -1,25 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { WidgetServiceContext } from "../../api/WidgetServiceContext.js"; +import { WidgetServiceContext } from "../../api/widgetServiceContext.js"; import { User } from "../../models/models.js"; import { createOrReplace, createOrUpdate } from "../../api/budgets/index.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, } from "../../models/options.js"; export interface BudgetsOperations { createOrReplace: ( name: string, resource: User, - options?: BudgetsCreateOrReplaceOptions, + options?: BudgetsCreateOrReplaceOptionalParams, ) => PollerLike, User>; createOrUpdate: ( name: string, resource: User, - options?: BudgetsCreateOrUpdateOptions, + options?: BudgetsCreateOrUpdateOptionalParams, ) => PollerLike, User>; } @@ -28,12 +28,12 @@ export function getBudgets(context: WidgetServiceContext) { createOrReplace: ( name: string, resource: User, - options?: BudgetsCreateOrReplaceOptions, + options?: BudgetsCreateOrReplaceOptionalParams, ) => createOrReplace(context, name, resource, options), createOrUpdate: ( name: string, resource: User, - options?: BudgetsCreateOrUpdateOptions, + options?: BudgetsCreateOrUpdateOptionalParams, ) => createOrUpdate(context, name, resource, options), }; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts index ed7a68360e..9d408f19d6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/classic/widgets/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { WidgetServiceContext } from "../../api/WidgetServiceContext.js"; +import { WidgetServiceContext } from "../../api/widgetServiceContext.js"; import { User, Widget, @@ -23,15 +23,15 @@ import { import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, } from "../../models/options.js"; export interface WidgetsOperations { @@ -41,40 +41,43 @@ export interface WidgetsOperations { value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options?: WidgetsListWidgetsOptions, + options?: WidgetsListWidgetsOptionalParams, ) => Promise; listWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsListWidgetsPagesOptions, + options?: WidgetsListWidgetsPagesOptionalParams, ) => PagedAsyncIterableIterator; queryWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsQueryWidgetsPagesOptions, + options?: WidgetsQueryWidgetsPagesOptionalParams, ) => PagedAsyncIterableIterator; - getWidget: (id: string, options?: WidgetsGetWidgetOptions) => Promise; + getWidget: ( + id: string, + options?: WidgetsGetWidgetOptionalParams, + ) => Promise; createWidget: ( body: CreateWidget, - options?: WidgetsCreateWidgetOptions, + options?: WidgetsCreateWidgetOptionalParams, ) => Promise; createOrReplace: ( name: string, resource: User, - options?: WidgetsCreateOrReplaceOptions, + options?: WidgetsCreateOrReplaceOptionalParams, ) => PollerLike, User>; updateWidget: ( id: string, body: UpdateWidget, - options?: WidgetsUpdateWidgetOptions, + options?: WidgetsUpdateWidgetOptionalParams, ) => Promise; deleteWidget: ( id: string, - options?: WidgetsDeleteWidgetOptions, + options?: WidgetsDeleteWidgetOptionalParams, ) => Promise; analyzeWidget: ( id: string, - options?: WidgetsAnalyzeWidgetOptions, + options?: WidgetsAnalyzeWidgetOptionalParams, ) => Promise; } @@ -86,7 +89,7 @@ export function getWidgets(context: WidgetServiceContext) { value: Uint8Array, csvArrayHeader: Uint8Array[], utcDateHeader: Date, - options?: WidgetsListWidgetsOptions, + options?: WidgetsListWidgetsOptionalParams, ) => listWidgets( context, @@ -100,30 +103,32 @@ export function getWidgets(context: WidgetServiceContext) { listWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsListWidgetsPagesOptions, + options?: WidgetsListWidgetsPagesOptionalParams, ) => listWidgetsPages(context, page, pageSize, options), queryWidgetsPages: ( page: number, pageSize: number, - options?: WidgetsQueryWidgetsPagesOptions, + options?: WidgetsQueryWidgetsPagesOptionalParams, ) => queryWidgetsPages(context, page, pageSize, options), - getWidget: (id: string, options?: WidgetsGetWidgetOptions) => + getWidget: (id: string, options?: WidgetsGetWidgetOptionalParams) => getWidget(context, id, options), - createWidget: (body: CreateWidget, options?: WidgetsCreateWidgetOptions) => - createWidget(context, body, options), + createWidget: ( + body: CreateWidget, + options?: WidgetsCreateWidgetOptionalParams, + ) => createWidget(context, body, options), createOrReplace: ( name: string, resource: User, - options?: WidgetsCreateOrReplaceOptions, + options?: WidgetsCreateOrReplaceOptionalParams, ) => createOrReplace(context, name, resource, options), updateWidget: ( id: string, body: UpdateWidget, - options?: WidgetsUpdateWidgetOptions, + options?: WidgetsUpdateWidgetOptionalParams, ) => updateWidget(context, id, body, options), - deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptions) => + deleteWidget: (id: string, options?: WidgetsDeleteWidgetOptionalParams) => deleteWidget(context, id, options), - analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptions) => + analyzeWidget: (id: string, options?: WidgetsAnalyzeWidgetOptionalParams) => analyzeWidget(context, id, options), }; } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts index 4c3c2eecc5..0253c55e8c 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts @@ -4,7 +4,7 @@ export { WidgetServiceClient, WidgetServiceClientOptions, -} from "./WidgetServiceClient.js"; +} from "./widgetServiceClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { User, @@ -15,18 +15,19 @@ export { UpdateWidget, AnalyzeResult, NonReferencedModel, - OperationStatus, - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + Versions, + OperationStatusUserError, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts index 22b6877bfa..0158847d32 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts @@ -10,20 +10,21 @@ export { UpdateWidget, AnalyzeResult, NonReferencedModel, - OperationStatus, + Versions, + OperationStatusUserError, } from "./models.js"; export { - WidgetsListWidgetsOptions, - WidgetsListWidgetsPagesOptions, - WidgetsQueryWidgetsPagesOptions, - WidgetsGetWidgetOptions, - WidgetsCreateWidgetOptions, - WidgetsCreateOrReplaceOptions, - WidgetsUpdateWidgetOptions, - WidgetsDeleteWidgetOptions, - WidgetsAnalyzeWidgetOptions, - BudgetsCreateOrReplaceOptions, - BudgetsCreateOrUpdateOptions, + WidgetsListWidgetsOptionalParams, + WidgetsListWidgetsPagesOptionalParams, + WidgetsQueryWidgetsPagesOptionalParams, + WidgetsGetWidgetOptionalParams, + WidgetsCreateWidgetOptionalParams, + WidgetsCreateOrReplaceOptionalParams, + WidgetsUpdateWidgetOptionalParams, + WidgetsDeleteWidgetOptionalParams, + WidgetsAnalyzeWidgetOptionalParams, + BudgetsCreateOrReplaceOptionalParams, + BudgetsCreateOrUpdateOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts index 54ba417f62..5ff77b92ad 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts @@ -62,8 +62,12 @@ export interface NonReferencedModel { prop2: string; } +/** The Contoso Widget Manager service version. */ +/** */ +export type Versions = "1.0.0"; + /** Provides status details for long running operations. */ -export interface OperationStatus { +export interface OperationStatusUserError { /** The unique ID of the operation. */ id: string; /** The status of the operation */ diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/options.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/options.ts index 4bdde68cad..e9041d06ba 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/options.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/options.ts @@ -3,42 +3,44 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface WidgetsListWidgetsOptions extends OperationOptions { +export interface WidgetsListWidgetsOptionalParams extends OperationOptions { optionalHeader?: string; nullableOptionalHeader?: string | null; optionalDateHeader?: Date; nullableDateHeader?: Date | null; } -export interface WidgetsListWidgetsPagesOptions extends OperationOptions {} +export interface WidgetsListWidgetsPagesOptionalParams + extends OperationOptions {} -export interface WidgetsQueryWidgetsPagesOptions extends OperationOptions {} +export interface WidgetsQueryWidgetsPagesOptionalParams + extends OperationOptions {} -export interface WidgetsGetWidgetOptions extends OperationOptions {} +export interface WidgetsGetWidgetOptionalParams extends OperationOptions {} -export interface WidgetsCreateWidgetOptions extends OperationOptions {} +export interface WidgetsCreateWidgetOptionalParams extends OperationOptions {} -export interface WidgetsCreateOrReplaceOptions extends OperationOptions { +export interface WidgetsCreateOrReplaceOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** The API version to use for this operation. */ apiVersion?: string; } -export interface WidgetsUpdateWidgetOptions extends OperationOptions {} +export interface WidgetsUpdateWidgetOptionalParams extends OperationOptions {} -export interface WidgetsDeleteWidgetOptions extends OperationOptions {} +export interface WidgetsDeleteWidgetOptionalParams extends OperationOptions {} -export interface WidgetsAnalyzeWidgetOptions extends OperationOptions {} +export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions {} -export interface BudgetsCreateOrReplaceOptions extends OperationOptions { +export interface BudgetsCreateOrReplaceOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** The API version to use for this operation. */ apiVersion?: string; } -export interface BudgetsCreateOrUpdateOptions extends OperationOptions { +export interface BudgetsCreateOrUpdateOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; /** The API version to use for this operation. */ diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts index 53e84594ac..7d8aa31902 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/restorePollerHelpers.ts @@ -7,8 +7,8 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { WidgetServiceContext } from "./api/WidgetServiceContext.js"; -import { WidgetServiceClient } from "./WidgetServiceClient.js"; +import { WidgetServiceContext } from "./api/widgetServiceContext.js"; +import { WidgetServiceClient } from "./widgetServiceClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _createOrReplaceDeserialize } from "./api/widgets/index.js"; import { diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/WidgetServiceClient.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts similarity index 94% rename from packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/WidgetServiceClient.ts rename to packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts index 75eba14421..88e2f3c566 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/WidgetServiceClient.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/widgetServiceClient.ts @@ -16,7 +16,7 @@ import { WidgetServiceContext, } from "./api/index.js"; -export { WidgetServiceClientOptions } from "./api/WidgetServiceContext.js"; +export { WidgetServiceClientOptions } from "./api/widgetServiceContext.js"; export class WidgetServiceClient { private _client: WidgetServiceContext; diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/vitest.browser.config.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/vitest.browser.config.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-test/test/widget_dpg/spec/main.tsp b/packages/typespec-test/test/widget_dpg/spec/main.tsp index 31c4a13a6e..a75784a198 100644 --- a/packages/typespec-test/test/widget_dpg/spec/main.tsp +++ b/packages/typespec-test/test/widget_dpg/spec/main.tsp @@ -148,7 +148,7 @@ result in an error. @statusCode code: 201; @body widget: Widget; } | WidgetError; - + @route("/widgets/createOrReplace") op createOrReplace is ResourceOperations.LongRunningResourceCreateOrReplace; @@ -170,7 +170,6 @@ are optional and will be updated within the widget if provided. ): AnalyzeResult | WidgetError; } - @route("/budgets") @tag("Widgets") interface Budgets { diff --git a/packages/typespec-test/test/widget_dpg/tspconfig.yaml b/packages/typespec-test/test/widget_dpg/tspconfig.yaml index 8e11eb6de5..13c33de860 100644 --- a/packages/typespec-test/test/widget_dpg/tspconfig.yaml +++ b/packages/typespec-test/test/widget_dpg/tspconfig.yaml @@ -4,9 +4,9 @@ options: "@azure-tools/typespec-ts": multiClient: false azureSdkForJs: false - generateMetadata: true isModularLibrary: true generateOrphanModels: true + generateMetadata: true "emitter-output-dir": "{project-root}/generated/typespec-ts" packageDetails: name: "@msinternal/widget_dpg" diff --git a/packages/typespec-ts/CHANGELOG.md b/packages/typespec-ts/CHANGELOG.md index d39bd06405..bcf9a51c26 100644 --- a/packages/typespec-ts/CHANGELOG.md +++ b/packages/typespec-ts/CHANGELOG.md @@ -1,7 +1,32 @@ +## 0.27.0 (2024-04-18) + +- [Feature] Support server parameter in modular. Please refer to [#2424](https://github.com/Azure/autorest.typescript/pull/2424). +- [Feature] Support special words. Please refer to [#2387](https://github.com/Azure/autorest.typescript/pull/2387). +- [Feature] Support additional properties full cases in RLC. Please refer to [#2445](https://github.com/Azure/autorest.typescript/pull/2445). +- [Feature] Support the change for union and enums in modular and RLC. Please refer to [#2380](https://github.com/Azure/autorest.typescript/pull/2380). +- [Feature] Upgrade typespec compiler to 0.55.0. Please refer to [#2380](https://github.com/Azure/autorest.typescript/pull/2380). +- [Feature] Bump typescript version to typescript@~5.4.5. Please refer to [#2442](https://github.com/Azure/autorest.typescript/pull/2442). +- [Feature] Update @azure-rest/core-client to 1.4.0.. Please refer to [#2441](https://github.com/Azure/autorest.typescript/pull/2441). +- [Feature] Upgrade mkdirp to ^3.0.1. Please refer to [#2436](https://github.com/Azure/autorest.typescript/pull/2436). +- [Bugfix] Fix missing `pack` scripts in package.json. Please refer to [#2426](https://github.com/Azure/autorest.typescript/pull/2426). + +## 0.26.1 (2024-04-04) + +- [Bugfix] Fix missing scripts in package.json file. Please refer to [#2402](https://github.com/Azure/autorest.typescript/pull/2402). + +## 0.26.0 (2024-04-03) + +- [Feature] Enable esm for RLC generation from TypeSpec. Please refer to [#2338](https://github.com/Azure/autorest.typescript/pull/2338). +- [Feature] Support usage and access. Please refer to [#2356](https://github.com/Azure/autorest.typescript/pull/2356). +- [Feature] Support server versions in modular. Please refer to [#2261](https://github.com/Azure/autorest.typescript/pull/2261). +- [Feature] Deprecate baseurl in favor of endpoint in RLC. Please refer to [#2246](https://github.com/Azure/autorest.typescript/pull/2246). +- [Bugfix] Fix error model rename issue. Please refer to [#2379](https://github.com/Azure/autorest.typescript/pull/2379). +- [Bugfix] Fix issues: anonymous array model import and sample mock value for credential. Please refer to [#2342](https://github.com/Azure/autorest.typescript/pull/2342). + ## 0.25.0 (2024-03-08) - [Feature] Upgrade @azure-tools/typespec-client-generator-core to 0.40.0. Please refer to [#2341](https://github.com/Azure/autorest.typescript/pull/2341). - + ## 0.24.0 (2024-03-07) - [Feature] Upgrade TypeSpec compiler to 0.54.0. Please refer to [#2334](https://github.com/Azure/autorest.typescript/pull/2334). diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index 0149749668..d0b006c531 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/typespec-ts", - "version": "0.25.0", + "version": "0.27.0", "description": "An experimental TypeSpec emitter for TypeScript RLC", "main": "dist/src/index.js", "type": "module", @@ -54,18 +54,18 @@ "@typescript-eslint/eslint-plugin": "^6.8.0", "@typescript-eslint/parser": "^6.8.0", "chai": "^4.3.6", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "eslint": "^8.9.0", "mocha": "^9.2.2", "rimraf": "^5.0.0", "ts-node": "~10.9.1", - "typescript": "~5.2.0", + "typescript": "~5.4.5", "prettier": "^3.1.0", - "@azure-tools/cadl-ranch-specs": "^0.31.5", - "@azure-tools/cadl-ranch-expect": "^0.13.2", - "@azure-tools/cadl-ranch": "^0.12.4", + "@azure-tools/cadl-ranch-specs": "^0.31.8", + "@azure-tools/cadl-ranch-expect": "^0.13.3", + "@azure-tools/cadl-ranch": "^0.12.7", "chalk": "^4.0.0", - "@azure-rest/core-client": "^1.3.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "cross-env": "^7.0.3", "@azure/core-paging": "^1.5.0", @@ -76,25 +76,25 @@ "@azure/core-util": "^1.4.0", "eslint-plugin-require-extensions": "0.1.3", "@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2", - "@azure-tools/typespec-azure-core": ">=0.40.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.40.0 <1.0.0", - "@typespec/compiler": ">=0.54.0 <1.0.0", - "@typespec/http": ">=0.54.0 <1.0.0", - "@typespec/rest": ">=0.54.0 <1.0.0", - "@typespec/versioning": ">=0.54.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.41.3 <1.0.0", + "@typespec/compiler": ">=0.55.0 <1.0.0", + "@typespec/http": ">=0.55.0 <1.0.0", + "@typespec/rest": ">=0.55.0 <1.0.0", + "@typespec/versioning": ">=0.55.0 <1.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.40.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.40.0 <1.0.0", - "@typespec/compiler": ">=0.54.0 <1.0.0", - "@typespec/http": ">=0.54.0 <1.0.0", - "@typespec/rest": ">=0.54.0 <1.0.0", - "@typespec/versioning": ">=0.54.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.41.3 <1.0.0", + "@typespec/compiler": ">=0.55.0 <1.0.0", + "@typespec/http": ">=0.55.0 <1.0.0", + "@typespec/rest": ">=0.55.0 <1.0.0", + "@typespec/versioning": ">=0.55.0 <1.0.0" }, "dependencies": { "prettier": "^3.1.0", "tslib": "^2.3.1", - "@azure-tools/rlc-common": "workspace:^0.25.0", + "@azure-tools/rlc-common": "workspace:^0.27.0", "ts-morph": "^15.1.0", "fs-extra": "^11.1.0" }, diff --git a/packages/typespec-ts/src/index.ts b/packages/typespec-ts/src/index.ts index 89c2efa764..79cdb7d2c2 100644 --- a/packages/typespec-ts/src/index.ts +++ b/packages/typespec-ts/src/index.ts @@ -31,7 +31,8 @@ import { hasUnexpectedHelper, RLCModel, buildSamples, - buildVitestConfig + buildVitestConfig, + buildTsTestBrowserConfig } from "@azure-tools/rlc-common"; import { transformRLCModel } from "./transform/transform.js"; import { emitContentByBuilder, emitModels } from "./utils/emitUtil.js"; @@ -72,10 +73,7 @@ export async function $onEmit(context: EmitContext) { /** Shared status */ const program: Program = context.program; const emitterOptions: EmitterOptions = context.options; - const dpgContext = createSdkContext( - context, - "@azure-tools/typespec-ts" - ) as SdkContext; + const dpgContext = createContextWithDefaultOptions(context); const needUnexpectedHelper: Map = new Map(); const serviceNameToRlcModelsMap: Map = new Map< string, @@ -130,6 +128,28 @@ export async function $onEmit(context: EmitContext) { }; } + function createContextWithDefaultOptions( + context: EmitContext> + ): SdkContext { + const tcgcSettings = { + "generate-protocol-methods": true, + "generate-convenience-methods": true, + "flatten-union-as-enum": false, + emitters: [ + { + main: "@azure-tools/typespec-ts", + metadata: { name: "@azure-tools/typespec-ts" } + } + ] + }; + context.options = { + ...context.options, + ...tcgcSettings + }; + + return createSdkContext(context) as SdkContext; + } + async function clearSrcFolder() { await fsextra.emptyDir( dpgContext.generationPathDetail?.modularSourcesDir ?? @@ -284,6 +304,7 @@ export async function $onEmit(context: EmitContext) { if (option.moduleKind === "esm") { commonBuilders.push((model) => buildVitestConfig(model, "node")); commonBuilders.push((model) => buildVitestConfig(model, "browser")); + commonBuilders.push((model) => buildTsTestBrowserConfig(model)); } if (isAzureFlavor) { commonBuilders.push(buildEsLintConfig); diff --git a/packages/typespec-ts/src/modular/buildClassicalClient.ts b/packages/typespec-ts/src/modular/buildClassicalClient.ts index 420e8c0b32..32c90d36d9 100644 --- a/packages/typespec-ts/src/modular/buildClassicalClient.ts +++ b/packages/typespec-ts/src/modular/buildClassicalClient.ts @@ -36,14 +36,18 @@ export function buildClassicalClient( const subfolder = client.subfolder ?? ""; const clientFile = codeModel.project.createSourceFile( - `${srcPath}/${ - subfolder !== "" ? subfolder + "/" : "" - }${classicalClientname}.ts` + `${srcPath}/${subfolder !== "" ? subfolder + "/" : ""}${normalizeName( + classicalClientname, + NameType.File + )}.ts` ); clientFile.addExportDeclaration({ namedExports: [`${classicalClientname}Options`], - moduleSpecifier: `./api/${modularClientName}Context.js` + moduleSpecifier: `./api/${normalizeName( + modularClientName, + NameType.File + )}Context.js` }); const clientClass = clientFile.addClass({ @@ -205,7 +209,7 @@ function buildClientOperationGroups( const declarations = getOperationFunction(op, clientType); const method: MethodDeclarationStructure = { docs: declarations.docs, - name: declarations.name ?? "FIXME", + name: declarations.propertyName ?? declarations.name ?? "FIXME", kind: StructureKind.Method, returnType: declarations.returnType, parameters: declarations.parameters?.filter( diff --git a/packages/typespec-ts/src/modular/buildClientContext.ts b/packages/typespec-ts/src/modular/buildClientContext.ts index 6480681099..14fe82fdc4 100644 --- a/packages/typespec-ts/src/modular/buildClientContext.ts +++ b/packages/typespec-ts/src/modular/buildClientContext.ts @@ -9,7 +9,12 @@ import { isRLCMultiEndpoint } from "../utils/clientUtils.js"; import { getDocsFromDescription } from "./helpers/docsHelpers.js"; import { importModels } from "./buildOperations.js"; import { SdkContext } from "../utils/interfaces.js"; -import { getImportSpecifier } from "@azure-tools/rlc-common"; +import { + getImportSpecifier, + normalizeName, + NameType +} from "@azure-tools/rlc-common"; +import { getType } from "./helpers/typeHelpers.js"; /** * This function creates the file containing the modular client context @@ -26,7 +31,7 @@ export function buildClientContext( const clientContextFile = codeModel.project.createSourceFile( `${srcPath}/${ subfolder && subfolder !== "" ? subfolder + "/" : "" - }/api/${name}Context.ts` + }/api/${normalizeName(name, NameType.File)}Context.ts` ); let factoryFunction; @@ -40,9 +45,22 @@ export function buildClientContext( clientContextFile.addInterface({ name: `${name}ClientOptions`, isExported: true, - extends: ["ClientOptions"] + extends: ["ClientOptions"], + properties: client.parameters + .filter((p) => { + return ( + p.optional || (p.type.type !== "constant" && p.clientDefaultValue) + ); + }) + .map((p) => { + return { + name: p.clientName, + type: getType(p.type).name, + hasQuestionToken: true, + docs: getDocsFromDescription(p.description) + }; + }) }); - if (isRLCMultiEndpoint(dpgContext)) { clientContextFile.addImportDeclaration({ moduleSpecifier: `../../rest/${subfolder}/index.js`, diff --git a/packages/typespec-ts/src/modular/buildCodeModel.ts b/packages/typespec-ts/src/modular/buildCodeModel.ts index 7ece8b41ae..85cd830297 100644 --- a/packages/typespec-ts/src/modular/buildCodeModel.ts +++ b/packages/typespec-ts/src/modular/buildCodeModel.ts @@ -1,7 +1,6 @@ import { - getLroMetadata, getPagedResult, - isFixed + getLroMetadata } from "@azure-tools/typespec-azure-core"; import { Enum, @@ -69,7 +68,6 @@ import { getAllModels, SdkBuiltInType, getSdkBuiltInType, - getClientType, SdkEnumValueType, getLibraryName, getWireName @@ -157,7 +155,8 @@ function applyCasing( const typesMap = new Map(); const simpleTypesMap = new Map(); const endpointPathParameters: Record[] = []; -let apiVersionParam: Parameter | undefined = undefined; +let methodApiVersionParam: Parameter | undefined = undefined; +let serverApiVersionParam: Parameter | undefined = undefined; function isSimpleType( program: Program, @@ -428,7 +427,11 @@ function emitParamBase( if (parameter.kind === "ModelProperty") { optional = parameter.optional; - name = getLibraryName(context, parameter); + name = normalizeName( + getLibraryName(context, parameter), + NameType.Parameter, + true + ); restApiName = getWireName(context, parameter); description = getDocStr(program, parameter); addedOn = getAddedOnVersion(program, parameter); @@ -518,7 +521,7 @@ function emitParameter( if ( isApiVersion(context, parameter as HttpOperationParameter) && - paramMap.location === "query" + (paramMap.location === "query" || paramMap.location === "endpointPath") ) { const defaultApiVersion = getDefaultApiVersion( context, @@ -779,8 +782,7 @@ function emitBasicOperation( if ( namespaceHierarchies.length === 0 && context.rlcOptions?.hierarchyClient === false && - operationGroupName !== "" && - namespaceHierarchies[0] !== operationGroupName + operationGroupName !== "" ) { namespaceHierarchies.push(operationGroupName); } @@ -792,7 +794,7 @@ function emitBasicOperation( const emittedParam = emitParameter(context, param, "Method"); if (isApiVersion(context, param)) { emittedParam.isApiVersion = true; - apiVersionParam = emittedParam; + methodApiVersionParam = emittedParam; } parameters.push(emittedParam); } @@ -871,7 +873,7 @@ function emitBasicOperation( param.clientName = param.clientName + "Parameter"; }); return { - name: normalizeName(name, NameType.Operation, true), + name, description: getDocStr(context.program, operation), summary: getSummary(context.program, operation) ?? "", url: httpOperation.path, @@ -978,8 +980,11 @@ function emitModel( baseModel = getType(context, type.baseModel, { usage }); } const effectiveName = getEffectiveSchemaType(context.program, type).name; - const overridedModelName = - getLibraryName(context, type) ?? getFriendlyName(context.program, type); + const overridedModelName = normalizeName( + getLibraryName(context, type) ?? getFriendlyName(context.program, type), + NameType.Interface, + true + ); const fullNamespaceName = getModelNamespaceName(context, type.namespace!) .map((nsName) => { @@ -1064,7 +1069,7 @@ function emitEnum(context: SdkContext, type: Enum): Record { description: getDocStr(program, type), valueType: { type: enumMemberType(type.members.values().next().value) }, values: enumValues, - isFixed: isFixed(program, type), + isFixed: true, coreTypeInfo: buildCoreTypeInfo(type) }; } @@ -1325,36 +1330,11 @@ function mapTypeSpecType( } } -function isExtensibleEnum(context: SdkContext, type: Enum): boolean { - if (isFixed(context.program, type)) { - return false; - } - - if (context.rlcOptions?.flavor === "azure") { - return true; - } - - return false; -} - function emitUnion( context: SdkContext, type: Union, usage: UsageFlags ): Record { - let isVariantExtensible = false; - - /** - * This is a temporary workaround to handle TCGC reporting incorrect isFixed for Unions with Enum variants - */ - for (const [_, variant] of type.variants) { - if (variant.type.kind === "Enum") { - if (isExtensibleEnum(context, variant.type)) { - isVariantExtensible = true; - break; - } - } - } const sdkType = getSdkUnion(context, type); const nonNullOptions = getNonNullOptions(type); if (sdkType === undefined) { @@ -1393,35 +1373,27 @@ function emitUnion( : variantTypes.map((x) => getTypeName(x).name).join(" | ") }; } else if (sdkType.kind === "enum") { + const typeName = getLibraryName(context, type) + ? getLibraryName(context, type) + : sdkType.isGeneratedName + ? type.name + : sdkType.name; return { - name: getLibraryName(context, type) - ? getLibraryName(context, type) - : type.name ?? sdkType.name, + name: typeName, nullable: sdkType.nullable, - description: sdkType.description || `Type of ${sdkType.name}`, + description: sdkType.description || `Type of ${typeName}`, internal: true, type: sdkType.kind, valueType: emitSimpleType(context, sdkType.valueType as SdkBuiltInType), values: sdkType.values.map((x) => emitEnumMember(context, x)), - isFixed: isVariantExtensible ? false : sdkType.isFixed, + isFixed: sdkType.isFixed, xmlMetadata: {}, usage }; - } else if ( - isStringOrNumberKind(context.program, sdkType.kind) && - isStringOrNumberKind(context.program, nonNullOptions[0]?.kind) - ) { + } else if (nonNullOptions.length === 1 && nonNullOptions[0]) { return { - name: undefined, // string/number union will be mapped as fixed enum without name - nullable: sdkType.nullable, - internal: true, - type: "enum", - valueType: emitSimpleType(context, sdkType as SdkBuiltInType), - values: nonNullOptions - .map((x) => getClientType(context, x)) - .map((x) => emitEnumMember(context, x)), - isFixed: true, - xmlMetadata: {} + ...emitType(context, nonNullOptions[0], usage), + nullable: sdkType.nullable }; } else { return { @@ -1431,20 +1403,6 @@ function emitUnion( } } -function isStringOrNumberKind(program: Program, kind?: string): boolean { - if (!kind) { - return false; - } - kind = kind.toLowerCase(); - try { - const type = emitStdScalar(program, { name: kind } as any); - kind = type["type"] ?? kind; - } catch (e: any) { - // ignore - } - return ["string", "number", "integer", "float"].includes(kind!); -} - function getNonNullOptions(type: Union) { return [...type.variants.values()] .map((x) => x.type) @@ -1478,7 +1436,7 @@ function emitSimpleType( return { nullable: sdkType.nullable, - type: "number", // TODO: switch to kind + type: sdkType.kind === "string" ? "string" : "number", // TODO: handle other types doc: "", apiVersions: [], sdkDefaultValue: undefined, @@ -1681,13 +1639,10 @@ function emitServerParams( "Client" ); endpointPathParameters.push(emittedParameter); - if ( - isApiVersion(context, serverParameter as any) && - apiVersionParam === undefined - ) { + if (isApiVersion(context, serverParameter as any)) { + emittedParameter.isApiVersion = true; + serverApiVersionParam = emittedParameter; emittedParameter.isApiVersion = true; - apiVersionParam = emittedParameter; - continue; } params.push(emittedParameter); } @@ -1763,10 +1718,10 @@ function emitGlobalParameters( return clientParameters; } -function getApiVersionParameter(): Parameter | void { - if (apiVersionParam) { +function getMethodApiVersionParameter(): Parameter | void { + if (methodApiVersionParam) { return { - ...apiVersionParam, + ...methodApiVersionParam, isApiVersion: true }; } @@ -1780,7 +1735,7 @@ function emitClients( const program = context.program; const clients = listClients(context); const retval: HrlcClient[] = []; - apiVersionParam = undefined; + methodApiVersionParam = undefined; for (const client of clients) { const clientName = getLibraryName(context, client.type).replace( "Client", @@ -1806,9 +1761,14 @@ function emitClients( rlcHelperDetails: rlcModels && rlcModels.helperDetails ? rlcModels.helperDetails : {} }; - const emittedApiVersionParam = getApiVersionParameter(); - if (emittedApiVersionParam && context.hasApiVersionInClient) { - emittedClient.parameters.push(emittedApiVersionParam); + const methodApiVersionParam = getMethodApiVersionParameter(); + if ( + methodApiVersionParam && + !serverApiVersionParam && + context.hasApiVersionInClient + ) { + // prompt method-level api version to client level only when there is no client one defined + emittedClient.parameters.push(methodApiVersionParam); // if we have client level api version, we need to remove it from all operations emittedClient.operationGroups.map((opGroup) => { opGroup.operations.map((op) => { @@ -1872,7 +1832,7 @@ export function emitCodeModel( simpleTypesMap.clear(); const allModels = getAllModels(dpgContext); for (const model of allModels) { - getType(dpgContext, model.__raw!, { usage: model.usage }); + getType(dpgContext, model.__raw!, { usage: model.usage as UsageFlags }); } for (const namespace of getNamespaces(dpgContext)) { diff --git a/packages/typespec-ts/src/modular/buildLroFiles.ts b/packages/typespec-ts/src/modular/buildLroFiles.ts index 877defaf8c..e420c43c75 100644 --- a/packages/typespec-ts/src/modular/buildLroFiles.ts +++ b/packages/typespec-ts/src/modular/buildLroFiles.ts @@ -4,6 +4,7 @@ import { isLroOnlyOperation } from "./helpers/operationHelpers.js"; import { ModularCodeModel, Client } from "./modularCodeModel.js"; import path from "path"; import { buildLroDeserDetailMap } from "./buildOperations.js"; +import { NameType, normalizeName } from "@azure-tools/rlc-common"; /** * Always import LRO dependencies and remember to remove if unused. @@ -215,12 +216,12 @@ function importClientContext(client: Client, sourceFile: SourceFile): string[] { const clientContextName = client.rlcClientName; sourceFile.addImportDeclaration({ namedImports: [`${clientContextName}`], - moduleSpecifier: `./api/${name}Context.js` + moduleSpecifier: `./api/${normalizeName(name, NameType.File)}Context.js` }); sourceFile.addImportDeclaration({ namedImports: [`${classicalClientname}`], - moduleSpecifier: `./${classicalClientname}.js` + moduleSpecifier: `./${normalizeName(classicalClientname, NameType.File)}.js` }); return [clientContextName, classicalClientname]; } diff --git a/packages/typespec-ts/src/modular/buildRootIndex.ts b/packages/typespec-ts/src/modular/buildRootIndex.ts index 029d77d7b0..caeb789d5a 100644 --- a/packages/typespec-ts/src/modular/buildRootIndex.ts +++ b/packages/typespec-ts/src/modular/buildRootIndex.ts @@ -1,6 +1,7 @@ import { Project, SourceFile } from "ts-morph"; import { getClientName } from "./helpers/namingHelpers.js"; import { Client, ModularCodeModel } from "./modularCodeModel.js"; +import { normalizeName, NameType } from "@azure-tools/rlc-common"; export function buildRootIndex( codeModel: ModularCodeModel, @@ -12,11 +13,19 @@ export function buildRootIndex( const subfolder = client.subfolder ?? ""; const clientName = `${getClientName(client)}Client`; const clientFile = project.getSourceFile( - `${srcPath}/${subfolder !== "" ? subfolder + "/" : ""}${clientName}.ts` + `${srcPath}/${subfolder !== "" ? subfolder + "/" : ""}${normalizeName( + clientName, + NameType.File + )}.ts` ); if (!clientFile) { - throw new Error(`Couldn't find client file: ${srcPath}/${clientName}.ts`); + throw new Error( + `Couldn't find client file: ${srcPath}/${normalizeName( + clientName, + NameType.File + )}.ts` + ); } exportClassicalClient(client, rootIndexFile, subfolder); @@ -93,7 +102,7 @@ function exportClassicalClient( namedExports: [clientName, `${clientName}Options`], moduleSpecifier: `./${ subfolder !== "" && !isSubClient ? subfolder + "/" : "" - }${clientName}.js` + }${normalizeName(clientName, NameType.File)}.js` }); } @@ -147,7 +156,7 @@ export function buildSubClientIndexFile( const clientName = `${getClientName(client)}Client`; const clientFilePath = `${srcPath}/${ subfolder !== "" ? subfolder + "/" : "" - }${clientName}.ts`; + }${normalizeName(clientName, NameType.File)}.ts`; const clientFile = codeModel.project.getSourceFile(clientFilePath); if (!clientFile) { diff --git a/packages/typespec-ts/src/modular/emitModels.ts b/packages/typespec-ts/src/modular/emitModels.ts index d921f86dbd..cb812909a4 100644 --- a/packages/typespec-ts/src/modular/emitModels.ts +++ b/packages/typespec-ts/src/modular/emitModels.ts @@ -82,6 +82,7 @@ export function extractAliases(codeModel: ModularCodeModel): Type[] { function buildEnumModel( model: Type ): OptionalKind { + const valueType = model.valueType?.type === "string" ? "string" : "number"; return { name: model.name!, isExported: true, @@ -91,14 +92,23 @@ function buildEnumModel( // output will be a literal union which is self documenting model.isFixed ? "" - : // When we generate an "extensible" enum, the type will be "string" so we list the known values + : // When we generate an "extensible" enum, the type will be "string" or "number" so we list the known values // in the docs for user reference. - (model.values ?? []).map((v) => `"${v.value}"`).join(", ") + getEnumValues() ], - type: model.isFixed - ? (model.values ?? []).map((v) => `"${v.value}"`).join(" | ") - : "string" + type: buildEnumType() }; + + function buildEnumType() { + return model.isFixed ? getEnumValues(" | ") : valueType; + } + + function getEnumValues(separator: string = ", ") { + const splitWord = valueType === "string" ? `"` : ``; + return (model.values ?? []) + .map((v) => `${splitWord}${v.value}${splitWord}`) + .join(separator); + } } type InterfaceStructure = OptionalKind & { diff --git a/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts b/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts index 0ac4531f07..8fa991ef7a 100644 --- a/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/classicalOperationHelpers.ts @@ -22,13 +22,13 @@ export function getClassicalOperation( .filter((i) => { return ( i.getModuleSpecifierValue() === - `${"../".repeat(layer + 2)}api/${modularClientName}.js` + `${"../".repeat(layer + 2)}api/${normalizeName(modularClientName, NameType.File)}.js` ); }); if (!hasClientContextImport || hasClientContextImport.length === 0) { classicFile.addImportDeclaration({ namedImports: [client.rlcClientName], - moduleSpecifier: `${"../".repeat(layer + 2)}api/${modularClientName}.js` + moduleSpecifier: `${"../".repeat(layer + 2)}api/${normalizeName(modularClientName, NameType.File)}.js` }); } @@ -80,7 +80,10 @@ export function getClassicalOperation( .map( (p) => p.name + - (p.name === "options" || p.hasQuestionToken ? "?" : "") + + (p.type?.toString().endsWith("OptionalParams") || + p.hasQuestionToken + ? "?" + : "") + ": " + p.type ) @@ -121,7 +124,10 @@ export function getClassicalOperation( .map( (p) => p.name + - (p.name === "options" || p.hasQuestionToken ? "?" : "") + + (p.type?.toString().endsWith("OptionalParams") || + p.hasQuestionToken + ? "?" + : "") + ": " + p.type ) @@ -212,8 +218,15 @@ export function getClassicalOperation( } function getClassicalMethodName( - declaration: OptionalKind + declaration: OptionalKind & { + propertyName?: string; + } ) { - return operationMap.get(declaration) ?? declaration.name ?? "FIXME"; + return ( + operationMap.get(declaration) ?? + declaration.propertyName ?? + declaration.name ?? + "FIXME" + ); } } diff --git a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts index 4653131333..5cc68dd489 100644 --- a/packages/typespec-ts/src/modular/helpers/clientHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/clientHelpers.ts @@ -24,6 +24,7 @@ export function getClientParameters( ...parameters .filter( (p) => + p.optional === false && p.type.type !== "constant" && (p.clientDefaultValue === null || p.clientDefaultValue === undefined) ) diff --git a/packages/typespec-ts/src/modular/helpers/namingHelpers.ts b/packages/typespec-ts/src/modular/helpers/namingHelpers.ts index b8e1a29be0..846085cfd6 100644 --- a/packages/typespec-ts/src/modular/helpers/namingHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/namingHelpers.ts @@ -22,16 +22,17 @@ export function getOperationName( const casingFn = options.casing === "camel" ? toCamelCase : toPascalCase; if (isReservedName(operation.name, NameType.Operation)) { return { - name: normalizeName(operation.name, NameType.Operation, true), + name: `$${operation.name}`, fixme: [ - `${operation.name} is a reserved word that cannot be used as an operation name. Please add @projectedName( - "javascript", "") to the operation to override the generated name.` + `${operation.name} is a reserved word that cannot be used as an operation name. + Please add @clientName("clientName") or @clientName("", "javascript") + to the operation to override the generated name.` ] }; } return { - name: casingFn(operation.name) + name: normalizeName(casingFn(operation.name), NameType.Operation, true) }; } diff --git a/packages/typespec-ts/src/modular/helpers/operationHelpers.ts b/packages/typespec-ts/src/modular/helpers/operationHelpers.ts index f06bbd3d74..87e0c083aa 100644 --- a/packages/typespec-ts/src/modular/helpers/operationHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/operationHelpers.ts @@ -19,8 +19,7 @@ import { NameType, OperationResponse, getResponseBaseName, - getResponseTypeName, - normalizeName + getResponseTypeName } from "@azure-tools/rlc-common"; import { getClassicalLayerPrefix, getOperationName } from "./namingHelpers.js"; import { @@ -91,12 +90,15 @@ export function getSendPrivateFunction( const operationPath = operation.url; const operationMethod = operation.method.toLowerCase(); + const optionalParamName = parameters.filter( + (p) => p.type?.toString().endsWith("OptionalParams") + )[0]?.name; const statements: string[] = []; statements.push( `return context.path("${operationPath}", ${getPathParameters( operation - )}).${operationMethod}({...operationOptionsToRequestParameters(options), ${getRequestParameters( + )}).${operationMethod}({...operationOptionsToRequestParameters(${optionalParamName}), ${getRequestParameters( dpgContext, operation, runtimeImports @@ -285,7 +287,7 @@ function getOperationSignatureParameters( // Add the options parameter const optionsParam = { - name: "options", + name: parameters.has("options") ? "optionalParams" : "options", type: optionsType, initializer: "{ requestOptions: {} }" }; @@ -301,13 +303,13 @@ function getOperationSignatureParameters( export function getOperationFunction( operation: Operation, clientType: string -): OptionalKind { +): OptionalKind & { propertyName?: string } { if (isPagingOnlyOperation(operation)) { // Case 1: paging-only operation return getPagingOnlyOperationFunction(operation, clientType); } else if (isLroOnlyOperation(operation)) { // Case 2: lro-only operation - return getLroOnlyOperatonFunction(operation, clientType); + return getLroOnlyOperationFunction(operation, clientType); } else if (isLroAndPagingOperation(operation)) { // Case 3: both paging + lro operation is not supported yet so handle them as normal operation and customization may be needed // https://github.com/Azure/autorest.typescript/issues/2313 @@ -325,14 +327,15 @@ export function getOperationFunction( returnType = buildType(type.name, type, type.format); } const { name, fixme = [] } = getOperationName(operation); - const functionStatement: OptionalKind = { + const functionStatement = { docs: [ ...getDocsFromDescription(operation.description), ...getFixmeForMultilineDocs(fixme) ], isAsync: true, isExported: true, - name: normalizeName(operation.name, NameType.Operation, true), + name, + propertyName: operation.name, parameters, returnType: `Promise<${returnType.type}>` }; @@ -351,20 +354,21 @@ export function getOperationFunction( }; } -function getLroOnlyOperatonFunction(operation: Operation, clientType: string) { +function getLroOnlyOperationFunction(operation: Operation, clientType: string) { // Extract required parameters const parameters: OptionalKind[] = getOperationSignatureParameters(operation, clientType); const returnType = buildLroReturnType(operation); const { name, fixme = [] } = getOperationName(operation); - const functionStatement: OptionalKind = { + const functionStatement = { docs: [ ...getDocsFromDescription(operation.description), ...getFixmeForMultilineDocs(fixme) ], isAsync: false, isExported: true, - name: normalizeName(operation.name, NameType.Operation, true), + name, + propertyName: operation.name, parameters, returnType: `PollerLike, ${returnType.type}>` }; @@ -412,14 +416,15 @@ function getPagingOnlyOperationFunction( returnType = buildType(type.name, type, type.format); } const { name, fixme = [] } = getOperationName(operation); - const functionStatement: OptionalKind = { + const functionStatement = { docs: [ ...getDocsFromDescription(operation.description), ...getFixmeForMultilineDocs(fixme) ], isAsync: false, isExported: true, - name: normalizeName(operation.name, NameType.Operation, true), + name, + propertyName: operation.name, parameters, returnType: `PagedAsyncIterableIterator<${returnType.type}>` }; @@ -469,13 +474,7 @@ export function getOperationOptionsName( includeGroupName && operation.name.indexOf("_") === -1 ? getClassicalLayerPrefix(operation, NameType.Interface) : ""; - const optionName = `${prefix}${toPascalCase(operation.name)}Options`; - if ( - operation.bodyParameter?.type.name === optionName || - optionName === "ClientOptions" - ) { - return optionName.replace(/Options$/, "RequestOptions"); - } + const optionName = `${prefix}${toPascalCase(operation.name)}OptionalParams`; return optionName; } @@ -635,12 +634,12 @@ function buildBodyParameter( return bodyParameter.optional ? `body: typeof ${bodyParameter.clientName} === 'string' ? uint8ArrayToString(${bodyParameter.clientName}, "${getEncodingFormat( - bodyParameter.type + bodyParameter )}") : ${bodyParameter.clientName}` : `body: uint8ArrayToString(${ bodyParameter.clientName - }, "${getEncodingFormat(bodyParameter.type)}")`; + }, "${getEncodingFormat(bodyParameter)}")`; } else if (bodyParameter.isBinaryPayload) { return `\nbody: ${bodyParameter.clientName},`; } @@ -1290,6 +1289,9 @@ export function serializeRequestValue( return `${clientValue} as any`; } default: + if (clientValue === "constructorParam") { + return `${clientValue} as any`; + } return clientValue; } } diff --git a/packages/typespec-ts/src/modular/helpers/typeHelpers.ts b/packages/typespec-ts/src/modular/helpers/typeHelpers.ts index 4dd75c6e1a..b6cf7c7fcb 100644 --- a/packages/typespec-ts/src/modular/helpers/typeHelpers.ts +++ b/packages/typespec-ts/src/modular/helpers/typeHelpers.ts @@ -103,7 +103,6 @@ export function getType(type: Type, format?: string): TypeMetadata { case "never": return { name: "never", nullable: type.nullable }; - default: throw new Error(`Unsupported type ${type.type}`); } diff --git a/packages/typespec-ts/src/modular/modularCodeModel.ts b/packages/typespec-ts/src/modular/modularCodeModel.ts index 507456f655..06ab254ccb 100644 --- a/packages/typespec-ts/src/modular/modularCodeModel.ts +++ b/packages/typespec-ts/src/modular/modularCodeModel.ts @@ -40,6 +40,7 @@ export interface BodyParameter { restApiName: string; location: "body"; optional: boolean; + format?: string; description: string; clientName: string; inOverload: boolean; diff --git a/packages/typespec-ts/src/transform/transform.ts b/packages/typespec-ts/src/transform/transform.ts index 375e3077ea..e9f479b8df 100644 --- a/packages/typespec-ts/src/transform/transform.ts +++ b/packages/typespec-ts/src/transform/transform.ts @@ -16,7 +16,8 @@ import { SchemaContext, UrlInfo, initInternalImports, - transformSampleGroups + transformSampleGroups, + Imports } from "@azure-tools/rlc-common"; import { getDoc } from "@typespec/compiler"; import { getServers } from "@typespec/http"; @@ -24,6 +25,7 @@ import { join } from "path"; import { getDefaultService, getFormattedPropertyDoc, + getImportedModelName, getSchemaForType, getTypeName, predictDefaultValue @@ -60,7 +62,7 @@ export async function transformRLCModel( NameType.Class ); const importSet = initInternalImports(); - const urlInfo = transformUrlInfo(client, dpgContext); + const urlInfo = transformUrlInfo(client, dpgContext, importSet); const paths: Paths = transformPaths(program, client, dpgContext); const schemas: Schema[] = transformSchemas(program, client, dpgContext); const responses: OperationResponse[] = transformToResponseTypes( @@ -113,8 +115,11 @@ export async function transformRLCModel( export function transformUrlInfo( client: SdkClient, - dpgContext: SdkContext + dpgContext: SdkContext, + importDetails: Imports ): UrlInfo | undefined { + const importedModels = new Set(); + const usage = [SchemaContext.Exception, SchemaContext.Input]; const program = dpgContext.program; const serviceNs = getDefaultService(program)?.type; let endpoint = undefined; @@ -135,28 +140,36 @@ export function transformUrlInfo( } const schema = getSchemaForType(dpgContext, type, { - usage: [SchemaContext.Exception, SchemaContext.Input], + usage: usage, needRef: false, relevantProperty: property }); + getImportedModelName(schema, usage)?.forEach( + importedModels.add, + importedModels + ); urlParameters.push({ oriName: key, name: normalizeName(key, NameType.Parameter, true), - type: getTypeName(schema), + type: getTypeName(schema, usage), description: (getDoc(program, property) && getFormattedPropertyDoc(program, property, schema, " ")) ?? - getFormattedPropertyDoc(program, type, schema, " " /* sperator*/), + getFormattedPropertyDoc(program, type, schema, " " /* separator*/), value: predictDefaultValue(dpgContext, host?.[0]?.parameters.get(key)) }); } } } + if (importedModels.size > 0) { + importDetails.rlcClientFactory.importsSet = importedModels; + } let hasApiVersionInUrl = false; if (endpoint && urlParameters.length > 0) { for (const param of urlParameters) { if (param.oriName === "apiVersion") { hasApiVersionInUrl = true; + dpgContext.hasApiVersionInClient = true; } if (param.oriName) { const regexp = new RegExp(`{${param.oriName}}`, "g"); diff --git a/packages/typespec-ts/src/transform/transformApiVersionInfo.ts b/packages/typespec-ts/src/transform/transformApiVersionInfo.ts index e81576e720..85d32afac6 100644 --- a/packages/typespec-ts/src/transform/transformApiVersionInfo.ts +++ b/packages/typespec-ts/src/transform/transformApiVersionInfo.ts @@ -41,6 +41,9 @@ export function transformApiVersionInfo( if (pathVersionDetail && queryVersionDetail) { return pathVersionDetail; } + if (pathVersionDetail && !queryVersionDetail) { + dpgContext.hasApiVersionInClient = true; + } return { definedPosition: extractDefinedPosition( queryVersionDetail, diff --git a/packages/typespec-ts/src/transform/transformSchemas.ts b/packages/typespec-ts/src/transform/transformSchemas.ts index fd1422de77..d13380bb84 100644 --- a/packages/typespec-ts/src/transform/transformSchemas.ts +++ b/packages/typespec-ts/src/transform/transformSchemas.ts @@ -8,13 +8,14 @@ import { } from "@azure-tools/typespec-client-generator-core"; import { SchemaContext } from "@azure-tools/rlc-common"; import { ignoreDiagnostics, Model, Program, Type } from "@typespec/compiler"; -import { getHttpOperation, HttpOperation } from "@typespec/http"; +import { getHttpOperation, getServers, HttpOperation } from "@typespec/http"; import { getSchemaForType, includeDerivedModel, getBodyType, trimUsage, - isAzureCoreErrorType + isAzureCoreErrorType, + getDefaultService } from "../utils/modelUtils.js"; import { SdkContext } from "../utils/interfaces.js"; import { KnownMediaType, extractMediaTypes } from "../utils/mediaTypes.js"; @@ -65,7 +66,9 @@ export function transformSchemas( const bodyModel = getBodyType(program, route); if ( bodyModel && - (bodyModel.kind === "Model" || bodyModel.kind === "Union") + (bodyModel.kind === "Model" || + bodyModel.kind === "Union" || + bodyModel.kind === "Enum") ) { requestBodySet.add(bodyModel); const contentTypes: KnownMediaType[] = extractMediaTypes( @@ -96,6 +99,22 @@ export function transformSchemas( } } } + function transformHostParameters() { + const serviceNs = getDefaultService(program)?.type; + if (serviceNs) { + const host = getServers(program, serviceNs); + if (host && host?.[0] && host?.[0]?.parameters) { + for (const key of host[0].parameters.keys()) { + const type = host?.[0]?.parameters.get(key)?.type; + if (!type) { + continue; + } + getGeneratedModels(type, SchemaContext.Input); + } + } + } + } + transformHostParameters(); program.stateMap(modelKey).forEach((context, tspModel) => { const model = getSchemaForType(dpgContext, tspModel, { usage: context, @@ -131,22 +150,6 @@ export function transformSchemas( } function getGeneratedModels(model: Type, context: SchemaContext) { if (model.kind === "Model") { - if ( - model.templateMapper && - model.templateMapper.args && - model.templateMapper.args.length > 0 - ) { - const temp = model.templateMapper.args[0]; - if ( - temp && - temp.kind === "Model" && - (!program.stateMap(modelKey).get(temp) || - !program.stateMap(modelKey).get(temp)?.includes(context)) - ) { - getGeneratedModels(temp, context); - } - } - setModelMap(model, context); const indexer = (model as Model).indexer; if ( @@ -161,26 +164,21 @@ export function transformSchemas( } for (const prop of model.properties) { const [, propType] = prop; - if ( - propType.type.kind === "Model" && - (!program.stateMap(modelKey).get(propType.type) || - !program.stateMap(modelKey).get(propType.type)?.includes(context)) - ) { + if (program.stateMap(modelKey).get(propType.type)?.includes(context)) { + continue; + } + if (propType.type.kind === "Model") { if (isAzureCoreErrorType(propType.type)) { continue; } getGeneratedModels(propType.type, context); - } - if ( - propType.type.kind === "Union" && - (!program.stateMap(modelKey).get(propType.type) || - !program.stateMap(modelKey).get(propType.type)?.includes(context)) - ) { + } else if (propType.type.kind === "Union") { const variants = Array.from(propType.type.variants.values()); for (const variant of variants) { if ( (variant.type.kind === "Model" || - variant.type.kind === "Union") && + variant.type.kind === "Union" || + variant.type.kind === "Enum") && (!program.stateMap(modelKey).get(variant.type) || !program .stateMap(modelKey) @@ -194,6 +192,8 @@ export function transformSchemas( if (!propType.type.expression) { setModelMap(propType.type, context); } + } else if (propType.type.kind === "Enum") { + getGeneratedModels(propType.type, context); } } const baseModel = model.baseModel; @@ -236,6 +236,8 @@ export function transformSchemas( } } else if (model.kind === "ModelProperty") { getGeneratedModels(model.type, context); + } else if (model.kind === "Enum") { + setModelMap(model, context); } } const allSchemas = Array.from(schemas, function (item) { diff --git a/packages/typespec-ts/src/utils/modelUtils.ts b/packages/typespec-ts/src/utils/modelUtils.ts index 8dfb32f248..8f90f1289b 100644 --- a/packages/typespec-ts/src/utils/modelUtils.ts +++ b/packages/typespec-ts/src/utils/modelUtils.ts @@ -63,7 +63,7 @@ import { createMetadataInfo, Visibility } from "@typespec/http"; -import { getPagedResult, isFixed } from "@azure-tools/typespec-azure-core"; +import { getPagedResult } from "@azure-tools/typespec-azure-core"; import { extractPagedMetadataNested } from "./operationUtil.js"; import { getDefaultApiVersion, @@ -604,15 +604,18 @@ function getSchemaForModel( .join("") + "List"; } + const isCoreModel = isAzureCoreErrorType(model); const modelSchema: ObjectSchema = { - name: - overridedModelName !== name + name: isCoreModel + ? name + : overridedModelName !== name ? overridedModelName : dpgContext.rlcOptions?.enableModelNamespace ? fullNamespaceName : name, type: "object", - description: getDoc(program, model) ?? "" + description: getDoc(program, model) ?? "", + fromCore: isCoreModel }; // normalized the output name modelSchema.name = normalizeName( @@ -621,7 +624,7 @@ function getSchemaForModel( true /** shouldGuard */ ); - if (modelSchema.name === "Record" && isRecordModelType(program, model)) { + if (model.name === "Record" && isRecordModelType(program, model)) { return getSchemaForRecordModel(dpgContext, model, { usage }); } modelSchema.typeName = modelSchema.name; @@ -629,10 +632,6 @@ function getSchemaForModel( modelSchema.outputTypeName = modelSchema.name + "Output"; } - if (isAzureCoreErrorType(model)) { - modelSchema.fromCore = true; - } - if (getPagedResult(program, model)) { const paged = extractPagedMetadataNested(program, model); if (paged && paged.itemsProperty) { @@ -925,16 +924,22 @@ function getSchemaForEnum(dpgContext: SdkContext, e: Enum) { values.push(getSchemaForType(dpgContext, option)); } - const schema: any = { type, description: getDoc(dpgContext.program, e) }; + const schema: any = { + type: "object", + name: e.name, + typeName: e.name, + outputTypeName: e.name + "Output", + description: getDoc(dpgContext.program, e), + memberType: type + }; + if (values.length > 0) { schema.enum = values; - schema.type = values + const unionAlias = values .map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`) .join(" | "); - if (!isFixed(dpgContext.program, e)) { - schema.name = "string"; - schema.typeName = "string"; - } + schema.alias = unionAlias; + schema.outputAlias = unionAlias; } return schema; } diff --git a/packages/typespec-ts/test/commands/cadl-ranch-list.ts b/packages/typespec-ts/test/commands/cadl-ranch-list.ts index cc9a8df68d..365e99e4c0 100644 --- a/packages/typespec-ts/test/commands/cadl-ranch-list.ts +++ b/packages/typespec-ts/test/commands/cadl-ranch-list.ts @@ -161,10 +161,6 @@ export const rlcTsps: TypeSpecRanchConfig[] = [ outputPath: "parameters/spread", inputPath: "parameters/spread" }, - { - outputPath: "projection", - inputPath: "projection/projected-name" - }, { outputPath: "server/path/single", inputPath: "server/path/single" @@ -213,6 +209,10 @@ export const rlcTsps: TypeSpecRanchConfig[] = [ outputPath: "payload/pageable", inputPath: "payload/pageable" }, + { + outputPath: "payload/media-type", + inputPath: "payload/media-type" + }, { outputPath: "client/naming", inputPath: "client/naming" @@ -257,6 +257,14 @@ export const modularTsps: TypeSpecRanchConfig[] = [ outputPath: "azure/clientGeneratorCore/usage", inputPath: "azure/client-generator-core/usage" }, + { + outputPath: "azure/clientGeneratorCore/access", + inputPath: "azure/client-generator-core/access" + }, + { + outputPath: "azure/clientGeneratorCore/usage", + inputPath: "azure/client-generator-core/usage" + }, { outputPath: "parameters/body-optionality", inputPath: "parameters/body-optionality" @@ -378,6 +386,10 @@ export const modularTsps: TypeSpecRanchConfig[] = [ outputPath: "unions", inputPath: "type/union" }, + { + outputPath: "payload/media-type", + inputPath: "payload/media-type" + }, { outputPath: "server/versions/versioned", inputPath: "server/versions/versioned" @@ -405,6 +417,18 @@ export const modularTsps: TypeSpecRanchConfig[] = [ { outputPath: "server/endpoint/not-defined", inputPath: "server/endpoint/not-defined" + }, + { + outputPath: "specialWords", + inputPath: "special-words" + }, + { + outputPath: "enums/extensible", + inputPath: "type/enum/extensible" + }, + { + outputPath: "enums/fixed", + inputPath: "type/enum/fixed" } ]; diff --git a/packages/typespec-ts/test/integration/clientNaming.spec.ts b/packages/typespec-ts/test/integration/clientNaming.spec.ts index af583a4e0e..602feef16a 100644 --- a/packages/typespec-ts/test/integration/clientNaming.spec.ts +++ b/packages/typespec-ts/test/integration/clientNaming.spec.ts @@ -113,4 +113,29 @@ describe("ClientEncodedNameClient Rest Client", () => { assert.fail(err as string); } }); + + it("should work with union enum name", async () => { + try { + const result = await client + .path("/client/naming/union-enum/union-enum-name") + .post({ body: "value1", headers: { "content-type": "text/plain" } }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should work with union enum member name", async () => { + try { + const result = await client + .path("/client/naming/union-enum/union-enum-member-name") + .post({ + body: "value1", + headers: { "content-type": "text/plain" } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); }); diff --git a/packages/typespec-ts/test/integration/encodeBytes.spec.ts b/packages/typespec-ts/test/integration/encodeBytes.spec.ts index e552c15ee3..380c780b89 100644 --- a/packages/typespec-ts/test/integration/encodeBytes.spec.ts +++ b/packages/typespec-ts/test/integration/encodeBytes.spec.ts @@ -3,6 +3,7 @@ import EncodeBytesClientFactory, { BytesClient } from "./generated/encode/bytes/src/index.js"; import { buildCsvCollection } from "./generated/encode/bytes/src/serializeHelper.js"; +import { uint8ArrayToString } from "@azure/core-util"; import { readFileSync } from "fs"; import { resolve } from "path"; @@ -71,17 +72,18 @@ describe("EncodeDatetimeClient Rest Client", () => { assert.fail(err as string); } }); - }); describe("property", () => { it(`should post bytes`, async () => { try { - const result = await client.path(`/encode/bytes/property/default`).post({ - body: { - value: "dGVzdA==" - } - }); + const result = await client + .path(`/encode/bytes/property/default`) + .post({ + body: { + value: "dGVzdA==" + } + }); assert.strictEqual(result.status, "200"); } catch (err) { assert.fail(err as string); @@ -103,11 +105,13 @@ describe("EncodeDatetimeClient Rest Client", () => { it(`should post bytes base64url encoding`, async () => { try { - const result = await client.path(`/encode/bytes/property/base64url`).post({ - body: { - value: "dGVzdA" - } - }); + const result = await client + .path(`/encode/bytes/property/base64url`) + .post({ + body: { + value: "dGVzdA" + } + }); assert.strictEqual(result.status, "200"); } catch (err) { assert.fail(err as string); @@ -128,7 +132,6 @@ describe("EncodeDatetimeClient Rest Client", () => { assert.fail(err as string); } }); - }); describe("header", () => { @@ -185,17 +188,20 @@ describe("EncodeDatetimeClient Rest Client", () => { assert.fail(err as string); } }); - }); describe("request body", () => { - const pngFile = readFileSync(resolve("../../packages/typespec-ts/temp/assets/image.png")); + const pngFile = readFileSync( + resolve("../../packages/typespec-ts/temp/assets/image.png") + ); it(`should post bytes`, async () => { try { - const result = await client.path(`/encode/bytes/body/request/default`).post({ - contentType: "application/json", - body: "dGVzdA==" - }); + const result = await client + .path(`/encode/bytes/body/request/default`) + .post({ + contentType: "application/json", + body: "dGVzdA==" + }); assert.strictEqual(result.status, "204"); } catch (err) { assert.fail(err as string); @@ -204,10 +210,12 @@ describe("EncodeDatetimeClient Rest Client", () => { it(`should post bytes base64 encoding`, async () => { try { - const result = await client.path(`/encode/bytes/body/request/base64`).post({ - contentType: "application/json", - body: "dGVzdA==" - }); + const result = await client + .path(`/encode/bytes/body/request/base64`) + .post({ + contentType: "application/json", + body: "dGVzdA==" + }); assert.strictEqual(result.status, "204"); } catch (err) { assert.fail(err as string); @@ -216,17 +224,19 @@ describe("EncodeDatetimeClient Rest Client", () => { it(`should post bytes base64url encoding`, async () => { try { - const result = await client.path(`/encode/bytes/body/request/base64url`).post({ - contentType: "application/json", - body: "dGVzdA" - }); + const result = await client + .path(`/encode/bytes/body/request/base64url`) + .post({ + contentType: "application/json", + body: "dGVzdA" + }); assert.strictEqual(result.status, "204"); } catch (err) { assert.fail(err as string); } }); - it.skip(`should post bytes with custom content type`, async () => { + it(`should post bytes with custom content type`, async () => { try { const result = await client .path(`/encode/bytes/body/request/custom-content-type`) @@ -240,7 +250,7 @@ describe("EncodeDatetimeClient Rest Client", () => { } }).timeout(10000); - it.skip(`should post bytes with custom content type`, async () => { + it(`should post bytes with custom content type`, async () => { try { const result = await client .path(`/encode/bytes/body/request/octet-stream`) @@ -256,12 +266,16 @@ describe("EncodeDatetimeClient Rest Client", () => { }); describe("response body", () => { - const pngFile = readFileSync(resolve("../../packages/typespec-ts/temp/assets/image.png")); + const pngFile = readFileSync( + resolve("../../packages/typespec-ts/temp/assets/image.png") + ).toString(); it(`should get bytes with base64 encoding by default`, async () => { try { - const result = await client.path(`/encode/bytes/body/response/default`).get(); + const result = await client + .path(`/encode/bytes/body/response/default`) + .get(); assert.strictEqual(result.status, "200"); - assert.strictEqual(result.body, "dGVzdA==") + assert.strictEqual(result.body, "dGVzdA=="); } catch (err) { assert.fail(err as string); } @@ -269,9 +283,11 @@ describe("EncodeDatetimeClient Rest Client", () => { it(`should get bytes base64 encoding`, async () => { try { - const result = await client.path(`/encode/bytes/body/response/base64`).get(); + const result = await client + .path(`/encode/bytes/body/response/base64`) + .get(); assert.strictEqual(result.status, "200"); - assert.strictEqual(result.body, "dGVzdA==") + assert.strictEqual(result.body, "dGVzdA=="); } catch (err) { assert.fail(err as string); } @@ -279,37 +295,41 @@ describe("EncodeDatetimeClient Rest Client", () => { it(`should get bytes base64url encoding`, async () => { try { - const result = await client.path(`/encode/bytes/body/response/base64url`).get(); + const result = await client + .path(`/encode/bytes/body/response/base64url`) + .get(); assert.strictEqual(result.status, "200"); - assert.strictEqual(result.body, "dGVzdA") + assert.strictEqual(result.body, "dGVzdA"); } catch (err) { assert.fail(err as string); } }); - it.skip(`should get bytes with custom content type`, async () => { + it(`should get bytes with custom content type`, async () => { try { const result = await client .path(`/encode/bytes/body/response/custom-content-type`) .get({ contentType: "image/png" }); + // console.log(result.status, Buffer.from(result.body), pngFile); assert.strictEqual(result.status, "200"); - assert.strictEqual(Buffer.from(result.body), pngFile); + assert.strictEqual(uint8ArrayToString(result.body, "utf-8"), pngFile); } catch (err) { assert.fail(err as string); } }); - it.skip(`should get bytes with octet-stream content type`, async () => { + it(`should get bytes with octet-stream content type`, async () => { try { const result = await client .path(`/encode/bytes/body/response/octet-stream`) .get({ - contentType: "application/octet-stream", + contentType: "application/octet-stream" }); + // console.log(result.status, Buffer.from(result.body), pngFile); assert.strictEqual(result.status, "200"); - assert.strictEqual(Buffer.from(result.body), pngFile); + assert.strictEqual(uint8ArrayToString(result.body, "utf-8"), pngFile); } catch (err) { assert.fail(err as string); } diff --git a/packages/typespec-ts/test/integration/generated/authentication/apiKey/package.json b/packages/typespec-ts/test/integration/generated/authentication/apiKey/package.json index 3ff5ddcf2c..00f51eadef 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/apiKey/package.json +++ b/packages/typespec-ts/test/integration/generated/authentication/apiKey/package.json @@ -73,11 +73,11 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^8.0.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", @@ -103,7 +103,7 @@ "karma-source-map-support": "~1.4.0", "karma-sourcemap-loader": "^0.4.0", "karma": "^6.2.0", - "c8": "^8.0.0", + "nyc": "^15.1.0", "ts-node": "^10.0.0" }, "type": "module", diff --git a/packages/typespec-ts/test/integration/generated/authentication/http-custom/package.json b/packages/typespec-ts/test/integration/generated/authentication/http-custom/package.json index e1eed18c20..7767d46132 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/http-custom/package.json +++ b/packages/typespec-ts/test/integration/generated/authentication/http-custom/package.json @@ -73,11 +73,11 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^8.0.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", @@ -103,7 +103,7 @@ "karma-source-map-support": "~1.4.0", "karma-sourcemap-loader": "^0.4.0", "karma": "^6.2.0", - "c8": "^8.0.0", + "nyc": "^15.1.0", "ts-node": "^10.0.0" }, "type": "module", diff --git a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/package.json b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/package.json index 99ad7d5815..fb82d90b50 100644 --- a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/package.json +++ b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/clientDefinitions.ts index a3f55a8c42..1d0c6ef0ef 100644 --- a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/clientDefinitions.ts +++ b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/clientDefinitions.ts @@ -18,7 +18,7 @@ import { NoDecoratorInInternal200Response, InternalDecoratorInInternal200Response, PublicDecoratorInInternal200Response, - PublicOperation200Response, + Public200Response, Internal200Response, Operation200Response, Discriminator200Response, @@ -56,7 +56,7 @@ export interface PublicDecoratorInInternal { } export interface Public { - get(options: PublicParameters): StreamableMethod; + get(options: PublicParameters): StreamableMethod; } export interface Internal { diff --git a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/responses.ts b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/responses.ts index bb463d8c7c..e8187551bd 100644 --- a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/access/src/responses.ts @@ -44,7 +44,7 @@ export interface PublicDecoratorInInternal200Response extends HttpResponse { } /** The request has succeeded. */ -export interface PublicOperation200Response extends HttpResponse { +export interface Public200Response extends HttpResponse { status: "200"; body: SharedModelOutput; } diff --git a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/usage/package.json b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/usage/package.json index cb78a3da20..7c4d09a570 100644 --- a/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/usage/package.json +++ b/packages/typespec-ts/test/integration/generated/azure/clientGeneratorCore/usage/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/azure/core-scalar/package.json b/packages/typespec-ts/test/integration/generated/azure/core-scalar/package.json index 960a7f9e25..6f2dedc667 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core-scalar/package.json +++ b/packages/typespec-ts/test/integration/generated/azure/core-scalar/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-ts/test/integration/generated/azure/core-scalar/vitest.browser.config.ts b/packages/typespec-ts/test/integration/generated/azure/core-scalar/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core-scalar/vitest.browser.config.ts +++ b/packages/typespec-ts/test/integration/generated/azure/core-scalar/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-ts/test/integration/generated/azure/core-traits/package.json b/packages/typespec-ts/test/integration/generated/azure/core-traits/package.json index 00bdd7d24a..ebe600fdee 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core-traits/package.json +++ b/packages/typespec-ts/test/integration/generated/azure/core-traits/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1", "@azure/core-util": "^1.0.0", "@azure-tools/test-credential": "^1.0.0", diff --git a/packages/typespec-ts/test/integration/generated/azure/core-traits/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/azure/core-traits/src/outputModels.ts index de12bf264b..dbcd7d33cf 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core-traits/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/azure/core-traits/src/outputModels.ts @@ -1,15 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** Provides the 'If-*' headers to enable conditional (cached) responses */ -export interface ConditionalRequestHeadersOutput {} - -/** Provides the 'ETag' header to enable conditional (cached) requests */ -export interface EtagResponseEnvelopeOutput {} - -/** Provides the 'x-ms-client-request-id' header to enable request correlation in requests and responses. */ -export interface ClientRequestIdHeaderOutput {} - /** Sample Model */ export interface UserOutput { /** The user's id. */ @@ -18,12 +9,6 @@ export interface UserOutput { name?: string; } -/** Provides the 'Repeatability-*' headers to enable repeatable requests. */ -export interface RepeatabilityRequestHeadersOutput {} - -/** Provides the 'Repeatability-*' headers to enable repeatable requests. */ -export interface RepeatabilityResponseHeadersOutput {} - /** User action response */ export interface UserActionResponseOutput { /** User action result. */ diff --git a/packages/typespec-ts/test/integration/generated/azure/core-traits/vitest.browser.config.ts b/packages/typespec-ts/test/integration/generated/azure/core-traits/vitest.browser.config.ts index 535b06a86a..62d4a62ec4 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core-traits/vitest.browser.config.ts +++ b/packages/typespec-ts/test/integration/generated/azure/core-traits/vitest.browser.config.ts @@ -7,7 +7,6 @@ export default defineConfig({ define: { "process.env": process.env, }, - test: { reporters: ["basic", "junit"], outputFile: { diff --git a/packages/typespec-ts/test/integration/generated/azure/core/package.json b/packages/typespec-ts/test/integration/generated/azure/core/package.json index 0dcfa358f0..f311e4bed0 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/package.json +++ b/packages/typespec-ts/test/integration/generated/azure/core/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -36,8 +36,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/azure/core/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/azure/core/src/clientDefinitions.ts index d3eb0767ec..a8228b7f24 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/src/clientDefinitions.ts +++ b/packages/typespec-ts/test/integration/generated/azure/core/src/clientDefinitions.ts @@ -23,8 +23,8 @@ import { CreateOrReplaceDefaultResponse, Get200Response, GetDefaultResponse, - DeleteOperation204Response, - DeleteOperationDefaultResponse, + Delete204Response, + DeleteDefaultResponse, List200Response, ListDefaultResponse, ListWithPage200Response, @@ -33,8 +33,8 @@ import { ListWithParametersDefaultResponse, ListWithCustomPageModel200Response, ListWithCustomPageModelDefaultResponse, - ExportOperation200Response, - ExportOperationDefaultResponse, + Export200Response, + ExportDefaultResponse, ListFirstItem200Response, ListFirstItemDefaultResponse, ListSecondItem200Response, @@ -66,9 +66,7 @@ export interface CreateOrUpdate { /** Deletes a User */ delete( options?: DeleteParameters, - ): StreamableMethod< - DeleteOperation204Response | DeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface List { @@ -107,9 +105,7 @@ export interface Export { /** Exports a User */ post( options: ExportParameters, - ): StreamableMethod< - ExportOperation200Response | ExportOperationDefaultResponse - >; + ): StreamableMethod; } export interface ListFirstItem { diff --git a/packages/typespec-ts/test/integration/generated/azure/core/src/isUnexpected.ts b/packages/typespec-ts/test/integration/generated/azure/core/src/isUnexpected.ts index 39b30b5e94..a5e087d419 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/src/isUnexpected.ts +++ b/packages/typespec-ts/test/integration/generated/azure/core/src/isUnexpected.ts @@ -10,8 +10,8 @@ import { CreateOrReplaceDefaultResponse, Get200Response, GetDefaultResponse, - DeleteOperation204Response, - DeleteOperationDefaultResponse, + Delete204Response, + DeleteDefaultResponse, List200Response, ListDefaultResponse, ListWithPage200Response, @@ -20,8 +20,8 @@ import { ListWithParametersDefaultResponse, ListWithCustomPageModel200Response, ListWithCustomPageModelDefaultResponse, - ExportOperation200Response, - ExportOperationDefaultResponse, + Export200Response, + ExportDefaultResponse, ListFirstItem200Response, ListFirstItemDefaultResponse, ListSecondItem200Response, @@ -58,8 +58,8 @@ export function isUnexpected( response: Get200Response | GetDefaultResponse, ): response is GetDefaultResponse; export function isUnexpected( - response: DeleteOperation204Response | DeleteOperationDefaultResponse, -): response is DeleteOperationDefaultResponse; + response: Delete204Response | DeleteDefaultResponse, +): response is DeleteDefaultResponse; export function isUnexpected( response: List200Response | ListDefaultResponse, ): response is ListDefaultResponse; @@ -75,8 +75,8 @@ export function isUnexpected( | ListWithCustomPageModelDefaultResponse, ): response is ListWithCustomPageModelDefaultResponse; export function isUnexpected( - response: ExportOperation200Response | ExportOperationDefaultResponse, -): response is ExportOperationDefaultResponse; + response: Export200Response | ExportDefaultResponse, +): response is ExportDefaultResponse; export function isUnexpected( response: ListFirstItem200Response | ListFirstItemDefaultResponse, ): response is ListFirstItemDefaultResponse; @@ -93,8 +93,8 @@ export function isUnexpected( | CreateOrReplaceDefaultResponse | Get200Response | GetDefaultResponse - | DeleteOperation204Response - | DeleteOperationDefaultResponse + | Delete204Response + | DeleteDefaultResponse | List200Response | ListDefaultResponse | ListWithPage200Response @@ -103,8 +103,8 @@ export function isUnexpected( | ListWithParametersDefaultResponse | ListWithCustomPageModel200Response | ListWithCustomPageModelDefaultResponse - | ExportOperation200Response - | ExportOperationDefaultResponse + | Export200Response + | ExportDefaultResponse | ListFirstItem200Response | ListFirstItemDefaultResponse | ListSecondItem200Response @@ -113,12 +113,12 @@ export function isUnexpected( | CreateOrUpdateDefaultResponse | CreateOrReplaceDefaultResponse | GetDefaultResponse - | DeleteOperationDefaultResponse + | DeleteDefaultResponse | ListDefaultResponse | ListWithPageDefaultResponse | ListWithParametersDefaultResponse | ListWithCustomPageModelDefaultResponse - | ExportOperationDefaultResponse + | ExportDefaultResponse | ListFirstItemDefaultResponse | ListSecondItemDefaultResponse { const lroOriginal = response.headers["x-ms-original-url"]; diff --git a/packages/typespec-ts/test/integration/generated/azure/core/src/responses.ts b/packages/typespec-ts/test/integration/generated/azure/core/src/responses.ts index 4f5e8e0d43..f938ddf7e2 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/azure/core/src/responses.ts @@ -143,36 +143,36 @@ export interface ListWithCustomPageModelDefaultResponse extends HttpResponse { } /** There is no content to send for this request, but the headers may be useful. */ -export interface DeleteOperation204Response extends HttpResponse { +export interface Delete204Response extends HttpResponse { status: "204"; } -export interface DeleteOperationDefaultHeaders { +export interface DeleteDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface DeleteOperationDefaultResponse extends HttpResponse { +export interface DeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & DeleteOperationDefaultHeaders; + headers: RawHttpHeaders & DeleteDefaultHeaders; } /** The request has succeeded. */ -export interface ExportOperation200Response extends HttpResponse { +export interface Export200Response extends HttpResponse { status: "200"; body: UserOutput; } -export interface ExportOperationDefaultHeaders { +export interface ExportDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface ExportOperationDefaultResponse extends HttpResponse { +export interface ExportDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & ExportOperationDefaultHeaders; + headers: RawHttpHeaders & ExportDefaultHeaders; } /** The request has succeeded. */ diff --git a/packages/typespec-ts/test/integration/generated/client/naming/package.json b/packages/typespec-ts/test/integration/generated/client/naming/package.json index 570aaf3e53..071da4e7e8 100644 --- a/packages/typespec-ts/test/integration/generated/client/naming/package.json +++ b/packages/typespec-ts/test/integration/generated/client/naming/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/package.json b/packages/typespec-ts/test/integration/generated/client/structure/default/package.json index d5d77509e9..4970f2792e 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/default/package.json +++ b/packages/typespec-ts/test/integration/generated/client/structure/default/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/src/index.ts b/packages/typespec-ts/test/integration/generated/client/structure/default/src/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/default/src/index.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/default/src/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/src/models.ts b/packages/typespec-ts/test/integration/generated/client/structure/default/src/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/client/structure/default/src/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/src/serviceClient.ts b/packages/typespec-ts/test/integration/generated/client/structure/default/src/serviceClient.ts index f5f05c9d98..1ab55d27d5 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/default/src/serviceClient.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/default/src/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { ServiceClient } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceClient` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceClient { const endpointUrl = diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/package.json b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/package.json index 7580122bea..d1589a4637 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/package.json +++ b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/index.ts b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/index.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/models.ts b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/serviceClient.ts b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/serviceClient.ts index ffcd544a1f..be0879d535 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/serviceClient.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { ServiceClient } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceClient` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceClient { const endpointUrl = diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/package.json b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/package.json index 74dad446ca..2c2b515c3e 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/package.json +++ b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/index.ts b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/index.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/models.ts b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/serviceClient.ts b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/serviceClient.ts index d518c8c6c1..6da6cdaf0c 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/serviceClient.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { ServiceClient } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceClient` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceClient { const endpointUrl = diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/package.json b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/package.json index 841ccbb4f1..7989726f49 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/package.json +++ b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/index.ts b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/index.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/models.ts b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/serviceClient.ts b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/serviceClient.ts index c84a0aaf3c..3cc63a81e1 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/serviceClient.ts +++ b/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { ServiceClient } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceClient` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceClient { const endpointUrl = diff --git a/packages/typespec-ts/test/integration/generated/dictionary/package.json b/packages/typespec-ts/test/integration/generated/dictionary/package.json index 9ecfa8fa09..2a8f9a8941 100644 --- a/packages/typespec-ts/test/integration/generated/dictionary/package.json +++ b/packages/typespec-ts/test/integration/generated/dictionary/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/enums/extensible/package.json b/packages/typespec-ts/test/integration/generated/enums/extensible/package.json index 02c3cdb1ac..d8226e01e4 100644 --- a/packages/typespec-ts/test/integration/generated/enums/extensible/package.json +++ b/packages/typespec-ts/test/integration/generated/enums/extensible/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/enums/fixed/package.json b/packages/typespec-ts/test/integration/generated/enums/fixed/package.json index 3e18dc75e0..f1f3c9f99b 100644 --- a/packages/typespec-ts/test/integration/generated/enums/fixed/package.json +++ b/packages/typespec-ts/test/integration/generated/enums/fixed/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/enums/fixed/src/index.ts b/packages/typespec-ts/test/integration/generated/enums/fixed/src/index.ts index acef35f382..e1eb44f461 100644 --- a/packages/typespec-ts/test/integration/generated/enums/fixed/src/index.ts +++ b/packages/typespec-ts/test/integration/generated/enums/fixed/src/index.ts @@ -7,5 +7,7 @@ export * from "./fixedClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; +export * from "./outputModels.js"; export default FixedClient; diff --git a/packages/typespec-ts/test/integration/generated/enums/fixed/src/models.ts b/packages/typespec-ts/test/integration/generated/enums/fixed/src/models.ts new file mode 100644 index 0000000000..963fe85f9d --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/enums/fixed/src/models.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Days of the week */ +export type DaysOfWeekEnum = + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/integration/generated/enums/fixed/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/enums/fixed/src/outputModels.ts new file mode 100644 index 0000000000..bc2067f2b0 --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/enums/fixed/src/outputModels.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Days of the week */ +export type DaysOfWeekEnumOutput = + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/integration/generated/enums/fixed/src/parameters.ts b/packages/typespec-ts/test/integration/generated/enums/fixed/src/parameters.ts index d2fe2da835..b8147511d1 100644 --- a/packages/typespec-ts/test/integration/generated/enums/fixed/src/parameters.ts +++ b/packages/typespec-ts/test/integration/generated/enums/fixed/src/parameters.ts @@ -2,19 +2,13 @@ // Licensed under the MIT license. import { RequestParameters } from "@azure-rest/core-client"; +import { DaysOfWeekEnum } from "./models.js"; export type GetKnownValueParameters = RequestParameters; export interface PutKnownValueBodyParam { /** _ */ - body: - | "Monday" - | "Tuesday" - | "Wednesday" - | "Thursday" - | "Friday" - | "Saturday" - | "Sunday"; + body: DaysOfWeekEnum; } export type PutKnownValueParameters = PutKnownValueBodyParam & @@ -22,14 +16,7 @@ export type PutKnownValueParameters = PutKnownValueBodyParam & export interface PutUnknownValueBodyParam { /** _ */ - body: - | "Monday" - | "Tuesday" - | "Wednesday" - | "Thursday" - | "Friday" - | "Saturday" - | "Sunday"; + body: DaysOfWeekEnum; } export type PutUnknownValueParameters = PutUnknownValueBodyParam & diff --git a/packages/typespec-ts/test/integration/generated/enums/fixed/src/responses.ts b/packages/typespec-ts/test/integration/generated/enums/fixed/src/responses.ts index ea04e2f91b..0c01ac36a1 100644 --- a/packages/typespec-ts/test/integration/generated/enums/fixed/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/enums/fixed/src/responses.ts @@ -2,18 +2,12 @@ // Licensed under the MIT license. import { HttpResponse } from "@azure-rest/core-client"; +import { DaysOfWeekEnumOutput } from "./outputModels.js"; /** The request has succeeded. */ export interface GetKnownValue200Response extends HttpResponse { status: "200"; - body: - | "Monday" - | "Tuesday" - | "Wednesday" - | "Thursday" - | "Friday" - | "Saturday" - | "Sunday"; + body: DaysOfWeekEnumOutput; } /** There is no content to send for this request, but the headers may be useful. */ diff --git a/packages/typespec-ts/test/integration/generated/headers/clientRequestId/package.json b/packages/typespec-ts/test/integration/generated/headers/clientRequestId/package.json index ed8bdf74b4..6e01320271 100644 --- a/packages/typespec-ts/test/integration/generated/headers/clientRequestId/package.json +++ b/packages/typespec-ts/test/integration/generated/headers/clientRequestId/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/headers/repeatability/package.json b/packages/typespec-ts/test/integration/generated/headers/repeatability/package.json index 44f7911be4..8ff61ff7da 100644 --- a/packages/typespec-ts/test/integration/generated/headers/repeatability/package.json +++ b/packages/typespec-ts/test/integration/generated/headers/repeatability/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/hello/package.json b/packages/typespec-ts/test/integration/generated/hello/package.json index 23e87ff3d0..0b67340813 100644 --- a/packages/typespec-ts/test/integration/generated/hello/package.json +++ b/packages/typespec-ts/test/integration/generated/hello/package.json @@ -62,11 +62,11 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^8.0.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", diff --git a/packages/typespec-ts/test/integration/generated/lro/lroCore/package.json b/packages/typespec-ts/test/integration/generated/lro/lroCore/package.json index dbd8e8a08a..e645da07c8 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroCore/package.json +++ b/packages/typespec-ts/test/integration/generated/lro/lroCore/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/clientDefinitions.ts index 3c1a6b3ca2..9c280b4a82 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/clientDefinitions.ts +++ b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/clientDefinitions.ts @@ -10,10 +10,10 @@ import { CreateOrReplace200Response, CreateOrReplace201Response, CreateOrReplaceDefaultResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, + Delete202Response, + DeleteDefaultResponse, + Export202Response, + ExportDefaultResponse, } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -29,18 +29,14 @@ export interface CreateOrReplace { /** Deletes a User */ delete( options?: DeleteParameters, - ): StreamableMethod< - DeleteOperation202Response | DeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface Export { /** Exports a User */ post( options: ExportParameters, - ): StreamableMethod< - ExportOperation202Response | ExportOperationDefaultResponse - >; + ): StreamableMethod; } export interface Routes { diff --git a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/isUnexpected.ts b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/isUnexpected.ts index 49a3da69f9..a0718a9a17 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/isUnexpected.ts +++ b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/isUnexpected.ts @@ -6,12 +6,12 @@ import { CreateOrReplace201Response, CreateOrReplaceLogicalResponse, CreateOrReplaceDefaultResponse, - DeleteOperation202Response, + Delete202Response, DeleteLogicalResponse, - DeleteOperationDefaultResponse, - ExportOperation202Response, + DeleteDefaultResponse, + Export202Response, ExportLogicalResponse, - ExportOperationDefaultResponse, + ExportDefaultResponse, } from "./responses.js"; const responseMap: Record = { @@ -30,33 +30,27 @@ export function isUnexpected( | CreateOrReplaceDefaultResponse, ): response is CreateOrReplaceDefaultResponse; export function isUnexpected( - response: - | DeleteOperation202Response - | DeleteLogicalResponse - | DeleteOperationDefaultResponse, -): response is DeleteOperationDefaultResponse; + response: Delete202Response | DeleteLogicalResponse | DeleteDefaultResponse, +): response is DeleteDefaultResponse; export function isUnexpected( - response: - | ExportOperation202Response - | ExportLogicalResponse - | ExportOperationDefaultResponse, -): response is ExportOperationDefaultResponse; + response: Export202Response | ExportLogicalResponse | ExportDefaultResponse, +): response is ExportDefaultResponse; export function isUnexpected( response: | CreateOrReplace200Response | CreateOrReplace201Response | CreateOrReplaceLogicalResponse | CreateOrReplaceDefaultResponse - | DeleteOperation202Response + | Delete202Response | DeleteLogicalResponse - | DeleteOperationDefaultResponse - | ExportOperation202Response + | DeleteDefaultResponse + | Export202Response | ExportLogicalResponse - | ExportOperationDefaultResponse, + | ExportDefaultResponse, ): response is | CreateOrReplaceDefaultResponse - | DeleteOperationDefaultResponse - | ExportOperationDefaultResponse { + | DeleteDefaultResponse + | ExportDefaultResponse { const lroOriginal = response.headers["x-ms-original-url"]; const url = new URL(lroOriginal ?? response.request.url); const method = response.request.method; diff --git a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/outputModels.ts index 3433683265..59ed42a7db 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/outputModels.ts @@ -15,12 +15,8 @@ export interface UserOutput { export interface OperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; } @@ -29,12 +25,8 @@ export interface OperationStatusOutput { export interface ResourceOperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; /** The result of the operation. */ @@ -48,3 +40,11 @@ export interface ExportedUserOutput { /** The exported URI. */ resourceUri: string; } + +/** Enum describing allowed operation states. */ +export type OperationStateOutput = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled"; diff --git a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/pollingHelper.ts b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/pollingHelper.ts index 5771f8b2f6..bbcdcc7242 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/pollingHelper.ts +++ b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/pollingHelper.ts @@ -16,11 +16,11 @@ import { CreateOrReplace201Response, CreateOrReplaceDefaultResponse, CreateOrReplaceLogicalResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, + Delete202Response, + DeleteDefaultResponse, DeleteLogicalResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, + Export202Response, + ExportDefaultResponse, ExportLogicalResponse, } from "./responses.js"; @@ -101,10 +101,10 @@ export interface SimplePollerLike< * @returns - A poller object to poll for operation state updates and eventually get the final response. */ export async function getLongRunningPoller< - TResult extends ExportLogicalResponse | ExportOperationDefaultResponse, + TResult extends ExportLogicalResponse | ExportDefaultResponse, >( client: Client, - initialResponse: ExportOperation202Response | ExportOperationDefaultResponse, + initialResponse: Export202Response | ExportDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< @@ -120,10 +120,10 @@ export async function getLongRunningPoller< options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< - TResult extends DeleteLogicalResponse | DeleteOperationDefaultResponse, + TResult extends DeleteLogicalResponse | DeleteDefaultResponse, >( client: Client, - initialResponse: DeleteOperation202Response | DeleteOperationDefaultResponse, + initialResponse: Delete202Response | DeleteDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller( diff --git a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/responses.ts b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/responses.ts index f416a2db94..a4ae2fe1c1 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroCore/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/lro/lroCore/src/responses.ts @@ -50,27 +50,27 @@ export interface CreateOrReplaceLogicalResponse extends HttpResponse { body: UserOutput; } -export interface DeleteOperation202Headers { +export interface Delete202Headers { /** The location for monitoring the operation state. */ "operation-location": string; } /** The request has been accepted for processing, but processing has not yet completed. */ -export interface DeleteOperation202Response extends HttpResponse { +export interface Delete202Response extends HttpResponse { status: "202"; body: OperationStatusOutput; - headers: RawHttpHeaders & DeleteOperation202Headers; + headers: RawHttpHeaders & Delete202Headers; } -export interface DeleteOperationDefaultHeaders { +export interface DeleteDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface DeleteOperationDefaultResponse extends HttpResponse { +export interface DeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & DeleteOperationDefaultHeaders; + headers: RawHttpHeaders & DeleteDefaultHeaders; } /** The final response for long-running delete operation */ @@ -79,27 +79,27 @@ export interface DeleteLogicalResponse extends HttpResponse { body: OperationStatusOutput; } -export interface ExportOperation202Headers { +export interface Export202Headers { /** The location for monitoring the operation state. */ "operation-location": string; } /** The request has been accepted for processing, but processing has not yet completed. */ -export interface ExportOperation202Response extends HttpResponse { +export interface Export202Response extends HttpResponse { status: "202"; body: ResourceOperationStatusOutput; - headers: RawHttpHeaders & ExportOperation202Headers; + headers: RawHttpHeaders & Export202Headers; } -export interface ExportOperationDefaultHeaders { +export interface ExportDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface ExportOperationDefaultResponse extends HttpResponse { +export interface ExportDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & ExportOperationDefaultHeaders; + headers: RawHttpHeaders & ExportDefaultHeaders; } /** The final response for long-running export operation */ diff --git a/packages/typespec-ts/test/integration/generated/lro/lroRPC/package.json b/packages/typespec-ts/test/integration/generated/lro/lroRPC/package.json index 9334ad464d..3502c374b8 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroRPC/package.json +++ b/packages/typespec-ts/test/integration/generated/lro/lroRPC/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/lro/lroRPC/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/lro/lroRPC/src/outputModels.ts index 09021f6a53..4062cec654 100644 --- a/packages/typespec-ts/test/integration/generated/lro/lroRPC/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/lro/lroRPC/src/outputModels.ts @@ -3,22 +3,12 @@ import { ErrorModel } from "@azure-rest/core-client"; -/** Options for the generation. */ -export interface GenerationOptionsOutput { - /** Prompt. */ - prompt: string; -} - /** Provides status details for long running operations. */ export interface ResourceOperationStatusOutput { /** The unique ID of the operation. */ readonly id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; /** The result of the operation. */ @@ -30,3 +20,11 @@ export interface GenerationResultOutput { /** The data. */ data: string; } + +/** Enum describing allowed operation states. */ +export type OperationStateOutput = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled"; diff --git a/packages/typespec-ts/test/integration/generated/models/empty/package.json b/packages/typespec-ts/test/integration/generated/models/empty/package.json index 96a37bec83..b5c33f6ab8 100644 --- a/packages/typespec-ts/test/integration/generated/models/empty/package.json +++ b/packages/typespec-ts/test/integration/generated/models/empty/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/package.json b/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/package.json index f7d5447607..014f02ba2b 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/package.json +++ b/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/models.ts b/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/models.ts index a6250ca794..c6456677fa 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/models.ts +++ b/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/models.ts @@ -18,7 +18,7 @@ export interface Golden extends DogParent { export interface SnakeParent { /** Length of the snake */ length: number; - kind: "cobra"; + kind: SnakeKind; } /** Cobra model */ @@ -33,3 +33,5 @@ export type Dog = DogParent | Golden; export type Snake = SnakeParent | Cobra; /** Alias for DogKind */ export type DogKind = string | "golden"; +/** fixed enum type for discriminator */ +export type SnakeKind = "cobra"; diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/outputModels.ts index d765ae0b55..a948d44a55 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/models/inheritance-enum-discriminator/src/outputModels.ts @@ -18,7 +18,7 @@ export interface GoldenOutput extends DogOutputParent { export interface SnakeOutputParent { /** Length of the snake */ length: number; - kind: "cobra"; + kind: SnakeKindOutput; } /** Cobra model */ @@ -33,3 +33,5 @@ export type DogOutput = DogOutputParent | GoldenOutput; export type SnakeOutput = SnakeOutputParent | CobraOutput; /** Alias for DogKindOutput */ export type DogKindOutput = string | "golden"; +/** fixed enum type for discriminator */ +export type SnakeKindOutput = "cobra"; diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance-not-discriminated/package.json b/packages/typespec-ts/test/integration/generated/models/inheritance-not-discriminated/package.json index 47e234f8da..8c3cd1eff1 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance-not-discriminated/package.json +++ b/packages/typespec-ts/test/integration/generated/models/inheritance-not-discriminated/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance-recursive/package.json b/packages/typespec-ts/test/integration/generated/models/inheritance-recursive/package.json index dae13c4d69..93504c8d32 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance-recursive/package.json +++ b/packages/typespec-ts/test/integration/generated/models/inheritance-recursive/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance-single-discriminator/package.json b/packages/typespec-ts/test/integration/generated/models/inheritance-single-discriminator/package.json index 96e26cac8e..90a8881b70 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance-single-discriminator/package.json +++ b/packages/typespec-ts/test/integration/generated/models/inheritance-single-discriminator/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/inheritance/package.json b/packages/typespec-ts/test/integration/generated/models/inheritance/package.json index 84da014d71..00c2eaabf2 100644 --- a/packages/typespec-ts/test/integration/generated/models/inheritance/package.json +++ b/packages/typespec-ts/test/integration/generated/models/inheritance/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/package.json b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/package.json index 19ed0b5000..db4ad84d49 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/package.json +++ b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/clientDefinitions.ts index 96bfb7a71d..22f1c2f288 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/clientDefinitions.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/clientDefinitions.ts @@ -18,18 +18,54 @@ import { ExtendsStringPutParameters, IsStringGetParameters, IsStringPutParameters, + SpreadStringGetParameters, + SpreadStringPutParameters, ExtendsFloatGetParameters, ExtendsFloatPutParameters, IsFloatGetParameters, IsFloatPutParameters, + SpreadFloatGetParameters, + SpreadFloatPutParameters, ExtendsModelGetParameters, ExtendsModelPutParameters, IsModelGetParameters, IsModelPutParameters, + SpreadModelGetParameters, + SpreadModelPutParameters, ExtendsModelArrayGetParameters, ExtendsModelArrayPutParameters, IsModelArrayGetParameters, IsModelArrayPutParameters, + SpreadModelArrayGetParameters, + SpreadModelArrayPutParameters, + SpreadDifferentStringGetParameters, + SpreadDifferentStringPutParameters, + SpreadDifferentFloatGetParameters, + SpreadDifferentFloatPutParameters, + SpreadDifferentModelGetParameters, + SpreadDifferentModelPutParameters, + SpreadDifferentModelArrayGetParameters, + SpreadDifferentModelArrayPutParameters, + ExtendsDifferentSpreadStringGetParameters, + ExtendsDifferentSpreadStringPutParameters, + ExtendsDifferentSpreadFloatGetParameters, + ExtendsDifferentSpreadFloatPutParameters, + ExtendsDifferentSpreadModelGetParameters, + ExtendsDifferentSpreadModelPutParameters, + ExtendsDifferentSpreadModelArrayGetParameters, + ExtendsDifferentSpreadModelArrayPutParameters, + MultipleSpreadGetParameters, + MultipleSpreadPutParameters, + SpreadRecordUnionGetParameters, + SpreadRecordUnionPutParameters, + SpreadRecordDiscriminatedUnionGetParameters, + SpreadRecordDiscriminatedUnionPutParameters, + SpreadRecordNonDiscriminatedUnionGetParameters, + SpreadRecordNonDiscriminatedUnionPutParameters, + SpreadRecordNonDiscriminatedUnion2GetParameters, + SpreadRecordNonDiscriminatedUnion2PutParameters, + SpreadRecordNonDiscriminatedUnion3GetParameters, + SpreadRecordNonDiscriminatedUnion3PutParameters, } from "./parameters.js"; import { ExtendsUnknownGet200Response, @@ -48,18 +84,54 @@ import { ExtendsStringPut204Response, IsStringGet200Response, IsStringPut204Response, + SpreadStringGet200Response, + SpreadStringPut204Response, ExtendsFloatGet200Response, ExtendsFloatPut204Response, IsFloatGet200Response, IsFloatPut204Response, + SpreadFloatGet200Response, + SpreadFloatPut204Response, ExtendsModelGet200Response, ExtendsModelPut204Response, IsModelGet200Response, IsModelPut204Response, + SpreadModelGet200Response, + SpreadModelPut204Response, ExtendsModelArrayGet200Response, ExtendsModelArrayPut204Response, IsModelArrayGet200Response, IsModelArrayPut204Response, + SpreadModelArrayGet200Response, + SpreadModelArrayPut204Response, + SpreadDifferentStringGet200Response, + SpreadDifferentStringPut204Response, + SpreadDifferentFloatGet200Response, + SpreadDifferentFloatPut204Response, + SpreadDifferentModelGet200Response, + SpreadDifferentModelPut204Response, + SpreadDifferentModelArrayGet200Response, + SpreadDifferentModelArrayPut204Response, + ExtendsDifferentSpreadStringGet200Response, + ExtendsDifferentSpreadStringPut204Response, + ExtendsDifferentSpreadFloatGet200Response, + ExtendsDifferentSpreadFloatPut204Response, + ExtendsDifferentSpreadModelGet200Response, + ExtendsDifferentSpreadModelPut204Response, + ExtendsDifferentSpreadModelArrayGet200Response, + ExtendsDifferentSpreadModelArrayPut204Response, + MultipleSpreadGet200Response, + MultipleSpreadPut204Response, + SpreadRecordUnionGet200Response, + SpreadRecordUnionPut204Response, + SpreadRecordDiscriminatedUnionGet200Response, + SpreadRecordDiscriminatedUnionPut204Response, + SpreadRecordNonDiscriminatedUnionGet200Response, + SpreadRecordNonDiscriminatedUnionPut204Response, + SpreadRecordNonDiscriminatedUnion2Get200Response, + SpreadRecordNonDiscriminatedUnion2Put204Response, + SpreadRecordNonDiscriminatedUnion3Get200Response, + SpreadRecordNonDiscriminatedUnion3Put204Response, } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -149,6 +221,17 @@ export interface IsStringGet { put(options: IsStringPutParameters): StreamableMethod; } +export interface SpreadStringGet { + /** Get call */ + get( + options?: SpreadStringGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadStringPutParameters, + ): StreamableMethod; +} + export interface ExtendsFloatGet { /** Get call */ get( @@ -167,6 +250,17 @@ export interface IsFloatGet { put(options: IsFloatPutParameters): StreamableMethod; } +export interface SpreadFloatGet { + /** Get call */ + get( + options?: SpreadFloatGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadFloatPutParameters, + ): StreamableMethod; +} + export interface ExtendsModelGet { /** Get call */ get( @@ -185,6 +279,17 @@ export interface IsModelGet { put(options: IsModelPutParameters): StreamableMethod; } +export interface SpreadModelGet { + /** Get call */ + get( + options?: SpreadModelGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadModelPutParameters, + ): StreamableMethod; +} + export interface ExtendsModelArrayGet { /** Get call */ get( @@ -207,6 +312,171 @@ export interface IsModelArrayGet { ): StreamableMethod; } +export interface SpreadModelArrayGet { + /** Get call */ + get( + options?: SpreadModelArrayGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadModelArrayPutParameters, + ): StreamableMethod; +} + +export interface SpreadDifferentStringGet { + /** Get call */ + get( + options?: SpreadDifferentStringGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadDifferentStringPutParameters, + ): StreamableMethod; +} + +export interface SpreadDifferentFloatGet { + /** Get call */ + get( + options?: SpreadDifferentFloatGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadDifferentFloatPutParameters, + ): StreamableMethod; +} + +export interface SpreadDifferentModelGet { + /** Get call */ + get( + options?: SpreadDifferentModelGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadDifferentModelPutParameters, + ): StreamableMethod; +} + +export interface SpreadDifferentModelArrayGet { + /** Get call */ + get( + options?: SpreadDifferentModelArrayGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadDifferentModelArrayPutParameters, + ): StreamableMethod; +} + +export interface ExtendsDifferentSpreadStringGet { + /** Get call */ + get( + options?: ExtendsDifferentSpreadStringGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: ExtendsDifferentSpreadStringPutParameters, + ): StreamableMethod; +} + +export interface ExtendsDifferentSpreadFloatGet { + /** Get call */ + get( + options?: ExtendsDifferentSpreadFloatGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: ExtendsDifferentSpreadFloatPutParameters, + ): StreamableMethod; +} + +export interface ExtendsDifferentSpreadModelGet { + /** Get call */ + get( + options?: ExtendsDifferentSpreadModelGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: ExtendsDifferentSpreadModelPutParameters, + ): StreamableMethod; +} + +export interface ExtendsDifferentSpreadModelArrayGet { + /** Get call */ + get( + options?: ExtendsDifferentSpreadModelArrayGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: ExtendsDifferentSpreadModelArrayPutParameters, + ): StreamableMethod; +} + +export interface MultipleSpreadGet { + /** Get call */ + get( + options?: MultipleSpreadGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: MultipleSpreadPutParameters, + ): StreamableMethod; +} + +export interface SpreadRecordUnionGet { + /** Get call */ + get( + options?: SpreadRecordUnionGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadRecordUnionPutParameters, + ): StreamableMethod; +} + +export interface SpreadRecordDiscriminatedUnionGet { + /** Get call */ + get( + options?: SpreadRecordDiscriminatedUnionGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadRecordDiscriminatedUnionPutParameters, + ): StreamableMethod; +} + +export interface SpreadRecordNonDiscriminatedUnionGet { + /** Get call */ + get( + options?: SpreadRecordNonDiscriminatedUnionGetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadRecordNonDiscriminatedUnionPutParameters, + ): StreamableMethod; +} + +export interface SpreadRecordNonDiscriminatedUnion2Get { + /** Get call */ + get( + options?: SpreadRecordNonDiscriminatedUnion2GetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadRecordNonDiscriminatedUnion2PutParameters, + ): StreamableMethod; +} + +export interface SpreadRecordNonDiscriminatedUnion3Get { + /** Get call */ + get( + options?: SpreadRecordNonDiscriminatedUnion3GetParameters, + ): StreamableMethod; + /** Put operation */ + put( + options: SpreadRecordNonDiscriminatedUnion3PutParameters, + ): StreamableMethod; +} + export interface Routes { /** Resource for '/type/property/additionalProperties/extendsRecordUnknown' has methods for the following verbs: get, put */ ( @@ -236,18 +506,30 @@ export interface Routes { ): ExtendsStringGet; /** Resource for '/type/property/additionalProperties/isRecordstring' has methods for the following verbs: get, put */ (path: "/type/property/additionalProperties/isRecordstring"): IsStringGet; + /** Resource for '/type/property/additionalProperties/spreadRecordString' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordString", + ): SpreadStringGet; /** Resource for '/type/property/additionalProperties/extendsRecordFloat' has methods for the following verbs: get, put */ ( path: "/type/property/additionalProperties/extendsRecordFloat", ): ExtendsFloatGet; /** Resource for '/type/property/additionalProperties/isRecordFloat' has methods for the following verbs: get, put */ (path: "/type/property/additionalProperties/isRecordFloat"): IsFloatGet; + /** Resource for '/type/property/additionalProperties/spreadRecordFloat' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordFloat", + ): SpreadFloatGet; /** Resource for '/type/property/additionalProperties/extendsRecordModel' has methods for the following verbs: get, put */ ( path: "/type/property/additionalProperties/extendsRecordModel", ): ExtendsModelGet; /** Resource for '/type/property/additionalProperties/isRecordModel' has methods for the following verbs: get, put */ (path: "/type/property/additionalProperties/isRecordModel"): IsModelGet; + /** Resource for '/type/property/additionalProperties/spreadRecordModel' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordModel", + ): SpreadModelGet; /** Resource for '/type/property/additionalProperties/extendsRecordModelArray' has methods for the following verbs: get, put */ ( path: "/type/property/additionalProperties/extendsRecordModelArray", @@ -256,6 +538,66 @@ export interface Routes { ( path: "/type/property/additionalProperties/isRecordModelArray", ): IsModelArrayGet; + /** Resource for '/type/property/additionalProperties/spreadRecordModelArray' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordModelArray", + ): SpreadModelArrayGet; + /** Resource for '/type/property/additionalProperties/spreadDifferentRecordString' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadDifferentRecordString", + ): SpreadDifferentStringGet; + /** Resource for '/type/property/additionalProperties/spreadDifferentRecordFloat' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadDifferentRecordFloat", + ): SpreadDifferentFloatGet; + /** Resource for '/type/property/additionalProperties/spreadDifferentRecordModel' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadDifferentRecordModel", + ): SpreadDifferentModelGet; + /** Resource for '/type/property/additionalProperties/spreadDifferentRecordModelArray' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadDifferentRecordModelArray", + ): SpreadDifferentModelArrayGet; + /** Resource for '/type/property/additionalProperties/extendsDifferentSpreadString' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/extendsDifferentSpreadString", + ): ExtendsDifferentSpreadStringGet; + /** Resource for '/type/property/additionalProperties/extendsDifferentSpreadFloat' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/extendsDifferentSpreadFloat", + ): ExtendsDifferentSpreadFloatGet; + /** Resource for '/type/property/additionalProperties/extendsDifferentSpreadModel' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/extendsDifferentSpreadModel", + ): ExtendsDifferentSpreadModelGet; + /** Resource for '/type/property/additionalProperties/extendsDifferentSpreadModelArray' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/extendsDifferentSpreadModelArray", + ): ExtendsDifferentSpreadModelArrayGet; + /** Resource for '/type/property/additionalProperties/multipleSpreadRecord' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/multipleSpreadRecord", + ): MultipleSpreadGet; + /** Resource for '/type/property/additionalProperties/spreadRecordUnion' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordUnion", + ): SpreadRecordUnionGet; + /** Resource for '/type/property/additionalProperties/spreadRecordDiscriminatedUnion' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordDiscriminatedUnion", + ): SpreadRecordDiscriminatedUnionGet; + /** Resource for '/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion", + ): SpreadRecordNonDiscriminatedUnionGet; + /** Resource for '/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2", + ): SpreadRecordNonDiscriminatedUnion2Get; + /** Resource for '/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3' has methods for the following verbs: get, put */ + ( + path: "/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3", + ): SpreadRecordNonDiscriminatedUnion3Get; } export type AdditionalPropertiesClient = Client & { diff --git a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/models.ts b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/models.ts index bea136b984..d83d3a8dca 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/models.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/models.ts @@ -81,6 +81,12 @@ export interface IsStringAdditionalProperties extends Record { name: string; } +/** The model spread Record with the same known property type */ +export interface SpreadStringRecord extends Record { + /** The name property */ + name: string; +} + /** The model extends from Record type. */ export interface ExtendsFloatAdditionalProperties extends Record { @@ -94,9 +100,17 @@ export interface IsFloatAdditionalProperties extends Record { id: number; } +/** The model spread Record with the same known property type */ +export interface SpreadFloatRecord extends Record { + /** The id property */ + id: number; +} + /** The model extends from Record type. */ export interface ExtendsModelAdditionalProperties - extends Record {} + extends Record { + knownProp: ModelForRecord; +} /** model for record */ export interface ModelForRecord { @@ -106,15 +120,138 @@ export interface ModelForRecord { /** The model is from Record type. */ export interface IsModelAdditionalProperties - extends Record {} + extends Record { + knownProp: ModelForRecord; +} + +/** The model spread Record with the same known property type */ +export interface SpreadModelRecord extends Record { + knownProp: ModelForRecord; +} /** The model extends from Record type. */ export interface ExtendsModelArrayAdditionalProperties - extends Record> {} + extends Record> { + knownProp: Array; +} /** The model is from Record type. */ export interface IsModelArrayAdditionalProperties - extends Record> {} + extends Record> { + knownProp: Array; +} + +export interface SpreadModelArrayRecord + extends Record> { + knownProp: Array; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadStringRecord extends Record { + /** The name property */ + id: number; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadStringDerived + extends DifferentSpreadStringRecord { + /** The index property */ + derivedProp: string; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadFloatRecord extends Record { + /** The id property */ + name: string; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadFloatDerived + extends DifferentSpreadFloatRecord { + /** The index property */ + derivedProp: number; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadModelRecord extends Record { + knownProp: string; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadModelDerived + extends DifferentSpreadModelRecord { + /** The index property */ + derivedProp: ModelForRecord; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadModelArrayRecord + extends Record { + knownProp: string; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadModelArrayDerived + extends DifferentSpreadModelArrayRecord { + /** The index property */ + derivedProp: Array; +} + +/** The model spread Record and Record */ +export interface MultipleSpreadRecord extends Record { + /** The name property */ + flag: boolean; +} + +/** The model spread Record */ +export interface SpreadRecordForUnion extends Record { + /** The name property */ + flag: boolean; +} + +/** The model spread Record */ +export interface SpreadRecordForDiscriminatedUnion + extends Record { + /** The name property */ + name: string; +} + +export interface WidgetData0 { + kind: "kind0"; + fooProp: string; +} + +export interface WidgetData1 { + kind: "kind1"; + start: Date | string; + end?: Date | string; +} + +/** The model spread Record */ +export interface SpreadRecordForNonDiscriminatedUnion + extends Record { + /** The name property */ + name: string; +} + +/** The model spread Record */ +export interface SpreadRecordForNonDiscriminatedUnion2 + extends Record { + /** The name property */ + name: string; +} + +export interface WidgetData2 { + kind: "kind1"; + start: string; +} + +/** The model spread Record */ +export interface SpreadRecordForNonDiscriminatedUnion3 + extends Record { + /** The name property */ + name: string; +} /** The model extends from Record with a discriminator. */ export type ExtendsUnknownAdditionalPropertiesDiscriminated = @@ -124,3 +261,5 @@ export type ExtendsUnknownAdditionalPropertiesDiscriminated = export type IsUnknownAdditionalPropertiesDiscriminated = | IsUnknownAdditionalPropertiesDiscriminatedParent | IsUnknownAdditionalPropertiesDiscriminatedDerived; +/** Alias for WidgetData */ +export type WidgetData = WidgetData0 | WidgetData1; diff --git a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/outputModels.ts index 48df163aa2..8ff8b44b03 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/outputModels.ts @@ -83,6 +83,12 @@ export interface IsStringAdditionalPropertiesOutput name: string; } +/** The model spread Record with the same known property type */ +export interface SpreadStringRecordOutput extends Record { + /** The name property */ + name: string; +} + /** The model extends from Record type. */ export interface ExtendsFloatAdditionalPropertiesOutput extends Record { @@ -97,9 +103,17 @@ export interface IsFloatAdditionalPropertiesOutput id: number; } +/** The model spread Record with the same known property type */ +export interface SpreadFloatRecordOutput extends Record { + /** The id property */ + id: number; +} + /** The model extends from Record type. */ export interface ExtendsModelAdditionalPropertiesOutput - extends Record {} + extends Record { + knownProp: ModelForRecordOutput; +} /** model for record */ export interface ModelForRecordOutput { @@ -109,15 +123,139 @@ export interface ModelForRecordOutput { /** The model is from Record type. */ export interface IsModelAdditionalPropertiesOutput - extends Record {} + extends Record { + knownProp: ModelForRecordOutput; +} + +/** The model spread Record with the same known property type */ +export interface SpreadModelRecordOutput + extends Record { + knownProp: ModelForRecordOutput; +} /** The model extends from Record type. */ export interface ExtendsModelArrayAdditionalPropertiesOutput - extends Record> {} + extends Record> { + knownProp: Array; +} /** The model is from Record type. */ export interface IsModelArrayAdditionalPropertiesOutput - extends Record> {} + extends Record> { + knownProp: Array; +} + +export interface SpreadModelArrayRecordOutput + extends Record> { + knownProp: Array; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadStringRecordOutput extends Record { + /** The name property */ + id: number; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadStringDerivedOutput + extends DifferentSpreadStringRecordOutput { + /** The index property */ + derivedProp: string; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadFloatRecordOutput extends Record { + /** The id property */ + name: string; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadFloatDerivedOutput + extends DifferentSpreadFloatRecordOutput { + /** The index property */ + derivedProp: number; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadModelRecordOutput extends Record { + knownProp: string; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadModelDerivedOutput + extends DifferentSpreadModelRecordOutput { + /** The index property */ + derivedProp: ModelForRecordOutput; +} + +/** The model spread Record with the different known property type */ +export interface DifferentSpreadModelArrayRecordOutput + extends Record { + knownProp: string; +} + +/** The model extends from a model that spread Record with the different known property type */ +export interface DifferentSpreadModelArrayDerivedOutput + extends DifferentSpreadModelArrayRecordOutput { + /** The index property */ + derivedProp: Array; +} + +/** The model spread Record and Record */ +export interface MultipleSpreadRecordOutput extends Record { + /** The name property */ + flag: boolean; +} + +/** The model spread Record */ +export interface SpreadRecordForUnionOutput extends Record { + /** The name property */ + flag: boolean; +} + +/** The model spread Record */ +export interface SpreadRecordForDiscriminatedUnionOutput + extends Record { + /** The name property */ + name: string; +} + +export interface WidgetData0Output { + kind: "kind0"; + fooProp: string; +} + +export interface WidgetData1Output { + kind: "kind1"; + start: string; + end?: string; +} + +/** The model spread Record */ +export interface SpreadRecordForNonDiscriminatedUnionOutput + extends Record { + /** The name property */ + name: string; +} + +/** The model spread Record */ +export interface SpreadRecordForNonDiscriminatedUnion2Output + extends Record { + /** The name property */ + name: string; +} + +export interface WidgetData2Output { + kind: "kind1"; + start: string; +} + +/** The model spread Record */ +export interface SpreadRecordForNonDiscriminatedUnion3Output + extends Record { + /** The name property */ + name: string; +} /** The model extends from Record with a discriminator. */ export type ExtendsUnknownAdditionalPropertiesDiscriminatedOutput = @@ -127,3 +265,5 @@ export type ExtendsUnknownAdditionalPropertiesDiscriminatedOutput = export type IsUnknownAdditionalPropertiesDiscriminatedOutput = | IsUnknownAdditionalPropertiesDiscriminatedOutputParent | IsUnknownAdditionalPropertiesDiscriminatedDerivedOutput; +/** Alias for WidgetDataOutput */ +export type WidgetDataOutput = WidgetData0Output | WidgetData1Output; diff --git a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/parameters.ts b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/parameters.ts index e65dc25f36..471206eacd 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/parameters.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/parameters.ts @@ -11,12 +11,30 @@ import { IsUnknownAdditionalPropertiesDiscriminated, ExtendsStringAdditionalProperties, IsStringAdditionalProperties, + SpreadStringRecord, ExtendsFloatAdditionalProperties, IsFloatAdditionalProperties, + SpreadFloatRecord, ExtendsModelAdditionalProperties, IsModelAdditionalProperties, + SpreadModelRecord, ExtendsModelArrayAdditionalProperties, IsModelArrayAdditionalProperties, + SpreadModelArrayRecord, + DifferentSpreadStringRecord, + DifferentSpreadFloatRecord, + DifferentSpreadModelRecord, + DifferentSpreadModelArrayRecord, + DifferentSpreadStringDerived, + DifferentSpreadFloatDerived, + DifferentSpreadModelDerived, + DifferentSpreadModelArrayDerived, + MultipleSpreadRecord, + SpreadRecordForUnion, + SpreadRecordForDiscriminatedUnion, + SpreadRecordForNonDiscriminatedUnion, + SpreadRecordForNonDiscriminatedUnion2, + SpreadRecordForNonDiscriminatedUnion3, } from "./models.js"; export type ExtendsUnknownGetParameters = RequestParameters; @@ -89,6 +107,15 @@ export interface IsStringPutBodyParam { } export type IsStringPutParameters = IsStringPutBodyParam & RequestParameters; +export type SpreadStringGetParameters = RequestParameters; + +export interface SpreadStringPutBodyParam { + /** body */ + body: SpreadStringRecord; +} + +export type SpreadStringPutParameters = SpreadStringPutBodyParam & + RequestParameters; export type ExtendsFloatGetParameters = RequestParameters; export interface ExtendsFloatPutBodyParam { @@ -106,6 +133,15 @@ export interface IsFloatPutBodyParam { } export type IsFloatPutParameters = IsFloatPutBodyParam & RequestParameters; +export type SpreadFloatGetParameters = RequestParameters; + +export interface SpreadFloatPutBodyParam { + /** body */ + body: SpreadFloatRecord; +} + +export type SpreadFloatPutParameters = SpreadFloatPutBodyParam & + RequestParameters; export type ExtendsModelGetParameters = RequestParameters; export interface ExtendsModelPutBodyParam { @@ -123,6 +159,15 @@ export interface IsModelPutBodyParam { } export type IsModelPutParameters = IsModelPutBodyParam & RequestParameters; +export type SpreadModelGetParameters = RequestParameters; + +export interface SpreadModelPutBodyParam { + /** body */ + body: SpreadModelRecord; +} + +export type SpreadModelPutParameters = SpreadModelPutBodyParam & + RequestParameters; export type ExtendsModelArrayGetParameters = RequestParameters; export interface ExtendsModelArrayPutBodyParam { @@ -141,3 +186,138 @@ export interface IsModelArrayPutBodyParam { export type IsModelArrayPutParameters = IsModelArrayPutBodyParam & RequestParameters; +export type SpreadModelArrayGetParameters = RequestParameters; + +export interface SpreadModelArrayPutBodyParam { + /** body */ + body: SpreadModelArrayRecord; +} + +export type SpreadModelArrayPutParameters = SpreadModelArrayPutBodyParam & + RequestParameters; +export type SpreadDifferentStringGetParameters = RequestParameters; + +export interface SpreadDifferentStringPutBodyParam { + /** body */ + body: DifferentSpreadStringRecord; +} + +export type SpreadDifferentStringPutParameters = + SpreadDifferentStringPutBodyParam & RequestParameters; +export type SpreadDifferentFloatGetParameters = RequestParameters; + +export interface SpreadDifferentFloatPutBodyParam { + /** body */ + body: DifferentSpreadFloatRecord; +} + +export type SpreadDifferentFloatPutParameters = + SpreadDifferentFloatPutBodyParam & RequestParameters; +export type SpreadDifferentModelGetParameters = RequestParameters; + +export interface SpreadDifferentModelPutBodyParam { + /** body */ + body: DifferentSpreadModelRecord; +} + +export type SpreadDifferentModelPutParameters = + SpreadDifferentModelPutBodyParam & RequestParameters; +export type SpreadDifferentModelArrayGetParameters = RequestParameters; + +export interface SpreadDifferentModelArrayPutBodyParam { + /** body */ + body: DifferentSpreadModelArrayRecord; +} + +export type SpreadDifferentModelArrayPutParameters = + SpreadDifferentModelArrayPutBodyParam & RequestParameters; +export type ExtendsDifferentSpreadStringGetParameters = RequestParameters; + +export interface ExtendsDifferentSpreadStringPutBodyParam { + /** body */ + body: DifferentSpreadStringDerived; +} + +export type ExtendsDifferentSpreadStringPutParameters = + ExtendsDifferentSpreadStringPutBodyParam & RequestParameters; +export type ExtendsDifferentSpreadFloatGetParameters = RequestParameters; + +export interface ExtendsDifferentSpreadFloatPutBodyParam { + /** body */ + body: DifferentSpreadFloatDerived; +} + +export type ExtendsDifferentSpreadFloatPutParameters = + ExtendsDifferentSpreadFloatPutBodyParam & RequestParameters; +export type ExtendsDifferentSpreadModelGetParameters = RequestParameters; + +export interface ExtendsDifferentSpreadModelPutBodyParam { + /** body */ + body: DifferentSpreadModelDerived; +} + +export type ExtendsDifferentSpreadModelPutParameters = + ExtendsDifferentSpreadModelPutBodyParam & RequestParameters; +export type ExtendsDifferentSpreadModelArrayGetParameters = RequestParameters; + +export interface ExtendsDifferentSpreadModelArrayPutBodyParam { + /** body */ + body: DifferentSpreadModelArrayDerived; +} + +export type ExtendsDifferentSpreadModelArrayPutParameters = + ExtendsDifferentSpreadModelArrayPutBodyParam & RequestParameters; +export type MultipleSpreadGetParameters = RequestParameters; + +export interface MultipleSpreadPutBodyParam { + /** body */ + body: MultipleSpreadRecord; +} + +export type MultipleSpreadPutParameters = MultipleSpreadPutBodyParam & + RequestParameters; +export type SpreadRecordUnionGetParameters = RequestParameters; + +export interface SpreadRecordUnionPutBodyParam { + /** body */ + body: SpreadRecordForUnion; +} + +export type SpreadRecordUnionPutParameters = SpreadRecordUnionPutBodyParam & + RequestParameters; +export type SpreadRecordDiscriminatedUnionGetParameters = RequestParameters; + +export interface SpreadRecordDiscriminatedUnionPutBodyParam { + /** body */ + body: SpreadRecordForDiscriminatedUnion; +} + +export type SpreadRecordDiscriminatedUnionPutParameters = + SpreadRecordDiscriminatedUnionPutBodyParam & RequestParameters; +export type SpreadRecordNonDiscriminatedUnionGetParameters = RequestParameters; + +export interface SpreadRecordNonDiscriminatedUnionPutBodyParam { + /** body */ + body: SpreadRecordForNonDiscriminatedUnion; +} + +export type SpreadRecordNonDiscriminatedUnionPutParameters = + SpreadRecordNonDiscriminatedUnionPutBodyParam & RequestParameters; +export type SpreadRecordNonDiscriminatedUnion2GetParameters = RequestParameters; + +export interface SpreadRecordNonDiscriminatedUnion2PutBodyParam { + /** body */ + body: SpreadRecordForNonDiscriminatedUnion2; +} + +export type SpreadRecordNonDiscriminatedUnion2PutParameters = + SpreadRecordNonDiscriminatedUnion2PutBodyParam & RequestParameters; +export type SpreadRecordNonDiscriminatedUnion3GetParameters = RequestParameters; + +export interface SpreadRecordNonDiscriminatedUnion3PutBodyParam { + /** body */ + body: SpreadRecordForNonDiscriminatedUnion3; +} + +export type SpreadRecordNonDiscriminatedUnion3PutParameters = + SpreadRecordNonDiscriminatedUnion3PutBodyParam & RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/responses.ts b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/responses.ts index 6da7cdf6f3..d353627b2d 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyAdditional/src/responses.ts @@ -11,12 +11,30 @@ import { IsUnknownAdditionalPropertiesDiscriminatedOutput, ExtendsStringAdditionalPropertiesOutput, IsStringAdditionalPropertiesOutput, + SpreadStringRecordOutput, ExtendsFloatAdditionalPropertiesOutput, IsFloatAdditionalPropertiesOutput, + SpreadFloatRecordOutput, ExtendsModelAdditionalPropertiesOutput, IsModelAdditionalPropertiesOutput, + SpreadModelRecordOutput, ExtendsModelArrayAdditionalPropertiesOutput, IsModelArrayAdditionalPropertiesOutput, + SpreadModelArrayRecordOutput, + DifferentSpreadStringRecordOutput, + DifferentSpreadFloatRecordOutput, + DifferentSpreadModelRecordOutput, + DifferentSpreadModelArrayRecordOutput, + DifferentSpreadStringDerivedOutput, + DifferentSpreadFloatDerivedOutput, + DifferentSpreadModelDerivedOutput, + DifferentSpreadModelArrayDerivedOutput, + MultipleSpreadRecordOutput, + SpreadRecordForUnionOutput, + SpreadRecordForDiscriminatedUnionOutput, + SpreadRecordForNonDiscriminatedUnionOutput, + SpreadRecordForNonDiscriminatedUnion2Output, + SpreadRecordForNonDiscriminatedUnion3Output, } from "./outputModels.js"; /** The request has succeeded. */ @@ -109,6 +127,17 @@ export interface IsStringPut204Response extends HttpResponse { status: "204"; } +/** The request has succeeded. */ +export interface SpreadStringGet200Response extends HttpResponse { + status: "200"; + body: SpreadStringRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadStringPut204Response extends HttpResponse { + status: "204"; +} + /** The request has succeeded. */ export interface ExtendsFloatGet200Response extends HttpResponse { status: "200"; @@ -131,6 +160,17 @@ export interface IsFloatPut204Response extends HttpResponse { status: "204"; } +/** The request has succeeded. */ +export interface SpreadFloatGet200Response extends HttpResponse { + status: "200"; + body: SpreadFloatRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadFloatPut204Response extends HttpResponse { + status: "204"; +} + /** The request has succeeded. */ export interface ExtendsModelGet200Response extends HttpResponse { status: "200"; @@ -153,6 +193,17 @@ export interface IsModelPut204Response extends HttpResponse { status: "204"; } +/** The request has succeeded. */ +export interface SpreadModelGet200Response extends HttpResponse { + status: "200"; + body: SpreadModelRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadModelPut204Response extends HttpResponse { + status: "204"; +} + /** The request has succeeded. */ export interface ExtendsModelArrayGet200Response extends HttpResponse { status: "200"; @@ -174,3 +225,184 @@ export interface IsModelArrayGet200Response extends HttpResponse { export interface IsModelArrayPut204Response extends HttpResponse { status: "204"; } + +/** The request has succeeded. */ +export interface SpreadModelArrayGet200Response extends HttpResponse { + status: "200"; + body: SpreadModelArrayRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadModelArrayPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadDifferentStringGet200Response extends HttpResponse { + status: "200"; + body: DifferentSpreadStringRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadDifferentStringPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadDifferentFloatGet200Response extends HttpResponse { + status: "200"; + body: DifferentSpreadFloatRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadDifferentFloatPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadDifferentModelGet200Response extends HttpResponse { + status: "200"; + body: DifferentSpreadModelRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadDifferentModelPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadDifferentModelArrayGet200Response extends HttpResponse { + status: "200"; + body: DifferentSpreadModelArrayRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadDifferentModelArrayPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface ExtendsDifferentSpreadStringGet200Response + extends HttpResponse { + status: "200"; + body: DifferentSpreadStringDerivedOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ExtendsDifferentSpreadStringPut204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface ExtendsDifferentSpreadFloatGet200Response + extends HttpResponse { + status: "200"; + body: DifferentSpreadFloatDerivedOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ExtendsDifferentSpreadFloatPut204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface ExtendsDifferentSpreadModelGet200Response + extends HttpResponse { + status: "200"; + body: DifferentSpreadModelDerivedOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ExtendsDifferentSpreadModelPut204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface ExtendsDifferentSpreadModelArrayGet200Response + extends HttpResponse { + status: "200"; + body: DifferentSpreadModelArrayDerivedOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ExtendsDifferentSpreadModelArrayPut204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface MultipleSpreadGet200Response extends HttpResponse { + status: "200"; + body: MultipleSpreadRecordOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface MultipleSpreadPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadRecordUnionGet200Response extends HttpResponse { + status: "200"; + body: SpreadRecordForUnionOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadRecordUnionPut204Response extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadRecordDiscriminatedUnionGet200Response + extends HttpResponse { + status: "200"; + body: SpreadRecordForDiscriminatedUnionOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadRecordDiscriminatedUnionPut204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadRecordNonDiscriminatedUnionGet200Response + extends HttpResponse { + status: "200"; + body: SpreadRecordForNonDiscriminatedUnionOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadRecordNonDiscriminatedUnionPut204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadRecordNonDiscriminatedUnion2Get200Response + extends HttpResponse { + status: "200"; + body: SpreadRecordForNonDiscriminatedUnion2Output; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadRecordNonDiscriminatedUnion2Put204Response + extends HttpResponse { + status: "204"; +} + +/** The request has succeeded. */ +export interface SpreadRecordNonDiscriminatedUnion3Get200Response + extends HttpResponse { + status: "200"; + body: SpreadRecordForNonDiscriminatedUnion3Output; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface SpreadRecordNonDiscriminatedUnion3Put204Response + extends HttpResponse { + status: "204"; +} diff --git a/packages/typespec-ts/test/integration/generated/models/propertyNullable/package.json b/packages/typespec-ts/test/integration/generated/models/propertyNullable/package.json index ab62a351a5..344a1741a3 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyNullable/package.json +++ b/packages/typespec-ts/test/integration/generated/models/propertyNullable/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/propertyOptional/package.json b/packages/typespec-ts/test/integration/generated/models/propertyOptional/package.json index 43bbf399d8..e14e0f00cf 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyOptional/package.json +++ b/packages/typespec-ts/test/integration/generated/models/propertyOptional/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/propertyTypes/package.json b/packages/typespec-ts/test/integration/generated/models/propertyTypes/package.json index f4db944bce..36a98dc6ce 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyTypes/package.json +++ b/packages/typespec-ts/test/integration/generated/models/propertyTypes/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/models.ts b/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/models.ts index 6f829bf5b2..b4525b2ae4 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/models.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/models.ts @@ -76,7 +76,7 @@ export interface DurationProperty { /** Model with enum properties */ export interface EnumProperty { /** Property */ - property: "ValueOne" | "ValueTwo"; + property: FixedInnerEnum; } /** Model with extensible enum properties */ @@ -196,5 +196,7 @@ export interface UnionEnumValueProperty { property: "value2"; } +/** Enum that will be used as a property for model EnumProperty. Non-extensible. */ +export type FixedInnerEnum = "ValueOne" | "ValueTwo"; /** Alias for InnerEnum */ export type InnerEnum = string | "ValueOne" | "ValueTwo"; diff --git a/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/outputModels.ts index 9f35cb9e51..eeb2a1a1c9 100644 --- a/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/models/propertyTypes/src/outputModels.ts @@ -76,7 +76,7 @@ export interface DurationPropertyOutput { /** Model with enum properties */ export interface EnumPropertyOutput { /** Property */ - property: "ValueOne" | "ValueTwo"; + property: FixedInnerEnumOutput; } /** Model with extensible enum properties */ @@ -196,5 +196,7 @@ export interface UnionEnumValuePropertyOutput { property: "value2"; } +/** Enum that will be used as a property for model EnumProperty. Non-extensible. */ +export type FixedInnerEnumOutput = "ValueOne" | "ValueTwo"; /** Alias for InnerEnumOutput */ export type InnerEnumOutput = string | "ValueOne" | "ValueTwo"; diff --git a/packages/typespec-ts/test/integration/generated/models/usage/package.json b/packages/typespec-ts/test/integration/generated/models/usage/package.json index e22008e851..576e5eec70 100644 --- a/packages/typespec-ts/test/integration/generated/models/usage/package.json +++ b/packages/typespec-ts/test/integration/generated/models/usage/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/models/visibility/package.json b/packages/typespec-ts/test/integration/generated/models/visibility/package.json index 0361ad57ca..9f5cc4967b 100644 --- a/packages/typespec-ts/test/integration/generated/models/visibility/package.json +++ b/packages/typespec-ts/test/integration/generated/models/visibility/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/clientDefinitions.ts new file mode 100644 index 0000000000..8ffe353bf5 --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/clientDefinitions.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + StringBodySendAsTextParameters, + StringBodyGetAsTextParameters, + StringBodySendAsJsonParameters, + StringBodyGetAsJsonParameters, +} from "./parameters.js"; +import { + StringBodySendAsText200Response, + StringBodyGetAsText200Response, + StringBodySendAsJson200Response, + StringBodyGetAsJson200Response, +} from "./responses.js"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface SendAsText { + post( + options: StringBodySendAsTextParameters, + ): StreamableMethod; +} + +export interface GetAsText { + get( + options?: StringBodyGetAsTextParameters, + ): StreamableMethod; +} + +export interface SendAsJson { + post( + options: StringBodySendAsJsonParameters, + ): StreamableMethod; +} + +export interface GetAsJson { + get( + options?: StringBodyGetAsJsonParameters, + ): StreamableMethod; +} + +export interface Routes { + /** Resource for '/payload/media-type/string-body/sendAsText' has methods for the following verbs: post */ + (path: "/payload/media-type/string-body/sendAsText"): SendAsText; + /** Resource for '/payload/media-type/string-body/getAsText' has methods for the following verbs: get */ + (path: "/payload/media-type/string-body/getAsText"): GetAsText; + /** Resource for '/payload/media-type/string-body/sendAsJson' has methods for the following verbs: post */ + (path: "/payload/media-type/string-body/sendAsJson"): SendAsJson; + /** Resource for '/payload/media-type/string-body/getAsJson' has methods for the following verbs: get */ + (path: "/payload/media-type/string-body/getAsJson"): GetAsJson; +} + +export type MediaTypeClient = Client & { + path: Routes; +}; diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.ts new file mode 100644 index 0000000000..422db68f62 --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import MediaTypeClient from "./mediaTypeClient.js"; + +export * from "./mediaTypeClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; + +export default MediaTypeClient; diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/logger.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/logger.ts new file mode 100644 index 0000000000..c1275a2113 --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("payload-media-type"); diff --git a/packages/typespec-ts/test/integration/generated/projection/src/projectionClient.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/mediaTypeClient.ts similarity index 76% rename from packages/typespec-ts/test/integration/generated/projection/src/projectionClient.ts rename to packages/typespec-ts/test/integration/generated/payload/media-type/src/mediaTypeClient.ts index c771f01890..4245ae89d1 100644 --- a/packages/typespec-ts/test/integration/generated/projection/src/projectionClient.ts +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/mediaTypeClient.ts @@ -3,18 +3,18 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; -import { ProjectionClient } from "./clientDefinitions.js"; +import { MediaTypeClient } from "./clientDefinitions.js"; /** - * Initialize a new instance of `ProjectionClient` + * Initialize a new instance of `MediaTypeClient` * @param options - the parameter for all optional parameters */ export default function createClient( options: ClientOptions = {}, -): ProjectionClient { +): MediaTypeClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; - const userAgentInfo = `azsdk-js-projection-rest/1.0.0-beta.1`; + const userAgentInfo = `azsdk-js-payload-media-type-rest/1.0.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` @@ -29,7 +29,7 @@ export default function createClient( }, }; - const client = getClient(endpointUrl, options) as ProjectionClient; + const client = getClient(endpointUrl, options) as MediaTypeClient; client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); return client; diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/parameters.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/parameters.ts new file mode 100644 index 0000000000..8ee7b19479 --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/parameters.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; + +export interface StringBodySendAsTextBodyParam { + body: string; +} + +export interface StringBodySendAsTextMediaTypesParam { + contentType: "text/plain"; +} + +export type StringBodySendAsTextParameters = + StringBodySendAsTextMediaTypesParam & + StringBodySendAsTextBodyParam & + RequestParameters; +export type StringBodyGetAsTextParameters = RequestParameters; + +export interface StringBodySendAsJsonBodyParam { + body: string; +} + +export interface StringBodySendAsJsonMediaTypesParam { + contentType: "application/json"; +} + +export type StringBodySendAsJsonParameters = + StringBodySendAsJsonMediaTypesParam & + StringBodySendAsJsonBodyParam & + RequestParameters; +export type StringBodyGetAsJsonParameters = RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/responses.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/responses.ts new file mode 100644 index 0000000000..3d847d1160 --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/responses.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { HttpResponse } from "@azure-rest/core-client"; + +/** The request has succeeded. */ +export interface StringBodySendAsText200Response extends HttpResponse { + status: "200"; +} + +/** The request has succeeded. */ +export interface StringBodyGetAsText200Response extends HttpResponse { + status: "200"; + body: string; +} + +/** The request has succeeded. */ +export interface StringBodySendAsJson200Response extends HttpResponse { + status: "200"; +} + +/** The request has succeeded. */ +export interface StringBodyGetAsJson200Response extends HttpResponse { + status: "200"; + body: string; +} diff --git a/packages/typespec-ts/test/integration/generated/projection/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml similarity index 73% rename from packages/typespec-ts/test/integration/generated/projection/tspconfig.yaml rename to packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml index bac7f9f06d..4b5ed9e960 100644 --- a/packages/typespec-ts/test/integration/generated/projection/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml @@ -8,8 +8,6 @@ options: addCredentials: false azureSdkForJs: false isTypeSpecTest: true - title: ProjectionClient enableOperationGroup: true packageDetails: - name: "@msinternal/projection" - description: "Projection Test Service" + name: "@msinternal/payload-media-type" diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/payload/multipart/src/clientDefinitions.ts index 4820ef49fe..bc11cbeae2 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/src/clientDefinitions.ts +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/src/clientDefinitions.ts @@ -9,6 +9,7 @@ import { FormDataJsonArrayPartsParameters, FormDataMultiBinaryPartsParameters, FormDataCheckFileNameAndContentTypeParameters, + FormDataAnonymousModelParameters, } from "./parameters.js"; import { FormDataBasic204Response, @@ -18,6 +19,7 @@ import { FormDataJsonArrayParts204Response, FormDataMultiBinaryParts204Response, FormDataCheckFileNameAndContentType204Response, + FormDataAnonymousModel204Response, } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -70,6 +72,13 @@ export interface CheckFileNameAndContentType { ): StreamableMethod; } +export interface AnonymousModel { + /** Test content-type: multipart/form-data */ + post( + options: FormDataAnonymousModelParameters, + ): StreamableMethod; +} + export interface Routes { /** Resource for '/multipart/form-data/mixed-parts' has methods for the following verbs: post */ (path: "/multipart/form-data/mixed-parts"): Basic; @@ -87,6 +96,8 @@ export interface Routes { ( path: "/multipart/form-data/check-filename-and-content-type", ): CheckFileNameAndContentType; + /** Resource for '/multipart/form-data/anonymous-model' has methods for the following verbs: post */ + (path: "/multipart/form-data/anonymous-model"): AnonymousModel; } export type MultiPartClient = Client & { diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/src/parameters.ts b/packages/typespec-ts/test/integration/generated/payload/multipart/src/parameters.ts index 87435fd461..4f3c88ce2f 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/src/parameters.ts +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/src/parameters.ts @@ -98,3 +98,23 @@ export type FormDataCheckFileNameAndContentTypeParameters = FormDataCheckFileNameAndContentTypeMediaTypesParam & FormDataCheckFileNameAndContentTypeBodyParam & RequestParameters; + +export interface FormDataAnonymousModelBodyParam { + body?: { + profileImage: + | string + | Uint8Array + | ReadableStream + | NodeJS.ReadableStream + | File; + }; +} + +export interface FormDataAnonymousModelMediaTypesParam { + contentType: "multipart/form-data"; +} + +export type FormDataAnonymousModelParameters = + FormDataAnonymousModelMediaTypesParam & + FormDataAnonymousModelBodyParam & + RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/src/responses.ts b/packages/typespec-ts/test/integration/generated/payload/multipart/src/responses.ts index 719a25d3e2..475f9145a5 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/src/responses.ts @@ -38,3 +38,8 @@ export interface FormDataCheckFileNameAndContentType204Response extends HttpResponse { status: "204"; } + +/** There is no content to send for this request, but the headers may be useful. */ +export interface FormDataAnonymousModel204Response extends HttpResponse { + status: "204"; +} diff --git a/packages/typespec-ts/test/integration/generated/projection/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/projection/src/clientDefinitions.ts deleted file mode 100644 index ec912ecdfc..0000000000 --- a/packages/typespec-ts/test/integration/generated/projection/src/clientDefinitions.ts +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { - OperationParameters, - ParameterParameters, - PropertyJsonParameters, - PropertyClientParameters, - PropertyLanguageParameters, - PropertyJsonAndClientParameters, - ModelClientParameters, - ModelLanguageParameters, -} from "./parameters.js"; -import { - Operation204Response, - Parameter204Response, - PropertyJson204Response, - PropertyClient204Response, - PropertyLanguage204Response, - PropertyJsonAndClient204Response, - ModelClient204Response, - ModelLanguage204Response, -} from "./responses.js"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; - -export interface Operation { - post(options?: OperationParameters): StreamableMethod; -} - -export interface Parameter { - post(options: ParameterParameters): StreamableMethod; -} - -export interface PropertyJson { - post( - options?: PropertyJsonParameters, - ): StreamableMethod; -} - -export interface PropertyClient { - post( - options?: PropertyClientParameters, - ): StreamableMethod; -} - -export interface PropertyLanguage { - post( - options?: PropertyLanguageParameters, - ): StreamableMethod; -} - -export interface PropertyJsonAndClient { - post( - options?: PropertyJsonAndClientParameters, - ): StreamableMethod; -} - -export interface ModelClient { - post( - options?: ModelClientParameters, - ): StreamableMethod; -} - -export interface ModelLanguage { - post( - options?: ModelLanguageParameters, - ): StreamableMethod; -} - -export interface Routes { - /** Resource for '/projection/projected-name/operation' has methods for the following verbs: post */ - (path: "/projection/projected-name/operation"): Operation; - /** Resource for '/projection/projected-name/parameter' has methods for the following verbs: post */ - (path: "/projection/projected-name/parameter"): Parameter; - /** Resource for '/projection/projected-name/property/json' has methods for the following verbs: post */ - (path: "/projection/projected-name/property/json"): PropertyJson; - /** Resource for '/projection/projected-name/property/client' has methods for the following verbs: post */ - (path: "/projection/projected-name/property/client"): PropertyClient; - /** Resource for '/projection/projected-name/property/language' has methods for the following verbs: post */ - (path: "/projection/projected-name/property/language"): PropertyLanguage; - /** Resource for '/projection/projected-name/property/json-and-client' has methods for the following verbs: post */ - ( - path: "/projection/projected-name/property/json-and-client", - ): PropertyJsonAndClient; - /** Resource for '/projection/projected-name/model/client' has methods for the following verbs: post */ - (path: "/projection/projected-name/model/client"): ModelClient; - /** Resource for '/projection/projected-name/model/language' has methods for the following verbs: post */ - (path: "/projection/projected-name/model/language"): ModelLanguage; -} - -export type ProjectionClient = Client & { - path: Routes; -}; diff --git a/packages/typespec-ts/test/integration/generated/projection/src/models.ts b/packages/typespec-ts/test/integration/generated/projection/src/models.ts deleted file mode 100644 index 2a70113d93..0000000000 --- a/packages/typespec-ts/test/integration/generated/projection/src/models.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -export interface JsonProjectedNameModel { - /** Pass in true */ - wireName: boolean; -} - -export interface ClientProjectedNameModel { - /** Pass in true */ - defaultName: boolean; -} - -export interface LanguageProjectedNameModel { - /** Pass in true */ - defaultName: boolean; -} - -export interface JsonAndClientProjectedNameModel { - /** Pass in true */ - wireName: boolean; -} - -export interface ModelWithClientProjectedName { - /** Pass in true */ - defaultName: boolean; -} - -export interface ModelWithLanguageProjectedName { - /** Pass in true */ - defaultName: boolean; -} diff --git a/packages/typespec-ts/test/integration/generated/projection/src/parameters.ts b/packages/typespec-ts/test/integration/generated/projection/src/parameters.ts deleted file mode 100644 index c7d4813863..0000000000 --- a/packages/typespec-ts/test/integration/generated/projection/src/parameters.ts +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { RequestParameters } from "@azure-rest/core-client"; -import { - JsonProjectedNameModel, - ClientProjectedNameModel, - LanguageProjectedNameModel, - JsonAndClientProjectedNameModel, - ModelWithClientProjectedName, - ModelWithLanguageProjectedName, -} from "./models.js"; - -export type OperationParameters = RequestParameters; - -export interface ParameterQueryParamProperties { - "default-name": string; -} - -export interface ParameterQueryParam { - queryParameters: ParameterQueryParamProperties; -} - -export type ParameterParameters = ParameterQueryParam & RequestParameters; - -export interface PropertyJsonBodyParam { - body?: JsonProjectedNameModel; -} - -export type PropertyJsonParameters = PropertyJsonBodyParam & RequestParameters; - -export interface PropertyClientBodyParam { - body?: ClientProjectedNameModel; -} - -export type PropertyClientParameters = PropertyClientBodyParam & - RequestParameters; - -export interface PropertyLanguageBodyParam { - body?: LanguageProjectedNameModel; -} - -export type PropertyLanguageParameters = PropertyLanguageBodyParam & - RequestParameters; - -export interface PropertyJsonAndClientBodyParam { - body?: JsonAndClientProjectedNameModel; -} - -export type PropertyJsonAndClientParameters = PropertyJsonAndClientBodyParam & - RequestParameters; - -export interface ModelClientBodyParam { - body?: ModelWithClientProjectedName; -} - -export type ModelClientParameters = ModelClientBodyParam & RequestParameters; - -export interface ModelLanguageBodyParam { - body?: ModelWithLanguageProjectedName; -} - -export type ModelLanguageParameters = ModelLanguageBodyParam & - RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/projection/src/responses.ts b/packages/typespec-ts/test/integration/generated/projection/src/responses.ts deleted file mode 100644 index 505295bfc5..0000000000 --- a/packages/typespec-ts/test/integration/generated/projection/src/responses.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { HttpResponse } from "@azure-rest/core-client"; - -/** There is no content to send for this request, but the headers may be useful. */ -export interface Operation204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface Parameter204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface PropertyJson204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface PropertyClient204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface PropertyLanguage204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface PropertyJsonAndClient204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface ModelClient204Response extends HttpResponse { - status: "204"; -} - -/** There is no content to send for this request, but the headers may be useful. */ -export interface ModelLanguage204Response extends HttpResponse { - status: "204"; -} diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srvDriven1/package.json b/packages/typespec-ts/test/integration/generated/resiliency/srvDriven1/package.json index 3372a540f5..1d909f5868 100644 --- a/packages/typespec-ts/test/integration/generated/resiliency/srvDriven1/package.json +++ b/packages/typespec-ts/test/integration/generated/resiliency/srvDriven1/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srvDriven2/package.json b/packages/typespec-ts/test/integration/generated/resiliency/srvDriven2/package.json index 745b52568e..a5be34119a 100644 --- a/packages/typespec-ts/test/integration/generated/resiliency/srvDriven2/package.json +++ b/packages/typespec-ts/test/integration/generated/resiliency/srvDriven2/package.json @@ -22,7 +22,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -35,8 +35,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.ts b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.ts index 23b721c06c..77556f3e7b 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.ts +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.ts @@ -7,5 +7,6 @@ export * from "./multipleParamInServerPathClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default MultipleParamInServerPathClient; diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/models.ts b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/models.ts new file mode 100644 index 0000000000..73ba43f52e --- /dev/null +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/models.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Service versions */ +export type Versions = "v1.0"; diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts index 8e5321aa05..d25c524611 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts @@ -4,9 +4,10 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { MultipleParamInServerPathClient } from "./clientDefinitions.js"; +import { Versions } from "./models.js"; export interface MultipleParamInServerPathClientOptions extends ClientOptions { - apiVersion?: string; + apiVersion?: Versions; } /** diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/clientDefinitions.ts b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/clientDefinitions.ts index 12e1c81916..e2e26f28ec 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/clientDefinitions.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/clientDefinitions.ts @@ -5,11 +5,13 @@ import { WithoutApiVersionParameters, WithQueryApiVersionParameters, WithPathApiVersionParameters, + WithQueryOldApiVersionParameters, } from "./parameters.js"; import { WithoutApiVersion200Response, WithQueryApiVersion200Response, WithPathApiVersion200Response, + WithQueryOldApiVersion200Response, } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -31,6 +33,12 @@ export interface WithPathApiVersion { ): StreamableMethod; } +export interface WithQueryOldApiVersion { + head( + options?: WithQueryOldApiVersionParameters, + ): StreamableMethod; +} + export interface Routes { /** Resource for '/server/versions/versioned/without-api-version' has methods for the following verbs: head */ (path: "/server/versions/versioned/without-api-version"): WithoutApiVersion; @@ -43,6 +51,10 @@ export interface Routes { path: "/server/versions/versioned/with-path-api-version/{apiVersion}", apiVersion: string, ): WithPathApiVersion; + /** Resource for '/server/versions/versioned/with-query-old-api-version' has methods for the following verbs: head */ + ( + path: "/server/versions/versioned/with-query-old-api-version", + ): WithQueryOldApiVersion; } export type VersionedParamInServerVersionsClient = Client & { diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/parameters.ts b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/parameters.ts index 1591399969..57eafe8fe5 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/parameters.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/parameters.ts @@ -16,3 +16,14 @@ export interface WithQueryApiVersionQueryParam { export type WithQueryApiVersionParameters = WithQueryApiVersionQueryParam & RequestParameters; export type WithPathApiVersionParameters = RequestParameters; + +export interface WithQueryOldApiVersionQueryParamProperties { + "api-version": string; +} + +export interface WithQueryOldApiVersionQueryParam { + queryParameters: WithQueryOldApiVersionQueryParamProperties; +} + +export type WithQueryOldApiVersionParameters = + WithQueryOldApiVersionQueryParam & RequestParameters; diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/responses.ts b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/responses.ts index 82277c5841..4b91c8fa54 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/responses.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/responses.ts @@ -17,3 +17,8 @@ export interface WithQueryApiVersion200Response extends HttpResponse { export interface WithPathApiVersion200Response extends HttpResponse { status: "200"; } + +/** The request has succeeded. */ +export interface WithQueryOldApiVersion200Response extends HttpResponse { + status: "200"; +} diff --git a/packages/typespec-ts/test/integration/generated/union-body/package.json b/packages/typespec-ts/test/integration/generated/union-body/package.json index 8b15e60178..bf0fbcccea 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/package.json +++ b/packages/typespec-ts/test/integration/generated/union-body/package.json @@ -73,11 +73,11 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^8.0.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", @@ -103,7 +103,7 @@ "karma-source-map-support": "~1.4.0", "karma-sourcemap-loader": "^0.4.0", "karma": "^6.2.0", - "c8": "^8.0.0", + "nyc": "^15.1.0", "ts-node": "^10.0.0" }, "type": "module", diff --git a/packages/typespec-ts/test/integration/generated/union-body/src/models.ts b/packages/typespec-ts/test/integration/generated/union-body/src/models.ts index 77f63a500f..ecdd11d559 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/src/models.ts +++ b/packages/typespec-ts/test/integration/generated/union-body/src/models.ts @@ -6,10 +6,12 @@ export interface RequestRegisterCC extends CommonRegistrationRequest { } export interface CommonRegistrationRequest { - /** Possible values: "01" */ - payMethod: string; + payMethod: PAYMENT_METHODS; } export interface RequestRegisterVA { prop: string; } + +/** Alias for PAYMENT_METHODS */ +export type PAYMENT_METHODS = "01"; diff --git a/packages/typespec-ts/test/integration/generated/union-body/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/union-body/src/outputModels.ts index ece7c8c88e..4f5c067f54 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/union-body/src/outputModels.ts @@ -7,10 +7,12 @@ export interface RequestRegisterCCOutput } export interface CommonRegistrationRequestOutput { - /** Possible values: "01" */ - payMethod: string; + payMethod: PAYMENT_METHODSOutput; } export interface RequestRegisterVAOutput { prop: string; } + +/** Alias for PAYMENT_METHODSOutput */ +export type PAYMENT_METHODSOutput = "01"; diff --git a/packages/typespec-ts/test/integration/generated/unions/package.json b/packages/typespec-ts/test/integration/generated/unions/package.json index 3204c28290..fa49867e93 100644 --- a/packages/typespec-ts/test/integration/generated/unions/package.json +++ b/packages/typespec-ts/test/integration/generated/unions/package.json @@ -62,11 +62,11 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^8.0.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", diff --git a/packages/typespec-ts/test/integration/generated/unions/samples-dev/enumsOnlySendSample.ts b/packages/typespec-ts/test/integration/generated/unions/samples-dev/enumsOnlySendSample.ts index ed168c6c32..333ac4ad72 100644 --- a/packages/typespec-ts/test/integration/generated/unions/samples-dev/enumsOnlySendSample.ts +++ b/packages/typespec-ts/test/integration/generated/unions/samples-dev/enumsOnlySendSample.ts @@ -15,7 +15,7 @@ async function enumsOnlySendSample() { const client = createUnionsClient(); const result = await client .path("/type/union/enums-only") - .post({ body: { prop: { lr: "left", ud: "left" } } }); + .post({ body: { prop: { lr: "left", ud: "up" } } }); console.log(result); } diff --git a/packages/typespec-ts/test/integration/generated/unions/src/models.ts b/packages/typespec-ts/test/integration/generated/unions/src/models.ts index 5d80dba23d..0d793788f7 100644 --- a/packages/typespec-ts/test/integration/generated/unions/src/models.ts +++ b/packages/typespec-ts/test/integration/generated/unions/src/models.ts @@ -11,9 +11,9 @@ export interface Dog { export interface EnumsOnlyCases { /** This should be receive/send the left variant */ - lr: string | string; + lr: LR | UD; /** This should be receive/send the up variant */ - ud: string | string; + ud: UD | UD; } export interface StringAndArrayCases { @@ -47,3 +47,7 @@ export interface MixedTypesCases { /** Alias for StringExtensibleNamedUnion */ export type StringExtensibleNamedUnion = string | "b" | "c"; +/** Alias for LR */ +export type LR = "left" | "right"; +/** Alias for UD */ +export type UD = "up" | "down"; diff --git a/packages/typespec-ts/test/integration/generated/unions/src/outputModels.ts b/packages/typespec-ts/test/integration/generated/unions/src/outputModels.ts index 940362007c..96a3c89bef 100644 --- a/packages/typespec-ts/test/integration/generated/unions/src/outputModels.ts +++ b/packages/typespec-ts/test/integration/generated/unions/src/outputModels.ts @@ -11,9 +11,9 @@ export interface DogOutput { export interface EnumsOnlyCasesOutput { /** This should be receive/send the left variant */ - lr: string | string; + lr: LROutput | UDOutput; /** This should be receive/send the up variant */ - ud: string | string; + ud: UDOutput | UDOutput; } export interface StringAndArrayCasesOutput { @@ -47,3 +47,7 @@ export interface MixedTypesCasesOutput { /** Alias for StringExtensibleNamedUnionOutput */ export type StringExtensibleNamedUnionOutput = string | "b" | "c"; +/** Alias for LROutput */ +export type LROutput = "left" | "right"; +/** Alias for UDOutput */ +export type UDOutput = "up" | "down"; diff --git a/packages/typespec-ts/test/integration/modelPropertyAdditional.spec.ts b/packages/typespec-ts/test/integration/modelPropertyAdditional.spec.ts index 41ee944b78..ce62bbd1a4 100644 --- a/packages/typespec-ts/test/integration/modelPropertyAdditional.spec.ts +++ b/packages/typespec-ts/test/integration/modelPropertyAdditional.spec.ts @@ -2,7 +2,7 @@ import { assert } from "chai"; import AdditionalPropertiesClientFactory, { AdditionalPropertiesClient } from "./generated/models/propertyAdditional/src/index.js"; -describe("ClientRequestIdClient", () => { +describe("ModelsPropertyAdditional Rest Client", () => { let client: AdditionalPropertiesClient; beforeEach(() => { @@ -217,7 +217,8 @@ describe("ClientRequestIdClient", () => { .path("/type/property/additionalProperties/extendsRecordModel") .put({ body: { - prop: { state: "ok" } + prop: { state: "ok" }, + knownProp:{state:"ok"} } }); assert.strictEqual(result.status, "204"); @@ -244,7 +245,8 @@ describe("ClientRequestIdClient", () => { .path("/type/property/additionalProperties/isRecordModel") .put({ body: { - prop: { state: "ok" } + prop: { state: "ok" }, + knownProp:{state:"ok"} } }); assert.strictEqual(result.status, "204"); @@ -273,7 +275,8 @@ describe("ClientRequestIdClient", () => { .path("/type/property/additionalProperties/extendsRecordModelArray") .put({ body: { - prop: [{ state: "ok" }, { state: "ok" }] + prop: [{ state: "ok" }, { state: "ok" }], + knownProp:[{ state: "ok" }, { state: "ok" }] } }); assert.strictEqual(result.status, "204"); @@ -302,7 +305,672 @@ describe("ClientRequestIdClient", () => { .path("/type/property/additionalProperties/isRecordModelArray") .put({ body: { - prop: [{ state: "ok" }, { state: "ok" }] + prop: [{ state: "ok" }, { state: "ok" }], + knownProp:[{ state: "ok" }, { state: "ok" }] + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record string additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordString") + .get({ + body: { + name: "SpreadSpringRecord", + prop: "abc" + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record string additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordString") + .put({ + body: { + name: "SpreadSpringRecord", + prop: "abc" + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record float additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordFloat") + .get({ + body: { + id: 43.125, + prop: 43.125, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record float additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordFloat") + .put({ + body: { + id: 43.125, + prop: 43.125, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record model additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordModel") + .get({ + body: { + prop: { state: "ok" }, + knownProp:{ state: "ok" } + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record model additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordModel") + .put({ + body: { + prop: { state: "ok" }, + knownProp:{ state: "ok" } + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record model array additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordModelArray") + .get({ + body: { + knownProp: [{ state: "ok" }, { state: "ok" }], + prop: [{ state: "ok" }, { state: "ok" }], + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record model array additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordModelArray") + .put({ + body: { + knownProp: [{ state: "ok" }, { state: "ok" }], + prop: [{ state: "ok" }, { state: "ok" }], + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread different record string additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordString") + .get({ + body: { + id: 43.125, + prop: "abc", + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread different record string additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordString") + .put({ + body: { + id: 43.125, + prop: "abc", + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread different record float additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordFloat") + .get({ + body: { + name: "abc", + prop: 43.125, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread different record float additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordFloat") + .put({ + body: { + name: "abc", + prop: 43.125, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread different record model additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordModel") + .get({ + body: { + knownProp: "abc", + prop: { state: "ok" }, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread different record model additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordModel") + .put({ + body: { + knownProp: "abc", + prop: { state: "ok" }, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread different record model array additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordModelArray") + .get({ + body: { + knownProp: "abc", + prop: [{ state: "ok" }, { state: "ok" }], + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread different record model array additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadDifferentRecordModelArray") + .put({ + body: { + knownProp: "abc", + prop: [{ state: "ok" }, { state: "ok" }], + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get extends different spread string additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadString") + .get({ + body: { + id: 43.125, + prop: "abc", + derivedProp: "abc", + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put extends different spread string additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadString") + .put({ + body: { + id: 43.125, + prop: "abc", + derivedProp: "abc", + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get extends different spread float additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadFloat") + .get({ + body: { + name: "abc", + prop: 43.125, + derivedProp: 43.125, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put extends different spread float additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadFloat") + .put({ + body: { + name: "abc", + prop: 43.125, + derivedProp: 43.125, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get extends different spread model additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadModel") + .get({ + body: { + knownProp: "abc", + prop: { state: "ok" }, + derivedProp: { state: "ok" }, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put extends different spread model additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadModel") + .put({ + body: { + knownProp: "abc", + prop: { state: "ok" }, + derivedProp: { state: "ok" }, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get extends different spread model array additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadModelArray") + .get({ + body: { + knownProp: "abc", + prop: [{ state: "ok" }, { state: "ok" }], + derivedProp: [{ state: "ok" }, { state: "ok" }], + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put extends different spread model array additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/extendsDifferentSpreadModelArray") + .put({ + body: { + knownProp: "abc", + prop: [{ state: "ok" }, { state: "ok" }], + derivedProp: [{ state: "ok" }, { state: "ok" }], + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get multiple spread record additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/multipleSpreadRecord") + .get({ + body: { + flag: true, + prop1: "abc", + prop2: 43.125, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put multiple spread record additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/multipleSpreadRecord") + .put({ + body: { + flag: true, + prop1: "abc", + prop2: 43.125, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record union additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordUnion") + .get({ + body: { + flag: true, + prop1: "abc", + prop2: 43.125, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record union additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordUnion") + .put({ + body: { + flag: true, + prop1: "abc", + prop2: 43.125, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record discriminate union additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordDiscriminatedUnion") + .get({ + body: { + name: "abc", + prop1: { + kind: "kind0", + fooProp: "abc", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record discriminate union additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordDiscriminatedUnion") + .put({ + body: { + name: "abc", + prop1: { + kind: "kind0", + fooProp: "abc", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record nondiscriminate union additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") + .get({ + body: { + name: "abc", + prop1: { + kind: "kind0", + fooProp: "abc", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record nondiscriminate union additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") + .put({ + body: { + name: "abc", + prop1: { + kind: "kind0", + fooProp: "abc", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record nondiscriminate union2 additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") + .get({ + body: { + name: "abc", + prop1: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record nondiscriminate union2 additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") + .put({ + body: { + name: "abc", + prop1: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get spread record nondiscriminate union3 additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") + .get({ + body: { + name: "abc", + prop1: [ + { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + ], + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, + } + }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put spread record nondiscriminate union3 additional properties", async () => { + try { + const result = await client + .path("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") + .put({ + body: { + name: "abc", + prop1: [ + { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + ], + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, } }); assert.strictEqual(result.status, "204"); diff --git a/packages/typespec-ts/test/integration/modelPropertyType.spec.ts b/packages/typespec-ts/test/integration/modelPropertyType.spec.ts index 830136e4cf..920f9002f0 100644 --- a/packages/typespec-ts/test/integration/modelPropertyType.spec.ts +++ b/packages/typespec-ts/test/integration/modelPropertyType.spec.ts @@ -123,6 +123,10 @@ const testedTypes: TypeDetail[] = [ { type: "union/float/literal", defaultValue: 46.875 + }, + { + type: "union-enum-value", + defaultValue: "value2" } ]; describe("ModelsPropertyTypesClient Rest Client", () => { diff --git a/packages/typespec-ts/test/integration/payloadMediaType.spec.ts b/packages/typespec-ts/test/integration/payloadMediaType.spec.ts new file mode 100644 index 0000000000..cf24e12d88 --- /dev/null +++ b/packages/typespec-ts/test/integration/payloadMediaType.spec.ts @@ -0,0 +1,60 @@ +import { assert } from "chai"; +import MediaTypeClientFactory, { + MediaTypeClient +} from "./generated/payload/media-type/src/index.js"; + +describe("MediaType Client", () => { + let client: MediaTypeClient; + + beforeEach(() => { + client = MediaTypeClientFactory({ + allowInsecureConnection: true + }); + }); + + it("should getAsText", async () => { + try { + const result = await client + .path("/payload/media-type/string-body/getAsText") + .get({ accept: "text/plain" }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "{cat}"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should sendAsText", async () => { + try { + const result = await client + .path("/payload/media-type/string-body/sendAsText") + .post({ body: "{cat}", contentType: "text/plain" }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should sendAsJson", async () => { + try { + const result = await client + .path("/payload/media-type/string-body/sendAsJson") + .post({ body: "foo", contentType: "application/json" }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should getAsJson", async () => { + try { + const result = await client + .path("/payload/media-type/string-body/getAsJson") + .get({ accept: "application/json" }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "foo"); + } catch (err) { + assert.fail(err as string); + } + }); +}); diff --git a/packages/typespec-ts/test/integration/projection.spec.ts b/packages/typespec-ts/test/integration/projection.spec.ts deleted file mode 100644 index 8260a1bd5a..0000000000 --- a/packages/typespec-ts/test/integration/projection.spec.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { assert } from "chai"; -import ProjectionClientFactory, { - ProjectionClient -} from "./generated/projection/src/index.js"; -describe("Projected Name Rest Client", () => { - let client: ProjectionClient; - - beforeEach(() => { - client = ProjectionClientFactory({ - allowInsecureConnection: true, - retryOptions: { - maxRetries: 0 - } - }); - }); - - it("should respect json projection", async () => { - try { - const result = await client - .path("/projection/projected-name/property/json") - .post({ - body: { - wireName: true - } - }); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should not respect client projection", async () => { - try { - const result = await client - .path("/projection/projected-name/property/client") - .post({ - body: { - defaultName: true - } - }); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should not respect language projection", async () => { - try { - const result = await client - .path("/projection/projected-name/property/language") - .post({ - body: { - defaultName: true - } - }); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should not respect language projection", async () => { - try { - const result = await client - .path("/projection/projected-name/property/json-and-client") - .post({ - body: { - wireName: true - } - }); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should not respect operation projection", async () => { - try { - const result = await client - .path("/projection/projected-name/operation") - .post(); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should not respect operation projection", async () => { - try { - const result = await client - .path("/projection/projected-name/parameter") - .post({ - queryParameters: { - "default-name": "true" - } - }); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); -}); \ No newline at end of file diff --git a/packages/typespec-ts/test/integration/server.spec.ts b/packages/typespec-ts/test/integration/server.spec.ts index 8a336d58e0..b9e517b29a 100644 --- a/packages/typespec-ts/test/integration/server.spec.ts +++ b/packages/typespec-ts/test/integration/server.spec.ts @@ -167,4 +167,15 @@ describe(" VersionedParamInServerVersions Rest Client", () => { assert.fail(err as string); } }); + + it("should work with old param", async () => { + try { + const result = await client + .path("/server/versions/versioned/with-query-old-api-version") + .head({ queryParameters: { "api-version": "2021-01-01-preview" } }); + assert.strictEqual(result.status, "200"); + } catch (err) { + assert.fail(err as string); + } + }); }); diff --git a/packages/typespec-ts/test/integration/specialWords.spec.ts b/packages/typespec-ts/test/integration/specialWords.spec.ts index 8cb65f21e3..7feb5077da 100644 --- a/packages/typespec-ts/test/integration/specialWords.spec.ts +++ b/packages/typespec-ts/test/integration/specialWords.spec.ts @@ -783,8 +783,22 @@ describe("SpecialWordsClient Rest Client", () => { assert.fail(err as string); } }); + it("should get special words for operation `cancellationToken`", async () => { + try { + const result = await client + .path("/special-words/parameters/cancellationToken") + .get({ + queryParameters: { + cancellationToken:"ok" + } + }); + assert.strictEqual(result.status, "204"); + } catch (err) { + assert.fail(err as string); + } + }); }); - + describe("models", () => { it("should get special words for operation `and`", async () => { try { diff --git a/packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreAccess.spec.ts b/packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreAccess.spec.ts index 184324d9f3..ee6e56dffb 100644 --- a/packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreAccess.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreAccess.spec.ts @@ -59,7 +59,7 @@ describe("Azure ClientGeneratorCore Access Client", () => { it("should get public shared model in operation", async () => { try { - const result = await client.publicOperation("myname"); + const result = await client.public("myname"); assert.equal(result.name, "myname"); } catch (err) { assert.fail(err as string); diff --git a/packages/typespec-ts/test/modularIntegration/azureCore.spec.ts b/packages/typespec-ts/test/modularIntegration/azureCore.spec.ts index 03eea2d8ab..a8264a8254 100644 --- a/packages/typespec-ts/test/modularIntegration/azureCore.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/azureCore.spec.ts @@ -162,7 +162,7 @@ describe("BasicClient Classical Client", () => { it("should export a user", async () => { try { - const user = await client.exportOperation(1, "json"); + const user = await client.export(1, "json"); assert.strictEqual(user?.id, 1); assert.strictEqual(user?.name, "Madge"); assert.strictEqual(user?.etag, "11bdc430-65e8-45ad-81d9-8ffa60d55b59"); @@ -209,7 +209,7 @@ describe("BasicClient Classical Client", () => { it("should delete a user", async () => { try { - const user = await client.deleteOperation(1); + const user = await client.delete(1); assert.isUndefined(user); } catch (err) { assert.fail(err as string); diff --git a/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts b/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts index 7c24a8bc01..7e8ca9febe 100644 --- a/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts @@ -98,4 +98,26 @@ describe("NameAndEncodedName Client", () => { assert.fail(err as string); } }); + + it("should work union enum name", async () => { + try { + const result = await client.unionEnum.unionEnumName("value1", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should work with union enum member name", async () => { + try { + const result = await client.unionEnum.unionEnumMemberName("value1", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); }); diff --git a/packages/typespec-ts/test/modularIntegration/encodeBytes.spec.ts b/packages/typespec-ts/test/modularIntegration/encodeBytes.spec.ts index e1862e8e08..fe2cf20d86 100644 --- a/packages/typespec-ts/test/modularIntegration/encodeBytes.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/encodeBytes.spec.ts @@ -97,8 +97,8 @@ describe("EncodeBytesClient Modular Client", () => { value: stringToUint8Array("dGVzdA", "base64url") }); assert.deepEqual( - result.value, - stringToUint8Array("dGVzdA", "base64url") + uint8ArrayToString(result.value, "base64url"), + "dGVzdA" ); } catch (err) { assert.fail(err as string); @@ -170,7 +170,7 @@ describe("EncodeBytesClient Modular Client", () => { }); }); - describe.skip("request body", () => { + describe("request body", () => { const pngFile = readFileSync( resolve("../../packages/typespec-ts/temp/assets/image.png") ); @@ -184,6 +184,7 @@ describe("EncodeBytesClient Modular Client", () => { ); assert.isUndefined(result); } catch (err) { + console.log(JSON.stringify(err)); assert.fail(err as string); } }); @@ -216,7 +217,7 @@ describe("EncodeBytesClient Modular Client", () => { } }); - it.skip(`should post bytes with custom content type`, async () => { + it(`should post bytes with custom content type`, async () => { try { const result = await client.requestBody.customContentType(pngFile, { contentType: "image/png" @@ -227,7 +228,7 @@ describe("EncodeBytesClient Modular Client", () => { } }).timeout(10000); - it.skip(`should post bytes with custom content type`, async () => { + it(`should post bytes with custom content type`, async () => { try { const result = await client.requestBody.octetStream(pngFile, { contentType: "application/octet-stream" @@ -242,7 +243,7 @@ describe("EncodeBytesClient Modular Client", () => { describe("response body", () => { const pngFile = readFileSync( resolve("../../packages/typespec-ts/temp/assets/image.png") - ); + ).toString(); it(`should get bytes with base64 encoding by default`, async () => { try { const result = await client.responseBody.default(); @@ -270,27 +271,27 @@ describe("EncodeBytesClient Modular Client", () => { } }); - it.skip(`should get bytes with custom content type`, async () => { + it(`should get bytes with custom content type`, async () => { try { const result = await client.responseBody.customContentType({ onResponse: (res) => { res.headers.get("content-type") === "image/png"; } }); - assert.strictEqual(Buffer.from(result), pngFile); + assert.strictEqual(uint8ArrayToString(result, "utf-8"), pngFile); } catch (err) { assert.fail(err as string); } }); - it.skip(`should get bytes with octet-stream content type`, async () => { + it(`should get bytes with octet-stream content type`, async () => { try { const result = await client.responseBody.octetStream({ onResponse: (res) => { res.headers.get("content-type") === "application/octet-stream"; } }); - assert.strictEqual(Buffer.from(result), pngFile); + assert.strictEqual(uint8ArrayToString(result, "utf-8"), pngFile); } catch (err) { assert.fail(err as string); } diff --git a/packages/typespec-ts/test/modularIntegration/extensibleEnums.spec.ts b/packages/typespec-ts/test/modularIntegration/extensibleEnums.spec.ts new file mode 100644 index 0000000000..7a642760b5 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/extensibleEnums.spec.ts @@ -0,0 +1,51 @@ +import { assert } from "chai"; +import { ExtensibleClient } from "./generated/enums/extensible/src/index.js"; +describe("ExtensibleEnums Rest Client", () => { + let client: ExtensibleClient; + + beforeEach(() => { + client = new ExtensibleClient({ + allowInsecureConnection: true + }); + }); + + it("should get known value", async () => { + try { + const result = await client.string.getKnownValue(); + assert.strictEqual(result, "Monday"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get unknown value", async () => { + try { + const result = await client.string.getUnknownValue(); + assert.strictEqual(result, "Weekend"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put known value", async () => { + try { + const result = await client.string.putKnownValue("Monday", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put unknown value and receives 500", async () => { + try { + const result = await client.string.putUnknownValue("Weekend", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/fixedEnums.spec.ts b/packages/typespec-ts/test/modularIntegration/fixedEnums.spec.ts new file mode 100644 index 0000000000..aba47980bf --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/fixedEnums.spec.ts @@ -0,0 +1,42 @@ +import { assert } from "chai"; +import { FixedClient } from "./generated/enums/fixed/src/index.js"; +describe("FixedEnums Rest Client", () => { + let client: FixedClient; + + beforeEach(() => { + client = new FixedClient({ + allowInsecureConnection: true + }); + }); + + it("should get known value", async () => { + try { + const result = await client.string.getKnownValue(); + assert.strictEqual(result, "Monday"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put known value", async () => { + try { + const result = await client.string.putKnownValue("Monday", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should put unknown value and receives 500", async () => { + try { + await client.string.putUnknownValue("Weekend" as any, { + requestOptions: { headers: { "content-type": "application/json" } } + }); + assert.fail("Expected an exception to be thrown."); + } catch (err) { + assert.isOk(err); + } + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/ArrayContext.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/arrayContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/ArrayContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/arrayContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/booleanValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/booleanValue/index.ts index 77f4d2dee4..3e8bd8c96a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/booleanValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/booleanValue/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - BooleanValueGetOptions, - BooleanValuePutOptions, + BooleanValueGetOptionalParams, + BooleanValuePutOptionalParams, } from "../../models/options.js"; export function _booleanValueGetSend( context: Client, - options: BooleanValueGetOptions = { requestOptions: {} }, + options: BooleanValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/boolean") @@ -37,7 +37,7 @@ export async function _booleanValueGetDeserialize( export async function booleanValueGet( context: Client, - options: BooleanValueGetOptions = { requestOptions: {} }, + options: BooleanValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanValueGetSend(context, options); return _booleanValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function booleanValueGet( export function _booleanValuePutSend( context: Client, body: boolean[], - options: BooleanValuePutOptions = { requestOptions: {} }, + options: BooleanValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/boolean") @@ -66,7 +66,7 @@ export async function _booleanValuePutDeserialize( export async function booleanValuePut( context: Client, body: boolean[], - options: BooleanValuePutOptions = { requestOptions: {} }, + options: BooleanValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanValuePutSend(context, body, options); return _booleanValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/datetimeValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/datetimeValue/index.ts index ae9bade0b4..08d89ef81e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/datetimeValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/datetimeValue/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DatetimeValueGetOptions, - DatetimeValuePutOptions, + DatetimeValueGetOptionalParams, + DatetimeValuePutOptionalParams, } from "../../models/options.js"; export function _datetimeValueGetSend( context: Client, - options: DatetimeValueGetOptions = { requestOptions: {} }, + options: DatetimeValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/datetime") @@ -39,7 +39,7 @@ export async function _datetimeValueGetDeserialize( export async function datetimeValueGet( context: Client, - options: DatetimeValueGetOptions = { requestOptions: {} }, + options: DatetimeValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _datetimeValueGetSend(context, options); return _datetimeValueGetDeserialize(result); @@ -48,7 +48,7 @@ export async function datetimeValueGet( export function _datetimeValuePutSend( context: Client, body: Date[], - options: DatetimeValuePutOptions = { requestOptions: {} }, + options: DatetimeValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/datetime") @@ -68,7 +68,7 @@ export async function _datetimeValuePutDeserialize( export async function datetimeValuePut( context: Client, body: Date[], - options: DatetimeValuePutOptions = { requestOptions: {} }, + options: DatetimeValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _datetimeValuePutSend(context, body, options); return _datetimeValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/durationValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/durationValue/index.ts index 479c33214b..32709f0e89 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/durationValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/durationValue/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DurationValueGetOptions, - DurationValuePutOptions, + DurationValueGetOptionalParams, + DurationValuePutOptionalParams, } from "../../models/options.js"; export function _durationValueGetSend( context: Client, - options: DurationValueGetOptions = { requestOptions: {} }, + options: DurationValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/duration") @@ -37,7 +37,7 @@ export async function _durationValueGetDeserialize( export async function durationValueGet( context: Client, - options: DurationValueGetOptions = { requestOptions: {} }, + options: DurationValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _durationValueGetSend(context, options); return _durationValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function durationValueGet( export function _durationValuePutSend( context: Client, body: string[], - options: DurationValuePutOptions = { requestOptions: {} }, + options: DurationValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/duration") @@ -66,7 +66,7 @@ export async function _durationValuePutDeserialize( export async function durationValuePut( context: Client, body: string[], - options: DurationValuePutOptions = { requestOptions: {} }, + options: DurationValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _durationValuePutSend(context, body, options); return _durationValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/float32Value/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/float32Value/index.ts index 0dcc156728..ddb2fc2f31 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/float32Value/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/float32Value/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Float32ValueGetOptions, - Float32ValuePutOptions, + Float32ValueGetOptionalParams, + Float32ValuePutOptionalParams, } from "../../models/options.js"; export function _float32ValueGetSend( context: Client, - options: Float32ValueGetOptions = { requestOptions: {} }, + options: Float32ValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/float32") @@ -37,7 +37,7 @@ export async function _float32ValueGetDeserialize( export async function float32ValueGet( context: Client, - options: Float32ValueGetOptions = { requestOptions: {} }, + options: Float32ValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _float32ValueGetSend(context, options); return _float32ValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function float32ValueGet( export function _float32ValuePutSend( context: Client, body: number[], - options: Float32ValuePutOptions = { requestOptions: {} }, + options: Float32ValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/float32") @@ -66,7 +66,7 @@ export async function _float32ValuePutDeserialize( export async function float32ValuePut( context: Client, body: number[], - options: Float32ValuePutOptions = { requestOptions: {} }, + options: Float32ValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _float32ValuePutSend(context, body, options); return _float32ValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/index.ts index b7e709e92c..b576317592 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/index.ts @@ -5,7 +5,7 @@ export { createArray, ArrayClientOptions, ArrayContext, -} from "./ArrayContext.js"; +} from "./arrayContext.js"; export { booleanValueGet, booleanValuePut } from "./booleanValue/index.js"; export { datetimeValueGet, datetimeValuePut } from "./datetimeValue/index.js"; export { durationValueGet, durationValuePut } from "./durationValue/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int32Value/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int32Value/index.ts index 3e7d6d3511..ad652e7a31 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int32Value/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int32Value/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Int32ValueGetOptions, - Int32ValuePutOptions, + Int32ValueGetOptionalParams, + Int32ValuePutOptionalParams, } from "../../models/options.js"; export function _int32ValueGetSend( context: Client, - options: Int32ValueGetOptions = { requestOptions: {} }, + options: Int32ValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/int32") @@ -37,7 +37,7 @@ export async function _int32ValueGetDeserialize( export async function int32ValueGet( context: Client, - options: Int32ValueGetOptions = { requestOptions: {} }, + options: Int32ValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _int32ValueGetSend(context, options); return _int32ValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function int32ValueGet( export function _int32ValuePutSend( context: Client, body: number[], - options: Int32ValuePutOptions = { requestOptions: {} }, + options: Int32ValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/int32") @@ -66,7 +66,7 @@ export async function _int32ValuePutDeserialize( export async function int32ValuePut( context: Client, body: number[], - options: Int32ValuePutOptions = { requestOptions: {} }, + options: Int32ValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _int32ValuePutSend(context, body, options); return _int32ValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int64Value/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int64Value/index.ts index 281cc18a79..076ee966ee 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int64Value/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/int64Value/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Int64ValueGetOptions, - Int64ValuePutOptions, + Int64ValueGetOptionalParams, + Int64ValuePutOptionalParams, } from "../../models/options.js"; export function _int64ValueGetSend( context: Client, - options: Int64ValueGetOptions = { requestOptions: {} }, + options: Int64ValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/int64") @@ -37,7 +37,7 @@ export async function _int64ValueGetDeserialize( export async function int64ValueGet( context: Client, - options: Int64ValueGetOptions = { requestOptions: {} }, + options: Int64ValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _int64ValueGetSend(context, options); return _int64ValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function int64ValueGet( export function _int64ValuePutSend( context: Client, body: number[], - options: Int64ValuePutOptions = { requestOptions: {} }, + options: Int64ValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/int64") @@ -66,7 +66,7 @@ export async function _int64ValuePutDeserialize( export async function int64ValuePut( context: Client, body: number[], - options: Int64ValuePutOptions = { requestOptions: {} }, + options: Int64ValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _int64ValuePutSend(context, body, options); return _int64ValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/modelValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/modelValue/index.ts index 6f4920858f..2378b1740e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/modelValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/modelValue/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ModelValueGetOptions, - ModelValuePutOptions, + ModelValueGetOptionalParams, + ModelValuePutOptionalParams, } from "../../models/options.js"; export function _modelValueGetSend( context: Client, - options: ModelValueGetOptions = { requestOptions: {} }, + options: ModelValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/model") @@ -43,7 +43,7 @@ export async function _modelValueGetDeserialize( export async function modelValueGet( context: Client, - options: ModelValueGetOptions = { requestOptions: {} }, + options: ModelValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _modelValueGetSend(context, options); return _modelValueGetDeserialize(result); @@ -52,7 +52,7 @@ export async function modelValueGet( export function _modelValuePutSend( context: Client, body: InnerModel[], - options: ModelValuePutOptions = { requestOptions: {} }, + options: ModelValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context.path("/type/array/model").put({ ...operationOptionsToRequestParameters(options), @@ -84,7 +84,7 @@ export async function _modelValuePutDeserialize( export async function modelValuePut( context: Client, body: InnerModel[], - options: ModelValuePutOptions = { requestOptions: {} }, + options: ModelValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _modelValuePutSend(context, body, options); return _modelValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/nullableFloatValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/nullableFloatValue/index.ts index 7883e61df3..7110889359 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/nullableFloatValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/nullableFloatValue/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - NullableFloatValueGetOptions, - NullableFloatValuePutOptions, + NullableFloatValueGetOptionalParams, + NullableFloatValuePutOptionalParams, } from "../../models/options.js"; export function _nullableFloatValueGetSend( context: Client, - options: NullableFloatValueGetOptions = { requestOptions: {} }, + options: NullableFloatValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/nullable-float") @@ -37,7 +37,7 @@ export async function _nullableFloatValueGetDeserialize( export async function nullableFloatValueGet( context: Client, - options: NullableFloatValueGetOptions = { requestOptions: {} }, + options: NullableFloatValueGetOptionalParams = { requestOptions: {} }, ): Promise<(number | null)[]> { const result = await _nullableFloatValueGetSend(context, options); return _nullableFloatValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function nullableFloatValueGet( export function _nullableFloatValuePutSend( context: Client, body: (number | null)[], - options: NullableFloatValuePutOptions = { requestOptions: {} }, + options: NullableFloatValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/nullable-float") @@ -66,7 +66,7 @@ export async function _nullableFloatValuePutDeserialize( export async function nullableFloatValuePut( context: Client, body: (number | null)[], - options: NullableFloatValuePutOptions = { requestOptions: {} }, + options: NullableFloatValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _nullableFloatValuePutSend(context, body, options); return _nullableFloatValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/stringValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/stringValue/index.ts index 98de513a39..ef990654b4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/stringValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/stringValue/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - StringValueGetOptions, - StringValuePutOptions, + StringValueGetOptionalParams, + StringValuePutOptionalParams, } from "../../models/options.js"; export function _stringValueGetSend( context: Client, - options: StringValueGetOptions = { requestOptions: {} }, + options: StringValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/string") @@ -37,7 +37,7 @@ export async function _stringValueGetDeserialize( export async function stringValueGet( context: Client, - options: StringValueGetOptions = { requestOptions: {} }, + options: StringValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringValueGetSend(context, options); return _stringValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function stringValueGet( export function _stringValuePutSend( context: Client, body: string[], - options: StringValuePutOptions = { requestOptions: {} }, + options: StringValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/string") @@ -66,7 +66,7 @@ export async function _stringValuePutDeserialize( export async function stringValuePut( context: Client, body: string[], - options: StringValuePutOptions = { requestOptions: {} }, + options: StringValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringValuePutSend(context, body, options); return _stringValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/unknownValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/unknownValue/index.ts index acd5bfbc06..cf6792204d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/unknownValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/api/unknownValue/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnknownValueGetOptions, - UnknownValuePutOptions, + UnknownValueGetOptionalParams, + UnknownValuePutOptionalParams, } from "../../models/options.js"; export function _unknownValueGetSend( context: Client, - options: UnknownValueGetOptions = { requestOptions: {} }, + options: UnknownValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/unknown") @@ -37,7 +37,7 @@ export async function _unknownValueGetDeserialize( export async function unknownValueGet( context: Client, - options: UnknownValueGetOptions = { requestOptions: {} }, + options: UnknownValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownValueGetSend(context, options); return _unknownValueGetDeserialize(result); @@ -46,7 +46,7 @@ export async function unknownValueGet( export function _unknownValuePutSend( context: Client, body: unknown[], - options: UnknownValuePutOptions = { requestOptions: {} }, + options: UnknownValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/array/unknown") @@ -66,7 +66,7 @@ export async function _unknownValuePutDeserialize( export async function unknownValuePut( context: Client, body: unknown[], - options: UnknownValuePutOptions = { requestOptions: {} }, + options: UnknownValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownValuePutSend(context, body, options); return _unknownValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/ArrayClient.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/arrayClient.ts similarity index 98% rename from packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/ArrayClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/arrayClient.ts index 98d68898fc..0e1e7065d3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/ArrayClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/arrayClient.ts @@ -44,7 +44,7 @@ import { } from "./classic/nullableFloatValue/index.js"; import { createArray, ArrayClientOptions, ArrayContext } from "./api/index.js"; -export { ArrayClientOptions } from "./api/ArrayContext.js"; +export { ArrayClientOptions } from "./api/arrayContext.js"; export class ArrayClient { private _client: ArrayContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/booleanValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/booleanValue/index.ts index c9a56beab4..c62724bb68 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/booleanValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/booleanValue/index.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { booleanValueGet, booleanValuePut, } from "../../api/booleanValue/index.js"; import { - BooleanValueGetOptions, - BooleanValuePutOptions, + BooleanValueGetOptionalParams, + BooleanValuePutOptionalParams, } from "../../models/options.js"; export interface BooleanValueOperations { - get: (options?: BooleanValueGetOptions) => Promise; - put: (body: boolean[], options?: BooleanValuePutOptions) => Promise; + get: (options?: BooleanValueGetOptionalParams) => Promise; + put: ( + body: boolean[], + options?: BooleanValuePutOptionalParams, + ) => Promise; } export function getBooleanValue(context: ArrayContext) { return { - get: (options?: BooleanValueGetOptions) => + get: (options?: BooleanValueGetOptionalParams) => booleanValueGet(context, options), - put: (body: boolean[], options?: BooleanValuePutOptions) => + put: (body: boolean[], options?: BooleanValuePutOptionalParams) => booleanValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/datetimeValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/datetimeValue/index.ts index c12c362f30..e16003bcb0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/datetimeValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/datetimeValue/index.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { datetimeValueGet, datetimeValuePut, } from "../../api/datetimeValue/index.js"; import { - DatetimeValueGetOptions, - DatetimeValuePutOptions, + DatetimeValueGetOptionalParams, + DatetimeValuePutOptionalParams, } from "../../models/options.js"; export interface DatetimeValueOperations { - get: (options?: DatetimeValueGetOptions) => Promise; - put: (body: Date[], options?: DatetimeValuePutOptions) => Promise; + get: (options?: DatetimeValueGetOptionalParams) => Promise; + put: ( + body: Date[], + options?: DatetimeValuePutOptionalParams, + ) => Promise; } export function getDatetimeValue(context: ArrayContext) { return { - get: (options?: DatetimeValueGetOptions) => + get: (options?: DatetimeValueGetOptionalParams) => datetimeValueGet(context, options), - put: (body: Date[], options?: DatetimeValuePutOptions) => + put: (body: Date[], options?: DatetimeValuePutOptionalParams) => datetimeValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/durationValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/durationValue/index.ts index 2f72e9496c..842e306c1a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/durationValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/durationValue/index.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { durationValueGet, durationValuePut, } from "../../api/durationValue/index.js"; import { - DurationValueGetOptions, - DurationValuePutOptions, + DurationValueGetOptionalParams, + DurationValuePutOptionalParams, } from "../../models/options.js"; export interface DurationValueOperations { - get: (options?: DurationValueGetOptions) => Promise; - put: (body: string[], options?: DurationValuePutOptions) => Promise; + get: (options?: DurationValueGetOptionalParams) => Promise; + put: ( + body: string[], + options?: DurationValuePutOptionalParams, + ) => Promise; } export function getDurationValue(context: ArrayContext) { return { - get: (options?: DurationValueGetOptions) => + get: (options?: DurationValueGetOptionalParams) => durationValueGet(context, options), - put: (body: string[], options?: DurationValuePutOptions) => + put: (body: string[], options?: DurationValuePutOptionalParams) => durationValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/float32Value/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/float32Value/index.ts index 261da55220..373c34b9b2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/float32Value/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/float32Value/index.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { float32ValueGet, float32ValuePut, } from "../../api/float32Value/index.js"; import { - Float32ValueGetOptions, - Float32ValuePutOptions, + Float32ValueGetOptionalParams, + Float32ValuePutOptionalParams, } from "../../models/options.js"; export interface Float32ValueOperations { - get: (options?: Float32ValueGetOptions) => Promise; - put: (body: number[], options?: Float32ValuePutOptions) => Promise; + get: (options?: Float32ValueGetOptionalParams) => Promise; + put: ( + body: number[], + options?: Float32ValuePutOptionalParams, + ) => Promise; } export function getFloat32Value(context: ArrayContext) { return { - get: (options?: Float32ValueGetOptions) => + get: (options?: Float32ValueGetOptionalParams) => float32ValueGet(context, options), - put: (body: number[], options?: Float32ValuePutOptions) => + put: (body: number[], options?: Float32ValuePutOptionalParams) => float32ValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int32Value/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int32Value/index.ts index 5889d3f3b9..84abbcd4d4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int32Value/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int32Value/index.ts @@ -1,22 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { int32ValueGet, int32ValuePut } from "../../api/int32Value/index.js"; import { - Int32ValueGetOptions, - Int32ValuePutOptions, + Int32ValueGetOptionalParams, + Int32ValuePutOptionalParams, } from "../../models/options.js"; export interface Int32ValueOperations { - get: (options?: Int32ValueGetOptions) => Promise; - put: (body: number[], options?: Int32ValuePutOptions) => Promise; + get: (options?: Int32ValueGetOptionalParams) => Promise; + put: (body: number[], options?: Int32ValuePutOptionalParams) => Promise; } export function getInt32Value(context: ArrayContext) { return { - get: (options?: Int32ValueGetOptions) => int32ValueGet(context, options), - put: (body: number[], options?: Int32ValuePutOptions) => + get: (options?: Int32ValueGetOptionalParams) => + int32ValueGet(context, options), + put: (body: number[], options?: Int32ValuePutOptionalParams) => int32ValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int64Value/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int64Value/index.ts index c1e4f570c2..7982edc025 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int64Value/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/int64Value/index.ts @@ -1,22 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { int64ValueGet, int64ValuePut } from "../../api/int64Value/index.js"; import { - Int64ValueGetOptions, - Int64ValuePutOptions, + Int64ValueGetOptionalParams, + Int64ValuePutOptionalParams, } from "../../models/options.js"; export interface Int64ValueOperations { - get: (options?: Int64ValueGetOptions) => Promise; - put: (body: number[], options?: Int64ValuePutOptions) => Promise; + get: (options?: Int64ValueGetOptionalParams) => Promise; + put: (body: number[], options?: Int64ValuePutOptionalParams) => Promise; } export function getInt64Value(context: ArrayContext) { return { - get: (options?: Int64ValueGetOptions) => int64ValueGet(context, options), - put: (body: number[], options?: Int64ValuePutOptions) => + get: (options?: Int64ValueGetOptionalParams) => + int64ValueGet(context, options), + put: (body: number[], options?: Int64ValuePutOptionalParams) => int64ValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/modelValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/modelValue/index.ts index 08390f3b8c..326da443b0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/modelValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/modelValue/index.ts @@ -1,23 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { InnerModel } from "../../models/models.js"; import { modelValueGet, modelValuePut } from "../../api/modelValue/index.js"; import { - ModelValueGetOptions, - ModelValuePutOptions, + ModelValueGetOptionalParams, + ModelValuePutOptionalParams, } from "../../models/options.js"; export interface ModelValueOperations { - get: (options?: ModelValueGetOptions) => Promise; - put: (body: InnerModel[], options?: ModelValuePutOptions) => Promise; + get: (options?: ModelValueGetOptionalParams) => Promise; + put: ( + body: InnerModel[], + options?: ModelValuePutOptionalParams, + ) => Promise; } export function getModelValue(context: ArrayContext) { return { - get: (options?: ModelValueGetOptions) => modelValueGet(context, options), - put: (body: InnerModel[], options?: ModelValuePutOptions) => + get: (options?: ModelValueGetOptionalParams) => + modelValueGet(context, options), + put: (body: InnerModel[], options?: ModelValuePutOptionalParams) => modelValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/nullableFloatValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/nullableFloatValue/index.ts index 0169b2fa97..9f5547f50a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/nullableFloatValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/nullableFloatValue/index.ts @@ -1,30 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { nullableFloatValueGet, nullableFloatValuePut, } from "../../api/nullableFloatValue/index.js"; import { - NullableFloatValueGetOptions, - NullableFloatValuePutOptions, + NullableFloatValueGetOptionalParams, + NullableFloatValuePutOptionalParams, } from "../../models/options.js"; export interface NullableFloatValueOperations { - get: (options?: NullableFloatValueGetOptions) => Promise<(number | null)[]>; + get: ( + options?: NullableFloatValueGetOptionalParams, + ) => Promise<(number | null)[]>; put: ( body: (number | null)[], - options?: NullableFloatValuePutOptions, + options?: NullableFloatValuePutOptionalParams, ) => Promise; } export function getNullableFloatValue(context: ArrayContext) { return { - get: (options?: NullableFloatValueGetOptions) => + get: (options?: NullableFloatValueGetOptionalParams) => nullableFloatValueGet(context, options), - put: (body: (number | null)[], options?: NullableFloatValuePutOptions) => - nullableFloatValuePut(context, body, options), + put: ( + body: (number | null)[], + options?: NullableFloatValuePutOptionalParams, + ) => nullableFloatValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/stringValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/stringValue/index.ts index ceccfb3550..b7dbab4920 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/stringValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/stringValue/index.ts @@ -1,22 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { stringValueGet, stringValuePut } from "../../api/stringValue/index.js"; import { - StringValueGetOptions, - StringValuePutOptions, + StringValueGetOptionalParams, + StringValuePutOptionalParams, } from "../../models/options.js"; export interface StringValueOperations { - get: (options?: StringValueGetOptions) => Promise; - put: (body: string[], options?: StringValuePutOptions) => Promise; + get: (options?: StringValueGetOptionalParams) => Promise; + put: ( + body: string[], + options?: StringValuePutOptionalParams, + ) => Promise; } export function getStringValue(context: ArrayContext) { return { - get: (options?: StringValueGetOptions) => stringValueGet(context, options), - put: (body: string[], options?: StringValuePutOptions) => + get: (options?: StringValueGetOptionalParams) => + stringValueGet(context, options), + put: (body: string[], options?: StringValuePutOptionalParams) => stringValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/unknownValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/unknownValue/index.ts index 58176d6f18..14fc8261c6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/unknownValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/classic/unknownValue/index.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ArrayContext } from "../../api/ArrayContext.js"; +import { ArrayContext } from "../../api/arrayContext.js"; import { unknownValueGet, unknownValuePut, } from "../../api/unknownValue/index.js"; import { - UnknownValueGetOptions, - UnknownValuePutOptions, + UnknownValueGetOptionalParams, + UnknownValuePutOptionalParams, } from "../../models/options.js"; export interface UnknownValueOperations { - get: (options?: UnknownValueGetOptions) => Promise; - put: (body: unknown[], options?: UnknownValuePutOptions) => Promise; + get: (options?: UnknownValueGetOptionalParams) => Promise; + put: ( + body: unknown[], + options?: UnknownValuePutOptionalParams, + ) => Promise; } export function getUnknownValue(context: ArrayContext) { return { - get: (options?: UnknownValueGetOptions) => + get: (options?: UnknownValueGetOptionalParams) => unknownValueGet(context, options), - put: (body: unknown[], options?: UnknownValuePutOptions) => + put: (body: unknown[], options?: UnknownValuePutOptionalParams) => unknownValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/index.ts index 44b4e973f2..d93370ef7d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/index.ts @@ -1,29 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ArrayClient, ArrayClientOptions } from "./ArrayClient.js"; +export { ArrayClient, ArrayClientOptions } from "./arrayClient.js"; export { InnerModel, - Int32ValueGetOptions, - Int32ValuePutOptions, - Int64ValueGetOptions, - Int64ValuePutOptions, - BooleanValueGetOptions, - BooleanValuePutOptions, - StringValueGetOptions, - StringValuePutOptions, - Float32ValueGetOptions, - Float32ValuePutOptions, - DatetimeValueGetOptions, - DatetimeValuePutOptions, - DurationValueGetOptions, - DurationValuePutOptions, - UnknownValueGetOptions, - UnknownValuePutOptions, - ModelValueGetOptions, - ModelValuePutOptions, - NullableFloatValueGetOptions, - NullableFloatValuePutOptions, + Int32ValueGetOptionalParams, + Int32ValuePutOptionalParams, + Int64ValueGetOptionalParams, + Int64ValuePutOptionalParams, + BooleanValueGetOptionalParams, + BooleanValuePutOptionalParams, + StringValueGetOptionalParams, + StringValuePutOptionalParams, + Float32ValueGetOptionalParams, + Float32ValuePutOptionalParams, + DatetimeValueGetOptionalParams, + DatetimeValuePutOptionalParams, + DurationValueGetOptionalParams, + DurationValuePutOptionalParams, + UnknownValueGetOptionalParams, + UnknownValuePutOptionalParams, + ModelValueGetOptionalParams, + ModelValuePutOptionalParams, + NullableFloatValueGetOptionalParams, + NullableFloatValuePutOptionalParams, } from "./models/index.js"; export { BooleanValueOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/index.ts index f9fffed572..d51ec8ef48 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/index.ts @@ -3,24 +3,24 @@ export { InnerModel } from "./models.js"; export { - Int32ValueGetOptions, - Int32ValuePutOptions, - Int64ValueGetOptions, - Int64ValuePutOptions, - BooleanValueGetOptions, - BooleanValuePutOptions, - StringValueGetOptions, - StringValuePutOptions, - Float32ValueGetOptions, - Float32ValuePutOptions, - DatetimeValueGetOptions, - DatetimeValuePutOptions, - DurationValueGetOptions, - DurationValuePutOptions, - UnknownValueGetOptions, - UnknownValuePutOptions, - ModelValueGetOptions, - ModelValuePutOptions, - NullableFloatValueGetOptions, - NullableFloatValuePutOptions, + Int32ValueGetOptionalParams, + Int32ValuePutOptionalParams, + Int64ValueGetOptionalParams, + Int64ValuePutOptionalParams, + BooleanValueGetOptionalParams, + BooleanValuePutOptionalParams, + StringValueGetOptionalParams, + StringValuePutOptionalParams, + Float32ValueGetOptionalParams, + Float32ValuePutOptionalParams, + DatetimeValueGetOptionalParams, + DatetimeValuePutOptionalParams, + DurationValueGetOptionalParams, + DurationValuePutOptionalParams, + UnknownValueGetOptionalParams, + UnknownValuePutOptionalParams, + ModelValueGetOptionalParams, + ModelValuePutOptionalParams, + NullableFloatValueGetOptionalParams, + NullableFloatValuePutOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/options.ts index 49169957e5..e0a5ea56b2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/arrays/items/src/models/options.ts @@ -3,42 +3,42 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface Int32ValueGetOptions extends OperationOptions {} +export interface Int32ValueGetOptionalParams extends OperationOptions {} -export interface Int32ValuePutOptions extends OperationOptions {} +export interface Int32ValuePutOptionalParams extends OperationOptions {} -export interface Int64ValueGetOptions extends OperationOptions {} +export interface Int64ValueGetOptionalParams extends OperationOptions {} -export interface Int64ValuePutOptions extends OperationOptions {} +export interface Int64ValuePutOptionalParams extends OperationOptions {} -export interface BooleanValueGetOptions extends OperationOptions {} +export interface BooleanValueGetOptionalParams extends OperationOptions {} -export interface BooleanValuePutOptions extends OperationOptions {} +export interface BooleanValuePutOptionalParams extends OperationOptions {} -export interface StringValueGetOptions extends OperationOptions {} +export interface StringValueGetOptionalParams extends OperationOptions {} -export interface StringValuePutOptions extends OperationOptions {} +export interface StringValuePutOptionalParams extends OperationOptions {} -export interface Float32ValueGetOptions extends OperationOptions {} +export interface Float32ValueGetOptionalParams extends OperationOptions {} -export interface Float32ValuePutOptions extends OperationOptions {} +export interface Float32ValuePutOptionalParams extends OperationOptions {} -export interface DatetimeValueGetOptions extends OperationOptions {} +export interface DatetimeValueGetOptionalParams extends OperationOptions {} -export interface DatetimeValuePutOptions extends OperationOptions {} +export interface DatetimeValuePutOptionalParams extends OperationOptions {} -export interface DurationValueGetOptions extends OperationOptions {} +export interface DurationValueGetOptionalParams extends OperationOptions {} -export interface DurationValuePutOptions extends OperationOptions {} +export interface DurationValuePutOptionalParams extends OperationOptions {} -export interface UnknownValueGetOptions extends OperationOptions {} +export interface UnknownValueGetOptionalParams extends OperationOptions {} -export interface UnknownValuePutOptions extends OperationOptions {} +export interface UnknownValuePutOptionalParams extends OperationOptions {} -export interface ModelValueGetOptions extends OperationOptions {} +export interface ModelValueGetOptionalParams extends OperationOptions {} -export interface ModelValuePutOptions extends OperationOptions {} +export interface ModelValuePutOptionalParams extends OperationOptions {} -export interface NullableFloatValueGetOptions extends OperationOptions {} +export interface NullableFloatValueGetOptionalParams extends OperationOptions {} -export interface NullableFloatValuePutOptions extends OperationOptions {} +export interface NullableFloatValuePutOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/ApiKeyContext.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/apiKeyContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/ApiKeyContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/apiKeyContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/index.ts index f1d8b388c2..84527538b6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/index.ts @@ -5,5 +5,5 @@ export { createApiKey, ApiKeyClientOptions, ApiKeyContext, -} from "./ApiKeyContext.js"; +} from "./apiKeyContext.js"; export { valid, invalid } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/operations.ts index 99af4ed802..43e97aa362 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/api/operations.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ValidOptions, InvalidOptions } from "../models/options.js"; +import { + ValidOptionalParams, + InvalidOptionalParams, +} from "../models/options.js"; export function _validSend( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/api-key/valid") @@ -36,7 +39,7 @@ export async function _validDeserialize( /** Check whether client is authenticated */ export async function valid( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _validSend(context, options); return _validDeserialize(result); @@ -44,7 +47,7 @@ export async function valid( export function _invalidSend( context: Client, - options: InvalidOptions = { requestOptions: {} }, + options: InvalidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/api-key/invalid") @@ -64,7 +67,7 @@ export async function _invalidDeserialize( /** Check whether client is authenticated. */ export async function invalid( context: Client, - options: InvalidOptions = { requestOptions: {} }, + options: InvalidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _invalidSend(context, options); return _invalidDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/ApiKeyClient.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/apiKeyClient.ts similarity index 73% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/ApiKeyClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/apiKeyClient.ts index 9567edf4b3..ed77f0c9d3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/ApiKeyClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/apiKeyClient.ts @@ -3,7 +3,10 @@ import { KeyCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; -import { ValidOptions, InvalidOptions } from "./models/options.js"; +import { + ValidOptionalParams, + InvalidOptionalParams, +} from "./models/options.js"; import { createApiKey, ApiKeyClientOptions, @@ -12,7 +15,7 @@ import { invalid, } from "./api/index.js"; -export { ApiKeyClientOptions } from "./api/ApiKeyContext.js"; +export { ApiKeyClientOptions } from "./api/apiKeyContext.js"; export class ApiKeyClient { private _client: ApiKeyContext; @@ -26,12 +29,14 @@ export class ApiKeyClient { } /** Check whether client is authenticated */ - valid(options: ValidOptions = { requestOptions: {} }): Promise { + valid(options: ValidOptionalParams = { requestOptions: {} }): Promise { return valid(this._client, options); } /** Check whether client is authenticated. */ - invalid(options: InvalidOptions = { requestOptions: {} }): Promise { + invalid( + options: InvalidOptionalParams = { requestOptions: {} }, + ): Promise { return invalid(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts index 6f670bfc3c..11abd21e42 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ApiKeyClient, ApiKeyClientOptions } from "./ApiKeyClient.js"; -export { ValidOptions, InvalidOptions } from "./models/index.js"; +export { ApiKeyClient, ApiKeyClientOptions } from "./apiKeyClient.js"; +export { ValidOptionalParams, InvalidOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts index 1b7a9609be..57fb2080f2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. export * from "./models.js"; -export { ValidOptions, InvalidOptions } from "./options.js"; +export { ValidOptionalParams, InvalidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/options.ts index 87547a88b0..8ed8d02ccb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ValidOptions extends OperationOptions {} +export interface ValidOptionalParams extends OperationOptions {} -export interface InvalidOptions extends OperationOptions {} +export interface InvalidOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/CustomContext.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/customContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/CustomContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/customContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/index.ts index 584d3a3841..7089a2aaaa 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/index.ts @@ -5,5 +5,5 @@ export { createCustom, CustomClientOptions, CustomContext, -} from "./CustomContext.js"; +} from "./customContext.js"; export { valid, invalid } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/operations.ts index 829938a0af..e573e01122 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/api/operations.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ValidOptions, InvalidOptions } from "../models/options.js"; +import { + ValidOptionalParams, + InvalidOptionalParams, +} from "../models/options.js"; export function _validSend( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/http/custom/valid") @@ -36,7 +39,7 @@ export async function _validDeserialize( /** Check whether client is authenticated */ export async function valid( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _validSend(context, options); return _validDeserialize(result); @@ -44,7 +47,7 @@ export async function valid( export function _invalidSend( context: Client, - options: InvalidOptions = { requestOptions: {} }, + options: InvalidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/http/custom/invalid") @@ -64,7 +67,7 @@ export async function _invalidDeserialize( /** Check whether client is authenticated. */ export async function invalid( context: Client, - options: InvalidOptions = { requestOptions: {} }, + options: InvalidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _invalidSend(context, options); return _invalidDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/CustomClient.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/customClient.ts similarity index 73% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/CustomClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/customClient.ts index 98c06c37b8..43a666e3a6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/CustomClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/customClient.ts @@ -3,7 +3,10 @@ import { KeyCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; -import { ValidOptions, InvalidOptions } from "./models/options.js"; +import { + ValidOptionalParams, + InvalidOptionalParams, +} from "./models/options.js"; import { createCustom, CustomClientOptions, @@ -12,7 +15,7 @@ import { invalid, } from "./api/index.js"; -export { CustomClientOptions } from "./api/CustomContext.js"; +export { CustomClientOptions } from "./api/customContext.js"; export class CustomClient { private _client: CustomContext; @@ -26,12 +29,14 @@ export class CustomClient { } /** Check whether client is authenticated */ - valid(options: ValidOptions = { requestOptions: {} }): Promise { + valid(options: ValidOptionalParams = { requestOptions: {} }): Promise { return valid(this._client, options); } /** Check whether client is authenticated. */ - invalid(options: InvalidOptions = { requestOptions: {} }): Promise { + invalid( + options: InvalidOptionalParams = { requestOptions: {} }, + ): Promise { return invalid(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts index eab152bad0..6708a04f07 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { CustomClient, CustomClientOptions } from "./CustomClient.js"; -export { ValidOptions, InvalidOptions } from "./models/index.js"; +export { CustomClient, CustomClientOptions } from "./customClient.js"; +export { ValidOptionalParams, InvalidOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts index 1b7a9609be..57fb2080f2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. export * from "./models.js"; -export { ValidOptions, InvalidOptions } from "./options.js"; +export { ValidOptionalParams, InvalidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/options.ts index 87547a88b0..8ed8d02ccb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http-custom/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ValidOptions extends OperationOptions {} +export interface ValidOptionalParams extends OperationOptions {} -export interface InvalidOptions extends OperationOptions {} +export interface InvalidOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/index.ts index b4a0e26015..6c98486695 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/index.ts @@ -5,5 +5,5 @@ export { createOAuth2, OAuth2ClientOptions, OAuth2Context, -} from "./OAuth2Context.js"; +} from "./oAuth2Context.js"; export { valid, invalid } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/OAuth2Context.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/oAuth2Context.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/OAuth2Context.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/oAuth2Context.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/operations.ts index 6756f7c22e..e5f5f13f79 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/api/operations.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ValidOptions, InvalidOptions } from "../models/options.js"; +import { + ValidOptionalParams, + InvalidOptionalParams, +} from "../models/options.js"; export function _validSend( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/oauth2/valid") @@ -36,7 +39,7 @@ export async function _validDeserialize( /** Check whether client is authenticated */ export async function valid( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _validSend(context, options); return _validDeserialize(result); @@ -44,7 +47,7 @@ export async function valid( export function _invalidSend( context: Client, - options: InvalidOptions = { requestOptions: {} }, + options: InvalidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/oauth2/invalid") @@ -64,7 +67,7 @@ export async function _invalidDeserialize( /** Check whether client is authenticated. Will return an invalid bearer error. */ export async function invalid( context: Client, - options: InvalidOptions = { requestOptions: {} }, + options: InvalidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _invalidSend(context, options); return _invalidDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts index 4be6f67658..07969ed4b7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { OAuth2Client, OAuth2ClientOptions } from "./OAuth2Client.js"; -export { ValidOptions, InvalidOptions } from "./models/index.js"; +export { OAuth2Client, OAuth2ClientOptions } from "./oAuth2Client.js"; +export { ValidOptionalParams, InvalidOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts index 1b7a9609be..57fb2080f2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. export * from "./models.js"; -export { ValidOptions, InvalidOptions } from "./options.js"; +export { ValidOptionalParams, InvalidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/options.ts index 87547a88b0..8ed8d02ccb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ValidOptions extends OperationOptions {} +export interface ValidOptionalParams extends OperationOptions {} -export interface InvalidOptions extends OperationOptions {} +export interface InvalidOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/OAuth2Client.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/oAuth2Client.ts similarity index 74% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/OAuth2Client.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/oAuth2Client.ts index 5ad3ade0a4..d3ecbd6e9d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/OAuth2Client.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/oAuth2Client.ts @@ -3,7 +3,10 @@ import { TokenCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; -import { ValidOptions, InvalidOptions } from "./models/options.js"; +import { + ValidOptionalParams, + InvalidOptionalParams, +} from "./models/options.js"; import { createOAuth2, OAuth2ClientOptions, @@ -12,7 +15,7 @@ import { invalid, } from "./api/index.js"; -export { OAuth2ClientOptions } from "./api/OAuth2Context.js"; +export { OAuth2ClientOptions } from "./api/oAuth2Context.js"; export class OAuth2Client { private _client: OAuth2Context; @@ -26,12 +29,14 @@ export class OAuth2Client { } /** Check whether client is authenticated */ - valid(options: ValidOptions = { requestOptions: {} }): Promise { + valid(options: ValidOptionalParams = { requestOptions: {} }): Promise { return valid(this._client, options); } /** Check whether client is authenticated. Will return an invalid bearer error. */ - invalid(options: InvalidOptions = { requestOptions: {} }): Promise { + invalid( + options: InvalidOptionalParams = { requestOptions: {} }, + ): Promise { return invalid(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/index.ts index 07b050c533..679b279309 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/index.ts @@ -6,4 +6,4 @@ export { createUnion, UnionClientOptions, UnionContext, -} from "./UnionContext.js"; +} from "./unionContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/operations.ts index 869ce523cf..84e21fdd86 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/operations.ts @@ -11,11 +11,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ValidKeyOptions, ValidTokenOptions } from "../models/options.js"; +import { + ValidKeyOptionalParams, + ValidTokenOptionalParams, +} from "../models/options.js"; export function _validKeySend( context: Client, - options: ValidKeyOptions = { requestOptions: {} }, + options: ValidKeyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/union/validkey") @@ -35,7 +38,7 @@ export async function _validKeyDeserialize( /** Check whether client is authenticated */ export async function validKey( context: Client, - options: ValidKeyOptions = { requestOptions: {} }, + options: ValidKeyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _validKeySend(context, options); return _validKeyDeserialize(result); @@ -43,7 +46,7 @@ export async function validKey( export function _validTokenSend( context: Client, - options: ValidTokenOptions = { requestOptions: {} }, + options: ValidTokenOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/authentication/union/validtoken") @@ -63,7 +66,7 @@ export async function _validTokenDeserialize( /** Check whether client is authenticated */ export async function validToken( context: Client, - options: ValidTokenOptions = { requestOptions: {} }, + options: ValidTokenOptionalParams = { requestOptions: {} }, ): Promise { const result = await _validTokenSend(context, options); return _validTokenDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/UnionContext.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/unionContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/UnionContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/api/unionContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.ts index 639a6103db..b6e98967f7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.ts @@ -1,5 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { UnionClient, UnionClientOptions } from "./UnionClient.js"; -export { ValidKeyOptions, ValidTokenOptions } from "./models/index.js"; +export { UnionClient, UnionClientOptions } from "./unionClient.js"; +export { + ValidKeyOptionalParams, + ValidTokenOptionalParams, +} from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/index.ts index 35d5d7d6e4..6c60146788 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ValidKeyOptions, ValidTokenOptions } from "./options.js"; +export { ValidKeyOptionalParams, ValidTokenOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/options.ts index 0d71c9262c..ac67c98b8d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ValidKeyOptions extends OperationOptions {} +export interface ValidKeyOptionalParams extends OperationOptions {} -export interface ValidTokenOptions extends OperationOptions {} +export interface ValidTokenOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/UnionClient.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/unionClient.ts similarity index 75% rename from packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/UnionClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/unionClient.ts index 51aff88ce3..837f0524d9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/UnionClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/unionClient.ts @@ -10,9 +10,12 @@ import { UnionClientOptions, UnionContext, } from "./api/index.js"; -import { ValidKeyOptions, ValidTokenOptions } from "./models/options.js"; +import { + ValidKeyOptionalParams, + ValidTokenOptionalParams, +} from "./models/options.js"; -export { UnionClientOptions } from "./api/UnionContext.js"; +export { UnionClientOptions } from "./api/unionContext.js"; export class UnionClient { private _client: UnionContext; @@ -29,13 +32,15 @@ export class UnionClient { } /** Check whether client is authenticated */ - validKey(options: ValidKeyOptions = { requestOptions: {} }): Promise { + validKey( + options: ValidKeyOptionalParams = { requestOptions: {} }, + ): Promise { return validKey(this._client, options); } /** Check whether client is authenticated */ validToken( - options: ValidTokenOptions = { requestOptions: {} }, + options: ValidTokenOptionalParams = { requestOptions: {} }, ): Promise { return validToken(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/package.json b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/package.json index 311e05b173..94ba5c0f0d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/AccessClient.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/accessClient.ts similarity index 66% rename from packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/AccessClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/accessClient.ts index 862540bc36..419e411c9b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/AccessClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/accessClient.ts @@ -13,15 +13,15 @@ import { AbstractModelUnion, } from "./models/models.js"; import { - NoDecoratorInPublicOptions, - PublicDecoratorInPublicOptions, - NoDecoratorInInternalOptions, - InternalDecoratorInInternalOptions, - PublicDecoratorInInternalOptions, - PublicOperationOptions, - InternalOptions, - OperationOptions, - DiscriminatorOptions, + NoDecoratorInPublicOptionalParams, + PublicDecoratorInPublicOptionalParams, + NoDecoratorInInternalOptionalParams, + InternalDecoratorInInternalOptionalParams, + PublicDecoratorInInternalOptionalParams, + PublicOptionalParams, + InternalOptionalParams, + OperationOptionalParams, + DiscriminatorOptionalParams, } from "./models/options.js"; import { createAccess, @@ -32,13 +32,13 @@ import { noDecoratorInInternal, internalDecoratorInInternal, publicDecoratorInInternal, - publicOperation, + $public, internal, operation, discriminator, } from "./api/index.js"; -export { AccessClientOptions } from "./api/AccessContext.js"; +export { AccessClientOptions } from "./api/accessContext.js"; export class AccessClient { private _client: AccessContext; @@ -53,49 +53,54 @@ export class AccessClient { noDecoratorInPublic( name: string, - options: NoDecoratorInPublicOptions = { requestOptions: {} }, + options: NoDecoratorInPublicOptionalParams = { requestOptions: {} }, ): Promise { return noDecoratorInPublic(this._client, name, options); } publicDecoratorInPublic( name: string, - options: PublicDecoratorInPublicOptions = { requestOptions: {} }, + options: PublicDecoratorInPublicOptionalParams = { requestOptions: {} }, ): Promise { return publicDecoratorInPublic(this._client, name, options); } noDecoratorInInternal( name: string, - options: NoDecoratorInInternalOptions = { requestOptions: {} }, + options: NoDecoratorInInternalOptionalParams = { requestOptions: {} }, ): Promise { return noDecoratorInInternal(this._client, name, options); } internalDecoratorInInternal( name: string, - options: InternalDecoratorInInternalOptions = { requestOptions: {} }, + options: InternalDecoratorInInternalOptionalParams = { requestOptions: {} }, ): Promise { return internalDecoratorInInternal(this._client, name, options); } publicDecoratorInInternal( name: string, - options: PublicDecoratorInInternalOptions = { requestOptions: {} }, + options: PublicDecoratorInInternalOptionalParams = { requestOptions: {} }, ): Promise { return publicDecoratorInInternal(this._client, name, options); } - publicOperation( + /** + * @fixme public is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + public( name: string, - options: PublicOperationOptions = { requestOptions: {} }, + options: PublicOptionalParams = { requestOptions: {} }, ): Promise { - return publicOperation(this._client, name, options); + return $public(this._client, name, options); } internal( name: string, - options: InternalOptions = { requestOptions: {} }, + options: InternalOptionalParams = { requestOptions: {} }, ): Promise { return internal(this._client, name, options); } @@ -115,7 +120,7 @@ export class AccessClient { */ operation( name: string, - options: OperationOptions = { requestOptions: {} }, + options: OperationOptionalParams = { requestOptions: {} }, ): Promise { return operation(this._client, name, options); } @@ -132,7 +137,7 @@ export class AccessClient { */ discriminator( kind: string, - options: DiscriminatorOptions = { requestOptions: {} }, + options: DiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { return discriminator(this._client, kind, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/AccessContext.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/accessContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/AccessContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/accessContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/index.ts index 32e742fa78..22c7195233 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/index.ts @@ -5,14 +5,14 @@ export { createAccess, AccessClientOptions, AccessContext, -} from "./AccessContext.js"; +} from "./accessContext.js"; export { noDecoratorInPublic, publicDecoratorInPublic, noDecoratorInInternal, internalDecoratorInInternal, publicDecoratorInInternal, - publicOperation, + $public, internal, operation, discriminator, diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/operations.ts index 6972b38368..ffb1bc2fca 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/api/operations.ts @@ -19,31 +19,31 @@ import { NoDecoratorInInternal200Response, NoDecoratorInPublic200Response, Operation200Response, + Public200Response, PublicDecoratorInInternal200Response, PublicDecoratorInPublic200Response, - PublicOperation200Response, } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError, - OperationOptions, } from "@azure-rest/core-client"; import { - NoDecoratorInPublicOptions, - PublicDecoratorInPublicOptions, - NoDecoratorInInternalOptions, - InternalDecoratorInInternalOptions, - PublicDecoratorInInternalOptions, - PublicOperationOptions, - InternalOptions, - DiscriminatorOptions, + NoDecoratorInPublicOptionalParams, + PublicDecoratorInPublicOptionalParams, + NoDecoratorInInternalOptionalParams, + InternalDecoratorInInternalOptionalParams, + PublicDecoratorInInternalOptionalParams, + PublicOptionalParams, + InternalOptionalParams, + OperationOptionalParams, + DiscriminatorOptionalParams, } from "../models/options.js"; export function _noDecoratorInPublicSend( context: Client, name: string, - options: NoDecoratorInPublicOptions = { requestOptions: {} }, + options: NoDecoratorInPublicOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -70,7 +70,7 @@ export async function _noDecoratorInPublicDeserialize( export async function noDecoratorInPublic( context: Client, name: string, - options: NoDecoratorInPublicOptions = { requestOptions: {} }, + options: NoDecoratorInPublicOptionalParams = { requestOptions: {} }, ): Promise { const result = await _noDecoratorInPublicSend(context, name, options); return _noDecoratorInPublicDeserialize(result); @@ -79,7 +79,7 @@ export async function noDecoratorInPublic( export function _publicDecoratorInPublicSend( context: Client, name: string, - options: PublicDecoratorInPublicOptions = { requestOptions: {} }, + options: PublicDecoratorInPublicOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -106,7 +106,7 @@ export async function _publicDecoratorInPublicDeserialize( export async function publicDecoratorInPublic( context: Client, name: string, - options: PublicDecoratorInPublicOptions = { requestOptions: {} }, + options: PublicDecoratorInPublicOptionalParams = { requestOptions: {} }, ): Promise { const result = await _publicDecoratorInPublicSend(context, name, options); return _publicDecoratorInPublicDeserialize(result); @@ -115,7 +115,7 @@ export async function publicDecoratorInPublic( export function _noDecoratorInInternalSend( context: Client, name: string, - options: NoDecoratorInInternalOptions = { requestOptions: {} }, + options: NoDecoratorInInternalOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -142,7 +142,7 @@ export async function _noDecoratorInInternalDeserialize( export async function noDecoratorInInternal( context: Client, name: string, - options: NoDecoratorInInternalOptions = { requestOptions: {} }, + options: NoDecoratorInInternalOptionalParams = { requestOptions: {} }, ): Promise { const result = await _noDecoratorInInternalSend(context, name, options); return _noDecoratorInInternalDeserialize(result); @@ -151,7 +151,7 @@ export async function noDecoratorInInternal( export function _internalDecoratorInInternalSend( context: Client, name: string, - options: InternalDecoratorInInternalOptions = { requestOptions: {} }, + options: InternalDecoratorInInternalOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -178,7 +178,7 @@ export async function _internalDecoratorInInternalDeserialize( export async function internalDecoratorInInternal( context: Client, name: string, - options: InternalDecoratorInInternalOptions = { requestOptions: {} }, + options: InternalDecoratorInInternalOptionalParams = { requestOptions: {} }, ): Promise { const result = await _internalDecoratorInInternalSend(context, name, options); return _internalDecoratorInInternalDeserialize(result); @@ -187,7 +187,7 @@ export async function internalDecoratorInInternal( export function _publicDecoratorInInternalSend( context: Client, name: string, - options: PublicDecoratorInInternalOptions = { requestOptions: {} }, + options: PublicDecoratorInInternalOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -214,17 +214,17 @@ export async function _publicDecoratorInInternalDeserialize( export async function publicDecoratorInInternal( context: Client, name: string, - options: PublicDecoratorInInternalOptions = { requestOptions: {} }, + options: PublicDecoratorInInternalOptionalParams = { requestOptions: {} }, ): Promise { const result = await _publicDecoratorInInternalSend(context, name, options); return _publicDecoratorInInternalDeserialize(result); } -export function _publicOperationSend( +export function _$publicSend( context: Client, name: string, - options: PublicOperationOptions = { requestOptions: {} }, -): StreamableMethod { + options: PublicOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/azure/client-generator-core/access/sharedModelInOperation/public") .get({ @@ -233,8 +233,8 @@ export function _publicOperationSend( }); } -export async function _publicOperationDeserialize( - result: PublicOperation200Response, +export async function _$publicDeserialize( + result: Public200Response, ): Promise { if (result.status !== "200") { throw createRestError(result); @@ -245,19 +245,24 @@ export async function _publicOperationDeserialize( }; } -export async function publicOperation( +/** + * @fixme public is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $public( context: Client, name: string, - options: PublicOperationOptions = { requestOptions: {} }, + options: PublicOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _publicOperationSend(context, name, options); - return _publicOperationDeserialize(result); + const result = await _$publicSend(context, name, options); + return _$publicDeserialize(result); } export function _internalSend( context: Client, name: string, - options: InternalOptions = { requestOptions: {} }, + options: InternalOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/client-generator-core/access/sharedModelInOperation/internal") @@ -282,7 +287,7 @@ export async function _internalDeserialize( export async function internal( context: Client, name: string, - options: InternalOptions = { requestOptions: {} }, + options: InternalOptionalParams = { requestOptions: {} }, ): Promise { const result = await _internalSend(context, name, options); return _internalDeserialize(result); @@ -291,7 +296,7 @@ export async function internal( export function _operationSend( context: Client, name: string, - options: OperationOptions = { requestOptions: {} }, + options: OperationOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -332,7 +337,7 @@ export async function _operationDeserialize( export async function operation( context: Client, name: string, - options: OperationOptions = { requestOptions: {} }, + options: OperationOptionalParams = { requestOptions: {} }, ): Promise { const result = await _operationSend(context, name, options); return _operationDeserialize(result); @@ -341,7 +346,7 @@ export async function operation( export function _discriminatorSend( context: Client, kind: string, - options: DiscriminatorOptions = { requestOptions: {} }, + options: DiscriminatorOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -376,7 +381,7 @@ export async function _discriminatorDeserialize( export async function discriminator( context: Client, kind: string, - options: DiscriminatorOptions = { requestOptions: {} }, + options: DiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { const result = await _discriminatorSend(context, kind, options); return _discriminatorDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/index.ts index 2b47494e33..25ee8fa19e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { AccessClient, AccessClientOptions } from "./AccessClient.js"; +export { AccessClient, AccessClientOptions } from "./accessClient.js"; export { BaseModel, OuterModel, @@ -15,13 +15,13 @@ export { NoDecoratorModelInPublic, PublicDecoratorModelInPublic, AbstractModelUnion, - NoDecoratorInPublicOptions, - PublicDecoratorInPublicOptions, - NoDecoratorInInternalOptions, - InternalDecoratorInInternalOptions, - PublicDecoratorInInternalOptions, - PublicOperationOptions, - InternalOptions, - OperationOptions, - DiscriminatorOptions, + NoDecoratorInPublicOptionalParams, + PublicDecoratorInPublicOptionalParams, + NoDecoratorInInternalOptionalParams, + InternalDecoratorInInternalOptionalParams, + PublicDecoratorInInternalOptionalParams, + PublicOptionalParams, + InternalOptionalParams, + OperationOptionalParams, + DiscriminatorOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/index.ts index 5d5c6ea2d6..4ae63556e3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/index.ts @@ -16,13 +16,13 @@ export { AbstractModelUnion, } from "./models.js"; export { - NoDecoratorInPublicOptions, - PublicDecoratorInPublicOptions, - NoDecoratorInInternalOptions, - InternalDecoratorInInternalOptions, - PublicDecoratorInInternalOptions, - PublicOperationOptions, - InternalOptions, - OperationOptions, - DiscriminatorOptions, + NoDecoratorInPublicOptionalParams, + PublicDecoratorInPublicOptionalParams, + NoDecoratorInInternalOptionalParams, + InternalDecoratorInInternalOptionalParams, + PublicDecoratorInInternalOptionalParams, + PublicOptionalParams, + InternalOptionalParams, + OperationOptionalParams, + DiscriminatorOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/options.ts index c3cf5b354a..3cb8a9e075 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/models/options.ts @@ -3,20 +3,23 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface NoDecoratorInPublicOptions extends OperationOptions {} +export interface NoDecoratorInPublicOptionalParams extends OperationOptions {} -export interface PublicDecoratorInPublicOptions extends OperationOptions {} +export interface PublicDecoratorInPublicOptionalParams + extends OperationOptions {} -export interface NoDecoratorInInternalOptions extends OperationOptions {} +export interface NoDecoratorInInternalOptionalParams extends OperationOptions {} -export interface InternalDecoratorInInternalOptions extends OperationOptions {} +export interface InternalDecoratorInInternalOptionalParams + extends OperationOptions {} -export interface PublicDecoratorInInternalOptions extends OperationOptions {} +export interface PublicDecoratorInInternalOptionalParams + extends OperationOptions {} -export interface PublicOperationOptions extends OperationOptions {} +export interface PublicOptionalParams extends OperationOptions {} -export interface InternalOptions extends OperationOptions {} +export interface InternalOptionalParams extends OperationOptions {} -export interface OperationOptions extends OperationOptions {} +export interface OperationOptionalParams extends OperationOptions {} -export interface DiscriminatorOptions extends OperationOptions {} +export interface DiscriminatorOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/clientDefinitions.ts index a5fb239a97..c0c15e5de6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/clientDefinitions.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/clientDefinitions.ts @@ -18,7 +18,7 @@ import { NoDecoratorInInternal200Response, InternalDecoratorInInternal200Response, PublicDecoratorInInternal200Response, - PublicOperation200Response, + Public200Response, Internal200Response, Operation200Response, Discriminator200Response, @@ -56,7 +56,7 @@ export interface PublicDecoratorInInternal { } export interface Public { - get(options: PublicParameters): StreamableMethod; + get(options: PublicParameters): StreamableMethod; } export interface Internal { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/responses.ts index bb463d8c7c..e8187551bd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/responses.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/access/src/rest/responses.ts @@ -44,7 +44,7 @@ export interface PublicDecoratorInInternal200Response extends HttpResponse { } /** The request has succeeded. */ -export interface PublicOperation200Response extends HttpResponse { +export interface Public200Response extends HttpResponse { status: "200"; body: SharedModelOutput; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/package.json b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/package.json index d2c4f6e763..9251b43f61 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/index.ts index 7cfbe32b75..7930a9b8d5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/index.ts @@ -6,4 +6,4 @@ export { createUsage, UsageClientOptions, UsageContext, -} from "./UsageContext.js"; +} from "./usageContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/operations.ts index 187253eabe..25d22fa29e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/operations.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - InputToInputOutputOptions, - OutputToInputOutputOptions, + InputToInputOutputOptionalParams, + OutputToInputOutputOptionalParams, } from "../models/options.js"; export function _inputToInputOutputSend( context: Client, body: InputModel, - options: InputToInputOutputOptions = { requestOptions: {} }, + options: InputToInputOutputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/client-generator-core/usage/inputToInputOutput") @@ -51,7 +51,7 @@ export async function _inputToInputOutputDeserialize( export async function inputToInputOutput( context: Client, body: InputModel, - options: InputToInputOutputOptions = { requestOptions: {} }, + options: InputToInputOutputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _inputToInputOutputSend(context, body, options); return _inputToInputOutputDeserialize(result); @@ -59,7 +59,7 @@ export async function inputToInputOutput( export function _outputToInputOutputSend( context: Client, - options: OutputToInputOutputOptions = { requestOptions: {} }, + options: OutputToInputOutputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/client-generator-core/usage/outputToInputOutput") @@ -88,7 +88,7 @@ export async function _outputToInputOutputDeserialize( */ export async function outputToInputOutput( context: Client, - options: OutputToInputOutputOptions = { requestOptions: {} }, + options: OutputToInputOutputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _outputToInputOutputSend(context, options); return _outputToInputOutputDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/UsageContext.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/usageContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/UsageContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/api/usageContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts index 487532d7cf..ebd06e6809 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/index.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { UsageClient, UsageClientOptions } from "./UsageClient.js"; +export { UsageClient, UsageClientOptions } from "./usageClient.js"; export { InputModel, OutputModel, - InputToInputOutputOptions, - OutputToInputOutputOptions, + InputToInputOutputOptionalParams, + OutputToInputOutputOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts index e09b6c95e1..b1a56b87c9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/index.ts @@ -3,6 +3,6 @@ export { InputModel, OutputModel } from "./models.js"; export { - InputToInputOutputOptions, - OutputToInputOutputOptions, + InputToInputOutputOptionalParams, + OutputToInputOutputOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/options.ts index 6f807dff7c..e346f9360d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface InputToInputOutputOptions extends OperationOptions {} +export interface InputToInputOutputOptionalParams extends OperationOptions {} -export interface OutputToInputOutputOptions extends OperationOptions {} +export interface OutputToInputOutputOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/UsageClient.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/usageClient.ts similarity index 80% rename from packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/UsageClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/usageClient.ts index 1b40b272c9..f462400dce 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/UsageClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/clientGeneratorCore/usage/src/usageClient.ts @@ -4,8 +4,8 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { InputModel, OutputModel } from "./models/models.js"; import { - InputToInputOutputOptions, - OutputToInputOutputOptions, + InputToInputOutputOptionalParams, + OutputToInputOutputOptionalParams, } from "./models/options.js"; import { inputToInputOutput, @@ -15,7 +15,7 @@ import { UsageContext, } from "./api/index.js"; -export { UsageClientOptions } from "./api/UsageContext.js"; +export { UsageClientOptions } from "./api/usageContext.js"; export class UsageClient { private _client: UsageContext; @@ -38,7 +38,7 @@ export class UsageClient { */ inputToInputOutput( body: InputModel, - options: InputToInputOutputOptions = { requestOptions: {} }, + options: InputToInputOutputOptionalParams = { requestOptions: {} }, ): Promise { return inputToInputOutput(this._client, body, options); } @@ -52,7 +52,7 @@ export class UsageClient { * ``` */ outputToInputOutput( - options: OutputToInputOutputOptions = { requestOptions: {} }, + options: OutputToInputOutputOptionalParams = { requestOptions: {} }, ): Promise { return outputToInputOutput(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/package.json b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/package.json index a8a5e2c61e..8cbd014e42 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/index.ts index 08b8359303..14ca765998 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/index.ts @@ -6,4 +6,4 @@ export { createScalar, ScalarClientOptions, ScalarContext, -} from "./ScalarContext.js"; +} from "./scalarContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/operations.ts index d23e5c5acd..3c6dad0b2a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/operations.ts @@ -16,16 +16,16 @@ import { createRestError, } from "@azure-rest/core-client"; import { - GetOptions, - PutOptions, - PostOptions, - HeaderOptions, - QueryOptions, + GetOptionalParams, + PutOptionalParams, + PostOptionalParams, + HeaderOptionalParams, + QueryOptionalParams, } from "../models/options.js"; export function _getSend( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/scalar/azureLocation") @@ -43,7 +43,7 @@ export async function _getDeserialize(result: Get200Response): Promise { /** get azureLocation value */ export async function get( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, options); return _getDeserialize(result); @@ -52,7 +52,7 @@ export async function get( export function _putSend( context: Client, body: string, - options: PutOptions = { requestOptions: {} }, + options: PutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/scalar/azureLocation") @@ -71,7 +71,7 @@ export async function _putDeserialize(result: Put204Response): Promise { export async function put( context: Client, body: string, - options: PutOptions = { requestOptions: {} }, + options: PutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putSend(context, body, options); return _putDeserialize(result); @@ -80,7 +80,7 @@ export async function put( export function _postSend( context: Client, body: AzureLocationModel, - options: PostOptions = { requestOptions: {} }, + options: PostOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/scalar/azureLocation") @@ -106,7 +106,7 @@ export async function _postDeserialize( export async function post( context: Client, body: AzureLocationModel, - options: PostOptions = { requestOptions: {} }, + options: PostOptionalParams = { requestOptions: {} }, ): Promise { const result = await _postSend(context, body, options); return _postDeserialize(result); @@ -115,7 +115,7 @@ export async function post( export function _headerSend( context: Client, region: string, - options: HeaderOptions = { requestOptions: {} }, + options: HeaderOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/scalar/azureLocation/header") @@ -139,7 +139,7 @@ export async function _headerDeserialize( export async function header( context: Client, region: string, - options: HeaderOptions = { requestOptions: {} }, + options: HeaderOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerSend(context, region, options); return _headerDeserialize(result); @@ -148,7 +148,7 @@ export async function header( export function _querySend( context: Client, region: string, - options: QueryOptions = { requestOptions: {} }, + options: QueryOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/scalar/azureLocation/query") @@ -172,7 +172,7 @@ export async function _queryDeserialize( export async function query( context: Client, region: string, - options: QueryOptions = { requestOptions: {} }, + options: QueryOptionalParams = { requestOptions: {} }, ): Promise { const result = await _querySend(context, region, options); return _queryDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/ScalarContext.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/scalarContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/ScalarContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/api/scalarContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/index.ts index 7e0ad009f9..d06dc491d8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/index.ts @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ScalarClient, ScalarClientOptions } from "./ScalarClient.js"; +export { ScalarClient, ScalarClientOptions } from "./scalarClient.js"; export { AzureLocationModel, - GetOptions, - PutOptions, - PostOptions, - HeaderOptions, - QueryOptions, + Versions, + GetOptionalParams, + PutOptionalParams, + PostOptionalParams, + HeaderOptionalParams, + QueryOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/index.ts index 9f06d1ce56..76ae342b76 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/index.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { AzureLocationModel } from "./models.js"; +export { AzureLocationModel, Versions } from "./models.js"; export { - GetOptions, - PutOptions, - PostOptions, - HeaderOptions, - QueryOptions, + GetOptionalParams, + PutOptionalParams, + PostOptionalParams, + HeaderOptionalParams, + QueryOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/models.ts index 9d3b221d42..a21d9029ec 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/models.ts @@ -4,3 +4,7 @@ export interface AzureLocationModel { location: string; } + +/** The version of the API. */ +/** */ +export type Versions = "2022-12-01-preview"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/options.ts index 1550d24896..a5f9c2bf8e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/models/options.ts @@ -3,12 +3,12 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface GetOptions extends OperationOptions {} +export interface GetOptionalParams extends OperationOptions {} -export interface PutOptions extends OperationOptions {} +export interface PutOptionalParams extends OperationOptions {} -export interface PostOptions extends OperationOptions {} +export interface PostOptionalParams extends OperationOptions {} -export interface HeaderOptions extends OperationOptions {} +export interface HeaderOptionalParams extends OperationOptions {} -export interface QueryOptions extends OperationOptions {} +export interface QueryOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/ScalarClient.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/scalarClient.ts similarity index 73% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/ScalarClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/scalarClient.ts index 6acf3623d6..c02a91f1d7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/ScalarClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-scalar/src/scalarClient.ts @@ -4,11 +4,11 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { AzureLocationModel } from "./models/models.js"; import { - GetOptions, - PutOptions, - PostOptions, - HeaderOptions, - QueryOptions, + GetOptionalParams, + PutOptionalParams, + PostOptionalParams, + HeaderOptionalParams, + QueryOptionalParams, } from "./models/options.js"; import { get, @@ -21,7 +21,7 @@ import { ScalarContext, } from "./api/index.js"; -export { ScalarClientOptions } from "./api/ScalarContext.js"; +export { ScalarClientOptions } from "./api/scalarContext.js"; export class ScalarClient { private _client: ScalarContext; @@ -34,14 +34,14 @@ export class ScalarClient { } /** get azureLocation value */ - get(options: GetOptions = { requestOptions: {} }): Promise { + get(options: GetOptionalParams = { requestOptions: {} }): Promise { return get(this._client, options); } /** put azureLocation value */ put( body: string, - options: PutOptions = { requestOptions: {} }, + options: PutOptionalParams = { requestOptions: {} }, ): Promise { return put(this._client, body, options); } @@ -49,7 +49,7 @@ export class ScalarClient { /** post a model which has azureLocation property */ post( body: AzureLocationModel, - options: PostOptions = { requestOptions: {} }, + options: PostOptionalParams = { requestOptions: {} }, ): Promise { return post(this._client, body, options); } @@ -57,7 +57,7 @@ export class ScalarClient { /** azureLocation value header */ header( region: string, - options: HeaderOptions = { requestOptions: {} }, + options: HeaderOptionalParams = { requestOptions: {} }, ): Promise { return header(this._client, region, options); } @@ -65,7 +65,7 @@ export class ScalarClient { /** azureLocation value query */ query( region: string, - options: QueryOptions = { requestOptions: {} }, + options: QueryOptionalParams = { requestOptions: {} }, ): Promise { return query(this._client, region, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/package.json b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/package.json index 8133c2d46b..3cde50bdeb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/index.ts index 1ad3884e73..a316ae4982 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/index.ts @@ -6,4 +6,4 @@ export { createTraits, TraitsClientOptions, TraitsContext, -} from "./TraitsContext.js"; +} from "./traitsContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/operations.ts index c0d0dee8b2..b4c924ca6c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/operations.ts @@ -16,15 +16,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - SmokeTestOptions, - RepeatableActionOptions, + SmokeTestOptionalParams, + RepeatableActionOptionalParams, } from "../models/options.js"; export function _smokeTestSend( context: Client, id: number, foo: string, - options: SmokeTestOptions = { requestOptions: {} }, + options: SmokeTestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/traits/user/{id}", id) @@ -69,7 +69,7 @@ export async function smokeTest( context: Client, id: number, foo: string, - options: SmokeTestOptions = { requestOptions: {} }, + options: SmokeTestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _smokeTestSend(context, id, foo, options); return _smokeTestDeserialize(result); @@ -79,7 +79,7 @@ export function _repeatableActionSend( context: Client, id: number, body: UserActionParam, - options: RepeatableActionOptions = { requestOptions: {} }, + options: RepeatableActionOptionalParams = { requestOptions: {} }, ): StreamableMethod< RepeatableAction200Response | RepeatableActionDefaultResponse > { @@ -119,7 +119,7 @@ export async function repeatableAction( context: Client, id: number, body: UserActionParam, - options: RepeatableActionOptions = { requestOptions: {} }, + options: RepeatableActionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _repeatableActionSend(context, id, body, options); return _repeatableActionDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/TraitsContext.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/traitsContext.ts similarity index 78% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/TraitsContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/traitsContext.ts index d65c51e918..eb5e008962 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/TraitsContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/api/traitsContext.ts @@ -5,7 +5,10 @@ import { ClientOptions } from "@azure-rest/core-client"; import { TraitsContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface TraitsClientOptions extends ClientOptions {} +export interface TraitsClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { TraitsContext } from "../rest/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/index.ts index a8ce8307ec..9d334d6d1b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/index.ts @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { TraitsClient, TraitsClientOptions } from "./TraitsClient.js"; +export { TraitsClient, TraitsClientOptions } from "./traitsClient.js"; export { User, UserActionParam, UserActionResponse, + Versions, RepeatabilityResult, - SmokeTestOptions, - RepeatableActionOptions, + SmokeTestOptionalParams, + RepeatableActionOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/index.ts index b0935e86c0..038ba901c0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/index.ts @@ -5,6 +5,10 @@ export { User, UserActionParam, UserActionResponse, + Versions, RepeatabilityResult, } from "./models.js"; -export { SmokeTestOptions, RepeatableActionOptions } from "./options.js"; +export { + SmokeTestOptionalParams, + RepeatableActionOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/models.ts index 316d534c78..842662828e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/models.ts @@ -21,6 +21,9 @@ export interface UserActionResponse { userActionResult: string; } +/** Service versions */ +/** */ +export type Versions = "2022-12-01-preview"; /** Repeatability Result header options */ /** */ export type RepeatabilityResult = "accepted" | "rejected"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/options.ts index 1bcba56025..1c659a7ebc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/models/options.ts @@ -3,7 +3,7 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface SmokeTestOptions extends OperationOptions { +export interface SmokeTestOptionalParams extends OperationOptions { /** The request should only proceed if an entity matches this string. */ ifMatch?: string; /** The request should only proceed if no entity matches this string. */ @@ -16,7 +16,7 @@ export interface SmokeTestOptions extends OperationOptions { clientRequestId?: string; } -export interface RepeatableActionOptions extends OperationOptions { +export interface RepeatableActionOptionalParams extends OperationOptions { /** An opaque, globally-unique, client-generated string identifier for the request. */ repeatabilityRequestId?: string; /** Specifies the date and time at which the request was first created. */ diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/rest/outputModels.ts index de12bf264b..dbcd7d33cf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/rest/outputModels.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/rest/outputModels.ts @@ -1,15 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** Provides the 'If-*' headers to enable conditional (cached) responses */ -export interface ConditionalRequestHeadersOutput {} - -/** Provides the 'ETag' header to enable conditional (cached) requests */ -export interface EtagResponseEnvelopeOutput {} - -/** Provides the 'x-ms-client-request-id' header to enable request correlation in requests and responses. */ -export interface ClientRequestIdHeaderOutput {} - /** Sample Model */ export interface UserOutput { /** The user's id. */ @@ -18,12 +9,6 @@ export interface UserOutput { name?: string; } -/** Provides the 'Repeatability-*' headers to enable repeatable requests. */ -export interface RepeatabilityRequestHeadersOutput {} - -/** Provides the 'Repeatability-*' headers to enable repeatable requests. */ -export interface RepeatabilityResponseHeadersOutput {} - /** User action response */ export interface UserActionResponseOutput { /** User action result. */ diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/TraitsClient.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/traitsClient.ts similarity index 78% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/TraitsClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/traitsClient.ts index 441b617462..295164ffcd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/TraitsClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core-traits/src/traitsClient.ts @@ -3,7 +3,10 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { User, UserActionParam, UserActionResponse } from "./models/models.js"; -import { SmokeTestOptions, RepeatableActionOptions } from "./models/options.js"; +import { + SmokeTestOptionalParams, + RepeatableActionOptionalParams, +} from "./models/options.js"; import { smokeTest, repeatableAction, @@ -12,7 +15,7 @@ import { TraitsContext, } from "./api/index.js"; -export { TraitsClientOptions } from "./api/TraitsContext.js"; +export { TraitsClientOptions } from "./api/traitsContext.js"; export class TraitsClient { private _client: TraitsContext; @@ -29,7 +32,7 @@ export class TraitsClient { smokeTest( id: number, foo: string, - options: SmokeTestOptions = { requestOptions: {} }, + options: SmokeTestOptionalParams = { requestOptions: {} }, ): Promise { return smokeTest(this._client, id, foo, options); } @@ -38,7 +41,7 @@ export class TraitsClient { repeatableAction( id: number, body: UserActionParam, - options: RepeatableActionOptions = { requestOptions: {} }, + options: RepeatableActionOptionalParams = { requestOptions: {} }, ): Promise { return repeatableAction(this._client, id, body, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/package.json b/packages/typespec-ts/test/modularIntegration/generated/azure/core/package.json index 77f75ff152..848846f26e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -38,8 +38,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/BasicContext.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/basicContext.ts similarity index 77% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/BasicContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/basicContext.ts index 93d746aa21..4ba6c96123 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/BasicContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/basicContext.ts @@ -5,7 +5,10 @@ import { ClientOptions } from "@azure-rest/core-client"; import { BasicContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface BasicClientOptions extends ClientOptions {} +export interface BasicClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { BasicContext } from "../rest/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/index.ts index 69670c3662..d1fa274e92 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/index.ts @@ -5,7 +5,7 @@ export { createBasic, BasicClientOptions, BasicContext, -} from "./BasicContext.js"; +} from "./basicContext.js"; export { createOrUpdate, createOrReplace, @@ -14,8 +14,8 @@ export { listWithPage, listWithParameters, listWithCustomPageModel, - deleteOperation, - exportOperation, + $delete, + $export, listFirstItem, listSecondItem, } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/operations.ts index 5186a2ad16..ccfd4f3d4d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/api/operations.ts @@ -5,11 +5,11 @@ import { User, ListItemInputBody, UserListResults, + FirstItem, + SecondItem, PagedUser, PagedFirstItem, - FirstItem, PagedSecondItem, - SecondItem, } from "../models/models.js"; import { PagedAsyncIterableIterator } from "../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "./pagingHelpers.js"; @@ -23,10 +23,10 @@ import { CreateOrUpdate200Response, CreateOrUpdate201Response, CreateOrUpdateDefaultResponse, - DeleteOperation204Response, - DeleteOperationDefaultResponse, - ExportOperation200Response, - ExportOperationDefaultResponse, + Delete204Response, + DeleteDefaultResponse, + Export200Response, + ExportDefaultResponse, Get200Response, GetDefaultResponse, List200Response, @@ -48,24 +48,24 @@ import { createRestError, } from "@azure-rest/core-client"; import { - CreateOrUpdateOptions, - CreateOrReplaceOptions, - GetOptions, - ListOptions, - ListWithPageOptions, - ListWithParametersOptions, - ListWithCustomPageModelOptions, - DeleteOperationOptions, - ExportOperationOptions, - ListFirstItemOptions, - ListSecondItemOptions, + CreateOrUpdateOptionalParams, + CreateOrReplaceOptionalParams, + GetOptionalParams, + ListOptionalParams, + ListWithPageOptionalParams, + ListWithParametersOptionalParams, + ListWithCustomPageModelOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, + ListFirstItemOptionalParams, + ListSecondItemOptionalParams, } from "../models/options.js"; export function _createOrUpdateSend( context: Client, id: number, resource: User, - options: CreateOrUpdateOptions = { requestOptions: {} }, + options: CreateOrUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod< | CreateOrUpdate200Response | CreateOrUpdate201Response @@ -120,7 +120,7 @@ export async function createOrUpdate( context: Client, id: number, resource: User, - options: CreateOrUpdateOptions = { requestOptions: {} }, + options: CreateOrUpdateOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createOrUpdateSend(context, id, resource, options); return _createOrUpdateDeserialize(result); @@ -130,7 +130,7 @@ export function _createOrReplaceSend( context: Client, id: number, resource: User, - options: CreateOrReplaceOptions = { requestOptions: {} }, + options: CreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod< | CreateOrReplace200Response | CreateOrReplace201Response @@ -183,7 +183,7 @@ export async function createOrReplace( context: Client, id: number, resource: User, - options: CreateOrReplaceOptions = { requestOptions: {} }, + options: CreateOrReplaceOptionalParams = { requestOptions: {} }, ): Promise { const result = await _createOrReplaceSend(context, id, resource, options); return _createOrReplaceDeserialize(result); @@ -192,7 +192,7 @@ export async function createOrReplace( export function _getSend( context: Client, id: number, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/basic/users/{id}", id) @@ -225,7 +225,7 @@ export async function _getDeserialize( export async function get( context: Client, id: number, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, id, options); return _getDeserialize(result); @@ -233,7 +233,7 @@ export async function get( export function _listSend( context: Client, - options: ListOptions = { requestOptions: {} }, + options: ListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/basic/users") @@ -288,7 +288,7 @@ export async function _listDeserialize( /** Lists all Users */ export function list( context: Client, - options: ListOptions = { requestOptions: {} }, + options: ListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -300,7 +300,7 @@ export function list( export function _listWithPageSend( context: Client, - options: ListWithPageOptions = { requestOptions: {} }, + options: ListWithPageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/basic/page") @@ -335,7 +335,7 @@ export async function _listWithPageDeserialize( /** List with Azure.Core.Page<>. */ export function listWithPage( context: Client, - options: ListWithPageOptions = { requestOptions: {} }, + options: ListWithPageOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -348,7 +348,7 @@ export function listWithPage( export function _listWithParametersSend( context: Client, bodyInput: ListItemInputBody, - options: ListWithParametersOptions = { requestOptions: {} }, + options: ListWithParametersOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListWithParameters200Response | ListWithParametersDefaultResponse > { @@ -390,7 +390,7 @@ export async function _listWithParametersDeserialize( export function listWithParameters( context: Client, bodyInput: ListItemInputBody, - options: ListWithParametersOptions = { requestOptions: {} }, + options: ListWithParametersOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -402,7 +402,7 @@ export function listWithParameters( export function _listWithCustomPageModelSend( context: Client, - options: ListWithCustomPageModelOptions = { requestOptions: {} }, + options: ListWithCustomPageModelOptionalParams = { requestOptions: {} }, ): StreamableMethod< ListWithCustomPageModel200Response | ListWithCustomPageModelDefaultResponse > { @@ -441,7 +441,7 @@ export async function _listWithCustomPageModelDeserialize( /** List with custom page model. */ export function listWithCustomPageModel( context: Client, - options: ListWithCustomPageModelOptions = { requestOptions: {} }, + options: ListWithCustomPageModelOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -451,20 +451,18 @@ export function listWithCustomPageModel( ); } -export function _deleteOperationSend( +export function _$deleteSend( context: Client, id: number, - options: DeleteOperationOptions = { requestOptions: {} }, -): StreamableMethod< - DeleteOperation204Response | DeleteOperationDefaultResponse -> { + options: DeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/azure/core/basic/users/{id}", id) .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteOperationDeserialize( - result: DeleteOperation204Response | DeleteOperationDefaultResponse, +export async function _$deleteDeserialize( + result: Delete204Response | DeleteDefaultResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -474,23 +472,26 @@ export async function _deleteOperationDeserialize( } /** Deletes a User */ -export async function deleteOperation( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $delete( context: Client, id: number, - options: DeleteOperationOptions = { requestOptions: {} }, + options: DeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _deleteOperationSend(context, id, options); - return _deleteOperationDeserialize(result); + const result = await _$deleteSend(context, id, options); + return _$deleteDeserialize(result); } -export function _exportOperationSend( +export function _$exportSend( context: Client, id: number, format: string, - options: ExportOperationOptions = { requestOptions: {} }, -): StreamableMethod< - ExportOperation200Response | ExportOperationDefaultResponse -> { + options: ExportOptionalParams = { requestOptions: {} }, +): StreamableMethod { return context .path("/azure/core/basic/users/{id}:export", id) .post({ @@ -499,8 +500,8 @@ export function _exportOperationSend( }); } -export async function _exportOperationDeserialize( - result: ExportOperation200Response | ExportOperationDefaultResponse, +export async function _$exportDeserialize( + result: Export200Response | ExportDefaultResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -522,19 +523,24 @@ export async function _exportOperationDeserialize( } /** Exports a User */ -export async function exportOperation( +/** + * @fixme export is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export async function $export( context: Client, id: number, format: string, - options: ExportOperationOptions = { requestOptions: {} }, + options: ExportOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _exportOperationSend(context, id, format, options); - return _exportOperationDeserialize(result); + const result = await _$exportSend(context, id, format, options); + return _$exportDeserialize(result); } export function _listFirstItemSend( context: Client, - options: ListFirstItemOptions = { requestOptions: {} }, + options: ListFirstItemOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/basic/first-item") @@ -557,7 +563,7 @@ export async function _listFirstItemDeserialize( /** Two operations with two different page item types should be successfully generated. Should generate model for FirstItem. */ export function listFirstItem( context: Client, - options: ListFirstItemOptions = { requestOptions: {} }, + options: ListFirstItemOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, @@ -569,7 +575,7 @@ export function listFirstItem( export function _listSecondItemSend( context: Client, - options: ListSecondItemOptions = { requestOptions: {} }, + options: ListSecondItemOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/azure/core/basic/second-item") @@ -592,7 +598,7 @@ export async function _listSecondItemDeserialize( /** Two operations with two different page item types should be successfully generated. Should generate model for SecondItem. */ export function listSecondItem( context: Client, - options: ListSecondItemOptions = { requestOptions: {} }, + options: ListSecondItemOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/BasicClient.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/basicClient.ts similarity index 59% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/src/BasicClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/azure/core/src/basicClient.ts index 30acb1abf3..376a6fbcef 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/BasicClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/basicClient.ts @@ -9,17 +9,17 @@ import { SecondItem, } from "./models/models.js"; import { - CreateOrUpdateOptions, - CreateOrReplaceOptions, - GetOptions, - ListOptions, - ListWithPageOptions, - ListWithParametersOptions, - ListWithCustomPageModelOptions, - DeleteOperationOptions, - ExportOperationOptions, - ListFirstItemOptions, - ListSecondItemOptions, + CreateOrUpdateOptionalParams, + CreateOrReplaceOptionalParams, + GetOptionalParams, + ListOptionalParams, + ListWithPageOptionalParams, + ListWithParametersOptionalParams, + ListWithCustomPageModelOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, + ListFirstItemOptionalParams, + ListSecondItemOptionalParams, } from "./models/options.js"; import { PagedAsyncIterableIterator } from "./models/pagingTypes.js"; import { @@ -33,13 +33,13 @@ import { listWithPage, listWithParameters, listWithCustomPageModel, - deleteOperation, - exportOperation, + $delete, + $export, listFirstItem, listSecondItem, } from "./api/index.js"; -export { BasicClientOptions } from "./api/BasicContext.js"; +export { BasicClientOptions } from "./api/basicContext.js"; export class BasicClient { private _client: BasicContext; @@ -56,7 +56,7 @@ export class BasicClient { createOrUpdate( id: number, resource: User, - options: CreateOrUpdateOptions = { requestOptions: {} }, + options: CreateOrUpdateOptionalParams = { requestOptions: {} }, ): Promise { return createOrUpdate(this._client, id, resource, options); } @@ -65,26 +65,29 @@ export class BasicClient { createOrReplace( id: number, resource: User, - options: CreateOrReplaceOptions = { requestOptions: {} }, + options: CreateOrReplaceOptionalParams = { requestOptions: {} }, ): Promise { return createOrReplace(this._client, id, resource, options); } /** Gets a User */ - get(id: number, options: GetOptions = { requestOptions: {} }): Promise { + get( + id: number, + options: GetOptionalParams = { requestOptions: {} }, + ): Promise { return get(this._client, id, options); } /** Lists all Users */ list( - options: ListOptions = { requestOptions: {} }, + options: ListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return list(this._client, options); } /** List with Azure.Core.Page<>. */ listWithPage( - options: ListWithPageOptions = { requestOptions: {} }, + options: ListWithPageOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listWithPage(this._client, options); } @@ -92,45 +95,55 @@ export class BasicClient { /** List with extensible enum parameter Azure.Core.Page<>. */ listWithParameters( bodyInput: ListItemInputBody, - options: ListWithParametersOptions = { requestOptions: {} }, + options: ListWithParametersOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listWithParameters(this._client, bodyInput, options); } /** List with custom page model. */ listWithCustomPageModel( - options: ListWithCustomPageModelOptions = { requestOptions: {} }, + options: ListWithCustomPageModelOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listWithCustomPageModel(this._client, options); } /** Deletes a User */ - deleteOperation( + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete( id: number, - options: DeleteOperationOptions = { requestOptions: {} }, + options: DeleteOptionalParams = { requestOptions: {} }, ): Promise { - return deleteOperation(this._client, id, options); + return $delete(this._client, id, options); } /** Exports a User */ - exportOperation( + /** + * @fixme export is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + export( id: number, format: string, - options: ExportOperationOptions = { requestOptions: {} }, + options: ExportOptionalParams = { requestOptions: {} }, ): Promise { - return exportOperation(this._client, id, format, options); + return $export(this._client, id, format, options); } /** Two operations with two different page item types should be successfully generated. Should generate model for FirstItem. */ listFirstItem( - options: ListFirstItemOptions = { requestOptions: {} }, + options: ListFirstItemOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listFirstItem(this._client, options); } /** Two operations with two different page item types should be successfully generated. Should generate model for SecondItem. */ listSecondItem( - options: ListSecondItemOptions = { requestOptions: {} }, + options: ListSecondItemOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return listSecondItem(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/index.ts index b854207261..83e02bbe46 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/index.ts @@ -1,29 +1,30 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { BasicClient, BasicClientOptions } from "./BasicClient.js"; +export { BasicClient, BasicClientOptions } from "./basicClient.js"; export { User, UserOrder, ListItemInputBody, + ListItemInputExtensibleEnum, UserListResults, + FirstItem, + SecondItem, + Versions, PagedUser, - ListItemInputExtensibleEnum, PagedFirstItem, - FirstItem, PagedSecondItem, - SecondItem, - CreateOrUpdateOptions, - CreateOrReplaceOptions, - GetOptions, - ListOptions, - ListWithPageOptions, - ListWithParametersOptions, - ListWithCustomPageModelOptions, - DeleteOperationOptions, - ExportOperationOptions, - ListFirstItemOptions, - ListSecondItemOptions, + CreateOrUpdateOptionalParams, + CreateOrReplaceOptionalParams, + GetOptionalParams, + ListOptionalParams, + ListWithPageOptionalParams, + ListWithParametersOptionalParams, + ListWithCustomPageModelOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, + ListFirstItemOptionalParams, + ListSecondItemOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/index.ts index f22447d5aa..72134b9711 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/index.ts @@ -5,26 +5,27 @@ export { User, UserOrder, ListItemInputBody, + ListItemInputExtensibleEnum, UserListResults, + FirstItem, + SecondItem, + Versions, PagedUser, - ListItemInputExtensibleEnum, PagedFirstItem, - FirstItem, PagedSecondItem, - SecondItem, } from "./models.js"; export { - CreateOrUpdateOptions, - CreateOrReplaceOptions, - GetOptions, - ListOptions, - ListWithPageOptions, - ListWithParametersOptions, - ListWithCustomPageModelOptions, - DeleteOperationOptions, - ExportOperationOptions, - ListFirstItemOptions, - ListSecondItemOptions, + CreateOrUpdateOptionalParams, + CreateOrReplaceOptionalParams, + GetOptionalParams, + ListOptionalParams, + ListWithPageOptionalParams, + ListWithParametersOptionalParams, + ListWithCustomPageModelOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, + ListFirstItemOptionalParams, + ListSecondItemOptionalParams, } from "./options.js"; export { PageSettings, diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/models.ts index 0b8a8f1346..6dd0d72c31 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/models.ts @@ -29,6 +29,10 @@ export interface ListItemInputBody { inputName: string; } +/** An extensible enum input parameter. */ +/** "First", "Second" */ +export type ListItemInputExtensibleEnum = string; + export interface UserListResults { /** List of items. */ items: User[]; @@ -36,12 +40,28 @@ export interface UserListResults { nextLink?: string; } +/** First item. */ +export interface FirstItem { + /** The id of the item. */ + readonly id: number; +} + +/** Second item. */ +export interface SecondItem { + /** The name of the item. */ + readonly name: string; +} + +/** The version of the API. */ +/** */ +export type Versions = "2022-12-01-preview"; + /** Paged collection of User items */ export interface PagedUser { /** The User items on this page */ value: User[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } /** Paged collection of User items */ @@ -49,25 +69,15 @@ export interface PagedUser { /** The User items on this page */ value: User[]; /** The link to the next page of items */ - readonly nextLink?: string; + nextLink?: string; } -/** An extensible enum input parameter. */ -/** "First", "Second" */ -export type ListItemInputExtensibleEnum = string; - /** Paged collection of FirstItem items */ export interface PagedFirstItem { /** The FirstItem items on this page */ value: FirstItem[]; /** The link to the next page of items */ - readonly nextLink?: string; -} - -/** First item. */ -export interface FirstItem { - /** The id of the item. */ - readonly id: number; + nextLink?: string; } /** Paged collection of SecondItem items */ @@ -75,11 +85,5 @@ export interface PagedSecondItem { /** The SecondItem items on this page */ value: SecondItem[]; /** The link to the next page of items */ - readonly nextLink?: string; -} - -/** Second item. */ -export interface SecondItem { - /** The name of the item. */ - readonly name: string; + nextLink?: string; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/options.ts index 1b4e830403..7ec8e3b093 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/models/options.ts @@ -4,16 +4,16 @@ import { OperationOptions } from "@azure-rest/core-client"; import { ListItemInputExtensibleEnum } from "./models.js"; -export interface CreateOrUpdateOptions extends OperationOptions { +export interface CreateOrUpdateOptionalParams extends OperationOptions { /** This request has a JSON Merge Patch body. */ contentType?: string; } -export interface CreateOrReplaceOptions extends OperationOptions {} +export interface CreateOrReplaceOptionalParams extends OperationOptions {} -export interface GetOptions extends OperationOptions {} +export interface GetOptionalParams extends OperationOptions {} -export interface ListOptions extends OperationOptions { +export interface ListOptionalParams extends OperationOptions { /** The number of result items to return. */ top?: number; /** The number of result items to skip. */ @@ -30,19 +30,20 @@ export interface ListOptions extends OperationOptions { expand?: string[]; } -export interface ListWithPageOptions extends OperationOptions {} +export interface ListWithPageOptionalParams extends OperationOptions {} -export interface ListWithParametersOptions extends OperationOptions { +export interface ListWithParametersOptionalParams extends OperationOptions { /** Another query parameter. */ another?: ListItemInputExtensibleEnum; } -export interface ListWithCustomPageModelOptions extends OperationOptions {} +export interface ListWithCustomPageModelOptionalParams + extends OperationOptions {} -export interface DeleteOperationOptions extends OperationOptions {} +export interface DeleteOptionalParams extends OperationOptions {} -export interface ExportOperationOptions extends OperationOptions {} +export interface ExportOptionalParams extends OperationOptions {} -export interface ListFirstItemOptions extends OperationOptions {} +export interface ListFirstItemOptionalParams extends OperationOptions {} -export interface ListSecondItemOptions extends OperationOptions {} +export interface ListSecondItemOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/clientDefinitions.ts index 38ed439f4e..785f1f2e48 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/clientDefinitions.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/clientDefinitions.ts @@ -23,8 +23,8 @@ import { CreateOrReplaceDefaultResponse, Get200Response, GetDefaultResponse, - DeleteOperation204Response, - DeleteOperationDefaultResponse, + Delete204Response, + DeleteDefaultResponse, List200Response, ListDefaultResponse, ListWithPage200Response, @@ -33,8 +33,8 @@ import { ListWithParametersDefaultResponse, ListWithCustomPageModel200Response, ListWithCustomPageModelDefaultResponse, - ExportOperation200Response, - ExportOperationDefaultResponse, + Export200Response, + ExportDefaultResponse, ListFirstItem200Response, ListFirstItemDefaultResponse, ListSecondItem200Response, @@ -66,9 +66,7 @@ export interface CreateOrUpdate { /** Deletes a User */ delete( options?: DeleteParameters, - ): StreamableMethod< - DeleteOperation204Response | DeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface List { @@ -107,9 +105,7 @@ export interface Export { /** Exports a User */ post( options: ExportParameters, - ): StreamableMethod< - ExportOperation200Response | ExportOperationDefaultResponse - >; + ): StreamableMethod; } export interface ListFirstItem { diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/isUnexpected.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/isUnexpected.ts index 39b30b5e94..a5e087d419 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/isUnexpected.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/isUnexpected.ts @@ -10,8 +10,8 @@ import { CreateOrReplaceDefaultResponse, Get200Response, GetDefaultResponse, - DeleteOperation204Response, - DeleteOperationDefaultResponse, + Delete204Response, + DeleteDefaultResponse, List200Response, ListDefaultResponse, ListWithPage200Response, @@ -20,8 +20,8 @@ import { ListWithParametersDefaultResponse, ListWithCustomPageModel200Response, ListWithCustomPageModelDefaultResponse, - ExportOperation200Response, - ExportOperationDefaultResponse, + Export200Response, + ExportDefaultResponse, ListFirstItem200Response, ListFirstItemDefaultResponse, ListSecondItem200Response, @@ -58,8 +58,8 @@ export function isUnexpected( response: Get200Response | GetDefaultResponse, ): response is GetDefaultResponse; export function isUnexpected( - response: DeleteOperation204Response | DeleteOperationDefaultResponse, -): response is DeleteOperationDefaultResponse; + response: Delete204Response | DeleteDefaultResponse, +): response is DeleteDefaultResponse; export function isUnexpected( response: List200Response | ListDefaultResponse, ): response is ListDefaultResponse; @@ -75,8 +75,8 @@ export function isUnexpected( | ListWithCustomPageModelDefaultResponse, ): response is ListWithCustomPageModelDefaultResponse; export function isUnexpected( - response: ExportOperation200Response | ExportOperationDefaultResponse, -): response is ExportOperationDefaultResponse; + response: Export200Response | ExportDefaultResponse, +): response is ExportDefaultResponse; export function isUnexpected( response: ListFirstItem200Response | ListFirstItemDefaultResponse, ): response is ListFirstItemDefaultResponse; @@ -93,8 +93,8 @@ export function isUnexpected( | CreateOrReplaceDefaultResponse | Get200Response | GetDefaultResponse - | DeleteOperation204Response - | DeleteOperationDefaultResponse + | Delete204Response + | DeleteDefaultResponse | List200Response | ListDefaultResponse | ListWithPage200Response @@ -103,8 +103,8 @@ export function isUnexpected( | ListWithParametersDefaultResponse | ListWithCustomPageModel200Response | ListWithCustomPageModelDefaultResponse - | ExportOperation200Response - | ExportOperationDefaultResponse + | Export200Response + | ExportDefaultResponse | ListFirstItem200Response | ListFirstItemDefaultResponse | ListSecondItem200Response @@ -113,12 +113,12 @@ export function isUnexpected( | CreateOrUpdateDefaultResponse | CreateOrReplaceDefaultResponse | GetDefaultResponse - | DeleteOperationDefaultResponse + | DeleteDefaultResponse | ListDefaultResponse | ListWithPageDefaultResponse | ListWithParametersDefaultResponse | ListWithCustomPageModelDefaultResponse - | ExportOperationDefaultResponse + | ExportDefaultResponse | ListFirstItemDefaultResponse | ListSecondItemDefaultResponse { const lroOriginal = response.headers["x-ms-original-url"]; diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/responses.ts index 4f5e8e0d43..f938ddf7e2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/responses.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/core/src/rest/responses.ts @@ -143,36 +143,36 @@ export interface ListWithCustomPageModelDefaultResponse extends HttpResponse { } /** There is no content to send for this request, but the headers may be useful. */ -export interface DeleteOperation204Response extends HttpResponse { +export interface Delete204Response extends HttpResponse { status: "204"; } -export interface DeleteOperationDefaultHeaders { +export interface DeleteDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface DeleteOperationDefaultResponse extends HttpResponse { +export interface DeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & DeleteOperationDefaultHeaders; + headers: RawHttpHeaders & DeleteDefaultHeaders; } /** The request has succeeded. */ -export interface ExportOperation200Response extends HttpResponse { +export interface Export200Response extends HttpResponse { status: "200"; body: UserOutput; } -export interface ExportOperationDefaultHeaders { +export interface ExportDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface ExportOperationDefaultResponse extends HttpResponse { +export interface ExportDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & ExportOperationDefaultHeaders; + headers: RawHttpHeaders & ExportDefaultHeaders; } /** The request has succeeded. */ diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/package.json b/packages/typespec-ts/test/modularIntegration/generated/client/naming/package.json index 3c95016a71..209b3514c3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/package.json @@ -26,7 +26,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -39,8 +39,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/clientModel/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/clientModel/index.ts index d9ecd1e6d2..051b5d4ed9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/clientModel/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/clientModel/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ClientModelClientOptions, - ClientModelLanguageOptions, + ClientModelClientOptionalParams, + ClientModelLanguageOptionalParams, } from "../../models/options.js"; export function _clientSend( context: Client, body: ClientModel, - options: ClientModelClientOptions = { requestOptions: {} }, + options: ClientModelClientOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/model/client") @@ -43,7 +43,7 @@ export async function _clientDeserialize( export async function client( context: Client, body: ClientModel, - options: ClientModelClientOptions = { requestOptions: {} }, + options: ClientModelClientOptionalParams = { requestOptions: {} }, ): Promise { const result = await _clientSend(context, body, options); return _clientDeserialize(result); @@ -52,7 +52,7 @@ export async function client( export function _languageSend( context: Client, body: TSModel, - options: ClientModelLanguageOptions = { requestOptions: {} }, + options: ClientModelLanguageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/model/language") @@ -75,7 +75,7 @@ export async function _languageDeserialize( export async function language( context: Client, body: TSModel, - options: ClientModelLanguageOptions = { requestOptions: {} }, + options: ClientModelLanguageOptionalParams = { requestOptions: {} }, ): Promise { const result = await _languageSend(context, body, options); return _languageDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/index.ts index eba1115582..347244aea3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/index.ts @@ -5,7 +5,7 @@ export { createNaming, NamingClientOptions, NamingContext, -} from "./NamingContext.js"; +} from "./namingContext.js"; export { clientName, parameter, diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/NamingContext.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/namingContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/NamingContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/namingContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/operations.ts index 2ec411b023..6d66bdccef 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/operations.ts @@ -22,18 +22,18 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ClientNameOptions, - ParameterOptions, - ClientRequestOptions, - LanguageOptions, - CompatibleWithEncodedNameOptions, - RequestOptions, - ResponseOptions, + ClientNameOptionalParams, + ParameterOptionalParams, + ClientOptionalParams, + LanguageOptionalParams, + CompatibleWithEncodedNameOptionalParams, + RequestOptionalParams, + ResponseOptionalParams, } from "../models/options.js"; export function _clientNameSend( context: Client, - options: ClientNameOptions = { requestOptions: {} }, + options: ClientNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/operation") @@ -52,7 +52,7 @@ export async function _clientNameDeserialize( export async function clientName( context: Client, - options: ClientNameOptions = { requestOptions: {} }, + options: ClientNameOptionalParams = { requestOptions: {} }, ): Promise { const result = await _clientNameSend(context, options); return _clientNameDeserialize(result); @@ -61,7 +61,7 @@ export async function clientName( export function _parameterSend( context: Client, clientName: string, - options: ParameterOptions = { requestOptions: {} }, + options: ParameterOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/parameter") @@ -84,7 +84,7 @@ export async function _parameterDeserialize( export async function parameter( context: Client, clientName: string, - options: ParameterOptions = { requestOptions: {} }, + options: ParameterOptionalParams = { requestOptions: {} }, ): Promise { const result = await _parameterSend(context, clientName, options); return _parameterDeserialize(result); @@ -93,7 +93,7 @@ export async function parameter( export function _clientSend( context: Client, body: ClientNameModel, - options: ClientRequestOptions = { requestOptions: {} }, + options: ClientOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/property/client") @@ -116,7 +116,7 @@ export async function _clientDeserialize( export async function client( context: Client, body: ClientNameModel, - options: ClientRequestOptions = { requestOptions: {} }, + options: ClientOptionalParams = { requestOptions: {} }, ): Promise { const result = await _clientSend(context, body, options); return _clientDeserialize(result); @@ -125,7 +125,7 @@ export async function client( export function _languageSend( context: Client, body: LanguageClientNameModel, - options: LanguageOptions = { requestOptions: {} }, + options: LanguageOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/property/language") @@ -148,7 +148,7 @@ export async function _languageDeserialize( export async function language( context: Client, body: LanguageClientNameModel, - options: LanguageOptions = { requestOptions: {} }, + options: LanguageOptionalParams = { requestOptions: {} }, ): Promise { const result = await _languageSend(context, body, options); return _languageDeserialize(result); @@ -157,7 +157,7 @@ export async function language( export function _compatibleWithEncodedNameSend( context: Client, body: ClientNameAndJsonEncodedNameModel, - options: CompatibleWithEncodedNameOptions = { requestOptions: {} }, + options: CompatibleWithEncodedNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/property/compatible-with-encoded-name") @@ -180,7 +180,7 @@ export async function _compatibleWithEncodedNameDeserialize( export async function compatibleWithEncodedName( context: Client, body: ClientNameAndJsonEncodedNameModel, - options: CompatibleWithEncodedNameOptions = { requestOptions: {} }, + options: CompatibleWithEncodedNameOptionalParams = { requestOptions: {} }, ): Promise { const result = await _compatibleWithEncodedNameSend(context, body, options); return _compatibleWithEncodedNameDeserialize(result); @@ -189,7 +189,7 @@ export async function compatibleWithEncodedName( export function _requestSend( context: Client, clientName: string, - options: RequestOptions = { requestOptions: {} }, + options: RequestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/header") @@ -212,7 +212,7 @@ export async function _requestDeserialize( export async function request( context: Client, clientName: string, - options: RequestOptions = { requestOptions: {} }, + options: RequestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requestSend(context, clientName, options); return _requestDeserialize(result); @@ -220,7 +220,7 @@ export async function request( export function _responseSend( context: Client, - options: ResponseOptions = { requestOptions: {} }, + options: ResponseOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/header") @@ -239,7 +239,7 @@ export async function _responseDeserialize( export async function response( context: Client, - options: ResponseOptions = { requestOptions: {} }, + options: ResponseOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseSend(context, options); return _responseDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/unionEnum/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/unionEnum/index.ts index 9a47f42384..0b3df141c4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/unionEnum/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/api/unionEnum/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnionEnumUnionEnumNameOptions, - UnionEnumUnionEnumMemberNameOptions, + UnionEnumUnionEnumNameOptionalParams, + UnionEnumUnionEnumMemberNameOptionalParams, } from "../../models/options.js"; export function _unionEnumNameSend( context: Client, body: ClientExtensibleEnum, - options: UnionEnumUnionEnumNameOptions = { requestOptions: {} }, + options: UnionEnumUnionEnumNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/union-enum/union-enum-name") @@ -40,7 +40,7 @@ export async function _unionEnumNameDeserialize( export async function unionEnumName( context: Client, body: ClientExtensibleEnum, - options: UnionEnumUnionEnumNameOptions = { requestOptions: {} }, + options: UnionEnumUnionEnumNameOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionEnumNameSend(context, body, options); return _unionEnumNameDeserialize(result); @@ -49,7 +49,7 @@ export async function unionEnumName( export function _unionEnumMemberNameSend( context: Client, body: ExtensibleEnum, - options: UnionEnumUnionEnumMemberNameOptions = { requestOptions: {} }, + options: UnionEnumUnionEnumMemberNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/client/naming/union-enum/union-enum-member-name") @@ -69,7 +69,7 @@ export async function _unionEnumMemberNameDeserialize( export async function unionEnumMemberName( context: Client, body: ExtensibleEnum, - options: UnionEnumUnionEnumMemberNameOptions = { requestOptions: {} }, + options: UnionEnumUnionEnumMemberNameOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionEnumMemberNameSend(context, body, options); return _unionEnumMemberNameDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/clientModel/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/clientModel/index.ts index 631c557ad7..05b488818e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/clientModel/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/clientModel/index.ts @@ -1,30 +1,30 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { NamingContext } from "../../api/NamingContext.js"; +import { NamingContext } from "../../api/namingContext.js"; import { ClientModel, TSModel } from "../../models/models.js"; import { client, language } from "../../api/clientModel/index.js"; import { - ClientModelClientOptions, - ClientModelLanguageOptions, + ClientModelClientOptionalParams, + ClientModelLanguageOptionalParams, } from "../../models/options.js"; export interface ClientModelOperations { client: ( body: ClientModel, - options?: ClientModelClientOptions, + options?: ClientModelClientOptionalParams, ) => Promise; language: ( body: TSModel, - options?: ClientModelLanguageOptions, + options?: ClientModelLanguageOptionalParams, ) => Promise; } export function getClientModel(context: NamingContext) { return { - client: (body: ClientModel, options?: ClientModelClientOptions) => + client: (body: ClientModel, options?: ClientModelClientOptionalParams) => client(context, body, options), - language: (body: TSModel, options?: ClientModelLanguageOptions) => + language: (body: TSModel, options?: ClientModelLanguageOptionalParams) => language(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/unionEnum/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/unionEnum/index.ts index efdc3f30ea..cc2feb4e02 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/unionEnum/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/classic/unionEnum/index.ts @@ -1,25 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { NamingContext } from "../../api/NamingContext.js"; +import { NamingContext } from "../../api/namingContext.js"; import { ClientExtensibleEnum, ExtensibleEnum } from "../../models/models.js"; import { unionEnumName, unionEnumMemberName, } from "../../api/unionEnum/index.js"; import { - UnionEnumUnionEnumNameOptions, - UnionEnumUnionEnumMemberNameOptions, + UnionEnumUnionEnumNameOptionalParams, + UnionEnumUnionEnumMemberNameOptionalParams, } from "../../models/options.js"; export interface UnionEnumOperations { unionEnumName: ( body: ClientExtensibleEnum, - options?: UnionEnumUnionEnumNameOptions, + options?: UnionEnumUnionEnumNameOptionalParams, ) => Promise; unionEnumMemberName: ( body: ExtensibleEnum, - options?: UnionEnumUnionEnumMemberNameOptions, + options?: UnionEnumUnionEnumMemberNameOptionalParams, ) => Promise; } @@ -27,11 +27,11 @@ export function getUnionEnum(context: NamingContext) { return { unionEnumName: ( body: ClientExtensibleEnum, - options?: UnionEnumUnionEnumNameOptions, + options?: UnionEnumUnionEnumNameOptionalParams, ) => unionEnumName(context, body, options), unionEnumMemberName: ( body: ExtensibleEnum, - options?: UnionEnumUnionEnumMemberNameOptions, + options?: UnionEnumUnionEnumMemberNameOptionalParams, ) => unionEnumMemberName(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.ts index 291db2189e..044be043ec 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { NamingClient, NamingClientOptions } from "./NamingClient.js"; +export { NamingClient, NamingClientOptions } from "./namingClient.js"; export { ClientNameModel, LanguageClientNameModel, @@ -10,16 +10,16 @@ export { ExtensibleEnum, ClientModel, TSModel, - ClientNameOptions, - ParameterOptions, - ClientRequestOptions, - LanguageOptions, - CompatibleWithEncodedNameOptions, - RequestOptions, - ResponseOptions, - ClientModelClientOptions, - ClientModelLanguageOptions, - UnionEnumUnionEnumNameOptions, - UnionEnumUnionEnumMemberNameOptions, + ClientNameOptionalParams, + ParameterOptionalParams, + ClientOptionalParams, + LanguageOptionalParams, + CompatibleWithEncodedNameOptionalParams, + RequestOptionalParams, + ResponseOptionalParams, + ClientModelClientOptionalParams, + ClientModelLanguageOptionalParams, + UnionEnumUnionEnumNameOptionalParams, + UnionEnumUnionEnumMemberNameOptionalParams, } from "./models/index.js"; export { ClientModelOperations, UnionEnumOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/index.ts index 1b4cacff5d..8fea03a1f4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/index.ts @@ -11,15 +11,15 @@ export { TSModel, } from "./models.js"; export { - ClientNameOptions, - ParameterOptions, - ClientRequestOptions, - LanguageOptions, - CompatibleWithEncodedNameOptions, - RequestOptions, - ResponseOptions, - ClientModelClientOptions, - ClientModelLanguageOptions, - UnionEnumUnionEnumNameOptions, - UnionEnumUnionEnumMemberNameOptions, + ClientNameOptionalParams, + ParameterOptionalParams, + ClientOptionalParams, + LanguageOptionalParams, + CompatibleWithEncodedNameOptionalParams, + RequestOptionalParams, + ResponseOptionalParams, + ClientModelClientOptionalParams, + ClientModelLanguageOptionalParams, + UnionEnumUnionEnumNameOptionalParams, + UnionEnumUnionEnumMemberNameOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/options.ts index 44d85beb17..2107e2ea38 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/models/options.ts @@ -3,24 +3,27 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ClientNameOptions extends OperationOptions {} +export interface ClientNameOptionalParams extends OperationOptions {} -export interface ParameterOptions extends OperationOptions {} +export interface ParameterOptionalParams extends OperationOptions {} -export interface ClientRequestOptions extends OperationOptions {} +export interface ClientOptionalParams extends OperationOptions {} -export interface LanguageOptions extends OperationOptions {} +export interface LanguageOptionalParams extends OperationOptions {} -export interface CompatibleWithEncodedNameOptions extends OperationOptions {} +export interface CompatibleWithEncodedNameOptionalParams + extends OperationOptions {} -export interface RequestOptions extends OperationOptions {} +export interface RequestOptionalParams extends OperationOptions {} -export interface ResponseOptions extends OperationOptions {} +export interface ResponseOptionalParams extends OperationOptions {} -export interface ClientModelClientOptions extends OperationOptions {} +export interface ClientModelClientOptionalParams extends OperationOptions {} -export interface ClientModelLanguageOptions extends OperationOptions {} +export interface ClientModelLanguageOptionalParams extends OperationOptions {} -export interface UnionEnumUnionEnumNameOptions extends OperationOptions {} +export interface UnionEnumUnionEnumNameOptionalParams + extends OperationOptions {} -export interface UnionEnumUnionEnumMemberNameOptions extends OperationOptions {} +export interface UnionEnumUnionEnumMemberNameOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/NamingClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/namingClient.ts similarity index 74% rename from packages/typespec-ts/test/modularIntegration/generated/client/naming/src/NamingClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/naming/src/namingClient.ts index 06ac46cf87..a912333a7b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/NamingClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/namingClient.ts @@ -8,13 +8,13 @@ import { ClientNameAndJsonEncodedNameModel, } from "./models/models.js"; import { - ClientNameOptions, - ParameterOptions, - ClientRequestOptions, - LanguageOptions, - CompatibleWithEncodedNameOptions, - RequestOptions, - ResponseOptions, + ClientNameOptionalParams, + ParameterOptionalParams, + ClientOptionalParams, + LanguageOptionalParams, + CompatibleWithEncodedNameOptionalParams, + RequestOptionalParams, + ResponseOptionalParams, } from "./models/options.js"; import { getClientModelOperations, @@ -37,7 +37,7 @@ import { response, } from "./api/index.js"; -export { NamingClientOptions } from "./api/NamingContext.js"; +export { NamingClientOptions } from "./api/namingContext.js"; export class NamingClient { private _client: NamingContext; @@ -53,47 +53,49 @@ export class NamingClient { } clientName( - options: ClientNameOptions = { requestOptions: {} }, + options: ClientNameOptionalParams = { requestOptions: {} }, ): Promise { return clientName(this._client, options); } parameter( clientName: string, - options: ParameterOptions = { requestOptions: {} }, + options: ParameterOptionalParams = { requestOptions: {} }, ): Promise { return parameter(this._client, clientName, options); } client( body: ClientNameModel, - options: ClientRequestOptions = { requestOptions: {} }, + options: ClientOptionalParams = { requestOptions: {} }, ): Promise { return client(this._client, body, options); } language( body: LanguageClientNameModel, - options: LanguageOptions = { requestOptions: {} }, + options: LanguageOptionalParams = { requestOptions: {} }, ): Promise { return language(this._client, body, options); } compatibleWithEncodedName( body: ClientNameAndJsonEncodedNameModel, - options: CompatibleWithEncodedNameOptions = { requestOptions: {} }, + options: CompatibleWithEncodedNameOptionalParams = { requestOptions: {} }, ): Promise { return compatibleWithEncodedName(this._client, body, options); } request( clientName: string, - options: RequestOptions = { requestOptions: {} }, + options: RequestOptionalParams = { requestOptions: {} }, ): Promise { return request(this._client, clientName, options); } - response(options: ResponseOptions = { requestOptions: {} }): Promise { + response( + options: ResponseOptionalParams = { requestOptions: {} }, + ): Promise { return response(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/package.json b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/package.json index f8852e30a6..2c8ecbec85 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/package.json @@ -29,7 +29,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -42,8 +42,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/bar/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/bar/index.ts index a481cea37d..b03647ee6d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/bar/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/bar/index.ts @@ -11,11 +11,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BarFiveOptions, BarSixOptions } from "../../models/options.js"; +import { + BarFiveOptionalParams, + BarSixOptionalParams, +} from "../../models/options.js"; export function _fiveSend( context: Client, - options: BarFiveOptions = { requestOptions: {} }, + options: BarFiveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/five") @@ -32,7 +35,7 @@ export async function _fiveDeserialize(result: Five204Response): Promise { export async function five( context: Client, - options: BarFiveOptions = { requestOptions: {} }, + options: BarFiveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _fiveSend(context, options); return _fiveDeserialize(result); @@ -40,7 +43,7 @@ export async function five( export function _sixSend( context: Client, - options: BarSixOptions = { requestOptions: {} }, + options: BarSixOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/six") @@ -57,7 +60,7 @@ export async function _sixDeserialize(result: Six204Response): Promise { export async function six( context: Client, - options: BarSixOptions = { requestOptions: {} }, + options: BarSixOptionalParams = { requestOptions: {} }, ): Promise { const result = await _sixSend(context, options); return _sixDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/baz/foo/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/baz/foo/index.ts index 1a2da7e38e..641ccd0d07 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/baz/foo/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/baz/foo/index.ts @@ -10,11 +10,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BazFooSevenOptions } from "../../../models/options.js"; +import { BazFooSevenOptionalParams } from "../../../models/options.js"; export function _sevenSend( context: Client, - options: BazFooSevenOptions = { requestOptions: {} }, + options: BazFooSevenOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/seven") @@ -33,7 +33,7 @@ export async function _sevenDeserialize( export async function seven( context: Client, - options: BazFooSevenOptions = { requestOptions: {} }, + options: BazFooSevenOptionalParams = { requestOptions: {} }, ): Promise { const result = await _sevenSend(context, options); return _sevenDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/foo/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/foo/index.ts index bc4a23c9be..32c9a17bbc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/foo/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/foo/index.ts @@ -11,11 +11,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { FooThreeOptions, FooFourOptions } from "../../models/options.js"; +import { + FooThreeOptionalParams, + FooFourOptionalParams, +} from "../../models/options.js"; export function _threeSend( context: Client, - options: FooThreeOptions = { requestOptions: {} }, + options: FooThreeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/three") @@ -34,7 +37,7 @@ export async function _threeDeserialize( export async function three( context: Client, - options: FooThreeOptions = { requestOptions: {} }, + options: FooThreeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _threeSend(context, options); return _threeDeserialize(result); @@ -42,7 +45,7 @@ export async function three( export function _fourSend( context: Client, - options: FooFourOptions = { requestOptions: {} }, + options: FooFourOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/four") @@ -59,7 +62,7 @@ export async function _fourDeserialize(result: Four204Response): Promise { export async function four( context: Client, - options: FooFourOptions = { requestOptions: {} }, + options: FooFourOptionalParams = { requestOptions: {} }, ): Promise { const result = await _fourSend(context, options); return _fourDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/index.ts index 5b4bd00c58..e136e5607e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/index.ts @@ -6,4 +6,4 @@ export { createService, ServiceClientOptions, ServiceContext, -} from "./ServiceContext.js"; +} from "./serviceContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/operations.ts index 99c4927e1e..df7f98fb93 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/operations.ts @@ -11,11 +11,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { OneOptions, TwoOptions } from "../models/options.js"; +import { OneOptionalParams, TwoOptionalParams } from "../models/options.js"; export function _oneSend( context: Client, - options: OneOptions = { requestOptions: {} }, + options: OneOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/one") @@ -32,7 +32,7 @@ export async function _oneDeserialize(result: One204Response): Promise { export async function one( context: Client, - options: OneOptions = { requestOptions: {} }, + options: OneOptionalParams = { requestOptions: {} }, ): Promise { const result = await _oneSend(context, options); return _oneDeserialize(result); @@ -40,7 +40,7 @@ export async function one( export function _twoSend( context: Client, - options: TwoOptions = { requestOptions: {} }, + options: TwoOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/two") @@ -57,7 +57,7 @@ export async function _twoDeserialize(result: Two204Response): Promise { export async function two( context: Client, - options: TwoOptions = { requestOptions: {} }, + options: TwoOptionalParams = { requestOptions: {} }, ): Promise { const result = await _twoSend(context, options); return _twoDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/bar/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/bar/index.ts index 8200a899fe..ed7d11082b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/bar/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/bar/index.ts @@ -10,11 +10,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { QuxBarNineOptions } from "../../../models/options.js"; +import { QuxBarNineOptionalParams } from "../../../models/options.js"; export function _nineSend( context: Client, - options: QuxBarNineOptions = { requestOptions: {} }, + options: QuxBarNineOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/nine") @@ -31,7 +31,7 @@ export async function _nineDeserialize(result: Nine204Response): Promise { export async function nine( context: Client, - options: QuxBarNineOptions = { requestOptions: {} }, + options: QuxBarNineOptionalParams = { requestOptions: {} }, ): Promise { const result = await _nineSend(context, options); return _nineDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/index.ts index 75d3cf7412..a272c33f6d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/qux/index.ts @@ -10,11 +10,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { QuxEightOptions } from "../../models/options.js"; +import { QuxEightOptionalParams } from "../../models/options.js"; export function _eightSend( context: Client, - options: QuxEightOptions = { requestOptions: {} }, + options: QuxEightOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/eight") @@ -33,7 +33,7 @@ export async function _eightDeserialize( export async function eight( context: Client, - options: QuxEightOptions = { requestOptions: {} }, + options: QuxEightOptionalParams = { requestOptions: {} }, ): Promise { const result = await _eightSend(context, options); return _eightDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/ServiceContext.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/serviceContext.ts similarity index 88% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/ServiceContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/serviceContext.ts index 4ca413a36a..bc868571c3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/ServiceContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/api/serviceContext.ts @@ -20,10 +20,10 @@ export { ServiceContext } from "../rest/index.js"; * 6. have two clients with a hierarchy relation. */ export function createService( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: ServiceClientOptions = {}, ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/bar/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/bar/index.ts index 79e1b91f1b..309bfd46fe 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/bar/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/bar/index.ts @@ -1,19 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/ServiceContext.js"; +import { ServiceContext } from "../../api/serviceContext.js"; import { five, six } from "../../api/bar/index.js"; -import { BarFiveOptions, BarSixOptions } from "../../models/options.js"; +import { + BarFiveOptionalParams, + BarSixOptionalParams, +} from "../../models/options.js"; export interface BarOperations { - five: (options?: BarFiveOptions) => Promise; - six: (options?: BarSixOptions) => Promise; + five: (options?: BarFiveOptionalParams) => Promise; + six: (options?: BarSixOptionalParams) => Promise; } export function getBar(context: ServiceContext) { return { - five: (options?: BarFiveOptions) => five(context, options), - six: (options?: BarSixOptions) => six(context, options), + five: (options?: BarFiveOptionalParams) => five(context, options), + six: (options?: BarSixOptionalParams) => six(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/foo/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/foo/index.ts index ec26e9453e..4d1d23068a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/foo/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/foo/index.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../../api/ServiceContext.js"; +import { ServiceContext } from "../../../api/serviceContext.js"; import { seven } from "../../../api/baz/foo/index.js"; -import { BazFooSevenOptions } from "../../../models/options.js"; +import { BazFooSevenOptionalParams } from "../../../models/options.js"; export interface BazFooOperations { - seven: (options?: BazFooSevenOptions) => Promise; + seven: (options?: BazFooSevenOptionalParams) => Promise; } export function getBazFoo(context: ServiceContext) { return { - seven: (options?: BazFooSevenOptions) => seven(context, options), + seven: (options?: BazFooSevenOptionalParams) => seven(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/index.ts index 895e7892c9..a3ff8b5e31 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/baz/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/ServiceContext.js"; +import { ServiceContext } from "../../api/serviceContext.js"; import { BazFooOperations, getBazFooOperations } from "./foo/index.js"; export interface BazOperations { diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/foo/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/foo/index.ts index 67fb8b3e2d..640ac21bdd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/foo/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/foo/index.ts @@ -1,19 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/ServiceContext.js"; +import { ServiceContext } from "../../api/serviceContext.js"; import { three, four } from "../../api/foo/index.js"; -import { FooThreeOptions, FooFourOptions } from "../../models/options.js"; +import { + FooThreeOptionalParams, + FooFourOptionalParams, +} from "../../models/options.js"; export interface FooOperations { - three: (options?: FooThreeOptions) => Promise; - four: (options?: FooFourOptions) => Promise; + three: (options?: FooThreeOptionalParams) => Promise; + four: (options?: FooFourOptionalParams) => Promise; } export function getFoo(context: ServiceContext) { return { - three: (options?: FooThreeOptions) => three(context, options), - four: (options?: FooFourOptions) => four(context, options), + three: (options?: FooThreeOptionalParams) => three(context, options), + four: (options?: FooFourOptionalParams) => four(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/bar/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/bar/index.ts index 3488b83086..84db3fbaa6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/bar/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/bar/index.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../../api/ServiceContext.js"; +import { ServiceContext } from "../../../api/serviceContext.js"; import { nine } from "../../../api/qux/bar/index.js"; -import { QuxBarNineOptions } from "../../../models/options.js"; +import { QuxBarNineOptionalParams } from "../../../models/options.js"; export interface QuxBarOperations { - nine: (options?: QuxBarNineOptions) => Promise; + nine: (options?: QuxBarNineOptionalParams) => Promise; } export function getQuxBar(context: ServiceContext) { return { - nine: (options?: QuxBarNineOptions) => nine(context, options), + nine: (options?: QuxBarNineOptionalParams) => nine(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/index.ts index 6731ca917f..d3ee1d2397 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/classic/qux/index.ts @@ -1,19 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/ServiceContext.js"; +import { ServiceContext } from "../../api/serviceContext.js"; import { eight } from "../../api/qux/index.js"; -import { QuxEightOptions } from "../../models/options.js"; +import { QuxEightOptionalParams } from "../../models/options.js"; import { QuxBarOperations, getQuxBarOperations } from "./bar/index.js"; export interface QuxOperations { - eight: (options?: QuxEightOptions) => Promise; + eight: (options?: QuxEightOptionalParams) => Promise; bar: QuxBarOperations; } export function getQux(context: ServiceContext) { return { - eight: (options?: QuxEightOptions) => eight(context, options), + eight: (options?: QuxEightOptionalParams) => eight(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/index.ts index a0d438978d..9ed43fe276 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/index.ts @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ServiceClient, ServiceClientOptions } from "./ServiceClient.js"; +export { ServiceClient, ServiceClientOptions } from "./serviceClient.js"; export { ClientType, - OneOptions, - TwoOptions, - BazFooSevenOptions, - QuxEightOptions, - QuxBarNineOptions, - FooThreeOptions, - FooFourOptions, - BarFiveOptions, - BarSixOptions, + OneOptionalParams, + TwoOptionalParams, + BazFooSevenOptionalParams, + QuxEightOptionalParams, + QuxBarNineOptionalParams, + FooThreeOptionalParams, + FooFourOptionalParams, + BarFiveOptionalParams, + BarSixOptionalParams, } from "./models/index.js"; export { BarOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/index.ts index faec037e64..cd6ff432e9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/index.ts @@ -3,13 +3,13 @@ export { ClientType } from "./models.js"; export { - OneOptions, - TwoOptions, - BazFooSevenOptions, - QuxEightOptions, - QuxBarNineOptions, - FooThreeOptions, - FooFourOptions, - BarFiveOptions, - BarSixOptions, + OneOptionalParams, + TwoOptionalParams, + BazFooSevenOptionalParams, + QuxEightOptionalParams, + QuxBarNineOptionalParams, + FooThreeOptionalParams, + FooFourOptionalParams, + BarFiveOptionalParams, + BarSixOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/models.ts index 1a325de7a1..67064de802 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/models.ts @@ -1,5 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** "default", "multi-client", "renamed-operation", "two-operation-group" */ -export type ClientType = string; +/** */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/options.ts index 3984977b66..b73ec747c2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/models/options.ts @@ -3,20 +3,20 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface OneOptions extends OperationOptions {} +export interface OneOptionalParams extends OperationOptions {} -export interface TwoOptions extends OperationOptions {} +export interface TwoOptionalParams extends OperationOptions {} -export interface BazFooSevenOptions extends OperationOptions {} +export interface BazFooSevenOptionalParams extends OperationOptions {} -export interface QuxEightOptions extends OperationOptions {} +export interface QuxEightOptionalParams extends OperationOptions {} -export interface QuxBarNineOptions extends OperationOptions {} +export interface QuxBarNineOptionalParams extends OperationOptions {} -export interface FooThreeOptions extends OperationOptions {} +export interface FooThreeOptionalParams extends OperationOptions {} -export interface FooFourOptions extends OperationOptions {} +export interface FooFourOptionalParams extends OperationOptions {} -export interface BarFiveOptions extends OperationOptions {} +export interface BarFiveOptionalParams extends OperationOptions {} -export interface BarSixOptions extends OperationOptions {} +export interface BarSixOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/serviceClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/serviceClient.ts index e20f74cf19..7caa06d3f9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/serviceClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/rest/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "../logger.js"; import { ServiceContext } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceContext` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceContext { const endpointUrl = diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/ServiceClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/serviceClient.ts similarity index 81% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/ServiceClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/serviceClient.ts index 94c6b93176..56c466e5d0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/ServiceClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/serviceClient.ts @@ -3,7 +3,7 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { ClientType } from "./models/models.js"; -import { OneOptions, TwoOptions } from "./models/options.js"; +import { OneOptionalParams, TwoOptionalParams } from "./models/options.js"; import { getBazOperations, BazOperations } from "./classic/baz/index.js"; import { getQuxOperations, QuxOperations } from "./classic/qux/index.js"; import { getFooOperations, FooOperations } from "./classic/foo/index.js"; @@ -16,7 +16,7 @@ import { ServiceContext, } from "./api/index.js"; -export { ServiceClientOptions } from "./api/ServiceContext.js"; +export { ServiceClientOptions } from "./api/serviceContext.js"; export class ServiceClient { private _client: ServiceContext; @@ -33,11 +33,11 @@ export class ServiceClient { * 6. have two clients with a hierarchy relation. */ constructor( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: ServiceClientOptions = {}, ) { - this._client = createService(endpoint, client, options); + this._client = createService(endpointParam, clientParam, options); this.pipeline = this._client.pipeline; this.baz = getBazOperations(this._client); this.qux = getQuxOperations(this._client); @@ -45,11 +45,11 @@ export class ServiceClient { this.bar = getBarOperations(this._client); } - one(options: OneOptions = { requestOptions: {} }): Promise { + one(options: OneOptionalParams = { requestOptions: {} }): Promise { return one(this._client, options); } - two(options: TwoOptions = { requestOptions: {} }): Promise { + two(options: TwoOptionalParams = { requestOptions: {} }): Promise { return two(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/package.json b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/package.json index 2607ff2ed7..4122aa070e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/package.json @@ -28,7 +28,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -41,8 +41,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/AClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/aClient.ts similarity index 65% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/AClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/aClient.ts index 00d4d24428..033c904475 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/AClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/aClient.ts @@ -4,9 +4,9 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { ClientType } from "./models/models.js"; import { - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "./models/options.js"; import { createA, @@ -17,7 +17,7 @@ import { renamedFive, } from "./api/index.js"; -export { AClientOptions } from "./api/AContext.js"; +export { AClientOptions } from "./api/aContext.js"; export class AClient { private _client: ServiceContext; @@ -25,28 +25,28 @@ export class AClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: AClientOptions = {}, ) { - this._client = createA(endpoint, client, options); + this._client = createA(endpointParam, clientParam, options); this.pipeline = this._client.pipeline; } renamedOne( - options: RenamedOneOptions = { requestOptions: {} }, + options: RenamedOneOptionalParams = { requestOptions: {} }, ): Promise { return renamedOne(this._client, options); } renamedThree( - options: RenamedThreeOptions = { requestOptions: {} }, + options: RenamedThreeOptionalParams = { requestOptions: {} }, ): Promise { return renamedThree(this._client, options); } renamedFive( - options: RenamedFiveOptions = { requestOptions: {} }, + options: RenamedFiveOptionalParams = { requestOptions: {} }, ): Promise { return renamedFive(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/AContext.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/aContext.ts similarity index 80% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/AContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/aContext.ts index 9d9ba6e51b..62c9323760 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/AContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/aContext.ts @@ -11,10 +11,10 @@ export interface AClientOptions extends ClientOptions {} export { ServiceContext } from "../../rest/index.js"; export function createA( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: AClientOptions = {}, ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/index.ts index 7a012c86e6..53db26814d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { createA, AClientOptions, ServiceContext } from "./AContext.js"; +export { createA, AClientOptions, ServiceContext } from "./aContext.js"; export { renamedOne, renamedThree, renamedFive } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/operations.ts index 2d52c94e14..f32523ab9f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/api/operations.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "../models/options.js"; export function _renamedOneSend( context: Client, - options: RenamedOneOptions = { requestOptions: {} }, + options: RenamedOneOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/one") @@ -39,7 +39,7 @@ export async function _renamedOneDeserialize( export async function renamedOne( context: Client, - options: RenamedOneOptions = { requestOptions: {} }, + options: RenamedOneOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedOneSend(context, options); return _renamedOneDeserialize(result); @@ -47,7 +47,7 @@ export async function renamedOne( export function _renamedThreeSend( context: Client, - options: RenamedThreeOptions = { requestOptions: {} }, + options: RenamedThreeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/three") @@ -66,7 +66,7 @@ export async function _renamedThreeDeserialize( export async function renamedThree( context: Client, - options: RenamedThreeOptions = { requestOptions: {} }, + options: RenamedThreeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedThreeSend(context, options); return _renamedThreeDeserialize(result); @@ -74,7 +74,7 @@ export async function renamedThree( export function _renamedFiveSend( context: Client, - options: RenamedFiveOptions = { requestOptions: {} }, + options: RenamedFiveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/five") @@ -93,7 +93,7 @@ export async function _renamedFiveDeserialize( export async function renamedFive( context: Client, - options: RenamedFiveOptions = { requestOptions: {} }, + options: RenamedFiveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedFiveSend(context, options); return _renamedFiveDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/index.ts index 10aa7d6542..eb4162e5ce 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/index.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { AClient, AClientOptions } from "./AClient.js"; +export { AClient, AClientOptions } from "./aClient.js"; export { ClientType, - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/index.ts index 930387afc7..043f3e9e20 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/index.ts @@ -3,7 +3,7 @@ export { ClientType } from "./models.js"; export { - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/models.ts index 1a325de7a1..67064de802 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/models.ts @@ -1,5 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** "default", "multi-client", "renamed-operation", "two-operation-group" */ -export type ClientType = string; +/** */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/options.ts index 3c9a22e4f8..aaf5ee133e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/a/models/options.ts @@ -3,8 +3,8 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface RenamedOneOptions extends OperationOptions {} +export interface RenamedOneOptionalParams extends OperationOptions {} -export interface RenamedThreeOptions extends OperationOptions {} +export interface RenamedThreeOptionalParams extends OperationOptions {} -export interface RenamedFiveOptions extends OperationOptions {} +export interface RenamedFiveOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/BContext.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/bContext.ts similarity index 80% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/BContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/bContext.ts index e5ad05b1dd..109b374da3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/BContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/bContext.ts @@ -11,10 +11,10 @@ export interface BClientOptions extends ClientOptions {} export { ServiceContext } from "../../rest/index.js"; export function createB( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: BClientOptions = {}, ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/index.ts index 07c2b9e851..cb8a9cd5ed 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { createB, BClientOptions, ServiceContext } from "./BContext.js"; +export { createB, BClientOptions, ServiceContext } from "./bContext.js"; export { renamedTwo, renamedFour, renamedSix } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/operations.ts index aece3c1325..97210ab355 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/api/operations.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - RenamedTwoOptions, - RenamedFourOptions, - RenamedSixOptions, + RenamedTwoOptionalParams, + RenamedFourOptionalParams, + RenamedSixOptionalParams, } from "../models/options.js"; export function _renamedTwoSend( context: Client, - options: RenamedTwoOptions = { requestOptions: {} }, + options: RenamedTwoOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/two") @@ -39,7 +39,7 @@ export async function _renamedTwoDeserialize( export async function renamedTwo( context: Client, - options: RenamedTwoOptions = { requestOptions: {} }, + options: RenamedTwoOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedTwoSend(context, options); return _renamedTwoDeserialize(result); @@ -47,7 +47,7 @@ export async function renamedTwo( export function _renamedFourSend( context: Client, - options: RenamedFourOptions = { requestOptions: {} }, + options: RenamedFourOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/four") @@ -66,7 +66,7 @@ export async function _renamedFourDeserialize( export async function renamedFour( context: Client, - options: RenamedFourOptions = { requestOptions: {} }, + options: RenamedFourOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedFourSend(context, options); return _renamedFourDeserialize(result); @@ -74,7 +74,7 @@ export async function renamedFour( export function _renamedSixSend( context: Client, - options: RenamedSixOptions = { requestOptions: {} }, + options: RenamedSixOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/six") @@ -93,7 +93,7 @@ export async function _renamedSixDeserialize( export async function renamedSix( context: Client, - options: RenamedSixOptions = { requestOptions: {} }, + options: RenamedSixOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedSixSend(context, options); return _renamedSixDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/BClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/bClient.ts similarity index 65% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/BClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/bClient.ts index 059a5c26af..6abd6b4bf8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/BClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/bClient.ts @@ -4,9 +4,9 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { ClientType } from "./models/models.js"; import { - RenamedTwoOptions, - RenamedFourOptions, - RenamedSixOptions, + RenamedTwoOptionalParams, + RenamedFourOptionalParams, + RenamedSixOptionalParams, } from "./models/options.js"; import { createB, @@ -17,7 +17,7 @@ import { renamedSix, } from "./api/index.js"; -export { BClientOptions } from "./api/BContext.js"; +export { BClientOptions } from "./api/bContext.js"; export class BClient { private _client: ServiceContext; @@ -25,28 +25,28 @@ export class BClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: BClientOptions = {}, ) { - this._client = createB(endpoint, client, options); + this._client = createB(endpointParam, clientParam, options); this.pipeline = this._client.pipeline; } renamedTwo( - options: RenamedTwoOptions = { requestOptions: {} }, + options: RenamedTwoOptionalParams = { requestOptions: {} }, ): Promise { return renamedTwo(this._client, options); } renamedFour( - options: RenamedFourOptions = { requestOptions: {} }, + options: RenamedFourOptionalParams = { requestOptions: {} }, ): Promise { return renamedFour(this._client, options); } renamedSix( - options: RenamedSixOptions = { requestOptions: {} }, + options: RenamedSixOptionalParams = { requestOptions: {} }, ): Promise { return renamedSix(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/index.ts index 2307dd9fb6..62f890eab9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/index.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { BClient, BClientOptions } from "./BClient.js"; +export { BClient, BClientOptions } from "./bClient.js"; export { ClientType, - RenamedTwoOptions, - RenamedFourOptions, - RenamedSixOptions, + RenamedTwoOptionalParams, + RenamedFourOptionalParams, + RenamedSixOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/index.ts index 2dbde38f3e..a3f9bda17d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/index.ts @@ -3,7 +3,7 @@ export { ClientType } from "./models.js"; export { - RenamedTwoOptions, - RenamedFourOptions, - RenamedSixOptions, + RenamedTwoOptionalParams, + RenamedFourOptionalParams, + RenamedSixOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/models.ts index 1a325de7a1..67064de802 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/models.ts @@ -1,5 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** "default", "multi-client", "renamed-operation", "two-operation-group" */ -export type ClientType = string; +/** */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/options.ts index e8c6b50d92..d240bc1fc5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/b/models/options.ts @@ -3,8 +3,8 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface RenamedTwoOptions extends OperationOptions {} +export interface RenamedTwoOptionalParams extends OperationOptions {} -export interface RenamedFourOptions extends OperationOptions {} +export interface RenamedFourOptionalParams extends OperationOptions {} -export interface RenamedSixOptions extends OperationOptions {} +export interface RenamedSixOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/index.ts index dc226697cb..7225607fec 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/index.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { AClient, AClientOptions } from "./a/AClient.js"; +export { AClient, AClientOptions } from "./a/aClient.js"; export { ClientType, - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "./a/models/index.js"; -export { BClient, BClientOptions } from "./b/BClient.js"; +export { BClient, BClientOptions } from "./b/bClient.js"; export { ClientType as BClientClientType, - RenamedTwoOptions, - RenamedFourOptions, - RenamedSixOptions, + RenamedTwoOptionalParams, + RenamedFourOptionalParams, + RenamedSixOptionalParams, } from "./b/models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/serviceClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/serviceClient.ts index 0483dfb5a1..ee6a76961b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/serviceClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/rest/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "../logger.js"; import { ServiceContext } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceContext` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceContext { const endpointUrl = diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/package.json b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/package.json index 417775297b..aa7bd4ca6d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/package.json @@ -90,11 +90,11 @@ "@types/node": "^18.0.0", "dotenv": "^16.0.0", "eslint": "^8.0.0", - "mkdirp": "^2.1.2", + "mkdirp": "^3.0.1", "prettier": "^2.5.1", "rimraf": "^5.0.0", "source-map-support": "^0.5.9", - "typescript": "~5.3.3", + "typescript": "~5.4.5", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/group/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/group/index.ts index 1d263acedb..9e98452f9a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/group/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/group/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - GroupRenamedTwoOptions, - GroupRenamedFourOptions, - GroupRenamedSixOptions, + GroupRenamedTwoOptionalParams, + GroupRenamedFourOptionalParams, + GroupRenamedSixOptionalParams, } from "../../models/options.js"; export function _renamedTwoSend( context: Client, - options: GroupRenamedTwoOptions = { requestOptions: {} }, + options: GroupRenamedTwoOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/two") @@ -39,7 +39,7 @@ export async function _renamedTwoDeserialize( export async function renamedTwo( context: Client, - options: GroupRenamedTwoOptions = { requestOptions: {} }, + options: GroupRenamedTwoOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedTwoSend(context, options); return _renamedTwoDeserialize(result); @@ -47,7 +47,7 @@ export async function renamedTwo( export function _renamedFourSend( context: Client, - options: GroupRenamedFourOptions = { requestOptions: {} }, + options: GroupRenamedFourOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/four") @@ -66,7 +66,7 @@ export async function _renamedFourDeserialize( export async function renamedFour( context: Client, - options: GroupRenamedFourOptions = { requestOptions: {} }, + options: GroupRenamedFourOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedFourSend(context, options); return _renamedFourDeserialize(result); @@ -74,7 +74,7 @@ export async function renamedFour( export function _renamedSixSend( context: Client, - options: GroupRenamedSixOptions = { requestOptions: {} }, + options: GroupRenamedSixOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/six") @@ -93,7 +93,7 @@ export async function _renamedSixDeserialize( export async function renamedSix( context: Client, - options: GroupRenamedSixOptions = { requestOptions: {} }, + options: GroupRenamedSixOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedSixSend(context, options); return _renamedSixDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/index.ts index a2ca4b15a4..a631656c89 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/index.ts @@ -6,4 +6,4 @@ export { createRenamedOperation, RenamedOperationClientOptions, ServiceContext, -} from "./RenamedOperationContext.js"; +} from "./renamedOperationContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/operations.ts index 56ce0076ae..1cccc2932e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/operations.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "../models/options.js"; export function _renamedOneSend( context: Client, - options: RenamedOneOptions = { requestOptions: {} }, + options: RenamedOneOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/one") @@ -39,7 +39,7 @@ export async function _renamedOneDeserialize( export async function renamedOne( context: Client, - options: RenamedOneOptions = { requestOptions: {} }, + options: RenamedOneOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedOneSend(context, options); return _renamedOneDeserialize(result); @@ -47,7 +47,7 @@ export async function renamedOne( export function _renamedThreeSend( context: Client, - options: RenamedThreeOptions = { requestOptions: {} }, + options: RenamedThreeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/three") @@ -66,7 +66,7 @@ export async function _renamedThreeDeserialize( export async function renamedThree( context: Client, - options: RenamedThreeOptions = { requestOptions: {} }, + options: RenamedThreeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedThreeSend(context, options); return _renamedThreeDeserialize(result); @@ -74,7 +74,7 @@ export async function renamedThree( export function _renamedFiveSend( context: Client, - options: RenamedFiveOptions = { requestOptions: {} }, + options: RenamedFiveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/five") @@ -93,7 +93,7 @@ export async function _renamedFiveDeserialize( export async function renamedFive( context: Client, - options: RenamedFiveOptions = { requestOptions: {} }, + options: RenamedFiveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _renamedFiveSend(context, options); return _renamedFiveDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/RenamedOperationContext.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/renamedOperationContext.ts similarity index 81% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/RenamedOperationContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/renamedOperationContext.ts index a8161caf44..0b29f3f7a1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/RenamedOperationContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/api/renamedOperationContext.ts @@ -11,10 +11,10 @@ export interface RenamedOperationClientOptions extends ClientOptions {} export { ServiceContext } from "../rest/index.js"; export function createRenamedOperation( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: RenamedOperationClientOptions = {}, ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/classic/group/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/classic/group/index.ts index 7991c15fee..b83d102a40 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/classic/group/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/classic/group/index.ts @@ -1,27 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/RenamedOperationContext.js"; +import { ServiceContext } from "../../api/renamedOperationContext.js"; import { renamedTwo, renamedFour, renamedSix } from "../../api/group/index.js"; import { - GroupRenamedTwoOptions, - GroupRenamedFourOptions, - GroupRenamedSixOptions, + GroupRenamedTwoOptionalParams, + GroupRenamedFourOptionalParams, + GroupRenamedSixOptionalParams, } from "../../models/options.js"; export interface GroupOperations { - renamedTwo: (options?: GroupRenamedTwoOptions) => Promise; - renamedFour: (options?: GroupRenamedFourOptions) => Promise; - renamedSix: (options?: GroupRenamedSixOptions) => Promise; + renamedTwo: (options?: GroupRenamedTwoOptionalParams) => Promise; + renamedFour: (options?: GroupRenamedFourOptionalParams) => Promise; + renamedSix: (options?: GroupRenamedSixOptionalParams) => Promise; } export function getGroup(context: ServiceContext) { return { - renamedTwo: (options?: GroupRenamedTwoOptions) => + renamedTwo: (options?: GroupRenamedTwoOptionalParams) => renamedTwo(context, options), - renamedFour: (options?: GroupRenamedFourOptions) => + renamedFour: (options?: GroupRenamedFourOptionalParams) => renamedFour(context, options), - renamedSix: (options?: GroupRenamedSixOptions) => + renamedSix: (options?: GroupRenamedSixOptionalParams) => renamedSix(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/index.ts index 15d1a82343..5dffbc9658 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/index.ts @@ -4,14 +4,14 @@ export { RenamedOperationClient, RenamedOperationClientOptions, -} from "./RenamedOperationClient.js"; +} from "./renamedOperationClient.js"; export { ClientType, - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, - GroupRenamedTwoOptions, - GroupRenamedFourOptions, - GroupRenamedSixOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, + GroupRenamedTwoOptionalParams, + GroupRenamedFourOptionalParams, + GroupRenamedSixOptionalParams, } from "./models/index.js"; export { GroupOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/index.ts index 431af85fdc..785bdb206c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/index.ts @@ -3,10 +3,10 @@ export { ClientType } from "./models.js"; export { - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, - GroupRenamedTwoOptions, - GroupRenamedFourOptions, - GroupRenamedSixOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, + GroupRenamedTwoOptionalParams, + GroupRenamedFourOptionalParams, + GroupRenamedSixOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/models.ts index 1a325de7a1..67064de802 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/models.ts @@ -1,5 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** "default", "multi-client", "renamed-operation", "two-operation-group" */ -export type ClientType = string; +/** */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/options.ts index 72ef964590..2d24ba9432 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/models/options.ts @@ -3,14 +3,14 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface RenamedOneOptions extends OperationOptions {} +export interface RenamedOneOptionalParams extends OperationOptions {} -export interface RenamedThreeOptions extends OperationOptions {} +export interface RenamedThreeOptionalParams extends OperationOptions {} -export interface RenamedFiveOptions extends OperationOptions {} +export interface RenamedFiveOptionalParams extends OperationOptions {} -export interface GroupRenamedTwoOptions extends OperationOptions {} +export interface GroupRenamedTwoOptionalParams extends OperationOptions {} -export interface GroupRenamedFourOptions extends OperationOptions {} +export interface GroupRenamedFourOptionalParams extends OperationOptions {} -export interface GroupRenamedSixOptions extends OperationOptions {} +export interface GroupRenamedSixOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/RenamedOperationClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/renamedOperationClient.ts similarity index 70% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/RenamedOperationClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/renamedOperationClient.ts index 49320ac750..3341ae5f9d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/RenamedOperationClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/renamedOperationClient.ts @@ -4,9 +4,9 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { ClientType } from "./models/models.js"; import { - RenamedOneOptions, - RenamedThreeOptions, - RenamedFiveOptions, + RenamedOneOptionalParams, + RenamedThreeOptionalParams, + RenamedFiveOptionalParams, } from "./models/options.js"; import { getGroupOperations, GroupOperations } from "./classic/group/index.js"; import { @@ -18,7 +18,7 @@ import { ServiceContext, } from "./api/index.js"; -export { RenamedOperationClientOptions } from "./api/RenamedOperationContext.js"; +export { RenamedOperationClientOptions } from "./api/renamedOperationContext.js"; export class RenamedOperationClient { private _client: ServiceContext; @@ -26,29 +26,29 @@ export class RenamedOperationClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: RenamedOperationClientOptions = {}, ) { - this._client = createRenamedOperation(endpoint, client, options); + this._client = createRenamedOperation(endpointParam, clientParam, options); this.pipeline = this._client.pipeline; this.group = getGroupOperations(this._client); } renamedOne( - options: RenamedOneOptions = { requestOptions: {} }, + options: RenamedOneOptionalParams = { requestOptions: {} }, ): Promise { return renamedOne(this._client, options); } renamedThree( - options: RenamedThreeOptions = { requestOptions: {} }, + options: RenamedThreeOptionalParams = { requestOptions: {} }, ): Promise { return renamedThree(this._client, options); } renamedFive( - options: RenamedFiveOptions = { requestOptions: {} }, + options: RenamedFiveOptionalParams = { requestOptions: {} }, ): Promise { return renamedFive(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/serviceClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/serviceClient.ts index b1f3f4387f..a61c438122 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/serviceClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/rest/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "../logger.js"; import { ServiceContext } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceContext` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceContext { const endpointUrl = diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/package.json b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/package.json index 02afb83868..d0b8bd88ee 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/package.json @@ -26,7 +26,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -39,8 +39,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group1/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group1/index.ts index f0f0fea2fe..196bc84aec 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group1/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group1/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Group1OneOptions, - Group1ThreeOptions, - Group1FourOptions, + Group1OneOptionalParams, + Group1ThreeOptionalParams, + Group1FourOptionalParams, } from "../../models/options.js"; export function _oneSend( context: Client, - options: Group1OneOptions = { requestOptions: {} }, + options: Group1OneOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/one") @@ -37,7 +37,7 @@ export async function _oneDeserialize(result: One204Response): Promise { export async function one( context: Client, - options: Group1OneOptions = { requestOptions: {} }, + options: Group1OneOptionalParams = { requestOptions: {} }, ): Promise { const result = await _oneSend(context, options); return _oneDeserialize(result); @@ -45,7 +45,7 @@ export async function one( export function _threeSend( context: Client, - options: Group1ThreeOptions = { requestOptions: {} }, + options: Group1ThreeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/three") @@ -64,7 +64,7 @@ export async function _threeDeserialize( export async function three( context: Client, - options: Group1ThreeOptions = { requestOptions: {} }, + options: Group1ThreeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _threeSend(context, options); return _threeDeserialize(result); @@ -72,7 +72,7 @@ export async function three( export function _fourSend( context: Client, - options: Group1FourOptions = { requestOptions: {} }, + options: Group1FourOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/four") @@ -89,7 +89,7 @@ export async function _fourDeserialize(result: Four204Response): Promise { export async function four( context: Client, - options: Group1FourOptions = { requestOptions: {} }, + options: Group1FourOptionalParams = { requestOptions: {} }, ): Promise { const result = await _fourSend(context, options); return _fourDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group2/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group2/index.ts index d9eb29a0c0..823f08b89d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group2/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/group2/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Group2TwoOptions, - Group2FiveOptions, - Group2SixOptions, + Group2TwoOptionalParams, + Group2FiveOptionalParams, + Group2SixOptionalParams, } from "../../models/options.js"; export function _twoSend( context: Client, - options: Group2TwoOptions = { requestOptions: {} }, + options: Group2TwoOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/two") @@ -37,7 +37,7 @@ export async function _twoDeserialize(result: Two204Response): Promise { export async function two( context: Client, - options: Group2TwoOptions = { requestOptions: {} }, + options: Group2TwoOptionalParams = { requestOptions: {} }, ): Promise { const result = await _twoSend(context, options); return _twoDeserialize(result); @@ -45,7 +45,7 @@ export async function two( export function _fiveSend( context: Client, - options: Group2FiveOptions = { requestOptions: {} }, + options: Group2FiveOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/five") @@ -62,7 +62,7 @@ export async function _fiveDeserialize(result: Five204Response): Promise { export async function five( context: Client, - options: Group2FiveOptions = { requestOptions: {} }, + options: Group2FiveOptionalParams = { requestOptions: {} }, ): Promise { const result = await _fiveSend(context, options); return _fiveDeserialize(result); @@ -70,7 +70,7 @@ export async function five( export function _sixSend( context: Client, - options: Group2SixOptions = { requestOptions: {} }, + options: Group2SixOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/six") @@ -87,7 +87,7 @@ export async function _sixDeserialize(result: Six204Response): Promise { export async function six( context: Client, - options: Group2SixOptions = { requestOptions: {} }, + options: Group2SixOptionalParams = { requestOptions: {} }, ): Promise { const result = await _sixSend(context, options); return _sixDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/index.ts index 9b41093ea9..e58887f432 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/index.ts @@ -5,4 +5,4 @@ export { createTwoOperationGroup, TwoOperationGroupClientOptions, ServiceContext, -} from "./TwoOperationGroupContext.js"; +} from "./twoOperationGroupContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/TwoOperationGroupContext.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/twoOperationGroupContext.ts similarity index 81% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/TwoOperationGroupContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/twoOperationGroupContext.ts index bb73e6fb22..06683d01f6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/TwoOperationGroupContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/api/twoOperationGroupContext.ts @@ -11,10 +11,10 @@ export interface TwoOperationGroupClientOptions extends ClientOptions {} export { ServiceContext } from "../rest/index.js"; export function createTwoOperationGroup( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: TwoOperationGroupClientOptions = {}, ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group1/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group1/index.ts index a1920276a2..28ab70800c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group1/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group1/index.ts @@ -1,25 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/TwoOperationGroupContext.js"; +import { ServiceContext } from "../../api/twoOperationGroupContext.js"; import { one, three, four } from "../../api/group1/index.js"; import { - Group1OneOptions, - Group1ThreeOptions, - Group1FourOptions, + Group1OneOptionalParams, + Group1ThreeOptionalParams, + Group1FourOptionalParams, } from "../../models/options.js"; export interface Group1Operations { - one: (options?: Group1OneOptions) => Promise; - three: (options?: Group1ThreeOptions) => Promise; - four: (options?: Group1FourOptions) => Promise; + one: (options?: Group1OneOptionalParams) => Promise; + three: (options?: Group1ThreeOptionalParams) => Promise; + four: (options?: Group1FourOptionalParams) => Promise; } export function getGroup1(context: ServiceContext) { return { - one: (options?: Group1OneOptions) => one(context, options), - three: (options?: Group1ThreeOptions) => three(context, options), - four: (options?: Group1FourOptions) => four(context, options), + one: (options?: Group1OneOptionalParams) => one(context, options), + three: (options?: Group1ThreeOptionalParams) => three(context, options), + four: (options?: Group1FourOptionalParams) => four(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group2/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group2/index.ts index 132062c81c..3d813531ec 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group2/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/classic/group2/index.ts @@ -1,25 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ServiceContext } from "../../api/TwoOperationGroupContext.js"; +import { ServiceContext } from "../../api/twoOperationGroupContext.js"; import { two, five, six } from "../../api/group2/index.js"; import { - Group2TwoOptions, - Group2FiveOptions, - Group2SixOptions, + Group2TwoOptionalParams, + Group2FiveOptionalParams, + Group2SixOptionalParams, } from "../../models/options.js"; export interface Group2Operations { - two: (options?: Group2TwoOptions) => Promise; - five: (options?: Group2FiveOptions) => Promise; - six: (options?: Group2SixOptions) => Promise; + two: (options?: Group2TwoOptionalParams) => Promise; + five: (options?: Group2FiveOptionalParams) => Promise; + six: (options?: Group2SixOptionalParams) => Promise; } export function getGroup2(context: ServiceContext) { return { - two: (options?: Group2TwoOptions) => two(context, options), - five: (options?: Group2FiveOptions) => five(context, options), - six: (options?: Group2SixOptions) => six(context, options), + two: (options?: Group2TwoOptionalParams) => two(context, options), + five: (options?: Group2FiveOptionalParams) => five(context, options), + six: (options?: Group2SixOptionalParams) => six(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/index.ts index eec426c3ba..83b1463fe1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/index.ts @@ -4,14 +4,14 @@ export { TwoOperationGroupClient, TwoOperationGroupClientOptions, -} from "./TwoOperationGroupClient.js"; +} from "./twoOperationGroupClient.js"; export { ClientType, - Group1OneOptions, - Group1ThreeOptions, - Group1FourOptions, - Group2TwoOptions, - Group2FiveOptions, - Group2SixOptions, + Group1OneOptionalParams, + Group1ThreeOptionalParams, + Group1FourOptionalParams, + Group2TwoOptionalParams, + Group2FiveOptionalParams, + Group2SixOptionalParams, } from "./models/index.js"; export { Group1Operations, Group2Operations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/index.ts index 24827c0b84..7ec0ee2bd5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/index.ts @@ -3,10 +3,10 @@ export { ClientType } from "./models.js"; export { - Group1OneOptions, - Group1ThreeOptions, - Group1FourOptions, - Group2TwoOptions, - Group2FiveOptions, - Group2SixOptions, + Group1OneOptionalParams, + Group1ThreeOptionalParams, + Group1FourOptionalParams, + Group2TwoOptionalParams, + Group2FiveOptionalParams, + Group2SixOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/models.ts index 1a325de7a1..67064de802 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/models.ts @@ -1,5 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -/** "default", "multi-client", "renamed-operation", "two-operation-group" */ -export type ClientType = string; +/** */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/options.ts index 99493095b2..0bc0165810 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/models/options.ts @@ -3,14 +3,14 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface Group1OneOptions extends OperationOptions {} +export interface Group1OneOptionalParams extends OperationOptions {} -export interface Group1ThreeOptions extends OperationOptions {} +export interface Group1ThreeOptionalParams extends OperationOptions {} -export interface Group1FourOptions extends OperationOptions {} +export interface Group1FourOptionalParams extends OperationOptions {} -export interface Group2TwoOptions extends OperationOptions {} +export interface Group2TwoOptionalParams extends OperationOptions {} -export interface Group2FiveOptions extends OperationOptions {} +export interface Group2FiveOptionalParams extends OperationOptions {} -export interface Group2SixOptions extends OperationOptions {} +export interface Group2SixOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/index.ts index 8e5dfea2bf..9bc01f35e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/index.ts @@ -7,5 +7,6 @@ export * from "./serviceClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default ServiceClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/models.ts new file mode 100644 index 0000000000..3be02bcc7c --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/models.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for ClientType */ +export type ClientType = + | "default" + | "multi-client" + | "renamed-operation" + | "two-operation-group"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/serviceClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/serviceClient.ts index 630c496afd..bc2cc24846 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/serviceClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/rest/serviceClient.ts @@ -4,16 +4,17 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "../logger.js"; import { ServiceContext } from "./clientDefinitions.js"; +import { ClientType } from "./models.js"; /** * Initialize a new instance of `ServiceContext` * @param endpointParam - Need to be set as 'http://localhost:3000' in client. - * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. Possible values: "default", "multi-client", "renamed-operation", "two-operation-group" + * @param clientParam - Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - clientParam: string, + clientParam: ClientType, options: ClientOptions = {}, ): ServiceContext { const endpointUrl = diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/TwoOperationGroupClient.ts b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/twoOperationGroupClient.ts similarity index 84% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/TwoOperationGroupClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/twoOperationGroupClient.ts index e7f4b5ec79..290fe505ae 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/TwoOperationGroupClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/twoOperationGroupClient.ts @@ -17,7 +17,7 @@ import { ServiceContext, } from "./api/index.js"; -export { TwoOperationGroupClientOptions } from "./api/TwoOperationGroupContext.js"; +export { TwoOperationGroupClientOptions } from "./api/twoOperationGroupContext.js"; export class TwoOperationGroupClient { private _client: ServiceContext; @@ -25,11 +25,11 @@ export class TwoOperationGroupClient { public readonly pipeline: Pipeline; constructor( - endpoint: string, - client: ClientType, + endpointParam: string, + clientParam: ClientType, options: TwoOperationGroupClientOptions = {}, ) { - this._client = createTwoOperationGroup(endpoint, client, options); + this._client = createTwoOperationGroup(endpointParam, clientParam, options); this.pipeline = this._client.pipeline; this.group1 = getGroup1Operations(this._client); this.group2 = getGroup2Operations(this._client); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/BytesContext.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/bytesContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/BytesContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/bytesContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/header/index.ts index 72aacbe301..a9a28a3cae 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/header/index.ts @@ -16,16 +16,16 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - HeaderDefaultOptions, - HeaderBase64Options, - HeaderBase64urlOptions, - HeaderBase64urlArrayOptions, + HeaderDefaultOptionalParams, + HeaderBase64OptionalParams, + HeaderBase64urlOptionalParams, + HeaderBase64urlArrayOptionalParams, } from "../../models/options.js"; export function _headerDefaultSend( context: Client, value: Uint8Array, - options: HeaderDefaultOptions = { requestOptions: {} }, + options: HeaderDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/header/default") @@ -48,7 +48,7 @@ export async function _headerDefaultDeserialize( export async function headerDefault( context: Client, value: Uint8Array, - options: HeaderDefaultOptions = { requestOptions: {} }, + options: HeaderDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerDefaultSend(context, value, options); return _headerDefaultDeserialize(result); @@ -57,7 +57,7 @@ export async function headerDefault( export function _headerBase64Send( context: Client, value: Uint8Array, - options: HeaderBase64Options = { requestOptions: {} }, + options: HeaderBase64OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/header/base64") @@ -80,7 +80,7 @@ export async function _headerBase64Deserialize( export async function headerBase64( context: Client, value: Uint8Array, - options: HeaderBase64Options = { requestOptions: {} }, + options: HeaderBase64OptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerBase64Send(context, value, options); return _headerBase64Deserialize(result); @@ -89,7 +89,7 @@ export async function headerBase64( export function _headerBase64urlSend( context: Client, value: Uint8Array, - options: HeaderBase64urlOptions = { requestOptions: {} }, + options: HeaderBase64urlOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/header/base64url") @@ -112,7 +112,7 @@ export async function _headerBase64urlDeserialize( export async function headerBase64url( context: Client, value: Uint8Array, - options: HeaderBase64urlOptions = { requestOptions: {} }, + options: HeaderBase64urlOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerBase64urlSend(context, value, options); return _headerBase64urlDeserialize(result); @@ -121,7 +121,7 @@ export async function headerBase64url( export function _headerBase64urlArraySend( context: Client, value: Uint8Array[], - options: HeaderBase64urlArrayOptions = { requestOptions: {} }, + options: HeaderBase64urlArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/header/base64url-array") @@ -148,7 +148,7 @@ export async function _headerBase64urlArrayDeserialize( export async function headerBase64urlArray( context: Client, value: Uint8Array[], - options: HeaderBase64urlArrayOptions = { requestOptions: {} }, + options: HeaderBase64urlArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerBase64urlArraySend(context, value, options); return _headerBase64urlArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/index.ts index e7548589f1..9a539c5321 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/index.ts @@ -5,7 +5,7 @@ export { createBytes, BytesClientOptions, BytesContext, -} from "./BytesContext.js"; +} from "./bytesContext.js"; export { headerDefault, headerBase64, diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/property/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/property/index.ts index 78e76d268e..5e6ce6fcea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/property/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/property/index.ts @@ -21,16 +21,16 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util"; import { - PropertyDefaultOptions, - PropertyBase64Options, - PropertyBase64urlOptions, - PropertyBase64urlArrayOptions, + PropertyDefaultOptionalParams, + PropertyBase64OptionalParams, + PropertyBase64urlOptionalParams, + PropertyBase64urlArrayOptionalParams, } from "../../models/options.js"; export function _propertyDefaultSend( context: Client, body: DefaultBytesProperty, - options: PropertyDefaultOptions = { requestOptions: {} }, + options: PropertyDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/property/default") @@ -58,7 +58,7 @@ export async function _propertyDefaultDeserialize( export async function propertyDefault( context: Client, body: DefaultBytesProperty, - options: PropertyDefaultOptions = { requestOptions: {} }, + options: PropertyDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyDefaultSend(context, body, options); return _propertyDefaultDeserialize(result); @@ -67,7 +67,7 @@ export async function propertyDefault( export function _propertyBase64Send( context: Client, body: Base64BytesProperty, - options: PropertyBase64Options = { requestOptions: {} }, + options: PropertyBase64OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/property/base64") @@ -95,7 +95,7 @@ export async function _propertyBase64Deserialize( export async function propertyBase64( context: Client, body: Base64BytesProperty, - options: PropertyBase64Options = { requestOptions: {} }, + options: PropertyBase64OptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyBase64Send(context, body, options); return _propertyBase64Deserialize(result); @@ -104,7 +104,7 @@ export async function propertyBase64( export function _propertyBase64urlSend( context: Client, body: Base64urlBytesProperty, - options: PropertyBase64urlOptions = { requestOptions: {} }, + options: PropertyBase64urlOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/property/base64url") @@ -132,7 +132,7 @@ export async function _propertyBase64urlDeserialize( export async function propertyBase64url( context: Client, body: Base64urlBytesProperty, - options: PropertyBase64urlOptions = { requestOptions: {} }, + options: PropertyBase64urlOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyBase64urlSend(context, body, options); return _propertyBase64urlDeserialize(result); @@ -141,7 +141,7 @@ export async function propertyBase64url( export function _propertyBase64urlArraySend( context: Client, body: Base64urlArrayBytesProperty, - options: PropertyBase64urlArrayOptions = { requestOptions: {} }, + options: PropertyBase64urlArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/property/base64url-array") @@ -170,7 +170,7 @@ export async function _propertyBase64urlArrayDeserialize( export async function propertyBase64urlArray( context: Client, body: Base64urlArrayBytesProperty, - options: PropertyBase64urlArrayOptions = { requestOptions: {} }, + options: PropertyBase64urlArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyBase64urlArraySend(context, body, options); return _propertyBase64urlArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/query/index.ts index bcdd0e60d6..02c4957b90 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/query/index.ts @@ -15,16 +15,16 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - QueryDefaultOptions, - QueryBase64Options, - QueryBase64urlOptions, - QueryBase64urlArrayOptions, + QueryDefaultOptionalParams, + QueryBase64OptionalParams, + QueryBase64urlOptionalParams, + QueryBase64urlArrayOptionalParams, } from "../../models/options.js"; export function _queryDefaultSend( context: Client, value: Uint8Array, - options: QueryDefaultOptions = { requestOptions: {} }, + options: QueryDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/query/default") @@ -47,7 +47,7 @@ export async function _queryDefaultDeserialize( export async function queryDefault( context: Client, value: Uint8Array, - options: QueryDefaultOptions = { requestOptions: {} }, + options: QueryDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryDefaultSend(context, value, options); return _queryDefaultDeserialize(result); @@ -56,7 +56,7 @@ export async function queryDefault( export function _queryBase64Send( context: Client, value: Uint8Array, - options: QueryBase64Options = { requestOptions: {} }, + options: QueryBase64OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/query/base64") @@ -79,7 +79,7 @@ export async function _queryBase64Deserialize( export async function queryBase64( context: Client, value: Uint8Array, - options: QueryBase64Options = { requestOptions: {} }, + options: QueryBase64OptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryBase64Send(context, value, options); return _queryBase64Deserialize(result); @@ -88,7 +88,7 @@ export async function queryBase64( export function _queryBase64urlSend( context: Client, value: Uint8Array, - options: QueryBase64urlOptions = { requestOptions: {} }, + options: QueryBase64urlOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/query/base64url") @@ -111,7 +111,7 @@ export async function _queryBase64urlDeserialize( export async function queryBase64url( context: Client, value: Uint8Array, - options: QueryBase64urlOptions = { requestOptions: {} }, + options: QueryBase64urlOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryBase64urlSend(context, value, options); return _queryBase64urlDeserialize(result); @@ -120,7 +120,7 @@ export async function queryBase64url( export function _queryBase64urlArraySend( context: Client, value: Uint8Array[], - options: QueryBase64urlArrayOptions = { requestOptions: {} }, + options: QueryBase64urlArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/query/base64url-array") @@ -145,7 +145,7 @@ export async function _queryBase64urlArrayDeserialize( export async function queryBase64urlArray( context: Client, value: Uint8Array[], - options: QueryBase64urlArrayOptions = { requestOptions: {} }, + options: QueryBase64urlArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryBase64urlArraySend(context, value, options); return _queryBase64urlArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/requestBody/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/requestBody/index.ts index 3f957aee55..3d74be4a2f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/requestBody/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/requestBody/index.ts @@ -16,17 +16,17 @@ import { } from "@azure-rest/core-client"; import { uint8ArrayToString } from "@azure/core-util"; import { - RequestBodyDefaultOptions, - RequestBodyOctetStreamOptions, - RequestBodyCustomContentTypeOptions, - RequestBodyBase64Options, - RequestBodyBase64urlOptions, + RequestBodyDefaultOptionalParams, + RequestBodyOctetStreamOptionalParams, + RequestBodyCustomContentTypeOptionalParams, + RequestBodyBase64OptionalParams, + RequestBodyBase64urlOptionalParams, } from "../../models/options.js"; export function _requestBodyDefaultSend( context: Client, value: Uint8Array, - options: RequestBodyDefaultOptions = { requestOptions: {} }, + options: RequestBodyDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/request/default") @@ -49,7 +49,7 @@ export async function _requestBodyDefaultDeserialize( export async function requestBodyDefault( context: Client, value: Uint8Array, - options: RequestBodyDefaultOptions = { requestOptions: {} }, + options: RequestBodyDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requestBodyDefaultSend(context, value, options); return _requestBodyDefaultDeserialize(result); @@ -58,7 +58,7 @@ export async function requestBodyDefault( export function _requestBodyOctetStreamSend( context: Client, value: Uint8Array, - options: RequestBodyOctetStreamOptions = { requestOptions: {} }, + options: RequestBodyOctetStreamOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/request/octet-stream") @@ -82,7 +82,7 @@ export async function _requestBodyOctetStreamDeserialize( export async function requestBodyOctetStream( context: Client, value: Uint8Array, - options: RequestBodyOctetStreamOptions = { requestOptions: {} }, + options: RequestBodyOctetStreamOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requestBodyOctetStreamSend(context, value, options); return _requestBodyOctetStreamDeserialize(result); @@ -91,7 +91,7 @@ export async function requestBodyOctetStream( export function _requestBodyCustomContentTypeSend( context: Client, value: Uint8Array, - options: RequestBodyCustomContentTypeOptions = { requestOptions: {} }, + options: RequestBodyCustomContentTypeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/request/custom-content-type") @@ -115,7 +115,7 @@ export async function _requestBodyCustomContentTypeDeserialize( export async function requestBodyCustomContentType( context: Client, value: Uint8Array, - options: RequestBodyCustomContentTypeOptions = { requestOptions: {} }, + options: RequestBodyCustomContentTypeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requestBodyCustomContentTypeSend( context, @@ -128,7 +128,7 @@ export async function requestBodyCustomContentType( export function _requestBodyBase64Send( context: Client, value: Uint8Array, - options: RequestBodyBase64Options = { requestOptions: {} }, + options: RequestBodyBase64OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/request/base64") @@ -151,7 +151,7 @@ export async function _requestBodyBase64Deserialize( export async function requestBodyBase64( context: Client, value: Uint8Array, - options: RequestBodyBase64Options = { requestOptions: {} }, + options: RequestBodyBase64OptionalParams = { requestOptions: {} }, ): Promise { const result = await _requestBodyBase64Send(context, value, options); return _requestBodyBase64Deserialize(result); @@ -160,13 +160,13 @@ export async function requestBodyBase64( export function _requestBodyBase64urlSend( context: Client, value: Uint8Array, - options: RequestBodyBase64urlOptions = { requestOptions: {} }, + options: RequestBodyBase64urlOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/request/base64url") .post({ ...operationOptionsToRequestParameters(options), - body: uint8ArrayToString(value, "base64"), + body: uint8ArrayToString(value, "base64url"), }); } @@ -183,7 +183,7 @@ export async function _requestBodyBase64urlDeserialize( export async function requestBodyBase64url( context: Client, value: Uint8Array, - options: RequestBodyBase64urlOptions = { requestOptions: {} }, + options: RequestBodyBase64urlOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requestBodyBase64urlSend(context, value, options); return _requestBodyBase64urlDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/responseBody/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/responseBody/index.ts index 9932b8d6c6..00b8396c41 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/responseBody/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/api/responseBody/index.ts @@ -16,16 +16,16 @@ import { } from "@azure-rest/core-client"; import { stringToUint8Array } from "@azure/core-util"; import { - ResponseBodyDefaultOptions, - ResponseBodyOctetStreamOptions, - ResponseBodyCustomContentTypeOptions, - ResponseBodyBase64Options, - ResponseBodyBase64urlOptions, + ResponseBodyDefaultOptionalParams, + ResponseBodyOctetStreamOptionalParams, + ResponseBodyCustomContentTypeOptionalParams, + ResponseBodyBase64OptionalParams, + ResponseBodyBase64urlOptionalParams, } from "../../models/options.js"; export function _responseBodyDefaultSend( context: Client, - options: ResponseBodyDefaultOptions = { requestOptions: {} }, + options: ResponseBodyDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/response/default") @@ -46,7 +46,7 @@ export async function _responseBodyDefaultDeserialize( export async function responseBodyDefault( context: Client, - options: ResponseBodyDefaultOptions = { requestOptions: {} }, + options: ResponseBodyDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseBodyDefaultSend(context, options); return _responseBodyDefaultDeserialize(result); @@ -54,7 +54,7 @@ export async function responseBodyDefault( export function _responseBodyOctetStreamSend( context: Client, - options: ResponseBodyOctetStreamOptions = { requestOptions: {} }, + options: ResponseBodyOctetStreamOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/response/octet-stream") @@ -73,7 +73,7 @@ export async function _responseBodyOctetStreamDeserialize( export async function responseBodyOctetStream( context: Client, - options: ResponseBodyOctetStreamOptions = { requestOptions: {} }, + options: ResponseBodyOctetStreamOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseBodyOctetStreamSend(context, options); return _responseBodyOctetStreamDeserialize(result); @@ -81,7 +81,7 @@ export async function responseBodyOctetStream( export function _responseBodyCustomContentTypeSend( context: Client, - options: ResponseBodyCustomContentTypeOptions = { requestOptions: {} }, + options: ResponseBodyCustomContentTypeOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/response/custom-content-type") @@ -100,7 +100,7 @@ export async function _responseBodyCustomContentTypeDeserialize( export async function responseBodyCustomContentType( context: Client, - options: ResponseBodyCustomContentTypeOptions = { requestOptions: {} }, + options: ResponseBodyCustomContentTypeOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseBodyCustomContentTypeSend(context, options); return _responseBodyCustomContentTypeDeserialize(result); @@ -108,7 +108,7 @@ export async function responseBodyCustomContentType( export function _responseBodyBase64Send( context: Client, - options: ResponseBodyBase64Options = { requestOptions: {} }, + options: ResponseBodyBase64OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/response/base64") @@ -129,7 +129,7 @@ export async function _responseBodyBase64Deserialize( export async function responseBodyBase64( context: Client, - options: ResponseBodyBase64Options = { requestOptions: {} }, + options: ResponseBodyBase64OptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseBodyBase64Send(context, options); return _responseBodyBase64Deserialize(result); @@ -137,7 +137,7 @@ export async function responseBodyBase64( export function _responseBodyBase64urlSend( context: Client, - options: ResponseBodyBase64urlOptions = { requestOptions: {} }, + options: ResponseBodyBase64urlOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/bytes/body/response/base64url") @@ -158,7 +158,7 @@ export async function _responseBodyBase64urlDeserialize( export async function responseBodyBase64url( context: Client, - options: ResponseBodyBase64urlOptions = { requestOptions: {} }, + options: ResponseBodyBase64urlOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseBodyBase64urlSend(context, options); return _responseBodyBase64urlDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/BytesClient.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/bytesClient.ts similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/BytesClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/bytesClient.ts index 168fa57f92..155927e66e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/BytesClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/bytesClient.ts @@ -21,7 +21,7 @@ import { } from "./classic/responseBody/index.js"; import { createBytes, BytesClientOptions, BytesContext } from "./api/index.js"; -export { BytesClientOptions } from "./api/BytesContext.js"; +export { BytesClientOptions } from "./api/bytesContext.js"; export class BytesClient { private _client: BytesContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/header/index.ts index b39eba4834..cb48545c08 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/header/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { BytesContext } from "../../api/BytesContext.js"; +import { BytesContext } from "../../api/bytesContext.js"; import { headerDefault, headerBase64, @@ -9,36 +9,42 @@ import { headerBase64urlArray, } from "../../api/header/index.js"; import { - HeaderDefaultOptions, - HeaderBase64Options, - HeaderBase64urlOptions, - HeaderBase64urlArrayOptions, + HeaderDefaultOptionalParams, + HeaderBase64OptionalParams, + HeaderBase64urlOptionalParams, + HeaderBase64urlArrayOptionalParams, } from "../../models/options.js"; export interface HeaderOperations { - default: (value: Uint8Array, options?: HeaderDefaultOptions) => Promise; - base64: (value: Uint8Array, options?: HeaderBase64Options) => Promise; + default: ( + value: Uint8Array, + options?: HeaderDefaultOptionalParams, + ) => Promise; + base64: ( + value: Uint8Array, + options?: HeaderBase64OptionalParams, + ) => Promise; base64url: ( value: Uint8Array, - options?: HeaderBase64urlOptions, + options?: HeaderBase64urlOptionalParams, ) => Promise; base64urlArray: ( value: Uint8Array[], - options?: HeaderBase64urlArrayOptions, + options?: HeaderBase64urlArrayOptionalParams, ) => Promise; } export function getHeader(context: BytesContext) { return { - default: (value: Uint8Array, options?: HeaderDefaultOptions) => + default: (value: Uint8Array, options?: HeaderDefaultOptionalParams) => headerDefault(context, value, options), - base64: (value: Uint8Array, options?: HeaderBase64Options) => + base64: (value: Uint8Array, options?: HeaderBase64OptionalParams) => headerBase64(context, value, options), - base64url: (value: Uint8Array, options?: HeaderBase64urlOptions) => + base64url: (value: Uint8Array, options?: HeaderBase64urlOptionalParams) => headerBase64url(context, value, options), base64urlArray: ( value: Uint8Array[], - options?: HeaderBase64urlArrayOptions, + options?: HeaderBase64urlArrayOptionalParams, ) => headerBase64urlArray(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/property/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/property/index.ts index 6367259864..b074da5658 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/property/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/property/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { BytesContext } from "../../api/BytesContext.js"; +import { BytesContext } from "../../api/bytesContext.js"; import { DefaultBytesProperty, Base64BytesProperty, @@ -15,44 +15,48 @@ import { propertyBase64urlArray, } from "../../api/property/index.js"; import { - PropertyDefaultOptions, - PropertyBase64Options, - PropertyBase64urlOptions, - PropertyBase64urlArrayOptions, + PropertyDefaultOptionalParams, + PropertyBase64OptionalParams, + PropertyBase64urlOptionalParams, + PropertyBase64urlArrayOptionalParams, } from "../../models/options.js"; export interface PropertyOperations { default: ( body: DefaultBytesProperty, - options?: PropertyDefaultOptions, + options?: PropertyDefaultOptionalParams, ) => Promise; base64: ( body: Base64BytesProperty, - options?: PropertyBase64Options, + options?: PropertyBase64OptionalParams, ) => Promise; base64url: ( body: Base64urlBytesProperty, - options?: PropertyBase64urlOptions, + options?: PropertyBase64urlOptionalParams, ) => Promise; base64urlArray: ( body: Base64urlArrayBytesProperty, - options?: PropertyBase64urlArrayOptions, + options?: PropertyBase64urlArrayOptionalParams, ) => Promise; } export function getProperty(context: BytesContext) { return { - default: (body: DefaultBytesProperty, options?: PropertyDefaultOptions) => - propertyDefault(context, body, options), - base64: (body: Base64BytesProperty, options?: PropertyBase64Options) => - propertyBase64(context, body, options), + default: ( + body: DefaultBytesProperty, + options?: PropertyDefaultOptionalParams, + ) => propertyDefault(context, body, options), + base64: ( + body: Base64BytesProperty, + options?: PropertyBase64OptionalParams, + ) => propertyBase64(context, body, options), base64url: ( body: Base64urlBytesProperty, - options?: PropertyBase64urlOptions, + options?: PropertyBase64urlOptionalParams, ) => propertyBase64url(context, body, options), base64urlArray: ( body: Base64urlArrayBytesProperty, - options?: PropertyBase64urlArrayOptions, + options?: PropertyBase64urlArrayOptionalParams, ) => propertyBase64urlArray(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/query/index.ts index 04ec563b86..690659ca21 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/query/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { BytesContext } from "../../api/BytesContext.js"; +import { BytesContext } from "../../api/bytesContext.js"; import { queryDefault, queryBase64, @@ -9,36 +9,42 @@ import { queryBase64urlArray, } from "../../api/query/index.js"; import { - QueryDefaultOptions, - QueryBase64Options, - QueryBase64urlOptions, - QueryBase64urlArrayOptions, + QueryDefaultOptionalParams, + QueryBase64OptionalParams, + QueryBase64urlOptionalParams, + QueryBase64urlArrayOptionalParams, } from "../../models/options.js"; export interface QueryOperations { - default: (value: Uint8Array, options?: QueryDefaultOptions) => Promise; - base64: (value: Uint8Array, options?: QueryBase64Options) => Promise; + default: ( + value: Uint8Array, + options?: QueryDefaultOptionalParams, + ) => Promise; + base64: ( + value: Uint8Array, + options?: QueryBase64OptionalParams, + ) => Promise; base64url: ( value: Uint8Array, - options?: QueryBase64urlOptions, + options?: QueryBase64urlOptionalParams, ) => Promise; base64urlArray: ( value: Uint8Array[], - options?: QueryBase64urlArrayOptions, + options?: QueryBase64urlArrayOptionalParams, ) => Promise; } export function getQuery(context: BytesContext) { return { - default: (value: Uint8Array, options?: QueryDefaultOptions) => + default: (value: Uint8Array, options?: QueryDefaultOptionalParams) => queryDefault(context, value, options), - base64: (value: Uint8Array, options?: QueryBase64Options) => + base64: (value: Uint8Array, options?: QueryBase64OptionalParams) => queryBase64(context, value, options), - base64url: (value: Uint8Array, options?: QueryBase64urlOptions) => + base64url: (value: Uint8Array, options?: QueryBase64urlOptionalParams) => queryBase64url(context, value, options), base64urlArray: ( value: Uint8Array[], - options?: QueryBase64urlArrayOptions, + options?: QueryBase64urlArrayOptionalParams, ) => queryBase64urlArray(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/requestBody/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/requestBody/index.ts index 115685189f..63b4c129a0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/requestBody/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/requestBody/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { BytesContext } from "../../api/BytesContext.js"; +import { BytesContext } from "../../api/bytesContext.js"; import { requestBodyDefault, requestBodyOctetStream, @@ -10,50 +10,54 @@ import { requestBodyBase64url, } from "../../api/requestBody/index.js"; import { - RequestBodyDefaultOptions, - RequestBodyOctetStreamOptions, - RequestBodyCustomContentTypeOptions, - RequestBodyBase64Options, - RequestBodyBase64urlOptions, + RequestBodyDefaultOptionalParams, + RequestBodyOctetStreamOptionalParams, + RequestBodyCustomContentTypeOptionalParams, + RequestBodyBase64OptionalParams, + RequestBodyBase64urlOptionalParams, } from "../../models/options.js"; export interface RequestBodyOperations { default: ( value: Uint8Array, - options?: RequestBodyDefaultOptions, + options?: RequestBodyDefaultOptionalParams, ) => Promise; octetStream: ( value: Uint8Array, - options?: RequestBodyOctetStreamOptions, + options?: RequestBodyOctetStreamOptionalParams, ) => Promise; customContentType: ( value: Uint8Array, - options?: RequestBodyCustomContentTypeOptions, + options?: RequestBodyCustomContentTypeOptionalParams, ) => Promise; base64: ( value: Uint8Array, - options?: RequestBodyBase64Options, + options?: RequestBodyBase64OptionalParams, ) => Promise; base64url: ( value: Uint8Array, - options?: RequestBodyBase64urlOptions, + options?: RequestBodyBase64urlOptionalParams, ) => Promise; } export function getRequestBody(context: BytesContext) { return { - default: (value: Uint8Array, options?: RequestBodyDefaultOptions) => + default: (value: Uint8Array, options?: RequestBodyDefaultOptionalParams) => requestBodyDefault(context, value, options), - octetStream: (value: Uint8Array, options?: RequestBodyOctetStreamOptions) => - requestBodyOctetStream(context, value, options), + octetStream: ( + value: Uint8Array, + options?: RequestBodyOctetStreamOptionalParams, + ) => requestBodyOctetStream(context, value, options), customContentType: ( value: Uint8Array, - options?: RequestBodyCustomContentTypeOptions, + options?: RequestBodyCustomContentTypeOptionalParams, ) => requestBodyCustomContentType(context, value, options), - base64: (value: Uint8Array, options?: RequestBodyBase64Options) => + base64: (value: Uint8Array, options?: RequestBodyBase64OptionalParams) => requestBodyBase64(context, value, options), - base64url: (value: Uint8Array, options?: RequestBodyBase64urlOptions) => - requestBodyBase64url(context, value, options), + base64url: ( + value: Uint8Array, + options?: RequestBodyBase64urlOptionalParams, + ) => requestBodyBase64url(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/responseBody/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/responseBody/index.ts index 60ff66562c..45c6eaddef 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/responseBody/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/classic/responseBody/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { BytesContext } from "../../api/BytesContext.js"; +import { BytesContext } from "../../api/bytesContext.js"; import { responseBodyDefault, responseBodyOctetStream, @@ -10,36 +10,39 @@ import { responseBodyBase64url, } from "../../api/responseBody/index.js"; import { - ResponseBodyDefaultOptions, - ResponseBodyOctetStreamOptions, - ResponseBodyCustomContentTypeOptions, - ResponseBodyBase64Options, - ResponseBodyBase64urlOptions, + ResponseBodyDefaultOptionalParams, + ResponseBodyOctetStreamOptionalParams, + ResponseBodyCustomContentTypeOptionalParams, + ResponseBodyBase64OptionalParams, + ResponseBodyBase64urlOptionalParams, } from "../../models/options.js"; export interface ResponseBodyOperations { - default: (options?: ResponseBodyDefaultOptions) => Promise; + default: (options?: ResponseBodyDefaultOptionalParams) => Promise; octetStream: ( - options?: ResponseBodyOctetStreamOptions, + options?: ResponseBodyOctetStreamOptionalParams, ) => Promise; customContentType: ( - options?: ResponseBodyCustomContentTypeOptions, + options?: ResponseBodyCustomContentTypeOptionalParams, + ) => Promise; + base64: (options?: ResponseBodyBase64OptionalParams) => Promise; + base64url: ( + options?: ResponseBodyBase64urlOptionalParams, ) => Promise; - base64: (options?: ResponseBodyBase64Options) => Promise; - base64url: (options?: ResponseBodyBase64urlOptions) => Promise; } export function getResponseBody(context: BytesContext) { return { - default: (options?: ResponseBodyDefaultOptions) => + default: (options?: ResponseBodyDefaultOptionalParams) => responseBodyDefault(context, options), - octetStream: (options?: ResponseBodyOctetStreamOptions) => + octetStream: (options?: ResponseBodyOctetStreamOptionalParams) => responseBodyOctetStream(context, options), - customContentType: (options?: ResponseBodyCustomContentTypeOptions) => - responseBodyCustomContentType(context, options), - base64: (options?: ResponseBodyBase64Options) => + customContentType: ( + options?: ResponseBodyCustomContentTypeOptionalParams, + ) => responseBodyCustomContentType(context, options), + base64: (options?: ResponseBodyBase64OptionalParams) => responseBodyBase64(context, options), - base64url: (options?: ResponseBodyBase64urlOptions) => + base64url: (options?: ResponseBodyBase64urlOptionalParams) => responseBodyBase64url(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.ts index 092f056311..c45d82414c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { BytesClient, BytesClientOptions } from "./BytesClient.js"; +export { BytesClient, BytesClientOptions } from "./bytesClient.js"; export { DefaultBytesProperty, Base64BytesProperty, Base64urlBytesProperty, Base64urlArrayBytesProperty, - QueryDefaultOptions, - QueryBase64Options, - QueryBase64urlOptions, - QueryBase64urlArrayOptions, - PropertyDefaultOptions, - PropertyBase64Options, - PropertyBase64urlOptions, - PropertyBase64urlArrayOptions, - HeaderDefaultOptions, - HeaderBase64Options, - HeaderBase64urlOptions, - HeaderBase64urlArrayOptions, - RequestBodyDefaultOptions, - RequestBodyOctetStreamOptions, - RequestBodyCustomContentTypeOptions, - RequestBodyBase64Options, - RequestBodyBase64urlOptions, - ResponseBodyDefaultOptions, - ResponseBodyOctetStreamOptions, - ResponseBodyCustomContentTypeOptions, - ResponseBodyBase64Options, - ResponseBodyBase64urlOptions, + QueryDefaultOptionalParams, + QueryBase64OptionalParams, + QueryBase64urlOptionalParams, + QueryBase64urlArrayOptionalParams, + PropertyDefaultOptionalParams, + PropertyBase64OptionalParams, + PropertyBase64urlOptionalParams, + PropertyBase64urlArrayOptionalParams, + HeaderDefaultOptionalParams, + HeaderBase64OptionalParams, + HeaderBase64urlOptionalParams, + HeaderBase64urlArrayOptionalParams, + RequestBodyDefaultOptionalParams, + RequestBodyOctetStreamOptionalParams, + RequestBodyCustomContentTypeOptionalParams, + RequestBodyBase64OptionalParams, + RequestBodyBase64urlOptionalParams, + ResponseBodyDefaultOptionalParams, + ResponseBodyOctetStreamOptionalParams, + ResponseBodyCustomContentTypeOptionalParams, + ResponseBodyBase64OptionalParams, + ResponseBodyBase64urlOptionalParams, } from "./models/index.js"; export { HeaderOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/index.ts index 5cd81e83a0..03d04267a4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/index.ts @@ -8,26 +8,26 @@ export { Base64urlArrayBytesProperty, } from "./models.js"; export { - QueryDefaultOptions, - QueryBase64Options, - QueryBase64urlOptions, - QueryBase64urlArrayOptions, - PropertyDefaultOptions, - PropertyBase64Options, - PropertyBase64urlOptions, - PropertyBase64urlArrayOptions, - HeaderDefaultOptions, - HeaderBase64Options, - HeaderBase64urlOptions, - HeaderBase64urlArrayOptions, - RequestBodyDefaultOptions, - RequestBodyOctetStreamOptions, - RequestBodyCustomContentTypeOptions, - RequestBodyBase64Options, - RequestBodyBase64urlOptions, - ResponseBodyDefaultOptions, - ResponseBodyOctetStreamOptions, - ResponseBodyCustomContentTypeOptions, - ResponseBodyBase64Options, - ResponseBodyBase64urlOptions, + QueryDefaultOptionalParams, + QueryBase64OptionalParams, + QueryBase64urlOptionalParams, + QueryBase64urlArrayOptionalParams, + PropertyDefaultOptionalParams, + PropertyBase64OptionalParams, + PropertyBase64urlOptionalParams, + PropertyBase64urlArrayOptionalParams, + HeaderDefaultOptionalParams, + HeaderBase64OptionalParams, + HeaderBase64urlOptionalParams, + HeaderBase64urlArrayOptionalParams, + RequestBodyDefaultOptionalParams, + RequestBodyOctetStreamOptionalParams, + RequestBodyCustomContentTypeOptionalParams, + RequestBodyBase64OptionalParams, + RequestBodyBase64urlOptionalParams, + ResponseBodyDefaultOptionalParams, + ResponseBodyOctetStreamOptionalParams, + ResponseBodyCustomContentTypeOptionalParams, + ResponseBodyBase64OptionalParams, + ResponseBodyBase64urlOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/options.ts index 05bbd2efed..d086795da6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/models/options.ts @@ -3,51 +3,54 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface QueryDefaultOptions extends OperationOptions {} +export interface QueryDefaultOptionalParams extends OperationOptions {} -export interface QueryBase64Options extends OperationOptions {} +export interface QueryBase64OptionalParams extends OperationOptions {} -export interface QueryBase64urlOptions extends OperationOptions {} +export interface QueryBase64urlOptionalParams extends OperationOptions {} -export interface QueryBase64urlArrayOptions extends OperationOptions {} +export interface QueryBase64urlArrayOptionalParams extends OperationOptions {} -export interface PropertyDefaultOptions extends OperationOptions {} +export interface PropertyDefaultOptionalParams extends OperationOptions {} -export interface PropertyBase64Options extends OperationOptions {} +export interface PropertyBase64OptionalParams extends OperationOptions {} -export interface PropertyBase64urlOptions extends OperationOptions {} +export interface PropertyBase64urlOptionalParams extends OperationOptions {} -export interface PropertyBase64urlArrayOptions extends OperationOptions {} +export interface PropertyBase64urlArrayOptionalParams + extends OperationOptions {} -export interface HeaderDefaultOptions extends OperationOptions {} +export interface HeaderDefaultOptionalParams extends OperationOptions {} -export interface HeaderBase64Options extends OperationOptions {} +export interface HeaderBase64OptionalParams extends OperationOptions {} -export interface HeaderBase64urlOptions extends OperationOptions {} +export interface HeaderBase64urlOptionalParams extends OperationOptions {} -export interface HeaderBase64urlArrayOptions extends OperationOptions {} +export interface HeaderBase64urlArrayOptionalParams extends OperationOptions {} -export interface RequestBodyDefaultOptions extends OperationOptions {} +export interface RequestBodyDefaultOptionalParams extends OperationOptions {} -export interface RequestBodyOctetStreamOptions extends OperationOptions { +export interface RequestBodyOctetStreamOptionalParams extends OperationOptions { contentType?: string; } -export interface RequestBodyCustomContentTypeOptions extends OperationOptions { +export interface RequestBodyCustomContentTypeOptionalParams + extends OperationOptions { contentType?: string; } -export interface RequestBodyBase64Options extends OperationOptions {} +export interface RequestBodyBase64OptionalParams extends OperationOptions {} -export interface RequestBodyBase64urlOptions extends OperationOptions {} +export interface RequestBodyBase64urlOptionalParams extends OperationOptions {} -export interface ResponseBodyDefaultOptions extends OperationOptions {} +export interface ResponseBodyDefaultOptionalParams extends OperationOptions {} -export interface ResponseBodyOctetStreamOptions extends OperationOptions {} +export interface ResponseBodyOctetStreamOptionalParams + extends OperationOptions {} -export interface ResponseBodyCustomContentTypeOptions +export interface ResponseBodyCustomContentTypeOptionalParams extends OperationOptions {} -export interface ResponseBodyBase64Options extends OperationOptions {} +export interface ResponseBodyBase64OptionalParams extends OperationOptions {} -export interface ResponseBodyBase64urlOptions extends OperationOptions {} +export interface ResponseBodyBase64urlOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/DatetimeContext.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/datetimeContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/DatetimeContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/datetimeContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/header/index.ts index b0ddaae15d..1b17b5d2e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/header/index.ts @@ -16,17 +16,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - HeaderDefaultOptions, - HeaderRfc3339Options, - HeaderRfc7231Options, - HeaderUnixTimestampOptions, - HeaderUnixTimestampArrayOptions, + HeaderDefaultOptionalParams, + HeaderRfc3339OptionalParams, + HeaderRfc7231OptionalParams, + HeaderUnixTimestampOptionalParams, + HeaderUnixTimestampArrayOptionalParams, } from "../../models/options.js"; export function _headerDefaultSend( context: Client, value: Date, - options: HeaderDefaultOptions = { requestOptions: {} }, + options: HeaderDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/header/default") @@ -49,7 +49,7 @@ export async function _headerDefaultDeserialize( export async function headerDefault( context: Client, value: Date, - options: HeaderDefaultOptions = { requestOptions: {} }, + options: HeaderDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerDefaultSend(context, value, options); return _headerDefaultDeserialize(result); @@ -58,7 +58,7 @@ export async function headerDefault( export function _headerRfc3339Send( context: Client, value: Date, - options: HeaderRfc3339Options = { requestOptions: {} }, + options: HeaderRfc3339OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/header/rfc3339") @@ -81,7 +81,7 @@ export async function _headerRfc3339Deserialize( export async function headerRfc3339( context: Client, value: Date, - options: HeaderRfc3339Options = { requestOptions: {} }, + options: HeaderRfc3339OptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerRfc3339Send(context, value, options); return _headerRfc3339Deserialize(result); @@ -90,7 +90,7 @@ export async function headerRfc3339( export function _headerRfc7231Send( context: Client, value: Date, - options: HeaderRfc7231Options = { requestOptions: {} }, + options: HeaderRfc7231OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/header/rfc7231") @@ -113,7 +113,7 @@ export async function _headerRfc7231Deserialize( export async function headerRfc7231( context: Client, value: Date, - options: HeaderRfc7231Options = { requestOptions: {} }, + options: HeaderRfc7231OptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerRfc7231Send(context, value, options); return _headerRfc7231Deserialize(result); @@ -122,7 +122,7 @@ export async function headerRfc7231( export function _headerUnixTimestampSend( context: Client, value: Date, - options: HeaderUnixTimestampOptions = { requestOptions: {} }, + options: HeaderUnixTimestampOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/header/unix-timestamp") @@ -145,7 +145,7 @@ export async function _headerUnixTimestampDeserialize( export async function headerUnixTimestamp( context: Client, value: Date, - options: HeaderUnixTimestampOptions = { requestOptions: {} }, + options: HeaderUnixTimestampOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerUnixTimestampSend(context, value, options); return _headerUnixTimestampDeserialize(result); @@ -154,7 +154,7 @@ export async function headerUnixTimestamp( export function _headerUnixTimestampArraySend( context: Client, value: Date[], - options: HeaderUnixTimestampArrayOptions = { requestOptions: {} }, + options: HeaderUnixTimestampArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/header/unix-timestamp-array") @@ -177,7 +177,7 @@ export async function _headerUnixTimestampArrayDeserialize( export async function headerUnixTimestampArray( context: Client, value: Date[], - options: HeaderUnixTimestampArrayOptions = { requestOptions: {} }, + options: HeaderUnixTimestampArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerUnixTimestampArraySend(context, value, options); return _headerUnixTimestampArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/index.ts index 8e892173b4..3a471883d3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/index.ts @@ -5,7 +5,7 @@ export { createDatetime, DatetimeClientOptions, DatetimeContext, -} from "./DatetimeContext.js"; +} from "./datetimeContext.js"; export { headerDefault, headerRfc3339, diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/property/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/property/index.ts index 0a61674062..3755c80f6e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/property/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/property/index.ts @@ -22,17 +22,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - PropertyDefaultOptions, - PropertyRfc3339Options, - PropertyRfc7231Options, - PropertyUnixTimestampOptions, - PropertyUnixTimestampArrayOptions, + PropertyDefaultOptionalParams, + PropertyRfc3339OptionalParams, + PropertyRfc7231OptionalParams, + PropertyUnixTimestampOptionalParams, + PropertyUnixTimestampArrayOptionalParams, } from "../../models/options.js"; export function _propertyDefaultSend( context: Client, body: DefaultDatetimeProperty, - options: PropertyDefaultOptions = { requestOptions: {} }, + options: PropertyDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/property/default") @@ -57,7 +57,7 @@ export async function _propertyDefaultDeserialize( export async function propertyDefault( context: Client, body: DefaultDatetimeProperty, - options: PropertyDefaultOptions = { requestOptions: {} }, + options: PropertyDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyDefaultSend(context, body, options); return _propertyDefaultDeserialize(result); @@ -66,7 +66,7 @@ export async function propertyDefault( export function _propertyRfc3339Send( context: Client, body: Rfc3339DatetimeProperty, - options: PropertyRfc3339Options = { requestOptions: {} }, + options: PropertyRfc3339OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/property/rfc3339") @@ -91,7 +91,7 @@ export async function _propertyRfc3339Deserialize( export async function propertyRfc3339( context: Client, body: Rfc3339DatetimeProperty, - options: PropertyRfc3339Options = { requestOptions: {} }, + options: PropertyRfc3339OptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyRfc3339Send(context, body, options); return _propertyRfc3339Deserialize(result); @@ -100,7 +100,7 @@ export async function propertyRfc3339( export function _propertyRfc7231Send( context: Client, body: Rfc7231DatetimeProperty, - options: PropertyRfc7231Options = { requestOptions: {} }, + options: PropertyRfc7231OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/property/rfc7231") @@ -125,7 +125,7 @@ export async function _propertyRfc7231Deserialize( export async function propertyRfc7231( context: Client, body: Rfc7231DatetimeProperty, - options: PropertyRfc7231Options = { requestOptions: {} }, + options: PropertyRfc7231OptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyRfc7231Send(context, body, options); return _propertyRfc7231Deserialize(result); @@ -134,7 +134,7 @@ export async function propertyRfc7231( export function _propertyUnixTimestampSend( context: Client, body: UnixTimestampDatetimeProperty, - options: PropertyUnixTimestampOptions = { requestOptions: {} }, + options: PropertyUnixTimestampOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/property/unix-timestamp") @@ -159,7 +159,7 @@ export async function _propertyUnixTimestampDeserialize( export async function propertyUnixTimestamp( context: Client, body: UnixTimestampDatetimeProperty, - options: PropertyUnixTimestampOptions = { requestOptions: {} }, + options: PropertyUnixTimestampOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyUnixTimestampSend(context, body, options); return _propertyUnixTimestampDeserialize(result); @@ -168,7 +168,7 @@ export async function propertyUnixTimestamp( export function _propertyUnixTimestampArraySend( context: Client, body: UnixTimestampArrayDatetimeProperty, - options: PropertyUnixTimestampArrayOptions = { requestOptions: {} }, + options: PropertyUnixTimestampArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/property/unix-timestamp-array") @@ -193,7 +193,7 @@ export async function _propertyUnixTimestampArrayDeserialize( export async function propertyUnixTimestampArray( context: Client, body: UnixTimestampArrayDatetimeProperty, - options: PropertyUnixTimestampArrayOptions = { requestOptions: {} }, + options: PropertyUnixTimestampArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyUnixTimestampArraySend(context, body, options); return _propertyUnixTimestampArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/query/index.ts index 277deb46ae..59255f62cf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/query/index.ts @@ -15,17 +15,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - QueryDefaultOptions, - QueryRfc3339Options, - QueryRfc7231Options, - QueryUnixTimestampOptions, - QueryUnixTimestampArrayOptions, + QueryDefaultOptionalParams, + QueryRfc3339OptionalParams, + QueryRfc7231OptionalParams, + QueryUnixTimestampOptionalParams, + QueryUnixTimestampArrayOptionalParams, } from "../../models/options.js"; export function _queryDefaultSend( context: Client, value: Date, - options: QueryDefaultOptions = { requestOptions: {} }, + options: QueryDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/query/default") @@ -48,7 +48,7 @@ export async function _queryDefaultDeserialize( export async function queryDefault( context: Client, value: Date, - options: QueryDefaultOptions = { requestOptions: {} }, + options: QueryDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryDefaultSend(context, value, options); return _queryDefaultDeserialize(result); @@ -57,7 +57,7 @@ export async function queryDefault( export function _queryRfc3339Send( context: Client, value: Date, - options: QueryRfc3339Options = { requestOptions: {} }, + options: QueryRfc3339OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/query/rfc3339") @@ -80,7 +80,7 @@ export async function _queryRfc3339Deserialize( export async function queryRfc3339( context: Client, value: Date, - options: QueryRfc3339Options = { requestOptions: {} }, + options: QueryRfc3339OptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryRfc3339Send(context, value, options); return _queryRfc3339Deserialize(result); @@ -89,7 +89,7 @@ export async function queryRfc3339( export function _queryRfc7231Send( context: Client, value: Date, - options: QueryRfc7231Options = { requestOptions: {} }, + options: QueryRfc7231OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/query/rfc7231") @@ -112,7 +112,7 @@ export async function _queryRfc7231Deserialize( export async function queryRfc7231( context: Client, value: Date, - options: QueryRfc7231Options = { requestOptions: {} }, + options: QueryRfc7231OptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryRfc7231Send(context, value, options); return _queryRfc7231Deserialize(result); @@ -121,7 +121,7 @@ export async function queryRfc7231( export function _queryUnixTimestampSend( context: Client, value: Date, - options: QueryUnixTimestampOptions = { requestOptions: {} }, + options: QueryUnixTimestampOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/query/unix-timestamp") @@ -144,7 +144,7 @@ export async function _queryUnixTimestampDeserialize( export async function queryUnixTimestamp( context: Client, value: Date, - options: QueryUnixTimestampOptions = { requestOptions: {} }, + options: QueryUnixTimestampOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryUnixTimestampSend(context, value, options); return _queryUnixTimestampDeserialize(result); @@ -153,7 +153,7 @@ export async function queryUnixTimestamp( export function _queryUnixTimestampArraySend( context: Client, value: Date[], - options: QueryUnixTimestampArrayOptions = { requestOptions: {} }, + options: QueryUnixTimestampArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/query/unix-timestamp-array") @@ -176,7 +176,7 @@ export async function _queryUnixTimestampArrayDeserialize( export async function queryUnixTimestampArray( context: Client, value: Date[], - options: QueryUnixTimestampArrayOptions = { requestOptions: {} }, + options: QueryUnixTimestampArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryUnixTimestampArraySend(context, value, options); return _queryUnixTimestampArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/responseHeader/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/responseHeader/index.ts index 6fbfe5e5ee..fdeaec4f14 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/responseHeader/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/api/responseHeader/index.ts @@ -14,15 +14,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ResponseHeaderDefaultOptions, - ResponseHeaderRfc3339Options, - ResponseHeaderRfc7231Options, - ResponseHeaderUnixTimestampOptions, + ResponseHeaderDefaultOptionalParams, + ResponseHeaderRfc3339OptionalParams, + ResponseHeaderRfc7231OptionalParams, + ResponseHeaderUnixTimestampOptionalParams, } from "../../models/options.js"; export function _responseHeaderDefaultSend( context: Client, - options: ResponseHeaderDefaultOptions = { requestOptions: {} }, + options: ResponseHeaderDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/responseheader/default") @@ -41,7 +41,7 @@ export async function _responseHeaderDefaultDeserialize( export async function responseHeaderDefault( context: Client, - options: ResponseHeaderDefaultOptions = { requestOptions: {} }, + options: ResponseHeaderDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseHeaderDefaultSend(context, options); return _responseHeaderDefaultDeserialize(result); @@ -49,7 +49,7 @@ export async function responseHeaderDefault( export function _responseHeaderRfc3339Send( context: Client, - options: ResponseHeaderRfc3339Options = { requestOptions: {} }, + options: ResponseHeaderRfc3339OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/responseheader/rfc3339") @@ -68,7 +68,7 @@ export async function _responseHeaderRfc3339Deserialize( export async function responseHeaderRfc3339( context: Client, - options: ResponseHeaderRfc3339Options = { requestOptions: {} }, + options: ResponseHeaderRfc3339OptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseHeaderRfc3339Send(context, options); return _responseHeaderRfc3339Deserialize(result); @@ -76,7 +76,7 @@ export async function responseHeaderRfc3339( export function _responseHeaderRfc7231Send( context: Client, - options: ResponseHeaderRfc7231Options = { requestOptions: {} }, + options: ResponseHeaderRfc7231OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/responseheader/rfc7231") @@ -95,7 +95,7 @@ export async function _responseHeaderRfc7231Deserialize( export async function responseHeaderRfc7231( context: Client, - options: ResponseHeaderRfc7231Options = { requestOptions: {} }, + options: ResponseHeaderRfc7231OptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseHeaderRfc7231Send(context, options); return _responseHeaderRfc7231Deserialize(result); @@ -103,7 +103,7 @@ export async function responseHeaderRfc7231( export function _responseHeaderUnixTimestampSend( context: Client, - options: ResponseHeaderUnixTimestampOptions = { requestOptions: {} }, + options: ResponseHeaderUnixTimestampOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/datetime/responseheader/unix-timestamp") @@ -122,7 +122,7 @@ export async function _responseHeaderUnixTimestampDeserialize( export async function responseHeaderUnixTimestamp( context: Client, - options: ResponseHeaderUnixTimestampOptions = { requestOptions: {} }, + options: ResponseHeaderUnixTimestampOptionalParams = { requestOptions: {} }, ): Promise { const result = await _responseHeaderUnixTimestampSend(context, options); return _responseHeaderUnixTimestampDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/header/index.ts index 26d44ce9c5..2dcfe1cbb3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/header/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DatetimeContext } from "../../api/DatetimeContext.js"; +import { DatetimeContext } from "../../api/datetimeContext.js"; import { headerDefault, headerRfc3339, @@ -10,40 +10,49 @@ import { headerUnixTimestampArray, } from "../../api/header/index.js"; import { - HeaderDefaultOptions, - HeaderRfc3339Options, - HeaderRfc7231Options, - HeaderUnixTimestampOptions, - HeaderUnixTimestampArrayOptions, + HeaderDefaultOptionalParams, + HeaderRfc3339OptionalParams, + HeaderRfc7231OptionalParams, + HeaderUnixTimestampOptionalParams, + HeaderUnixTimestampArrayOptionalParams, } from "../../models/options.js"; export interface HeaderOperations { - default: (value: Date, options?: HeaderDefaultOptions) => Promise; - rfc3339: (value: Date, options?: HeaderRfc3339Options) => Promise; - rfc7231: (value: Date, options?: HeaderRfc7231Options) => Promise; + default: ( + value: Date, + options?: HeaderDefaultOptionalParams, + ) => Promise; + rfc3339: ( + value: Date, + options?: HeaderRfc3339OptionalParams, + ) => Promise; + rfc7231: ( + value: Date, + options?: HeaderRfc7231OptionalParams, + ) => Promise; unixTimestamp: ( value: Date, - options?: HeaderUnixTimestampOptions, + options?: HeaderUnixTimestampOptionalParams, ) => Promise; unixTimestampArray: ( value: Date[], - options?: HeaderUnixTimestampArrayOptions, + options?: HeaderUnixTimestampArrayOptionalParams, ) => Promise; } export function getHeader(context: DatetimeContext) { return { - default: (value: Date, options?: HeaderDefaultOptions) => + default: (value: Date, options?: HeaderDefaultOptionalParams) => headerDefault(context, value, options), - rfc3339: (value: Date, options?: HeaderRfc3339Options) => + rfc3339: (value: Date, options?: HeaderRfc3339OptionalParams) => headerRfc3339(context, value, options), - rfc7231: (value: Date, options?: HeaderRfc7231Options) => + rfc7231: (value: Date, options?: HeaderRfc7231OptionalParams) => headerRfc7231(context, value, options), - unixTimestamp: (value: Date, options?: HeaderUnixTimestampOptions) => + unixTimestamp: (value: Date, options?: HeaderUnixTimestampOptionalParams) => headerUnixTimestamp(context, value, options), unixTimestampArray: ( value: Date[], - options?: HeaderUnixTimestampArrayOptions, + options?: HeaderUnixTimestampArrayOptionalParams, ) => headerUnixTimestampArray(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/property/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/property/index.ts index f690add8dd..4ec7fdb6c4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/property/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/property/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DatetimeContext } from "../../api/DatetimeContext.js"; +import { DatetimeContext } from "../../api/datetimeContext.js"; import { DefaultDatetimeProperty, Rfc3339DatetimeProperty, @@ -17,33 +17,33 @@ import { propertyUnixTimestampArray, } from "../../api/property/index.js"; import { - PropertyDefaultOptions, - PropertyRfc3339Options, - PropertyRfc7231Options, - PropertyUnixTimestampOptions, - PropertyUnixTimestampArrayOptions, + PropertyDefaultOptionalParams, + PropertyRfc3339OptionalParams, + PropertyRfc7231OptionalParams, + PropertyUnixTimestampOptionalParams, + PropertyUnixTimestampArrayOptionalParams, } from "../../models/options.js"; export interface PropertyOperations { default: ( body: DefaultDatetimeProperty, - options?: PropertyDefaultOptions, + options?: PropertyDefaultOptionalParams, ) => Promise; rfc3339: ( body: Rfc3339DatetimeProperty, - options?: PropertyRfc3339Options, + options?: PropertyRfc3339OptionalParams, ) => Promise; rfc7231: ( body: Rfc7231DatetimeProperty, - options?: PropertyRfc7231Options, + options?: PropertyRfc7231OptionalParams, ) => Promise; unixTimestamp: ( body: UnixTimestampDatetimeProperty, - options?: PropertyUnixTimestampOptions, + options?: PropertyUnixTimestampOptionalParams, ) => Promise; unixTimestampArray: ( body: UnixTimestampArrayDatetimeProperty, - options?: PropertyUnixTimestampArrayOptions, + options?: PropertyUnixTimestampArrayOptionalParams, ) => Promise; } @@ -51,23 +51,23 @@ export function getProperty(context: DatetimeContext) { return { default: ( body: DefaultDatetimeProperty, - options?: PropertyDefaultOptions, + options?: PropertyDefaultOptionalParams, ) => propertyDefault(context, body, options), rfc3339: ( body: Rfc3339DatetimeProperty, - options?: PropertyRfc3339Options, + options?: PropertyRfc3339OptionalParams, ) => propertyRfc3339(context, body, options), rfc7231: ( body: Rfc7231DatetimeProperty, - options?: PropertyRfc7231Options, + options?: PropertyRfc7231OptionalParams, ) => propertyRfc7231(context, body, options), unixTimestamp: ( body: UnixTimestampDatetimeProperty, - options?: PropertyUnixTimestampOptions, + options?: PropertyUnixTimestampOptionalParams, ) => propertyUnixTimestamp(context, body, options), unixTimestampArray: ( body: UnixTimestampArrayDatetimeProperty, - options?: PropertyUnixTimestampArrayOptions, + options?: PropertyUnixTimestampArrayOptionalParams, ) => propertyUnixTimestampArray(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/query/index.ts index a7594bd132..a1827365e7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/query/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DatetimeContext } from "../../api/DatetimeContext.js"; +import { DatetimeContext } from "../../api/datetimeContext.js"; import { queryDefault, queryRfc3339, @@ -10,40 +10,40 @@ import { queryUnixTimestampArray, } from "../../api/query/index.js"; import { - QueryDefaultOptions, - QueryRfc3339Options, - QueryRfc7231Options, - QueryUnixTimestampOptions, - QueryUnixTimestampArrayOptions, + QueryDefaultOptionalParams, + QueryRfc3339OptionalParams, + QueryRfc7231OptionalParams, + QueryUnixTimestampOptionalParams, + QueryUnixTimestampArrayOptionalParams, } from "../../models/options.js"; export interface QueryOperations { - default: (value: Date, options?: QueryDefaultOptions) => Promise; - rfc3339: (value: Date, options?: QueryRfc3339Options) => Promise; - rfc7231: (value: Date, options?: QueryRfc7231Options) => Promise; + default: (value: Date, options?: QueryDefaultOptionalParams) => Promise; + rfc3339: (value: Date, options?: QueryRfc3339OptionalParams) => Promise; + rfc7231: (value: Date, options?: QueryRfc7231OptionalParams) => Promise; unixTimestamp: ( value: Date, - options?: QueryUnixTimestampOptions, + options?: QueryUnixTimestampOptionalParams, ) => Promise; unixTimestampArray: ( value: Date[], - options?: QueryUnixTimestampArrayOptions, + options?: QueryUnixTimestampArrayOptionalParams, ) => Promise; } export function getQuery(context: DatetimeContext) { return { - default: (value: Date, options?: QueryDefaultOptions) => + default: (value: Date, options?: QueryDefaultOptionalParams) => queryDefault(context, value, options), - rfc3339: (value: Date, options?: QueryRfc3339Options) => + rfc3339: (value: Date, options?: QueryRfc3339OptionalParams) => queryRfc3339(context, value, options), - rfc7231: (value: Date, options?: QueryRfc7231Options) => + rfc7231: (value: Date, options?: QueryRfc7231OptionalParams) => queryRfc7231(context, value, options), - unixTimestamp: (value: Date, options?: QueryUnixTimestampOptions) => + unixTimestamp: (value: Date, options?: QueryUnixTimestampOptionalParams) => queryUnixTimestamp(context, value, options), unixTimestampArray: ( value: Date[], - options?: QueryUnixTimestampArrayOptions, + options?: QueryUnixTimestampArrayOptionalParams, ) => queryUnixTimestampArray(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/responseHeader/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/responseHeader/index.ts index 2af404fa39..78e95bc5cf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/responseHeader/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/classic/responseHeader/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DatetimeContext } from "../../api/DatetimeContext.js"; +import { DatetimeContext } from "../../api/datetimeContext.js"; import { responseHeaderDefault, responseHeaderRfc3339, @@ -9,30 +9,30 @@ import { responseHeaderUnixTimestamp, } from "../../api/responseHeader/index.js"; import { - ResponseHeaderDefaultOptions, - ResponseHeaderRfc3339Options, - ResponseHeaderRfc7231Options, - ResponseHeaderUnixTimestampOptions, + ResponseHeaderDefaultOptionalParams, + ResponseHeaderRfc3339OptionalParams, + ResponseHeaderRfc7231OptionalParams, + ResponseHeaderUnixTimestampOptionalParams, } from "../../models/options.js"; export interface ResponseHeaderOperations { - default: (options?: ResponseHeaderDefaultOptions) => Promise; - rfc3339: (options?: ResponseHeaderRfc3339Options) => Promise; - rfc7231: (options?: ResponseHeaderRfc7231Options) => Promise; + default: (options?: ResponseHeaderDefaultOptionalParams) => Promise; + rfc3339: (options?: ResponseHeaderRfc3339OptionalParams) => Promise; + rfc7231: (options?: ResponseHeaderRfc7231OptionalParams) => Promise; unixTimestamp: ( - options?: ResponseHeaderUnixTimestampOptions, + options?: ResponseHeaderUnixTimestampOptionalParams, ) => Promise; } export function getResponseHeader(context: DatetimeContext) { return { - default: (options?: ResponseHeaderDefaultOptions) => + default: (options?: ResponseHeaderDefaultOptionalParams) => responseHeaderDefault(context, options), - rfc3339: (options?: ResponseHeaderRfc3339Options) => + rfc3339: (options?: ResponseHeaderRfc3339OptionalParams) => responseHeaderRfc3339(context, options), - rfc7231: (options?: ResponseHeaderRfc7231Options) => + rfc7231: (options?: ResponseHeaderRfc7231OptionalParams) => responseHeaderRfc7231(context, options), - unixTimestamp: (options?: ResponseHeaderUnixTimestampOptions) => + unixTimestamp: (options?: ResponseHeaderUnixTimestampOptionalParams) => responseHeaderUnixTimestamp(context, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/DatetimeClient.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/datetimeClient.ts similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/DatetimeClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/datetimeClient.ts index f4b0c0d721..f7c5948b8b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/DatetimeClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/datetimeClient.ts @@ -21,7 +21,7 @@ import { DatetimeContext, } from "./api/index.js"; -export { DatetimeClientOptions } from "./api/DatetimeContext.js"; +export { DatetimeClientOptions } from "./api/datetimeContext.js"; export class DatetimeClient { private _client: DatetimeContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.ts index 435582d2f5..e1f03e189d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.ts @@ -1,32 +1,32 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { DatetimeClient, DatetimeClientOptions } from "./DatetimeClient.js"; +export { DatetimeClient, DatetimeClientOptions } from "./datetimeClient.js"; export { DefaultDatetimeProperty, Rfc3339DatetimeProperty, Rfc7231DatetimeProperty, UnixTimestampDatetimeProperty, UnixTimestampArrayDatetimeProperty, - QueryDefaultOptions, - QueryRfc3339Options, - QueryRfc7231Options, - QueryUnixTimestampOptions, - QueryUnixTimestampArrayOptions, - PropertyDefaultOptions, - PropertyRfc3339Options, - PropertyRfc7231Options, - PropertyUnixTimestampOptions, - PropertyUnixTimestampArrayOptions, - HeaderDefaultOptions, - HeaderRfc3339Options, - HeaderRfc7231Options, - HeaderUnixTimestampOptions, - HeaderUnixTimestampArrayOptions, - ResponseHeaderDefaultOptions, - ResponseHeaderRfc3339Options, - ResponseHeaderRfc7231Options, - ResponseHeaderUnixTimestampOptions, + QueryDefaultOptionalParams, + QueryRfc3339OptionalParams, + QueryRfc7231OptionalParams, + QueryUnixTimestampOptionalParams, + QueryUnixTimestampArrayOptionalParams, + PropertyDefaultOptionalParams, + PropertyRfc3339OptionalParams, + PropertyRfc7231OptionalParams, + PropertyUnixTimestampOptionalParams, + PropertyUnixTimestampArrayOptionalParams, + HeaderDefaultOptionalParams, + HeaderRfc3339OptionalParams, + HeaderRfc7231OptionalParams, + HeaderUnixTimestampOptionalParams, + HeaderUnixTimestampArrayOptionalParams, + ResponseHeaderDefaultOptionalParams, + ResponseHeaderRfc3339OptionalParams, + ResponseHeaderRfc7231OptionalParams, + ResponseHeaderUnixTimestampOptionalParams, } from "./models/index.js"; export { HeaderOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/index.ts index 6ab22dd99d..0d13774f2c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/index.ts @@ -9,23 +9,23 @@ export { UnixTimestampArrayDatetimeProperty, } from "./models.js"; export { - QueryDefaultOptions, - QueryRfc3339Options, - QueryRfc7231Options, - QueryUnixTimestampOptions, - QueryUnixTimestampArrayOptions, - PropertyDefaultOptions, - PropertyRfc3339Options, - PropertyRfc7231Options, - PropertyUnixTimestampOptions, - PropertyUnixTimestampArrayOptions, - HeaderDefaultOptions, - HeaderRfc3339Options, - HeaderRfc7231Options, - HeaderUnixTimestampOptions, - HeaderUnixTimestampArrayOptions, - ResponseHeaderDefaultOptions, - ResponseHeaderRfc3339Options, - ResponseHeaderRfc7231Options, - ResponseHeaderUnixTimestampOptions, + QueryDefaultOptionalParams, + QueryRfc3339OptionalParams, + QueryRfc7231OptionalParams, + QueryUnixTimestampOptionalParams, + QueryUnixTimestampArrayOptionalParams, + PropertyDefaultOptionalParams, + PropertyRfc3339OptionalParams, + PropertyRfc7231OptionalParams, + PropertyUnixTimestampOptionalParams, + PropertyUnixTimestampArrayOptionalParams, + HeaderDefaultOptionalParams, + HeaderRfc3339OptionalParams, + HeaderRfc7231OptionalParams, + HeaderUnixTimestampOptionalParams, + HeaderUnixTimestampArrayOptionalParams, + ResponseHeaderDefaultOptionalParams, + ResponseHeaderRfc3339OptionalParams, + ResponseHeaderRfc7231OptionalParams, + ResponseHeaderUnixTimestampOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/options.ts index 20323624d1..626f92234d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/models/options.ts @@ -3,40 +3,44 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface QueryDefaultOptions extends OperationOptions {} +export interface QueryDefaultOptionalParams extends OperationOptions {} -export interface QueryRfc3339Options extends OperationOptions {} +export interface QueryRfc3339OptionalParams extends OperationOptions {} -export interface QueryRfc7231Options extends OperationOptions {} +export interface QueryRfc7231OptionalParams extends OperationOptions {} -export interface QueryUnixTimestampOptions extends OperationOptions {} +export interface QueryUnixTimestampOptionalParams extends OperationOptions {} -export interface QueryUnixTimestampArrayOptions extends OperationOptions {} +export interface QueryUnixTimestampArrayOptionalParams + extends OperationOptions {} -export interface PropertyDefaultOptions extends OperationOptions {} +export interface PropertyDefaultOptionalParams extends OperationOptions {} -export interface PropertyRfc3339Options extends OperationOptions {} +export interface PropertyRfc3339OptionalParams extends OperationOptions {} -export interface PropertyRfc7231Options extends OperationOptions {} +export interface PropertyRfc7231OptionalParams extends OperationOptions {} -export interface PropertyUnixTimestampOptions extends OperationOptions {} +export interface PropertyUnixTimestampOptionalParams extends OperationOptions {} -export interface PropertyUnixTimestampArrayOptions extends OperationOptions {} +export interface PropertyUnixTimestampArrayOptionalParams + extends OperationOptions {} -export interface HeaderDefaultOptions extends OperationOptions {} +export interface HeaderDefaultOptionalParams extends OperationOptions {} -export interface HeaderRfc3339Options extends OperationOptions {} +export interface HeaderRfc3339OptionalParams extends OperationOptions {} -export interface HeaderRfc7231Options extends OperationOptions {} +export interface HeaderRfc7231OptionalParams extends OperationOptions {} -export interface HeaderUnixTimestampOptions extends OperationOptions {} +export interface HeaderUnixTimestampOptionalParams extends OperationOptions {} -export interface HeaderUnixTimestampArrayOptions extends OperationOptions {} +export interface HeaderUnixTimestampArrayOptionalParams + extends OperationOptions {} -export interface ResponseHeaderDefaultOptions extends OperationOptions {} +export interface ResponseHeaderDefaultOptionalParams extends OperationOptions {} -export interface ResponseHeaderRfc3339Options extends OperationOptions {} +export interface ResponseHeaderRfc3339OptionalParams extends OperationOptions {} -export interface ResponseHeaderRfc7231Options extends OperationOptions {} +export interface ResponseHeaderRfc7231OptionalParams extends OperationOptions {} -export interface ResponseHeaderUnixTimestampOptions extends OperationOptions {} +export interface ResponseHeaderUnixTimestampOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/DurationContext.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/durationContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/DurationContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/durationContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/header/index.ts index ea463222b9..a62cf3bc10 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/header/index.ts @@ -16,17 +16,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - HeaderDefaultOptions, - HeaderIso8601Options, - HeaderIso8601ArrayOptions, - HeaderInt32SecondsOptions, - HeaderFloatSecondsOptions, + HeaderDefaultOptionalParams, + HeaderIso8601OptionalParams, + HeaderIso8601ArrayOptionalParams, + HeaderInt32SecondsOptionalParams, + HeaderFloatSecondsOptionalParams, } from "../../models/options.js"; export function _headerDefaultSend( context: Client, duration: string, - options: HeaderDefaultOptions = { requestOptions: {} }, + options: HeaderDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/header/default") @@ -49,7 +49,7 @@ export async function _headerDefaultDeserialize( export async function headerDefault( context: Client, duration: string, - options: HeaderDefaultOptions = { requestOptions: {} }, + options: HeaderDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerDefaultSend(context, duration, options); return _headerDefaultDeserialize(result); @@ -58,7 +58,7 @@ export async function headerDefault( export function _headerIso8601Send( context: Client, duration: string, - options: HeaderIso8601Options = { requestOptions: {} }, + options: HeaderIso8601OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/header/iso8601") @@ -81,7 +81,7 @@ export async function _headerIso8601Deserialize( export async function headerIso8601( context: Client, duration: string, - options: HeaderIso8601Options = { requestOptions: {} }, + options: HeaderIso8601OptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerIso8601Send(context, duration, options); return _headerIso8601Deserialize(result); @@ -90,7 +90,7 @@ export async function headerIso8601( export function _headerIso8601ArraySend( context: Client, duration: string[], - options: HeaderIso8601ArrayOptions = { requestOptions: {} }, + options: HeaderIso8601ArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/header/iso8601-array") @@ -113,7 +113,7 @@ export async function _headerIso8601ArrayDeserialize( export async function headerIso8601Array( context: Client, duration: string[], - options: HeaderIso8601ArrayOptions = { requestOptions: {} }, + options: HeaderIso8601ArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerIso8601ArraySend(context, duration, options); return _headerIso8601ArrayDeserialize(result); @@ -122,7 +122,7 @@ export async function headerIso8601Array( export function _headerInt32SecondsSend( context: Client, duration: number, - options: HeaderInt32SecondsOptions = { requestOptions: {} }, + options: HeaderInt32SecondsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/header/int32-seconds") @@ -145,7 +145,7 @@ export async function _headerInt32SecondsDeserialize( export async function headerInt32Seconds( context: Client, duration: number, - options: HeaderInt32SecondsOptions = { requestOptions: {} }, + options: HeaderInt32SecondsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerInt32SecondsSend(context, duration, options); return _headerInt32SecondsDeserialize(result); @@ -154,7 +154,7 @@ export async function headerInt32Seconds( export function _headerFloatSecondsSend( context: Client, duration: number, - options: HeaderFloatSecondsOptions = { requestOptions: {} }, + options: HeaderFloatSecondsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/header/float-seconds") @@ -177,7 +177,7 @@ export async function _headerFloatSecondsDeserialize( export async function headerFloatSeconds( context: Client, duration: number, - options: HeaderFloatSecondsOptions = { requestOptions: {} }, + options: HeaderFloatSecondsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerFloatSecondsSend(context, duration, options); return _headerFloatSecondsDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/index.ts index 54d0621d4e..101ea9084f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/index.ts @@ -5,7 +5,7 @@ export { createDuration, DurationClientOptions, DurationContext, -} from "./DurationContext.js"; +} from "./durationContext.js"; export { headerDefault, headerIso8601, diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/property/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/property/index.ts index ef344f33b8..637ce466e5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/property/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/property/index.ts @@ -22,17 +22,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - PropertyDefaultOptions, - PropertyIso8601Options, - PropertyInt32SecondsOptions, - PropertyFloatSecondsOptions, - PropertyFloatSecondsArrayOptions, + PropertyDefaultOptionalParams, + PropertyIso8601OptionalParams, + PropertyInt32SecondsOptionalParams, + PropertyFloatSecondsOptionalParams, + PropertyFloatSecondsArrayOptionalParams, } from "../../models/options.js"; export function _propertyDefaultSend( context: Client, body: DefaultDurationProperty, - options: PropertyDefaultOptions = { requestOptions: {} }, + options: PropertyDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/property/default") @@ -57,7 +57,7 @@ export async function _propertyDefaultDeserialize( export async function propertyDefault( context: Client, body: DefaultDurationProperty, - options: PropertyDefaultOptions = { requestOptions: {} }, + options: PropertyDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyDefaultSend(context, body, options); return _propertyDefaultDeserialize(result); @@ -66,7 +66,7 @@ export async function propertyDefault( export function _propertyIso8601Send( context: Client, body: ISO8601DurationProperty, - options: PropertyIso8601Options = { requestOptions: {} }, + options: PropertyIso8601OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/property/iso8601") @@ -91,7 +91,7 @@ export async function _propertyIso8601Deserialize( export async function propertyIso8601( context: Client, body: ISO8601DurationProperty, - options: PropertyIso8601Options = { requestOptions: {} }, + options: PropertyIso8601OptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyIso8601Send(context, body, options); return _propertyIso8601Deserialize(result); @@ -100,7 +100,7 @@ export async function propertyIso8601( export function _propertyInt32SecondsSend( context: Client, body: Int32SecondsDurationProperty, - options: PropertyInt32SecondsOptions = { requestOptions: {} }, + options: PropertyInt32SecondsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/property/int32-seconds") @@ -125,7 +125,7 @@ export async function _propertyInt32SecondsDeserialize( export async function propertyInt32Seconds( context: Client, body: Int32SecondsDurationProperty, - options: PropertyInt32SecondsOptions = { requestOptions: {} }, + options: PropertyInt32SecondsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyInt32SecondsSend(context, body, options); return _propertyInt32SecondsDeserialize(result); @@ -134,7 +134,7 @@ export async function propertyInt32Seconds( export function _propertyFloatSecondsSend( context: Client, body: FloatSecondsDurationProperty, - options: PropertyFloatSecondsOptions = { requestOptions: {} }, + options: PropertyFloatSecondsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/property/float-seconds") @@ -159,7 +159,7 @@ export async function _propertyFloatSecondsDeserialize( export async function propertyFloatSeconds( context: Client, body: FloatSecondsDurationProperty, - options: PropertyFloatSecondsOptions = { requestOptions: {} }, + options: PropertyFloatSecondsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyFloatSecondsSend(context, body, options); return _propertyFloatSecondsDeserialize(result); @@ -168,7 +168,7 @@ export async function propertyFloatSeconds( export function _propertyFloatSecondsArraySend( context: Client, body: FloatSecondsDurationArrayProperty, - options: PropertyFloatSecondsArrayOptions = { requestOptions: {} }, + options: PropertyFloatSecondsArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/property/float-seconds-array") @@ -193,7 +193,7 @@ export async function _propertyFloatSecondsArrayDeserialize( export async function propertyFloatSecondsArray( context: Client, body: FloatSecondsDurationArrayProperty, - options: PropertyFloatSecondsArrayOptions = { requestOptions: {} }, + options: PropertyFloatSecondsArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _propertyFloatSecondsArraySend(context, body, options); return _propertyFloatSecondsArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/query/index.ts index 63ab989864..a98e3a129e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/api/query/index.ts @@ -15,17 +15,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - QueryDefaultOptions, - QueryIso8601Options, - QueryInt32SecondsOptions, - QueryFloatSecondsOptions, - QueryInt32SecondsArrayOptions, + QueryDefaultOptionalParams, + QueryIso8601OptionalParams, + QueryInt32SecondsOptionalParams, + QueryFloatSecondsOptionalParams, + QueryInt32SecondsArrayOptionalParams, } from "../../models/options.js"; export function _queryDefaultSend( context: Client, input: string, - options: QueryDefaultOptions = { requestOptions: {} }, + options: QueryDefaultOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/query/default") @@ -48,7 +48,7 @@ export async function _queryDefaultDeserialize( export async function queryDefault( context: Client, input: string, - options: QueryDefaultOptions = { requestOptions: {} }, + options: QueryDefaultOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryDefaultSend(context, input, options); return _queryDefaultDeserialize(result); @@ -57,7 +57,7 @@ export async function queryDefault( export function _queryIso8601Send( context: Client, input: string, - options: QueryIso8601Options = { requestOptions: {} }, + options: QueryIso8601OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/query/iso8601") @@ -80,7 +80,7 @@ export async function _queryIso8601Deserialize( export async function queryIso8601( context: Client, input: string, - options: QueryIso8601Options = { requestOptions: {} }, + options: QueryIso8601OptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryIso8601Send(context, input, options); return _queryIso8601Deserialize(result); @@ -89,7 +89,7 @@ export async function queryIso8601( export function _queryInt32SecondsSend( context: Client, input: number, - options: QueryInt32SecondsOptions = { requestOptions: {} }, + options: QueryInt32SecondsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/query/int32-seconds") @@ -112,7 +112,7 @@ export async function _queryInt32SecondsDeserialize( export async function queryInt32Seconds( context: Client, input: number, - options: QueryInt32SecondsOptions = { requestOptions: {} }, + options: QueryInt32SecondsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryInt32SecondsSend(context, input, options); return _queryInt32SecondsDeserialize(result); @@ -121,7 +121,7 @@ export async function queryInt32Seconds( export function _queryFloatSecondsSend( context: Client, input: number, - options: QueryFloatSecondsOptions = { requestOptions: {} }, + options: QueryFloatSecondsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/query/float-seconds") @@ -144,7 +144,7 @@ export async function _queryFloatSecondsDeserialize( export async function queryFloatSeconds( context: Client, input: number, - options: QueryFloatSecondsOptions = { requestOptions: {} }, + options: QueryFloatSecondsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryFloatSecondsSend(context, input, options); return _queryFloatSecondsDeserialize(result); @@ -153,7 +153,7 @@ export async function queryFloatSeconds( export function _queryInt32SecondsArraySend( context: Client, input: number[], - options: QueryInt32SecondsArrayOptions = { requestOptions: {} }, + options: QueryInt32SecondsArrayOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/encode/duration/query/int32-seconds-array") @@ -176,7 +176,7 @@ export async function _queryInt32SecondsArrayDeserialize( export async function queryInt32SecondsArray( context: Client, input: number[], - options: QueryInt32SecondsArrayOptions = { requestOptions: {} }, + options: QueryInt32SecondsArrayOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryInt32SecondsArraySend(context, input, options); return _queryInt32SecondsArrayDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/header/index.ts index 3fa714a76a..55f7d3af79 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/header/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DurationContext } from "../../api/DurationContext.js"; +import { DurationContext } from "../../api/durationContext.js"; import { headerDefault, headerIso8601, @@ -10,42 +10,54 @@ import { headerFloatSeconds, } from "../../api/header/index.js"; import { - HeaderDefaultOptions, - HeaderIso8601Options, - HeaderIso8601ArrayOptions, - HeaderInt32SecondsOptions, - HeaderFloatSecondsOptions, + HeaderDefaultOptionalParams, + HeaderIso8601OptionalParams, + HeaderIso8601ArrayOptionalParams, + HeaderInt32SecondsOptionalParams, + HeaderFloatSecondsOptionalParams, } from "../../models/options.js"; export interface HeaderOperations { - default: (duration: string, options?: HeaderDefaultOptions) => Promise; - iso8601: (duration: string, options?: HeaderIso8601Options) => Promise; + default: ( + duration: string, + options?: HeaderDefaultOptionalParams, + ) => Promise; + iso8601: ( + duration: string, + options?: HeaderIso8601OptionalParams, + ) => Promise; iso8601Array: ( duration: string[], - options?: HeaderIso8601ArrayOptions, + options?: HeaderIso8601ArrayOptionalParams, ) => Promise; int32Seconds: ( duration: number, - options?: HeaderInt32SecondsOptions, + options?: HeaderInt32SecondsOptionalParams, ) => Promise; floatSeconds: ( duration: number, - options?: HeaderFloatSecondsOptions, + options?: HeaderFloatSecondsOptionalParams, ) => Promise; } export function getHeader(context: DurationContext) { return { - default: (duration: string, options?: HeaderDefaultOptions) => + default: (duration: string, options?: HeaderDefaultOptionalParams) => headerDefault(context, duration, options), - iso8601: (duration: string, options?: HeaderIso8601Options) => + iso8601: (duration: string, options?: HeaderIso8601OptionalParams) => headerIso8601(context, duration, options), - iso8601Array: (duration: string[], options?: HeaderIso8601ArrayOptions) => - headerIso8601Array(context, duration, options), - int32Seconds: (duration: number, options?: HeaderInt32SecondsOptions) => - headerInt32Seconds(context, duration, options), - floatSeconds: (duration: number, options?: HeaderFloatSecondsOptions) => - headerFloatSeconds(context, duration, options), + iso8601Array: ( + duration: string[], + options?: HeaderIso8601ArrayOptionalParams, + ) => headerIso8601Array(context, duration, options), + int32Seconds: ( + duration: number, + options?: HeaderInt32SecondsOptionalParams, + ) => headerInt32Seconds(context, duration, options), + floatSeconds: ( + duration: number, + options?: HeaderFloatSecondsOptionalParams, + ) => headerFloatSeconds(context, duration, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/property/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/property/index.ts index 02c085a1f4..3ee22c669b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/property/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/property/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DurationContext } from "../../api/DurationContext.js"; +import { DurationContext } from "../../api/durationContext.js"; import { DefaultDurationProperty, ISO8601DurationProperty, @@ -17,33 +17,33 @@ import { propertyFloatSecondsArray, } from "../../api/property/index.js"; import { - PropertyDefaultOptions, - PropertyIso8601Options, - PropertyInt32SecondsOptions, - PropertyFloatSecondsOptions, - PropertyFloatSecondsArrayOptions, + PropertyDefaultOptionalParams, + PropertyIso8601OptionalParams, + PropertyInt32SecondsOptionalParams, + PropertyFloatSecondsOptionalParams, + PropertyFloatSecondsArrayOptionalParams, } from "../../models/options.js"; export interface PropertyOperations { default: ( body: DefaultDurationProperty, - options?: PropertyDefaultOptions, + options?: PropertyDefaultOptionalParams, ) => Promise; iso8601: ( body: ISO8601DurationProperty, - options?: PropertyIso8601Options, + options?: PropertyIso8601OptionalParams, ) => Promise; int32Seconds: ( body: Int32SecondsDurationProperty, - options?: PropertyInt32SecondsOptions, + options?: PropertyInt32SecondsOptionalParams, ) => Promise; floatSeconds: ( body: FloatSecondsDurationProperty, - options?: PropertyFloatSecondsOptions, + options?: PropertyFloatSecondsOptionalParams, ) => Promise; floatSecondsArray: ( body: FloatSecondsDurationArrayProperty, - options?: PropertyFloatSecondsArrayOptions, + options?: PropertyFloatSecondsArrayOptionalParams, ) => Promise; } @@ -51,23 +51,23 @@ export function getProperty(context: DurationContext) { return { default: ( body: DefaultDurationProperty, - options?: PropertyDefaultOptions, + options?: PropertyDefaultOptionalParams, ) => propertyDefault(context, body, options), iso8601: ( body: ISO8601DurationProperty, - options?: PropertyIso8601Options, + options?: PropertyIso8601OptionalParams, ) => propertyIso8601(context, body, options), int32Seconds: ( body: Int32SecondsDurationProperty, - options?: PropertyInt32SecondsOptions, + options?: PropertyInt32SecondsOptionalParams, ) => propertyInt32Seconds(context, body, options), floatSeconds: ( body: FloatSecondsDurationProperty, - options?: PropertyFloatSecondsOptions, + options?: PropertyFloatSecondsOptionalParams, ) => propertyFloatSeconds(context, body, options), floatSecondsArray: ( body: FloatSecondsDurationArrayProperty, - options?: PropertyFloatSecondsArrayOptions, + options?: PropertyFloatSecondsArrayOptionalParams, ) => propertyFloatSecondsArray(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/query/index.ts index ecfed1eefe..08005270dd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/classic/query/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { DurationContext } from "../../api/DurationContext.js"; +import { DurationContext } from "../../api/durationContext.js"; import { queryDefault, queryIso8601, @@ -10,43 +10,49 @@ import { queryInt32SecondsArray, } from "../../api/query/index.js"; import { - QueryDefaultOptions, - QueryIso8601Options, - QueryInt32SecondsOptions, - QueryFloatSecondsOptions, - QueryInt32SecondsArrayOptions, + QueryDefaultOptionalParams, + QueryIso8601OptionalParams, + QueryInt32SecondsOptionalParams, + QueryFloatSecondsOptionalParams, + QueryInt32SecondsArrayOptionalParams, } from "../../models/options.js"; export interface QueryOperations { - default: (input: string, options?: QueryDefaultOptions) => Promise; - iso8601: (input: string, options?: QueryIso8601Options) => Promise; + default: ( + input: string, + options?: QueryDefaultOptionalParams, + ) => Promise; + iso8601: ( + input: string, + options?: QueryIso8601OptionalParams, + ) => Promise; int32Seconds: ( input: number, - options?: QueryInt32SecondsOptions, + options?: QueryInt32SecondsOptionalParams, ) => Promise; floatSeconds: ( input: number, - options?: QueryFloatSecondsOptions, + options?: QueryFloatSecondsOptionalParams, ) => Promise; int32SecondsArray: ( input: number[], - options?: QueryInt32SecondsArrayOptions, + options?: QueryInt32SecondsArrayOptionalParams, ) => Promise; } export function getQuery(context: DurationContext) { return { - default: (input: string, options?: QueryDefaultOptions) => + default: (input: string, options?: QueryDefaultOptionalParams) => queryDefault(context, input, options), - iso8601: (input: string, options?: QueryIso8601Options) => + iso8601: (input: string, options?: QueryIso8601OptionalParams) => queryIso8601(context, input, options), - int32Seconds: (input: number, options?: QueryInt32SecondsOptions) => + int32Seconds: (input: number, options?: QueryInt32SecondsOptionalParams) => queryInt32Seconds(context, input, options), - floatSeconds: (input: number, options?: QueryFloatSecondsOptions) => + floatSeconds: (input: number, options?: QueryFloatSecondsOptionalParams) => queryFloatSeconds(context, input, options), int32SecondsArray: ( input: number[], - options?: QueryInt32SecondsArrayOptions, + options?: QueryInt32SecondsArrayOptionalParams, ) => queryInt32SecondsArray(context, input, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/DurationClient.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/durationClient.ts similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/DurationClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/durationClient.ts index 2e0041ce30..3c79f5125a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/DurationClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/durationClient.ts @@ -17,7 +17,7 @@ import { DurationContext, } from "./api/index.js"; -export { DurationClientOptions } from "./api/DurationContext.js"; +export { DurationClientOptions } from "./api/durationContext.js"; export class DurationClient { private _client: DurationContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.ts index 692ef7d59a..327e31900f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.ts @@ -1,28 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { DurationClient, DurationClientOptions } from "./DurationClient.js"; +export { DurationClient, DurationClientOptions } from "./durationClient.js"; export { DefaultDurationProperty, ISO8601DurationProperty, Int32SecondsDurationProperty, FloatSecondsDurationProperty, FloatSecondsDurationArrayProperty, - QueryDefaultOptions, - QueryIso8601Options, - QueryInt32SecondsOptions, - QueryFloatSecondsOptions, - QueryInt32SecondsArrayOptions, - PropertyDefaultOptions, - PropertyIso8601Options, - PropertyInt32SecondsOptions, - PropertyFloatSecondsOptions, - PropertyFloatSecondsArrayOptions, - HeaderDefaultOptions, - HeaderIso8601Options, - HeaderIso8601ArrayOptions, - HeaderInt32SecondsOptions, - HeaderFloatSecondsOptions, + QueryDefaultOptionalParams, + QueryIso8601OptionalParams, + QueryInt32SecondsOptionalParams, + QueryFloatSecondsOptionalParams, + QueryInt32SecondsArrayOptionalParams, + PropertyDefaultOptionalParams, + PropertyIso8601OptionalParams, + PropertyInt32SecondsOptionalParams, + PropertyFloatSecondsOptionalParams, + PropertyFloatSecondsArrayOptionalParams, + HeaderDefaultOptionalParams, + HeaderIso8601OptionalParams, + HeaderIso8601ArrayOptionalParams, + HeaderInt32SecondsOptionalParams, + HeaderFloatSecondsOptionalParams, } from "./models/index.js"; export { HeaderOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/index.ts index f0b43ea881..192e780276 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/index.ts @@ -9,19 +9,19 @@ export { FloatSecondsDurationArrayProperty, } from "./models.js"; export { - QueryDefaultOptions, - QueryIso8601Options, - QueryInt32SecondsOptions, - QueryFloatSecondsOptions, - QueryInt32SecondsArrayOptions, - PropertyDefaultOptions, - PropertyIso8601Options, - PropertyInt32SecondsOptions, - PropertyFloatSecondsOptions, - PropertyFloatSecondsArrayOptions, - HeaderDefaultOptions, - HeaderIso8601Options, - HeaderIso8601ArrayOptions, - HeaderInt32SecondsOptions, - HeaderFloatSecondsOptions, + QueryDefaultOptionalParams, + QueryIso8601OptionalParams, + QueryInt32SecondsOptionalParams, + QueryFloatSecondsOptionalParams, + QueryInt32SecondsArrayOptionalParams, + PropertyDefaultOptionalParams, + PropertyIso8601OptionalParams, + PropertyInt32SecondsOptionalParams, + PropertyFloatSecondsOptionalParams, + PropertyFloatSecondsArrayOptionalParams, + HeaderDefaultOptionalParams, + HeaderIso8601OptionalParams, + HeaderIso8601ArrayOptionalParams, + HeaderInt32SecondsOptionalParams, + HeaderFloatSecondsOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/options.ts index 5dff518131..55f6af641c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/models/options.ts @@ -3,32 +3,34 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface QueryDefaultOptions extends OperationOptions {} +export interface QueryDefaultOptionalParams extends OperationOptions {} -export interface QueryIso8601Options extends OperationOptions {} +export interface QueryIso8601OptionalParams extends OperationOptions {} -export interface QueryInt32SecondsOptions extends OperationOptions {} +export interface QueryInt32SecondsOptionalParams extends OperationOptions {} -export interface QueryFloatSecondsOptions extends OperationOptions {} +export interface QueryFloatSecondsOptionalParams extends OperationOptions {} -export interface QueryInt32SecondsArrayOptions extends OperationOptions {} +export interface QueryInt32SecondsArrayOptionalParams + extends OperationOptions {} -export interface PropertyDefaultOptions extends OperationOptions {} +export interface PropertyDefaultOptionalParams extends OperationOptions {} -export interface PropertyIso8601Options extends OperationOptions {} +export interface PropertyIso8601OptionalParams extends OperationOptions {} -export interface PropertyInt32SecondsOptions extends OperationOptions {} +export interface PropertyInt32SecondsOptionalParams extends OperationOptions {} -export interface PropertyFloatSecondsOptions extends OperationOptions {} +export interface PropertyFloatSecondsOptionalParams extends OperationOptions {} -export interface PropertyFloatSecondsArrayOptions extends OperationOptions {} +export interface PropertyFloatSecondsArrayOptionalParams + extends OperationOptions {} -export interface HeaderDefaultOptions extends OperationOptions {} +export interface HeaderDefaultOptionalParams extends OperationOptions {} -export interface HeaderIso8601Options extends OperationOptions {} +export interface HeaderIso8601OptionalParams extends OperationOptions {} -export interface HeaderIso8601ArrayOptions extends OperationOptions {} +export interface HeaderIso8601ArrayOptionalParams extends OperationOptions {} -export interface HeaderInt32SecondsOptions extends OperationOptions {} +export interface HeaderInt32SecondsOptionalParams extends OperationOptions {} -export interface HeaderFloatSecondsOptions extends OperationOptions {} +export interface HeaderFloatSecondsOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/extensibleContext.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/extensibleContext.ts new file mode 100644 index 0000000000..e080ad0e62 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/extensibleContext.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ClientOptions } from "@azure-rest/core-client"; +import { ExtensibleContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface ExtensibleClientOptions extends ClientOptions {} + +export { ExtensibleContext } from "../rest/index.js"; + +export function createExtensible( + options: ExtensibleClientOptions = {}, +): ExtensibleContext { + const clientContext = getClient(options); + return clientContext; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/index.ts new file mode 100644 index 0000000000..2a2c751f25 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createExtensible, + ExtensibleClientOptions, + ExtensibleContext, +} from "./extensibleContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/string/index.ts new file mode 100644 index 0000000000..8882170ebc --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/api/string/index.ts @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DaysOfWeekExtensibleEnum } from "../../models/models.js"; +import { + ExtensibleContext as Client, + GetKnownValue200Response, + GetUnknownValue200Response, + PutKnownValue204Response, + PutUnknownValue204Response, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + StringGetKnownValueOptionalParams, + StringGetUnknownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "../../models/options.js"; + +export function _getKnownValueSend( + context: Client, + options: StringGetKnownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/extensible/string/known-value") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getKnownValueDeserialize( + result: GetKnownValue200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return result.body; +} + +export async function getKnownValue( + context: Client, + options: StringGetKnownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getKnownValueSend(context, options); + return _getKnownValueDeserialize(result); +} + +export function _getUnknownValueSend( + context: Client, + options: StringGetUnknownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/extensible/string/unknown-value") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getUnknownValueDeserialize( + result: GetUnknownValue200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return result.body; +} + +export async function getUnknownValue( + context: Client, + options: StringGetUnknownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getUnknownValueSend(context, options); + return _getUnknownValueDeserialize(result); +} + +export function _putKnownValueSend( + context: Client, + body: DaysOfWeekExtensibleEnum, + options: StringPutKnownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/extensible/string/known-value") + .put({ ...operationOptionsToRequestParameters(options), body: body }); +} + +export async function _putKnownValueDeserialize( + result: PutKnownValue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function putKnownValue( + context: Client, + body: DaysOfWeekExtensibleEnum, + options: StringPutKnownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _putKnownValueSend(context, body, options); + return _putKnownValueDeserialize(result); +} + +export function _putUnknownValueSend( + context: Client, + body: DaysOfWeekExtensibleEnum, + options: StringPutUnknownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/extensible/string/unknown-value") + .put({ ...operationOptionsToRequestParameters(options), body: body }); +} + +export async function _putUnknownValueDeserialize( + result: PutUnknownValue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function putUnknownValue( + context: Client, + body: DaysOfWeekExtensibleEnum, + options: StringPutUnknownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _putUnknownValueSend(context, body, options); + return _putUnknownValueDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/index.ts new file mode 100644 index 0000000000..e691a0982d --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/index.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { StringOperations } from "./string/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/string/index.ts new file mode 100644 index 0000000000..44ea5682fd --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/classic/string/index.ts @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ExtensibleContext } from "../../api/extensibleContext.js"; +import { DaysOfWeekExtensibleEnum } from "../../models/models.js"; +import { + getKnownValue, + getUnknownValue, + putKnownValue, + putUnknownValue, +} from "../../api/string/index.js"; +import { + StringGetKnownValueOptionalParams, + StringGetUnknownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "../../models/options.js"; + +export interface StringOperations { + getKnownValue: ( + options?: StringGetKnownValueOptionalParams, + ) => Promise; + getUnknownValue: ( + options?: StringGetUnknownValueOptionalParams, + ) => Promise; + putKnownValue: ( + body: DaysOfWeekExtensibleEnum, + options?: StringPutKnownValueOptionalParams, + ) => Promise; + putUnknownValue: ( + body: DaysOfWeekExtensibleEnum, + options?: StringPutUnknownValueOptionalParams, + ) => Promise; +} + +export function getString(context: ExtensibleContext) { + return { + getKnownValue: (options?: StringGetKnownValueOptionalParams) => + getKnownValue(context, options), + getUnknownValue: (options?: StringGetUnknownValueOptionalParams) => + getUnknownValue(context, options), + putKnownValue: ( + body: DaysOfWeekExtensibleEnum, + options?: StringPutKnownValueOptionalParams, + ) => putKnownValue(context, body, options), + putUnknownValue: ( + body: DaysOfWeekExtensibleEnum, + options?: StringPutUnknownValueOptionalParams, + ) => putUnknownValue(context, body, options), + }; +} + +export function getStringOperations( + context: ExtensibleContext, +): StringOperations { + return { + ...getString(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/extensibleClient.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/extensibleClient.ts new file mode 100644 index 0000000000..7b2c4b55e2 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/extensibleClient.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Pipeline } from "@azure/core-rest-pipeline"; +import { + getStringOperations, + StringOperations, +} from "./classic/string/index.js"; +import { + createExtensible, + ExtensibleClientOptions, + ExtensibleContext, +} from "./api/index.js"; + +export { ExtensibleClientOptions } from "./api/extensibleContext.js"; + +export class ExtensibleClient { + private _client: ExtensibleContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor(options: ExtensibleClientOptions = {}) { + this._client = createExtensible(options); + this.pipeline = this._client.pipeline; + this.string = getStringOperations(this._client); + } + + /** The operation groups for String */ + public readonly string: StringOperations; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/index.ts new file mode 100644 index 0000000000..b29d2be6b4 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + ExtensibleClient, + ExtensibleClientOptions, +} from "./extensibleClient.js"; +export { + DaysOfWeekExtensibleEnum, + StringGetKnownValueOptionalParams, + StringGetUnknownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "./models/index.js"; +export { StringOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/logger.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/logger.ts new file mode 100644 index 0000000000..654a483261 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("extensible-enums"); diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/index.ts new file mode 100644 index 0000000000..cc86b963b3 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { DaysOfWeekExtensibleEnum } from "./models.js"; +export { + StringGetKnownValueOptionalParams, + StringGetUnknownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/models.ts new file mode 100644 index 0000000000..b64bf64bb3 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/models.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Days of the week */ +/** "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" */ +export type DaysOfWeekExtensibleEnum = string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/options.ts new file mode 100644 index 0000000000..ddc34027f3 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/models/options.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface StringGetKnownValueOptionalParams extends OperationOptions {} + +export interface StringGetUnknownValueOptionalParams extends OperationOptions {} + +export interface StringPutKnownValueOptionalParams extends OperationOptions {} + +export interface StringPutUnknownValueOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/clientDefinitions.ts new file mode 100644 index 0000000000..aafc555c62 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/clientDefinitions.ts @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + GetKnownValueParameters, + PutKnownValueParameters, + GetUnknownValueParameters, + PutUnknownValueParameters, +} from "./parameters.js"; +import { + GetKnownValue200Response, + PutKnownValue204Response, + GetUnknownValue200Response, + PutUnknownValue204Response, +} from "./responses.js"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface GetKnownValue { + get( + options?: GetKnownValueParameters, + ): StreamableMethod; + put( + options: PutKnownValueParameters, + ): StreamableMethod; +} + +export interface GetUnknownValue { + get( + options?: GetUnknownValueParameters, + ): StreamableMethod; + put( + options: PutUnknownValueParameters, + ): StreamableMethod; +} + +export interface Routes { + /** Resource for '/type/enum/extensible/string/known-value' has methods for the following verbs: get, put */ + (path: "/type/enum/extensible/string/known-value"): GetKnownValue; + /** Resource for '/type/enum/extensible/string/unknown-value' has methods for the following verbs: get, put */ + (path: "/type/enum/extensible/string/unknown-value"): GetUnknownValue; +} + +export type ExtensibleContext = Client & { + path: Routes; +}; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/extensibleClient.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/extensibleClient.ts new file mode 100644 index 0000000000..e38c440f6b --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/extensibleClient.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { ExtensibleContext } from "./clientDefinitions.js"; + +/** + * Initialize a new instance of `ExtensibleContext` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: ClientOptions = {}, +): ExtensibleContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-extensible-enums-rest/1.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + + const client = getClient(endpointUrl, options) as ExtensibleContext; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + return client; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/index.ts new file mode 100644 index 0000000000..fc9c168fd9 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import ExtensibleClient from "./extensibleClient.js"; + +export * from "./extensibleClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./models.js"; +export * from "./outputModels.js"; + +export default ExtensibleClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/models.ts new file mode 100644 index 0000000000..88cb2d97aa --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/models.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for DaysOfWeekExtensibleEnum */ +export type DaysOfWeekExtensibleEnum = + | string + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/outputModels.ts new file mode 100644 index 0000000000..8ef6411820 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/outputModels.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Alias for DaysOfWeekExtensibleEnumOutput */ +export type DaysOfWeekExtensibleEnumOutput = + | string + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/parameters.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/parameters.ts new file mode 100644 index 0000000000..def3a9f1d8 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/parameters.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; +import { DaysOfWeekExtensibleEnum } from "./models.js"; + +export type GetKnownValueParameters = RequestParameters; +export type GetUnknownValueParameters = RequestParameters; + +export interface PutKnownValueBodyParam { + body: DaysOfWeekExtensibleEnum; +} + +export type PutKnownValueParameters = PutKnownValueBodyParam & + RequestParameters; + +export interface PutUnknownValueBodyParam { + body: DaysOfWeekExtensibleEnum; +} + +export type PutUnknownValueParameters = PutUnknownValueBodyParam & + RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/responses.ts new file mode 100644 index 0000000000..3b4feb0609 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/src/rest/responses.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { HttpResponse } from "@azure-rest/core-client"; +import { DaysOfWeekExtensibleEnumOutput } from "./outputModels.js"; + +/** The request has succeeded. */ +export interface GetKnownValue200Response extends HttpResponse { + status: "200"; + body: DaysOfWeekExtensibleEnumOutput; +} + +/** The request has succeeded. */ +export interface GetUnknownValue200Response extends HttpResponse { + status: "200"; + body: DaysOfWeekExtensibleEnumOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface PutKnownValue204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface PutUnknownValue204Response extends HttpResponse { + status: "204"; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/tspconfig.yaml new file mode 100644 index 0000000000..cbf7d039cf --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/extensible/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: false + generateTest: false + addCredentials: false + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/extensible-enums" + description: "Extensible Enums Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/fixedContext.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/fixedContext.ts new file mode 100644 index 0000000000..9a85cabb77 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/fixedContext.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ClientOptions } from "@azure-rest/core-client"; +import { FixedContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface FixedClientOptions extends ClientOptions {} + +export { FixedContext } from "../rest/index.js"; + +export function createFixed(options: FixedClientOptions = {}): FixedContext { + const clientContext = getClient(options); + return clientContext; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/index.ts new file mode 100644 index 0000000000..2b0cae9038 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createFixed, + FixedClientOptions, + FixedContext, +} from "./fixedContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/string/index.ts new file mode 100644 index 0000000000..f6ce8445ab --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/api/string/index.ts @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { DaysOfWeekEnum } from "../../models/models.js"; +import { + FixedContext as Client, + GetKnownValue200Response, + PutKnownValue204Response, + PutUnknownValue204Response, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + StringGetKnownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "../../models/options.js"; + +export function _getKnownValueSend( + context: Client, + options: StringGetKnownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/fixed/string/known-value") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getKnownValueDeserialize( + result: GetKnownValue200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return result.body; +} + +/** getKnownValue */ +export async function getKnownValue( + context: Client, + options: StringGetKnownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getKnownValueSend(context, options); + return _getKnownValueDeserialize(result); +} + +export function _putKnownValueSend( + context: Client, + body: DaysOfWeekEnum, + options: StringPutKnownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/fixed/string/known-value") + .put({ ...operationOptionsToRequestParameters(options), body: body }); +} + +export async function _putKnownValueDeserialize( + result: PutKnownValue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +/** putKnownValue */ +export async function putKnownValue( + context: Client, + body: DaysOfWeekEnum, + options: StringPutKnownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _putKnownValueSend(context, body, options); + return _putKnownValueDeserialize(result); +} + +export function _putUnknownValueSend( + context: Client, + body: DaysOfWeekEnum, + options: StringPutUnknownValueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/type/enum/fixed/string/unknown-value") + .put({ ...operationOptionsToRequestParameters(options), body: body }); +} + +export async function _putUnknownValueDeserialize( + result: PutUnknownValue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +/** putUnknownValue */ +export async function putUnknownValue( + context: Client, + body: DaysOfWeekEnum, + options: StringPutUnknownValueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _putUnknownValueSend(context, body, options); + return _putUnknownValueDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/index.ts new file mode 100644 index 0000000000..e691a0982d --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/index.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { StringOperations } from "./string/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/string/index.ts new file mode 100644 index 0000000000..6fdcc2d192 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/classic/string/index.ts @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { FixedContext } from "../../api/fixedContext.js"; +import { DaysOfWeekEnum } from "../../models/models.js"; +import { + getKnownValue, + putKnownValue, + putUnknownValue, +} from "../../api/string/index.js"; +import { + StringGetKnownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "../../models/options.js"; + +export interface StringOperations { + getKnownValue: ( + options?: StringGetKnownValueOptionalParams, + ) => Promise; + putKnownValue: ( + body: DaysOfWeekEnum, + options?: StringPutKnownValueOptionalParams, + ) => Promise; + putUnknownValue: ( + body: DaysOfWeekEnum, + options?: StringPutUnknownValueOptionalParams, + ) => Promise; +} + +export function getString(context: FixedContext) { + return { + getKnownValue: (options?: StringGetKnownValueOptionalParams) => + getKnownValue(context, options), + putKnownValue: ( + body: DaysOfWeekEnum, + options?: StringPutKnownValueOptionalParams, + ) => putKnownValue(context, body, options), + putUnknownValue: ( + body: DaysOfWeekEnum, + options?: StringPutUnknownValueOptionalParams, + ) => putUnknownValue(context, body, options), + }; +} + +export function getStringOperations(context: FixedContext): StringOperations { + return { + ...getString(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/fixedClient.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/fixedClient.ts new file mode 100644 index 0000000000..566702d0aa --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/fixedClient.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Pipeline } from "@azure/core-rest-pipeline"; +import { + getStringOperations, + StringOperations, +} from "./classic/string/index.js"; +import { createFixed, FixedClientOptions, FixedContext } from "./api/index.js"; + +export { FixedClientOptions } from "./api/fixedContext.js"; + +export class FixedClient { + private _client: FixedContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor(options: FixedClientOptions = {}) { + this._client = createFixed(options); + this.pipeline = this._client.pipeline; + this.string = getStringOperations(this._client); + } + + /** The operation groups for String */ + public readonly string: StringOperations; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/index.ts new file mode 100644 index 0000000000..f362b4def3 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { FixedClient, FixedClientOptions } from "./fixedClient.js"; +export { + DaysOfWeekEnum, + StringGetKnownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "./models/index.js"; +export { StringOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/integration/generated/projection/src/logger.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/logger.ts similarity index 69% rename from packages/typespec-ts/test/integration/generated/projection/src/logger.ts rename to packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/logger.ts index 8f2a683284..7fa51eb977 100644 --- a/packages/typespec-ts/test/integration/generated/projection/src/logger.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/logger.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. import { createClientLogger } from "@azure/logger"; -export const logger = createClientLogger("projection"); +export const logger = createClientLogger("fixed-enums"); diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/index.ts new file mode 100644 index 0000000000..11e3805520 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { DaysOfWeekEnum } from "./models.js"; +export { + StringGetKnownValueOptionalParams, + StringPutKnownValueOptionalParams, + StringPutUnknownValueOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/models.ts new file mode 100644 index 0000000000..4b9c553be7 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/models.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Days of the week */ +/** */ +export type DaysOfWeekEnum = + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/options.ts new file mode 100644 index 0000000000..342661d493 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/models/options.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface StringGetKnownValueOptionalParams extends OperationOptions {} + +export interface StringPutKnownValueOptionalParams extends OperationOptions {} + +export interface StringPutUnknownValueOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/clientDefinitions.ts new file mode 100644 index 0000000000..b563aeae6d --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/clientDefinitions.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + GetKnownValueParameters, + PutKnownValueParameters, + PutUnknownValueParameters, +} from "./parameters.js"; +import { + GetKnownValue200Response, + PutKnownValue204Response, + PutUnknownValue204Response, +} from "./responses.js"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface GetKnownValue { + /** getKnownValue */ + get( + options?: GetKnownValueParameters, + ): StreamableMethod; + /** putKnownValue */ + put( + options: PutKnownValueParameters, + ): StreamableMethod; +} + +export interface PutUnknownValue { + /** putUnknownValue */ + put( + options: PutUnknownValueParameters, + ): StreamableMethod; +} + +export interface Routes { + /** Resource for '/type/enum/fixed/string/known-value' has methods for the following verbs: get, put */ + (path: "/type/enum/fixed/string/known-value"): GetKnownValue; + /** Resource for '/type/enum/fixed/string/unknown-value' has methods for the following verbs: put */ + (path: "/type/enum/fixed/string/unknown-value"): PutUnknownValue; +} + +export type FixedContext = Client & { + path: Routes; +}; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/fixedClient.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/fixedClient.ts new file mode 100644 index 0000000000..0fba6f319e --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/fixedClient.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { FixedContext } from "./clientDefinitions.js"; + +/** + * Initialize a new instance of `FixedContext` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: ClientOptions = {}, +): FixedContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-fixed-enums-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + + const client = getClient(endpointUrl, options) as FixedContext; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + return client; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/index.ts new file mode 100644 index 0000000000..e1eb44f461 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import FixedClient from "./fixedClient.js"; + +export * from "./fixedClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./models.js"; +export * from "./outputModels.js"; + +export default FixedClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/models.ts new file mode 100644 index 0000000000..963fe85f9d --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/models.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Days of the week */ +export type DaysOfWeekEnum = + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/outputModels.ts new file mode 100644 index 0000000000..bc2067f2b0 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/outputModels.ts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Days of the week */ +export type DaysOfWeekEnumOutput = + | "Monday" + | "Tuesday" + | "Wednesday" + | "Thursday" + | "Friday" + | "Saturday" + | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/parameters.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/parameters.ts new file mode 100644 index 0000000000..b8147511d1 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/parameters.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; +import { DaysOfWeekEnum } from "./models.js"; + +export type GetKnownValueParameters = RequestParameters; + +export interface PutKnownValueBodyParam { + /** _ */ + body: DaysOfWeekEnum; +} + +export type PutKnownValueParameters = PutKnownValueBodyParam & + RequestParameters; + +export interface PutUnknownValueBodyParam { + /** _ */ + body: DaysOfWeekEnum; +} + +export type PutUnknownValueParameters = PutUnknownValueBodyParam & + RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/responses.ts new file mode 100644 index 0000000000..0c01ac36a1 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/src/rest/responses.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { HttpResponse } from "@azure-rest/core-client"; +import { DaysOfWeekEnumOutput } from "./outputModels.js"; + +/** The request has succeeded. */ +export interface GetKnownValue200Response extends HttpResponse { + status: "200"; + body: DaysOfWeekEnumOutput; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface PutKnownValue204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface PutUnknownValue204Response extends HttpResponse { + status: "204"; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/tspconfig.yaml new file mode 100644 index 0000000000..fb5dc390be --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/enums/fixed/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: false + generateTest: false + addCredentials: false + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/fixed-enums" + description: "Enums Fixed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/index.ts index 41ad5be297..05a799b005 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/index.ts @@ -6,4 +6,4 @@ export { createRequestId, RequestIdClientOptions, RequestIdClientContext, -} from "./RequestIdContext.js"; +} from "./requestIdContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/operations.ts index 44559a7228..11edbd3e18 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/operations.ts @@ -10,11 +10,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { GetOptions } from "../models/options.js"; +import { GetOptionalParams } from "../models/options.js"; export function _getSend( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/special-headers/client-request-id") @@ -32,7 +32,7 @@ export async function _getDeserialize(result: Get204Response): Promise { /** Get operation with azure client request id header. */ export async function get( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, options); return _getDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/RequestIdContext.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/requestIdContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/RequestIdContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/api/requestIdContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/index.ts index b39bc49f2f..5c0a059d01 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { RequestIdClient, RequestIdClientOptions } from "./RequestIdClient.js"; -export { GetOptions } from "./models/index.js"; +export { RequestIdClient, RequestIdClientOptions } from "./requestIdClient.js"; +export { GetOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/index.ts index 7e3a55f642..5e98fbab56 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { GetOptions } from "./options.js"; +export { GetOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/options.ts index a8875a5b44..32335e286f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/models/options.ts @@ -3,4 +3,4 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface GetOptions extends OperationOptions {} +export interface GetOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/RequestIdClient.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/requestIdClient.ts similarity index 78% rename from packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/RequestIdClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/requestIdClient.ts index 84054c5837..c4bb610a85 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/RequestIdClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/client-request-id/src/requestIdClient.ts @@ -8,9 +8,9 @@ import { RequestIdClientOptions, RequestIdClientContext, } from "./api/index.js"; -import { GetOptions } from "./models/options.js"; +import { GetOptionalParams } from "./models/options.js"; -export { RequestIdClientOptions } from "./api/RequestIdContext.js"; +export { RequestIdClientOptions } from "./api/requestIdContext.js"; export class RequestIdClient { private _client: RequestIdClientContext; @@ -24,7 +24,7 @@ export class RequestIdClient { } /** Get operation with azure client request id header. */ - get(options: GetOptions = { requestOptions: {} }): Promise { + get(options: GetOptionalParams = { requestOptions: {} }): Promise { return get(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/index.ts index 5e09986867..6d644844fc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/index.ts @@ -6,4 +6,4 @@ export { createRepeatability, RepeatabilityClientOptions, RepeatabilityContext, -} from "./RepeatabilityContext.js"; +} from "./repeatabilityContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/operations.ts index fe440099c3..b5911850eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/operations.ts @@ -10,13 +10,13 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ImmediateSuccessOptions } from "../models/options.js"; +import { ImmediateSuccessOptionalParams } from "../models/options.js"; export function _immediateSuccessSend( context: Client, repeatabilityRequestID: string, repeatabilityFirstSent: Date, - options: ImmediateSuccessOptions = { requestOptions: {} }, + options: ImmediateSuccessOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/special-headers/repeatability/immediateSuccess") @@ -44,7 +44,7 @@ export async function immediateSuccess( context: Client, repeatabilityRequestID: string, repeatabilityFirstSent: Date, - options: ImmediateSuccessOptions = { requestOptions: {} }, + options: ImmediateSuccessOptionalParams = { requestOptions: {} }, ): Promise { const result = await _immediateSuccessSend( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/RepeatabilityContext.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/repeatabilityContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/RepeatabilityContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/api/repeatabilityContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/index.ts index c3a952ed73..a44372cc93 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/index.ts @@ -4,5 +4,5 @@ export { RepeatabilityClient, RepeatabilityClientOptions, -} from "./RepeatabilityClient.js"; -export { ImmediateSuccessOptions } from "./models/index.js"; +} from "./repeatabilityClient.js"; +export { ImmediateSuccessOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/index.ts index 2b81de8097..2513d4abb3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ImmediateSuccessOptions } from "./options.js"; +export { ImmediateSuccessOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/options.ts index f03c1bfab8..71571d1f9f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/models/options.ts @@ -3,4 +3,4 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ImmediateSuccessOptions extends OperationOptions {} +export interface ImmediateSuccessOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/RepeatabilityClient.ts b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/repeatabilityClient.ts similarity index 82% rename from packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/RepeatabilityClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/repeatabilityClient.ts index b662b8b39c..da40156f19 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/RepeatabilityClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/headers/repeatability/generated/src/repeatabilityClient.ts @@ -8,9 +8,9 @@ import { RepeatabilityClientOptions, RepeatabilityContext, } from "./api/index.js"; -import { ImmediateSuccessOptions } from "./models/options.js"; +import { ImmediateSuccessOptionalParams } from "./models/options.js"; -export { RepeatabilityClientOptions } from "./api/RepeatabilityContext.js"; +export { RepeatabilityClientOptions } from "./api/repeatabilityContext.js"; export class RepeatabilityClient { private _client: RepeatabilityContext; @@ -27,7 +27,7 @@ export class RepeatabilityClient { immediateSuccess( repeatabilityRequestID: string, repeatabilityFirstSent: Date, - options: ImmediateSuccessOptions = { requestOptions: {} }, + options: ImmediateSuccessOptionalParams = { requestOptions: {} }, ): Promise { return immediateSuccess( this._client, diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/package.json b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/package.json index cf94b6bcd1..cea30c6746 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -39,8 +39,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/index.ts index 2a620f6a1b..e6a6d5e75f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. export { longRunningRpc } from "./operations.js"; -export { createRpc, RpcClientOptions, RpcContext } from "./RpcContext.js"; +export { createRpc, RpcClientOptions, RpcContext } from "./rpcContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/operations.ts index c7f754589d..166ece1a67 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/operations.ts @@ -16,12 +16,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { LongRunningRpcOptions } from "../models/options.js"; +import { LongRunningRpcOptionalParams } from "../models/options.js"; export function _longRunningRpcSend( context: Client, body: GenerationOptions, - options: LongRunningRpcOptions = { requestOptions: {} }, + options: LongRunningRpcOptionalParams = { requestOptions: {} }, ): StreamableMethod< | LongRunningRpc202Response | LongRunningRpcDefaultResponse @@ -62,7 +62,7 @@ export async function _longRunningRpcDeserialize( export function longRunningRpc( context: Client, body: GenerationOptions, - options: LongRunningRpcOptions = { requestOptions: {} }, + options: LongRunningRpcOptionalParams = { requestOptions: {} }, ): PollerLike, GenerationResult> { return getLongRunningPoller(context, _longRunningRpcDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/RpcContext.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/rpcContext.ts similarity index 78% rename from packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/RpcContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/rpcContext.ts index 8ee42f6f93..95ed008693 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/RpcContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/api/rpcContext.ts @@ -5,7 +5,10 @@ import { ClientOptions } from "@azure-rest/core-client"; import { RpcContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface RpcClientOptions extends ClientOptions {} +export interface RpcClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { RpcContext } from "../rest/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/index.ts index 8b9c3b9c84..26fcd945a9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/index.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { RpcClient, RpcClientOptions } from "./RpcClient.js"; +export { RpcClient, RpcClientOptions } from "./rpcClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { GenerationOptions, GenerationResult, - LongRunningRpcOptions, + Versions, + LongRunningRpcOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/index.ts index 7f8bb22ee9..ef8b61aba3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { GenerationOptions, GenerationResult } from "./models.js"; -export { LongRunningRpcOptions } from "./options.js"; +export { GenerationOptions, GenerationResult, Versions } from "./models.js"; +export { LongRunningRpcOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/models.ts index daf65fc570..54273d55ad 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/models.ts @@ -12,3 +12,7 @@ export interface GenerationResult { /** The data. */ data: string; } + +/** The API version. */ +/** */ +export type Versions = "2022-12-01-preview"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/options.ts index d38fc970da..dc984f8677 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/models/options.ts @@ -3,7 +3,7 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface LongRunningRpcOptions extends OperationOptions { +export interface LongRunningRpcOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rest/outputModels.ts index 09021f6a53..4062cec654 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rest/outputModels.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rest/outputModels.ts @@ -3,22 +3,12 @@ import { ErrorModel } from "@azure-rest/core-client"; -/** Options for the generation. */ -export interface GenerationOptionsOutput { - /** Prompt. */ - prompt: string; -} - /** Provides status details for long running operations. */ export interface ResourceOperationStatusOutput { /** The unique ID of the operation. */ readonly id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; /** The result of the operation. */ @@ -30,3 +20,11 @@ export interface GenerationResultOutput { /** The data. */ data: string; } + +/** Enum describing allowed operation states. */ +export type OperationStateOutput = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/restorePollerHelpers.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/restorePollerHelpers.ts index e763e2356d..6fc05cff99 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/restorePollerHelpers.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/restorePollerHelpers.ts @@ -7,8 +7,8 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { RpcContext } from "./api/RpcContext.js"; -import { RpcClient } from "./RpcClient.js"; +import { RpcContext } from "./api/rpcContext.js"; +import { RpcClient } from "./rpcClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _longRunningRpcDeserialize } from "./api/operations.js"; import { diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/RpcClient.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rpcClient.ts similarity index 83% rename from packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/RpcClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rpcClient.ts index 3322f93f2b..68cc5a1c49 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/RpcClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/rpc/generated/src/rpcClient.ts @@ -4,7 +4,7 @@ import { PollerLike, OperationState } from "@azure/core-lro"; import { Pipeline } from "@azure/core-rest-pipeline"; import { GenerationOptions, GenerationResult } from "./models/models.js"; -import { LongRunningRpcOptions } from "./models/options.js"; +import { LongRunningRpcOptionalParams } from "./models/options.js"; import { longRunningRpc, createRpc, @@ -12,7 +12,7 @@ import { RpcContext, } from "./api/index.js"; -export { RpcClientOptions } from "./api/RpcContext.js"; +export { RpcClientOptions } from "./api/rpcContext.js"; export class RpcClient { private _client: RpcContext; @@ -28,7 +28,7 @@ export class RpcClient { /** Generate data. */ longRunningRpc( body: GenerationOptions, - options: LongRunningRpcOptions = { requestOptions: {} }, + options: LongRunningRpcOptionalParams = { requestOptions: {} }, ): PollerLike, GenerationResult> { return longRunningRpc(this._client, body, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/package.json b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/package.json index 3de5534cf8..b31cf7caae 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -39,8 +39,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/index.ts index b4a8ca5440..e8788a93b1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/index.ts @@ -1,13 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { - createOrReplace, - deleteOperation, - exportOperation, -} from "./operations.js"; +export { createOrReplace, $delete, $export } from "./operations.js"; export { createStandard, StandardClientOptions, StandardContext, -} from "./StandardContext.js"; +} from "./standardContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/operations.ts index 32f92a73e8..9e9d9de722 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/operations.ts @@ -9,12 +9,12 @@ import { CreateOrReplace201Response, CreateOrReplaceDefaultResponse, CreateOrReplaceLogicalResponse, + Delete202Response, + DeleteDefaultResponse, DeleteLogicalResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, + Export202Response, + ExportDefaultResponse, ExportLogicalResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, isUnexpected, StandardContext as Client, } from "../rest/index.js"; @@ -24,16 +24,16 @@ import { createRestError, } from "@azure-rest/core-client"; import { - CreateOrReplaceOptions, - DeleteOperationOptions, - ExportOperationOptions, + CreateOrReplaceOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, } from "../models/options.js"; export function _createOrReplaceSend( context: Client, name: string, resource: User, - options: CreateOrReplaceOptions = { requestOptions: {} }, + options: CreateOrReplaceOptionalParams = { requestOptions: {} }, ): StreamableMethod< | CreateOrReplace200Response | CreateOrReplace201Response @@ -71,7 +71,7 @@ export function createOrReplace( context: Client, name: string, resource: User, - options: CreateOrReplaceOptions = { requestOptions: {} }, + options: CreateOrReplaceOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return getLongRunningPoller(context, _createOrReplaceDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, @@ -81,25 +81,20 @@ export function createOrReplace( }) as PollerLike, User>; } -export function _deleteOperationSend( +export function _$deleteSend( context: Client, name: string, - options: DeleteOperationOptions = { requestOptions: {} }, + options: DeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod< - | DeleteOperation202Response - | DeleteOperationDefaultResponse - | DeleteLogicalResponse + Delete202Response | DeleteDefaultResponse | DeleteLogicalResponse > { return context .path("/azure/core/lro/standard/users/{name}", name) .delete({ ...operationOptionsToRequestParameters(options) }); } -export async function _deleteOperationDeserialize( - result: - | DeleteOperation202Response - | DeleteOperationDefaultResponse - | DeleteLogicalResponse, +export async function _$deleteDeserialize( + result: Delete202Response | DeleteDefaultResponse | DeleteLogicalResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -110,27 +105,30 @@ export async function _deleteOperationDeserialize( } /** Deletes a User */ -export function deleteOperation( +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( context: Client, name: string, - options: DeleteOperationOptions = { requestOptions: {} }, + options: DeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _deleteOperationDeserialize, { + return getLongRunningPoller(context, _$deleteDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, - getInitialResponse: () => _deleteOperationSend(context, name, options), + getInitialResponse: () => _$deleteSend(context, name, options), }) as PollerLike, void>; } -export function _exportOperationSend( +export function _$exportSend( context: Client, name: string, format: string, - options: ExportOperationOptions = { requestOptions: {} }, + options: ExportOptionalParams = { requestOptions: {} }, ): StreamableMethod< - | ExportOperation202Response - | ExportOperationDefaultResponse - | ExportLogicalResponse + Export202Response | ExportDefaultResponse | ExportLogicalResponse > { return context .path("/azure/core/lro/standard/users/{name}:export", name) @@ -140,11 +138,8 @@ export function _exportOperationSend( }); } -export async function _exportOperationDeserialize( - result: - | ExportOperation202Response - | ExportOperationDefaultResponse - | ExportLogicalResponse, +export async function _$exportDeserialize( + result: Export202Response | ExportDefaultResponse | ExportLogicalResponse, ): Promise { if (isUnexpected(result)) { throw createRestError(result); @@ -165,16 +160,20 @@ export async function _exportOperationDeserialize( } /** Exports a User */ -export function exportOperation( +/** + * @fixme export is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $export( context: Client, name: string, format: string, - options: ExportOperationOptions = { requestOptions: {} }, + options: ExportOptionalParams = { requestOptions: {} }, ): PollerLike, ExportedUser> { - return getLongRunningPoller(context, _exportOperationDeserialize, { + return getLongRunningPoller(context, _$exportDeserialize, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, - getInitialResponse: () => - _exportOperationSend(context, name, format, options), + getInitialResponse: () => _$exportSend(context, name, format, options), }) as PollerLike, ExportedUser>; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/StandardContext.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/standardContext.ts similarity index 78% rename from packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/StandardContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/standardContext.ts index 0b8a2d60a1..bbac782f20 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/StandardContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/api/standardContext.ts @@ -5,7 +5,10 @@ import { ClientOptions } from "@azure-rest/core-client"; import { StandardContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface StandardClientOptions extends ClientOptions {} +export interface StandardClientOptions extends ClientOptions { + /** The API version to use for this operation. */ + apiVersion?: string; +} export { StandardContext } from "../rest/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/index.ts index 0d5fc20f49..5ad9bcaf7a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/index.ts @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { StandardClient, StandardClientOptions } from "./StandardClient.js"; +export { StandardClient, StandardClientOptions } from "./standardClient.js"; export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { User, ExportedUser, - CreateOrReplaceOptions, - DeleteOperationOptions, - ExportOperationOptions, + Versions, + CreateOrReplaceOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/index.ts index 8833bd04b9..cf55de4ed4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { User, ExportedUser } from "./models.js"; +export { User, ExportedUser, Versions } from "./models.js"; export { - CreateOrReplaceOptions, - DeleteOperationOptions, - ExportOperationOptions, + CreateOrReplaceOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/models.ts index 6f96699a94..215937603c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/models.ts @@ -16,3 +16,7 @@ export interface ExportedUser { /** The exported URI. */ resourceUri: string; } + +/** The API version. */ +/** */ +export type Versions = "2022-12-01-preview"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/options.ts index 0d0e816943..3576dcb57a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/models/options.ts @@ -3,17 +3,17 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface CreateOrReplaceOptions extends OperationOptions { +export interface CreateOrReplaceOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } -export interface DeleteOperationOptions extends OperationOptions { +export interface DeleteOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } -export interface ExportOperationOptions extends OperationOptions { +export interface ExportOptionalParams extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/clientDefinitions.ts index 9e0ef147d5..776ad1336a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/clientDefinitions.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/clientDefinitions.ts @@ -10,10 +10,10 @@ import { CreateOrReplace200Response, CreateOrReplace201Response, CreateOrReplaceDefaultResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, + Delete202Response, + DeleteDefaultResponse, + Export202Response, + ExportDefaultResponse, } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -29,18 +29,14 @@ export interface CreateOrReplace { /** Deletes a User */ delete( options?: DeleteParameters, - ): StreamableMethod< - DeleteOperation202Response | DeleteOperationDefaultResponse - >; + ): StreamableMethod; } export interface Export { /** Exports a User */ post( options: ExportParameters, - ): StreamableMethod< - ExportOperation202Response | ExportOperationDefaultResponse - >; + ): StreamableMethod; } export interface Routes { diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/isUnexpected.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/isUnexpected.ts index 49a3da69f9..a0718a9a17 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/isUnexpected.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/isUnexpected.ts @@ -6,12 +6,12 @@ import { CreateOrReplace201Response, CreateOrReplaceLogicalResponse, CreateOrReplaceDefaultResponse, - DeleteOperation202Response, + Delete202Response, DeleteLogicalResponse, - DeleteOperationDefaultResponse, - ExportOperation202Response, + DeleteDefaultResponse, + Export202Response, ExportLogicalResponse, - ExportOperationDefaultResponse, + ExportDefaultResponse, } from "./responses.js"; const responseMap: Record = { @@ -30,33 +30,27 @@ export function isUnexpected( | CreateOrReplaceDefaultResponse, ): response is CreateOrReplaceDefaultResponse; export function isUnexpected( - response: - | DeleteOperation202Response - | DeleteLogicalResponse - | DeleteOperationDefaultResponse, -): response is DeleteOperationDefaultResponse; + response: Delete202Response | DeleteLogicalResponse | DeleteDefaultResponse, +): response is DeleteDefaultResponse; export function isUnexpected( - response: - | ExportOperation202Response - | ExportLogicalResponse - | ExportOperationDefaultResponse, -): response is ExportOperationDefaultResponse; + response: Export202Response | ExportLogicalResponse | ExportDefaultResponse, +): response is ExportDefaultResponse; export function isUnexpected( response: | CreateOrReplace200Response | CreateOrReplace201Response | CreateOrReplaceLogicalResponse | CreateOrReplaceDefaultResponse - | DeleteOperation202Response + | Delete202Response | DeleteLogicalResponse - | DeleteOperationDefaultResponse - | ExportOperation202Response + | DeleteDefaultResponse + | Export202Response | ExportLogicalResponse - | ExportOperationDefaultResponse, + | ExportDefaultResponse, ): response is | CreateOrReplaceDefaultResponse - | DeleteOperationDefaultResponse - | ExportOperationDefaultResponse { + | DeleteDefaultResponse + | ExportDefaultResponse { const lroOriginal = response.headers["x-ms-original-url"]; const url = new URL(lroOriginal ?? response.request.url); const method = response.request.method; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/outputModels.ts index 3433683265..59ed42a7db 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/outputModels.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/outputModels.ts @@ -15,12 +15,8 @@ export interface UserOutput { export interface OperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; } @@ -29,12 +25,8 @@ export interface OperationStatusOutput { export interface ResourceOperationStatusOutput { /** The unique ID of the operation. */ id: string; - /** - * The status of the operation - * - * Possible values: "NotStarted", "Running", "Succeeded", "Failed", "Canceled" - */ - status: string; + /** The status of the operation */ + status: OperationStateOutput; /** Error object that describes the error when status is "Failed". */ error?: ErrorModel; /** The result of the operation. */ @@ -48,3 +40,11 @@ export interface ExportedUserOutput { /** The exported URI. */ resourceUri: string; } + +/** Enum describing allowed operation states. */ +export type OperationStateOutput = + | "NotStarted" + | "Running" + | "Succeeded" + | "Failed" + | "Canceled"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/pollingHelper.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/pollingHelper.ts index 5771f8b2f6..bbcdcc7242 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/pollingHelper.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/pollingHelper.ts @@ -16,11 +16,11 @@ import { CreateOrReplace201Response, CreateOrReplaceDefaultResponse, CreateOrReplaceLogicalResponse, - DeleteOperation202Response, - DeleteOperationDefaultResponse, + Delete202Response, + DeleteDefaultResponse, DeleteLogicalResponse, - ExportOperation202Response, - ExportOperationDefaultResponse, + Export202Response, + ExportDefaultResponse, ExportLogicalResponse, } from "./responses.js"; @@ -101,10 +101,10 @@ export interface SimplePollerLike< * @returns - A poller object to poll for operation state updates and eventually get the final response. */ export async function getLongRunningPoller< - TResult extends ExportLogicalResponse | ExportOperationDefaultResponse, + TResult extends ExportLogicalResponse | ExportDefaultResponse, >( client: Client, - initialResponse: ExportOperation202Response | ExportOperationDefaultResponse, + initialResponse: Export202Response | ExportDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< @@ -120,10 +120,10 @@ export async function getLongRunningPoller< options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller< - TResult extends DeleteLogicalResponse | DeleteOperationDefaultResponse, + TResult extends DeleteLogicalResponse | DeleteDefaultResponse, >( client: Client, - initialResponse: DeleteOperation202Response | DeleteOperationDefaultResponse, + initialResponse: Delete202Response | DeleteDefaultResponse, options?: CreateHttpPollerOptions>, ): Promise, TResult>>; export async function getLongRunningPoller( diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/responses.ts index f416a2db94..a4ae2fe1c1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/responses.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/rest/responses.ts @@ -50,27 +50,27 @@ export interface CreateOrReplaceLogicalResponse extends HttpResponse { body: UserOutput; } -export interface DeleteOperation202Headers { +export interface Delete202Headers { /** The location for monitoring the operation state. */ "operation-location": string; } /** The request has been accepted for processing, but processing has not yet completed. */ -export interface DeleteOperation202Response extends HttpResponse { +export interface Delete202Response extends HttpResponse { status: "202"; body: OperationStatusOutput; - headers: RawHttpHeaders & DeleteOperation202Headers; + headers: RawHttpHeaders & Delete202Headers; } -export interface DeleteOperationDefaultHeaders { +export interface DeleteDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface DeleteOperationDefaultResponse extends HttpResponse { +export interface DeleteDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & DeleteOperationDefaultHeaders; + headers: RawHttpHeaders & DeleteDefaultHeaders; } /** The final response for long-running delete operation */ @@ -79,27 +79,27 @@ export interface DeleteLogicalResponse extends HttpResponse { body: OperationStatusOutput; } -export interface ExportOperation202Headers { +export interface Export202Headers { /** The location for monitoring the operation state. */ "operation-location": string; } /** The request has been accepted for processing, but processing has not yet completed. */ -export interface ExportOperation202Response extends HttpResponse { +export interface Export202Response extends HttpResponse { status: "202"; body: ResourceOperationStatusOutput; - headers: RawHttpHeaders & ExportOperation202Headers; + headers: RawHttpHeaders & Export202Headers; } -export interface ExportOperationDefaultHeaders { +export interface ExportDefaultHeaders { /** String error code indicating what went wrong. */ "x-ms-error-code"?: string; } -export interface ExportOperationDefaultResponse extends HttpResponse { +export interface ExportDefaultResponse extends HttpResponse { status: string; body: ErrorResponse; - headers: RawHttpHeaders & ExportOperationDefaultHeaders; + headers: RawHttpHeaders & ExportDefaultHeaders; } /** The final response for long-running export operation */ diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/restorePollerHelpers.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/restorePollerHelpers.ts index e25677f5a3..53e5be40d7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/restorePollerHelpers.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/restorePollerHelpers.ts @@ -7,13 +7,13 @@ import { deserializeState, ResourceLocationConfig, } from "@azure/core-lro"; -import { StandardContext } from "./api/StandardContext.js"; -import { StandardClient } from "./StandardClient.js"; +import { StandardContext } from "./api/standardContext.js"; +import { StandardClient } from "./standardClient.js"; import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _createOrReplaceDeserialize, - _deleteOperationDeserialize, - _exportOperationDeserialize, + _$deleteDeserialize, + _$exportDeserialize, } from "./api/operations.js"; import { PathUncheckedResponse, @@ -81,9 +81,8 @@ export function restorePoller( const deserializeMap: Record = { "PUT /azure/core/lro/standard/users/{name}": _createOrReplaceDeserialize, - "DELETE /azure/core/lro/standard/users/{name}": _deleteOperationDeserialize, - "POST /azure/core/lro/standard/users/{name}:export": - _exportOperationDeserialize, + "DELETE /azure/core/lro/standard/users/{name}": _$deleteDeserialize, + "POST /azure/core/lro/standard/users/{name}:export": _$exportDeserialize, }; function getDeserializationHelper( diff --git a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/StandardClient.ts b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/standardClient.ts similarity index 55% rename from packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/StandardClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/standardClient.ts index c6182e0b45..6765e77d21 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/StandardClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/lro/standard/generated/src/standardClient.ts @@ -5,20 +5,20 @@ import { PollerLike, OperationState } from "@azure/core-lro"; import { Pipeline } from "@azure/core-rest-pipeline"; import { User, ExportedUser } from "./models/models.js"; import { - CreateOrReplaceOptions, - DeleteOperationOptions, - ExportOperationOptions, + CreateOrReplaceOptionalParams, + DeleteOptionalParams, + ExportOptionalParams, } from "./models/options.js"; import { createOrReplace, - deleteOperation, - exportOperation, + $delete, + $export, createStandard, StandardClientOptions, StandardContext, } from "./api/index.js"; -export { StandardClientOptions } from "./api/StandardContext.js"; +export { StandardClientOptions } from "./api/standardContext.js"; export class StandardClient { private _client: StandardContext; @@ -35,25 +35,35 @@ export class StandardClient { createOrReplace( name: string, resource: User, - options: CreateOrReplaceOptions = { requestOptions: {} }, + options: CreateOrReplaceOptionalParams = { requestOptions: {} }, ): PollerLike, User> { return createOrReplace(this._client, name, resource, options); } /** Deletes a User */ - deleteOperation( + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete( name: string, - options: DeleteOperationOptions = { requestOptions: {} }, + options: DeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return deleteOperation(this._client, name, options); + return $delete(this._client, name, options); } /** Exports a User */ - exportOperation( + /** + * @fixme export is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + export( name: string, format: string, - options: ExportOperationOptions = { requestOptions: {} }, + options: ExportOptionalParams = { requestOptions: {} }, ): PollerLike, ExportedUser> { - return exportOperation(this._client, name, format, options); + return $export(this._client, name, format, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/EmptyContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/emptyContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/EmptyContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/emptyContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/index.ts index b39654afee..ad1b600aa1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/index.ts @@ -5,5 +5,5 @@ export { createEmpty, EmptyClientOptions, EmptyContext, -} from "./EmptyContext.js"; +} from "./emptyContext.js"; export { putEmpty, getEmpty, postRoundTripEmpty } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/operations.ts index 386058d954..0354721661 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/api/operations.ts @@ -14,15 +14,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - PutEmptyOptions, - GetEmptyOptions, - PostRoundTripEmptyOptions, + PutEmptyOptionalParams, + GetEmptyOptionalParams, + PostRoundTripEmptyOptionalParams, } from "../models/options.js"; export function _putEmptySend( context: Client, input: EmptyInput, - options: PutEmptyOptions = { requestOptions: {} }, + options: PutEmptyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/empty/alone") @@ -42,7 +42,7 @@ export async function _putEmptyDeserialize( export async function putEmpty( context: Client, input: EmptyInput, - options: PutEmptyOptions = { requestOptions: {} }, + options: PutEmptyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putEmptySend(context, input, options); return _putEmptyDeserialize(result); @@ -50,7 +50,7 @@ export async function putEmpty( export function _getEmptySend( context: Client, - options: GetEmptyOptions = { requestOptions: {} }, + options: GetEmptyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/empty/alone") @@ -69,7 +69,7 @@ export async function _getEmptyDeserialize( export async function getEmpty( context: Client, - options: GetEmptyOptions = { requestOptions: {} }, + options: GetEmptyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getEmptySend(context, options); return _getEmptyDeserialize(result); @@ -78,7 +78,7 @@ export async function getEmpty( export function _postRoundTripEmptySend( context: Client, body: EmptyInputOutput, - options: PostRoundTripEmptyOptions = { requestOptions: {} }, + options: PostRoundTripEmptyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/empty/round-trip") @@ -98,7 +98,7 @@ export async function _postRoundTripEmptyDeserialize( export async function postRoundTripEmpty( context: Client, body: EmptyInputOutput, - options: PostRoundTripEmptyOptions = { requestOptions: {} }, + options: PostRoundTripEmptyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _postRoundTripEmptySend(context, body, options); return _postRoundTripEmptyDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/EmptyClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/emptyClient.ts similarity index 76% rename from packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/EmptyClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/emptyClient.ts index 6ce18a5601..c4b4a9c1d8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/EmptyClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/emptyClient.ts @@ -4,9 +4,9 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { EmptyInput, EmptyOutput, EmptyInputOutput } from "./models/models.js"; import { - PutEmptyOptions, - GetEmptyOptions, - PostRoundTripEmptyOptions, + PutEmptyOptionalParams, + GetEmptyOptionalParams, + PostRoundTripEmptyOptionalParams, } from "./models/options.js"; import { createEmpty, @@ -17,7 +17,7 @@ import { postRoundTripEmpty, } from "./api/index.js"; -export { EmptyClientOptions } from "./api/EmptyContext.js"; +export { EmptyClientOptions } from "./api/emptyContext.js"; export class EmptyClient { private _client: EmptyContext; @@ -32,20 +32,20 @@ export class EmptyClient { putEmpty( input: EmptyInput, - options: PutEmptyOptions = { requestOptions: {} }, + options: PutEmptyOptionalParams = { requestOptions: {} }, ): Promise { return putEmpty(this._client, input, options); } getEmpty( - options: GetEmptyOptions = { requestOptions: {} }, + options: GetEmptyOptionalParams = { requestOptions: {} }, ): Promise { return getEmpty(this._client, options); } postRoundTripEmpty( body: EmptyInputOutput, - options: PostRoundTripEmptyOptions = { requestOptions: {} }, + options: PostRoundTripEmptyOptionalParams = { requestOptions: {} }, ): Promise { return postRoundTripEmpty(this._client, body, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/index.ts index 8fb80781ef..6e8060d049 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/index.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { EmptyClient, EmptyClientOptions } from "./EmptyClient.js"; +export { EmptyClient, EmptyClientOptions } from "./emptyClient.js"; export { EmptyInput, EmptyOutput, EmptyInputOutput, - PutEmptyOptions, - GetEmptyOptions, - PostRoundTripEmptyOptions, + PutEmptyOptionalParams, + GetEmptyOptionalParams, + PostRoundTripEmptyOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/index.ts index 60532281af..544b016d45 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/index.ts @@ -3,7 +3,7 @@ export { EmptyInput, EmptyOutput, EmptyInputOutput } from "./models.js"; export { - PutEmptyOptions, - GetEmptyOptions, - PostRoundTripEmptyOptions, + PutEmptyOptionalParams, + GetEmptyOptionalParams, + PostRoundTripEmptyOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/options.ts index a8c2176b04..850f40f85c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/empty/generated/src/models/options.ts @@ -3,8 +3,8 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface PutEmptyOptions extends OperationOptions {} +export interface PutEmptyOptionalParams extends OperationOptions {} -export interface GetEmptyOptions extends OperationOptions {} +export interface GetEmptyOptionalParams extends OperationOptions {} -export interface PostRoundTripEmptyOptions extends OperationOptions {} +export interface PostRoundTripEmptyOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/package.json b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/package.json index 0169541f9d..0090160ec5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/EnumDiscriminatorContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/enumDiscriminatorContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/EnumDiscriminatorContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/enumDiscriminatorContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/index.ts index 10298b21ae..8691b19a81 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/index.ts @@ -5,7 +5,7 @@ export { createEnumDiscriminator, EnumDiscriminatorClientOptions, EnumDiscriminatorContext, -} from "./EnumDiscriminatorContext.js"; +} from "./enumDiscriminatorContext.js"; export { getExtensibleModel, putExtensibleModel, diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/operations.ts index 62af239ab9..465b7ef294 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/api/operations.ts @@ -19,19 +19,19 @@ import { createRestError, } from "@azure-rest/core-client"; import { - GetExtensibleModelOptions, - PutExtensibleModelOptions, - GetExtensibleModelMissingDiscriminatorOptions, - GetExtensibleModelWrongDiscriminatorOptions, - GetFixedModelOptions, - PutFixedModelOptions, - GetFixedModelMissingDiscriminatorOptions, - GetFixedModelWrongDiscriminatorOptions, + GetExtensibleModelOptionalParams, + PutExtensibleModelOptionalParams, + GetExtensibleModelMissingDiscriminatorOptionalParams, + GetExtensibleModelWrongDiscriminatorOptionalParams, + GetFixedModelOptionalParams, + PutFixedModelOptionalParams, + GetFixedModelMissingDiscriminatorOptionalParams, + GetFixedModelWrongDiscriminatorOptionalParams, } from "../models/options.js"; export function _getExtensibleModelSend( context: Client, - options: GetExtensibleModelOptions = { requestOptions: {} }, + options: GetExtensibleModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/enum-discriminator/extensible-enum") @@ -51,7 +51,7 @@ export async function _getExtensibleModelDeserialize( /** Receive model with extensible enum discriminator type. */ export async function getExtensibleModel( context: Client, - options: GetExtensibleModelOptions = { requestOptions: {} }, + options: GetExtensibleModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getExtensibleModelSend(context, options); return _getExtensibleModelDeserialize(result); @@ -60,7 +60,7 @@ export async function getExtensibleModel( export function _putExtensibleModelSend( context: Client, input: DogUnion, - options: PutExtensibleModelOptions = { requestOptions: {} }, + options: PutExtensibleModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/enum-discriminator/extensible-enum") @@ -81,7 +81,7 @@ export async function _putExtensibleModelDeserialize( export async function putExtensibleModel( context: Client, input: DogUnion, - options: PutExtensibleModelOptions = { requestOptions: {} }, + options: PutExtensibleModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putExtensibleModelSend(context, input, options); return _putExtensibleModelDeserialize(result); @@ -89,7 +89,7 @@ export async function putExtensibleModel( export function _getExtensibleModelMissingDiscriminatorSend( context: Client, - options: GetExtensibleModelMissingDiscriminatorOptions = { + options: GetExtensibleModelMissingDiscriminatorOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -113,7 +113,7 @@ export async function _getExtensibleModelMissingDiscriminatorDeserialize( /** Get a model omitting the discriminator. */ export async function getExtensibleModelMissingDiscriminator( context: Client, - options: GetExtensibleModelMissingDiscriminatorOptions = { + options: GetExtensibleModelMissingDiscriminatorOptionalParams = { requestOptions: {}, }, ): Promise { @@ -126,7 +126,9 @@ export async function getExtensibleModelMissingDiscriminator( export function _getExtensibleModelWrongDiscriminatorSend( context: Client, - options: GetExtensibleModelWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetExtensibleModelWrongDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( @@ -148,7 +150,9 @@ export async function _getExtensibleModelWrongDiscriminatorDeserialize( /** Get a model containing discriminator value never defined. */ export async function getExtensibleModelWrongDiscriminator( context: Client, - options: GetExtensibleModelWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetExtensibleModelWrongDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getExtensibleModelWrongDiscriminatorSend( context, @@ -159,7 +163,7 @@ export async function getExtensibleModelWrongDiscriminator( export function _getFixedModelSend( context: Client, - options: GetFixedModelOptions = { requestOptions: {} }, + options: GetFixedModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/enum-discriminator/fixed-enum") @@ -179,7 +183,7 @@ export async function _getFixedModelDeserialize( /** Receive model with fixed enum discriminator type. */ export async function getFixedModel( context: Client, - options: GetFixedModelOptions = { requestOptions: {} }, + options: GetFixedModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getFixedModelSend(context, options); return _getFixedModelDeserialize(result); @@ -188,7 +192,7 @@ export async function getFixedModel( export function _putFixedModelSend( context: Client, input: SnakeUnion, - options: PutFixedModelOptions = { requestOptions: {} }, + options: PutFixedModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/enum-discriminator/fixed-enum") @@ -209,7 +213,7 @@ export async function _putFixedModelDeserialize( export async function putFixedModel( context: Client, input: SnakeUnion, - options: PutFixedModelOptions = { requestOptions: {} }, + options: PutFixedModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putFixedModelSend(context, input, options); return _putFixedModelDeserialize(result); @@ -217,7 +221,9 @@ export async function putFixedModel( export function _getFixedModelMissingDiscriminatorSend( context: Client, - options: GetFixedModelMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetFixedModelMissingDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( @@ -239,7 +245,9 @@ export async function _getFixedModelMissingDiscriminatorDeserialize( /** Get a model omitting the discriminator. */ export async function getFixedModelMissingDiscriminator( context: Client, - options: GetFixedModelMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetFixedModelMissingDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getFixedModelMissingDiscriminatorSend(context, options); return _getFixedModelMissingDiscriminatorDeserialize(result); @@ -247,7 +255,9 @@ export async function getFixedModelMissingDiscriminator( export function _getFixedModelWrongDiscriminatorSend( context: Client, - options: GetFixedModelWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetFixedModelWrongDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path( @@ -269,7 +279,9 @@ export async function _getFixedModelWrongDiscriminatorDeserialize( /** Get a model containing discriminator value never defined. */ export async function getFixedModelWrongDiscriminator( context: Client, - options: GetFixedModelWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetFixedModelWrongDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _getFixedModelWrongDiscriminatorSend(context, options); return _getFixedModelWrongDiscriminatorDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/EnumDiscriminatorClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/enumDiscriminatorClient.ts similarity index 71% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/EnumDiscriminatorClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/enumDiscriminatorClient.ts index 8b8c124e8f..0c7a1e9aa0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/EnumDiscriminatorClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/enumDiscriminatorClient.ts @@ -4,14 +4,14 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { DogUnion, SnakeUnion } from "./models/models.js"; import { - GetExtensibleModelOptions, - PutExtensibleModelOptions, - GetExtensibleModelMissingDiscriminatorOptions, - GetExtensibleModelWrongDiscriminatorOptions, - GetFixedModelOptions, - PutFixedModelOptions, - GetFixedModelMissingDiscriminatorOptions, - GetFixedModelWrongDiscriminatorOptions, + GetExtensibleModelOptionalParams, + PutExtensibleModelOptionalParams, + GetExtensibleModelMissingDiscriminatorOptionalParams, + GetExtensibleModelWrongDiscriminatorOptionalParams, + GetFixedModelOptionalParams, + PutFixedModelOptionalParams, + GetFixedModelMissingDiscriminatorOptionalParams, + GetFixedModelWrongDiscriminatorOptionalParams, } from "./models/options.js"; import { createEnumDiscriminator, @@ -27,7 +27,7 @@ import { getFixedModelWrongDiscriminator, } from "./api/index.js"; -export { EnumDiscriminatorClientOptions } from "./api/EnumDiscriminatorContext.js"; +export { EnumDiscriminatorClientOptions } from "./api/enumDiscriminatorContext.js"; export class EnumDiscriminatorClient { private _client: EnumDiscriminatorContext; @@ -42,7 +42,7 @@ export class EnumDiscriminatorClient { /** Receive model with extensible enum discriminator type. */ getExtensibleModel( - options: GetExtensibleModelOptions = { requestOptions: {} }, + options: GetExtensibleModelOptionalParams = { requestOptions: {} }, ): Promise { return getExtensibleModel(this._client, options); } @@ -50,14 +50,14 @@ export class EnumDiscriminatorClient { /** Send model with extensible enum discriminator type. */ putExtensibleModel( input: DogUnion, - options: PutExtensibleModelOptions = { requestOptions: {} }, + options: PutExtensibleModelOptionalParams = { requestOptions: {} }, ): Promise { return putExtensibleModel(this._client, input, options); } /** Get a model omitting the discriminator. */ getExtensibleModelMissingDiscriminator( - options: GetExtensibleModelMissingDiscriminatorOptions = { + options: GetExtensibleModelMissingDiscriminatorOptionalParams = { requestOptions: {}, }, ): Promise { @@ -66,7 +66,7 @@ export class EnumDiscriminatorClient { /** Get a model containing discriminator value never defined. */ getExtensibleModelWrongDiscriminator( - options: GetExtensibleModelWrongDiscriminatorOptions = { + options: GetExtensibleModelWrongDiscriminatorOptionalParams = { requestOptions: {}, }, ): Promise { @@ -75,7 +75,7 @@ export class EnumDiscriminatorClient { /** Receive model with fixed enum discriminator type. */ getFixedModel( - options: GetFixedModelOptions = { requestOptions: {} }, + options: GetFixedModelOptionalParams = { requestOptions: {} }, ): Promise { return getFixedModel(this._client, options); } @@ -83,21 +83,25 @@ export class EnumDiscriminatorClient { /** Send model with fixed enum discriminator type. */ putFixedModel( input: SnakeUnion, - options: PutFixedModelOptions = { requestOptions: {} }, + options: PutFixedModelOptionalParams = { requestOptions: {} }, ): Promise { return putFixedModel(this._client, input, options); } /** Get a model omitting the discriminator. */ getFixedModelMissingDiscriminator( - options: GetFixedModelMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetFixedModelMissingDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): Promise { return getFixedModelMissingDiscriminator(this._client, options); } /** Get a model containing discriminator value never defined. */ getFixedModelWrongDiscriminator( - options: GetFixedModelWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetFixedModelWrongDiscriminatorOptionalParams = { + requestOptions: {}, + }, ): Promise { return getFixedModelWrongDiscriminator(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/index.ts index 4bafe56c02..5d08356c79 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/index.ts @@ -4,7 +4,7 @@ export { EnumDiscriminatorClient, EnumDiscriminatorClientOptions, -} from "./EnumDiscriminatorClient.js"; +} from "./enumDiscriminatorClient.js"; export { Dog, Golden, @@ -14,12 +14,12 @@ export { SnakeKind, DogUnion, SnakeUnion, - GetExtensibleModelOptions, - PutExtensibleModelOptions, - GetExtensibleModelMissingDiscriminatorOptions, - GetExtensibleModelWrongDiscriminatorOptions, - GetFixedModelOptions, - PutFixedModelOptions, - GetFixedModelMissingDiscriminatorOptions, - GetFixedModelWrongDiscriminatorOptions, + GetExtensibleModelOptionalParams, + PutExtensibleModelOptionalParams, + GetExtensibleModelMissingDiscriminatorOptionalParams, + GetExtensibleModelWrongDiscriminatorOptionalParams, + GetFixedModelOptionalParams, + PutFixedModelOptionalParams, + GetFixedModelMissingDiscriminatorOptionalParams, + GetFixedModelWrongDiscriminatorOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/index.ts index aee8d69066..c9e3ac9aad 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/index.ts @@ -12,12 +12,12 @@ export { SnakeUnion, } from "./models.js"; export { - GetExtensibleModelOptions, - PutExtensibleModelOptions, - GetExtensibleModelMissingDiscriminatorOptions, - GetExtensibleModelWrongDiscriminatorOptions, - GetFixedModelOptions, - PutFixedModelOptions, - GetFixedModelMissingDiscriminatorOptions, - GetFixedModelWrongDiscriminatorOptions, + GetExtensibleModelOptionalParams, + PutExtensibleModelOptionalParams, + GetExtensibleModelMissingDiscriminatorOptionalParams, + GetExtensibleModelWrongDiscriminatorOptionalParams, + GetFixedModelOptionalParams, + PutFixedModelOptionalParams, + GetFixedModelMissingDiscriminatorOptionalParams, + GetFixedModelWrongDiscriminatorOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/options.ts index 0e12cf19a4..c95d87d29a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/models/options.ts @@ -3,22 +3,22 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface GetExtensibleModelOptions extends OperationOptions {} +export interface GetExtensibleModelOptionalParams extends OperationOptions {} -export interface PutExtensibleModelOptions extends OperationOptions {} +export interface PutExtensibleModelOptionalParams extends OperationOptions {} -export interface GetExtensibleModelMissingDiscriminatorOptions +export interface GetExtensibleModelMissingDiscriminatorOptionalParams extends OperationOptions {} -export interface GetExtensibleModelWrongDiscriminatorOptions +export interface GetExtensibleModelWrongDiscriminatorOptionalParams extends OperationOptions {} -export interface GetFixedModelOptions extends OperationOptions {} +export interface GetFixedModelOptionalParams extends OperationOptions {} -export interface PutFixedModelOptions extends OperationOptions {} +export interface PutFixedModelOptionalParams extends OperationOptions {} -export interface GetFixedModelMissingDiscriminatorOptions +export interface GetFixedModelMissingDiscriminatorOptionalParams extends OperationOptions {} -export interface GetFixedModelWrongDiscriminatorOptions +export interface GetFixedModelWrongDiscriminatorOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/models.ts index a6250ca794..c6456677fa 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/models.ts @@ -18,7 +18,7 @@ export interface Golden extends DogParent { export interface SnakeParent { /** Length of the snake */ length: number; - kind: "cobra"; + kind: SnakeKind; } /** Cobra model */ @@ -33,3 +33,5 @@ export type Dog = DogParent | Golden; export type Snake = SnakeParent | Cobra; /** Alias for DogKind */ export type DogKind = string | "golden"; +/** fixed enum type for discriminator */ +export type SnakeKind = "cobra"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/outputModels.ts index d765ae0b55..a948d44a55 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/outputModels.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/enum-discriminator/src/rest/outputModels.ts @@ -18,7 +18,7 @@ export interface GoldenOutput extends DogOutputParent { export interface SnakeOutputParent { /** Length of the snake */ length: number; - kind: "cobra"; + kind: SnakeKindOutput; } /** Cobra model */ @@ -33,3 +33,5 @@ export type DogOutput = DogOutputParent | GoldenOutput; export type SnakeOutput = SnakeOutputParent | CobraOutput; /** Alias for DogKindOutput */ export type DogKindOutput = string | "golden"; +/** fixed enum type for discriminator */ +export type SnakeKindOutput = "cobra"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/package.json b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/package.json index 9e4958c610..9c8e40a70c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/index.ts index e187133c82..d1c0eef4e4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/index.ts @@ -5,7 +5,7 @@ export { createNestedDiscriminator, NestedDiscriminatorClientOptions, NestedDiscriminatorContext, -} from "./NestedDiscriminatorContext.js"; +} from "./nestedDiscriminatorContext.js"; export { getModel, putModel, diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/NestedDiscriminatorContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/nestedDiscriminatorContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/NestedDiscriminatorContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/nestedDiscriminatorContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/operations.ts index 0eb90c3a14..918f5029f5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/api/operations.ts @@ -17,17 +17,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, } from "../models/options.js"; export function _getModelSend( context: Client, - options: GetModelOptions = { requestOptions: {} }, + options: GetModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/nested-discriminator/model") @@ -46,7 +46,7 @@ export async function _getModelDeserialize( export async function getModel( context: Client, - options: GetModelOptions = { requestOptions: {} }, + options: GetModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getModelSend(context, options); return _getModelDeserialize(result); @@ -55,7 +55,7 @@ export async function getModel( export function _putModelSend( context: Client, input: FishUnion, - options: PutModelOptions = { requestOptions: {} }, + options: PutModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/nested-discriminator/model") @@ -75,7 +75,7 @@ export async function _putModelDeserialize( export async function putModel( context: Client, input: FishUnion, - options: PutModelOptions = { requestOptions: {} }, + options: PutModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putModelSend(context, input, options); return _putModelDeserialize(result); @@ -83,7 +83,7 @@ export async function putModel( export function _getRecursiveModelSend( context: Client, - options: GetRecursiveModelOptions = { requestOptions: {} }, + options: GetRecursiveModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/nested-discriminator/recursivemodel") @@ -102,7 +102,7 @@ export async function _getRecursiveModelDeserialize( export async function getRecursiveModel( context: Client, - options: GetRecursiveModelOptions = { requestOptions: {} }, + options: GetRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getRecursiveModelSend(context, options); return _getRecursiveModelDeserialize(result); @@ -111,7 +111,7 @@ export async function getRecursiveModel( export function _putRecursiveModelSend( context: Client, input: FishUnion, - options: PutRecursiveModelOptions = { requestOptions: {} }, + options: PutRecursiveModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/nested-discriminator/recursivemodel") @@ -131,7 +131,7 @@ export async function _putRecursiveModelDeserialize( export async function putRecursiveModel( context: Client, input: FishUnion, - options: PutRecursiveModelOptions = { requestOptions: {} }, + options: PutRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putRecursiveModelSend(context, input, options); return _putRecursiveModelDeserialize(result); @@ -139,7 +139,7 @@ export async function putRecursiveModel( export function _getMissingDiscriminatorSend( context: Client, - options: GetMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetMissingDiscriminatorOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/nested-discriminator/missingdiscriminator") @@ -158,7 +158,7 @@ export async function _getMissingDiscriminatorDeserialize( export async function getMissingDiscriminator( context: Client, - options: GetMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetMissingDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getMissingDiscriminatorSend(context, options); return _getMissingDiscriminatorDeserialize(result); @@ -166,7 +166,7 @@ export async function getMissingDiscriminator( export function _getWrongDiscriminatorSend( context: Client, - options: GetWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetWrongDiscriminatorOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/nested-discriminator/wrongdiscriminator") @@ -185,7 +185,7 @@ export async function _getWrongDiscriminatorDeserialize( export async function getWrongDiscriminator( context: Client, - options: GetWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetWrongDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getWrongDiscriminatorSend(context, options); return _getWrongDiscriminatorDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/index.ts index d16e2b1593..9235347a3a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/index.ts @@ -4,7 +4,7 @@ export { NestedDiscriminatorClient, NestedDiscriminatorClientOptions, -} from "./NestedDiscriminatorClient.js"; +} from "./nestedDiscriminatorClient.js"; export { Fish, Shark, @@ -13,10 +13,10 @@ export { Salmon, FishUnion, SharkUnion, - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/index.ts index e1422e5c01..ea38c643e8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/index.ts @@ -11,10 +11,10 @@ export { SharkUnion, } from "./models.js"; export { - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/options.ts index 642f81b5a8..21f28f2851 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/models/options.ts @@ -3,14 +3,15 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface GetModelOptions extends OperationOptions {} +export interface GetModelOptionalParams extends OperationOptions {} -export interface PutModelOptions extends OperationOptions {} +export interface PutModelOptionalParams extends OperationOptions {} -export interface GetRecursiveModelOptions extends OperationOptions {} +export interface GetRecursiveModelOptionalParams extends OperationOptions {} -export interface PutRecursiveModelOptions extends OperationOptions {} +export interface PutRecursiveModelOptionalParams extends OperationOptions {} -export interface GetMissingDiscriminatorOptions extends OperationOptions {} +export interface GetMissingDiscriminatorOptionalParams + extends OperationOptions {} -export interface GetWrongDiscriminatorOptions extends OperationOptions {} +export interface GetWrongDiscriminatorOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/NestedDiscriminatorClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/nestedDiscriminatorClient.ts similarity index 69% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/NestedDiscriminatorClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/nestedDiscriminatorClient.ts index 6426ec7791..b15a3b3b80 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/NestedDiscriminatorClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/nested-discriminator/src/nestedDiscriminatorClient.ts @@ -4,12 +4,12 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { FishUnion } from "./models/models.js"; import { - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, } from "./models/options.js"; import { createNestedDiscriminator, @@ -23,7 +23,7 @@ import { getWrongDiscriminator, } from "./api/index.js"; -export { NestedDiscriminatorClientOptions } from "./api/NestedDiscriminatorContext.js"; +export { NestedDiscriminatorClientOptions } from "./api/nestedDiscriminatorContext.js"; export class NestedDiscriminatorClient { private _client: NestedDiscriminatorContext; @@ -37,39 +37,39 @@ export class NestedDiscriminatorClient { } getModel( - options: GetModelOptions = { requestOptions: {} }, + options: GetModelOptionalParams = { requestOptions: {} }, ): Promise { return getModel(this._client, options); } putModel( input: FishUnion, - options: PutModelOptions = { requestOptions: {} }, + options: PutModelOptionalParams = { requestOptions: {} }, ): Promise { return putModel(this._client, input, options); } getRecursiveModel( - options: GetRecursiveModelOptions = { requestOptions: {} }, + options: GetRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { return getRecursiveModel(this._client, options); } putRecursiveModel( input: FishUnion, - options: PutRecursiveModelOptions = { requestOptions: {} }, + options: PutRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { return putRecursiveModel(this._client, input, options); } getMissingDiscriminator( - options: GetMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetMissingDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { return getMissingDiscriminator(this._client, options); } getWrongDiscriminator( - options: GetWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetWrongDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { return getWrongDiscriminator(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/package.json b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/package.json index 7b918c1c25..2095c70212 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/index.ts index 0916dae973..5cfa860ed9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/index.ts @@ -5,5 +5,5 @@ export { createNotDiscriminated, NotDiscriminatedClientOptions, NotDiscriminatedContext, -} from "./NotDiscriminatedContext.js"; +} from "./notDiscriminatedContext.js"; export { postValid, getValid, putValid } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/NotDiscriminatedContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/notDiscriminatedContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/NotDiscriminatedContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/notDiscriminatedContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/operations.ts index a4c0776297..4269887c22 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/api/operations.ts @@ -14,15 +14,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - PostValidOptions, - GetValidOptions, - PutValidOptions, + PostValidOptionalParams, + GetValidOptionalParams, + PutValidOptionalParams, } from "../models/options.js"; export function _postValidSend( context: Client, input: Siamese, - options: PostValidOptions = { requestOptions: {} }, + options: PostValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/not-discriminated/valid") @@ -45,7 +45,7 @@ export async function _postValidDeserialize( export async function postValid( context: Client, input: Siamese, - options: PostValidOptions = { requestOptions: {} }, + options: PostValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _postValidSend(context, input, options); return _postValidDeserialize(result); @@ -53,7 +53,7 @@ export async function postValid( export function _getValidSend( context: Client, - options: GetValidOptions = { requestOptions: {} }, + options: GetValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/not-discriminated/valid") @@ -76,7 +76,7 @@ export async function _getValidDeserialize( export async function getValid( context: Client, - options: GetValidOptions = { requestOptions: {} }, + options: GetValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getValidSend(context, options); return _getValidDeserialize(result); @@ -85,7 +85,7 @@ export async function getValid( export function _putValidSend( context: Client, input: Siamese, - options: PutValidOptions = { requestOptions: {} }, + options: PutValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/not-discriminated/valid") @@ -112,7 +112,7 @@ export async function _putValidDeserialize( export async function putValid( context: Client, input: Siamese, - options: PutValidOptions = { requestOptions: {} }, + options: PutValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putValidSend(context, input, options); return _putValidDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/index.ts index 40ed01945c..7ebaafafa3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/index.ts @@ -4,12 +4,12 @@ export { NotDiscriminatedClient, NotDiscriminatedClientOptions, -} from "./NotDiscriminatedClient.js"; +} from "./notDiscriminatedClient.js"; export { Pet, Cat, Siamese, - PostValidOptions, - GetValidOptions, - PutValidOptions, + PostValidOptionalParams, + GetValidOptionalParams, + PutValidOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/index.ts index a0cfc96046..37535e516d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/index.ts @@ -3,7 +3,7 @@ export { Pet, Cat, Siamese } from "./models.js"; export { - PostValidOptions, - GetValidOptions, - PutValidOptions, + PostValidOptionalParams, + GetValidOptionalParams, + PutValidOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/options.ts index fbbce24029..b027c4aca2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/models/options.ts @@ -3,8 +3,8 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface PostValidOptions extends OperationOptions {} +export interface PostValidOptionalParams extends OperationOptions {} -export interface GetValidOptions extends OperationOptions {} +export interface GetValidOptionalParams extends OperationOptions {} -export interface PutValidOptions extends OperationOptions {} +export interface PutValidOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/NotDiscriminatedClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/notDiscriminatedClient.ts similarity index 76% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/NotDiscriminatedClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/notDiscriminatedClient.ts index eff7a4a78b..d2719baa0e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/NotDiscriminatedClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/not-discriminated/src/notDiscriminatedClient.ts @@ -4,9 +4,9 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { Siamese } from "./models/models.js"; import { - PostValidOptions, - GetValidOptions, - PutValidOptions, + PostValidOptionalParams, + GetValidOptionalParams, + PutValidOptionalParams, } from "./models/options.js"; import { createNotDiscriminated, @@ -17,7 +17,7 @@ import { putValid, } from "./api/index.js"; -export { NotDiscriminatedClientOptions } from "./api/NotDiscriminatedContext.js"; +export { NotDiscriminatedClientOptions } from "./api/notDiscriminatedContext.js"; export class NotDiscriminatedClient { private _client: NotDiscriminatedContext; @@ -32,20 +32,20 @@ export class NotDiscriminatedClient { postValid( input: Siamese, - options: PostValidOptions = { requestOptions: {} }, + options: PostValidOptionalParams = { requestOptions: {} }, ): Promise { return postValid(this._client, input, options); } getValid( - options: GetValidOptions = { requestOptions: {} }, + options: GetValidOptionalParams = { requestOptions: {} }, ): Promise { return getValid(this._client, options); } putValid( input: Siamese, - options: PutValidOptions = { requestOptions: {} }, + options: PutValidOptionalParams = { requestOptions: {} }, ): Promise { return putValid(this._client, input, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/index.ts index 34d0cb6a99..4cab4e094e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/index.ts @@ -6,4 +6,4 @@ export { createRecursive, RecursiveClientOptions, RecursiveContext, -} from "./RecursiveContext.js"; +} from "./recursiveContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/operations.ts index d925a22432..dace3c508e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/operations.ts @@ -12,12 +12,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { PutOptions, GetOptions } from "../models/options.js"; +import { PutOptionalParams, GetOptionalParams } from "../models/options.js"; export function _putSend( context: Client, input: Extension, - options: PutOptions = { requestOptions: {} }, + options: PutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/recursive") @@ -47,7 +47,7 @@ export async function _putDeserialize(result: Put204Response): Promise { export async function put( context: Client, input: Extension, - options: PutOptions = { requestOptions: {} }, + options: PutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putSend(context, input, options); return _putDeserialize(result); @@ -55,7 +55,7 @@ export async function put( export function _getSend( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/recursive") @@ -83,7 +83,7 @@ export async function _getDeserialize( export async function get( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, options); return _getDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/RecursiveContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/recursiveContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/RecursiveContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/api/recursiveContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/index.ts index 171463ee12..568e537a39 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/index.ts @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { RecursiveClient, RecursiveClientOptions } from "./RecursiveClient.js"; -export { Element, Extension, PutOptions, GetOptions } from "./models/index.js"; +export { RecursiveClient, RecursiveClientOptions } from "./recursiveClient.js"; +export { + Element, + Extension, + PutOptionalParams, + GetOptionalParams, +} from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/index.ts index 28a14df797..6d2e77c22d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. export { Element, Extension } from "./models.js"; -export { PutOptions, GetOptions } from "./options.js"; +export { PutOptionalParams, GetOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/options.ts index 8808a0e460..c23d4be003 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface PutOptions extends OperationOptions {} +export interface PutOptionalParams extends OperationOptions {} -export interface GetOptions extends OperationOptions {} +export interface GetOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/RecursiveClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/recursiveClient.ts similarity index 74% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/RecursiveClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/recursiveClient.ts index 8cbe0695c7..3a876dce61 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/RecursiveClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/recursive/generated/src/recursiveClient.ts @@ -3,7 +3,7 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { Extension } from "./models/models.js"; -import { PutOptions, GetOptions } from "./models/options.js"; +import { PutOptionalParams, GetOptionalParams } from "./models/options.js"; import { put, get, @@ -12,7 +12,7 @@ import { RecursiveContext, } from "./api/index.js"; -export { RecursiveClientOptions } from "./api/RecursiveContext.js"; +export { RecursiveClientOptions } from "./api/recursiveContext.js"; export class RecursiveClient { private _client: RecursiveContext; @@ -27,12 +27,12 @@ export class RecursiveClient { put( input: Extension, - options: PutOptions = { requestOptions: {} }, + options: PutOptionalParams = { requestOptions: {} }, ): Promise { return put(this._client, input, options); } - get(options: GetOptions = { requestOptions: {} }): Promise { + get(options: GetOptionalParams = { requestOptions: {} }): Promise { return get(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/package.json b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/package.json index 3f852b7917..fbe015756e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/package.json +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/package.json @@ -24,7 +24,7 @@ "license": "MIT", "files": ["dist", "README.md", "LICENSE", "review/*"], "dependencies": { - "@azure-rest/core-client": "^1.2.0", + "@azure-rest/core-client": "^1.4.0", "@azure/core-auth": "^1.6.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", @@ -37,8 +37,8 @@ "eslint": "^8.55.0", "prettier": "^3.2.5", "rimraf": "^5.0.5", - "mkdirp": "^2.1.2", - "typescript": "~5.3.3", + "mkdirp": "^3.0.1", + "typescript": "~5.4.5", "tshy": "1.11.1" }, "scripts": { diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/index.ts index cd79ed4a1f..f24dac444f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/index.ts @@ -14,4 +14,4 @@ export { createSingleDiscriminator, SingleDiscriminatorClientOptions, SingleDiscriminatorContext, -} from "./SingleDiscriminatorContext.js"; +} from "./singleDiscriminatorContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/operations.ts index 0dfc4a351c..6f1c204703 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/operations.ts @@ -18,18 +18,18 @@ import { createRestError, } from "@azure-rest/core-client"; import { - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, - GetLegacyModelOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, + GetLegacyModelOptionalParams, } from "../models/options.js"; export function _getModelSend( context: Client, - options: GetModelOptions = { requestOptions: {} }, + options: GetModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/model") @@ -48,7 +48,7 @@ export async function _getModelDeserialize( export async function getModel( context: Client, - options: GetModelOptions = { requestOptions: {} }, + options: GetModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getModelSend(context, options); return _getModelDeserialize(result); @@ -57,7 +57,7 @@ export async function getModel( export function _putModelSend( context: Client, input: BirdUnion, - options: PutModelOptions = { requestOptions: {} }, + options: PutModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/model") @@ -77,7 +77,7 @@ export async function _putModelDeserialize( export async function putModel( context: Client, input: BirdUnion, - options: PutModelOptions = { requestOptions: {} }, + options: PutModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putModelSend(context, input, options); return _putModelDeserialize(result); @@ -85,7 +85,7 @@ export async function putModel( export function _getRecursiveModelSend( context: Client, - options: GetRecursiveModelOptions = { requestOptions: {} }, + options: GetRecursiveModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/recursivemodel") @@ -104,7 +104,7 @@ export async function _getRecursiveModelDeserialize( export async function getRecursiveModel( context: Client, - options: GetRecursiveModelOptions = { requestOptions: {} }, + options: GetRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getRecursiveModelSend(context, options); return _getRecursiveModelDeserialize(result); @@ -113,7 +113,7 @@ export async function getRecursiveModel( export function _putRecursiveModelSend( context: Client, input: BirdUnion, - options: PutRecursiveModelOptions = { requestOptions: {} }, + options: PutRecursiveModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/recursivemodel") @@ -133,7 +133,7 @@ export async function _putRecursiveModelDeserialize( export async function putRecursiveModel( context: Client, input: BirdUnion, - options: PutRecursiveModelOptions = { requestOptions: {} }, + options: PutRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _putRecursiveModelSend(context, input, options); return _putRecursiveModelDeserialize(result); @@ -141,7 +141,7 @@ export async function putRecursiveModel( export function _getMissingDiscriminatorSend( context: Client, - options: GetMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetMissingDiscriminatorOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/missingdiscriminator") @@ -160,7 +160,7 @@ export async function _getMissingDiscriminatorDeserialize( export async function getMissingDiscriminator( context: Client, - options: GetMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetMissingDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getMissingDiscriminatorSend(context, options); return _getMissingDiscriminatorDeserialize(result); @@ -168,7 +168,7 @@ export async function getMissingDiscriminator( export function _getWrongDiscriminatorSend( context: Client, - options: GetWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetWrongDiscriminatorOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/wrongdiscriminator") @@ -187,7 +187,7 @@ export async function _getWrongDiscriminatorDeserialize( export async function getWrongDiscriminator( context: Client, - options: GetWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetWrongDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getWrongDiscriminatorSend(context, options); return _getWrongDiscriminatorDeserialize(result); @@ -195,7 +195,7 @@ export async function getWrongDiscriminator( export function _getLegacyModelSend( context: Client, - options: GetLegacyModelOptions = { requestOptions: {} }, + options: GetLegacyModelOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/inheritance/single-discriminator/legacy-model") @@ -214,7 +214,7 @@ export async function _getLegacyModelDeserialize( export async function getLegacyModel( context: Client, - options: GetLegacyModelOptions = { requestOptions: {} }, + options: GetLegacyModelOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getLegacyModelSend(context, options); return _getLegacyModelDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/SingleDiscriminatorContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/singleDiscriminatorContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/SingleDiscriminatorContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/api/singleDiscriminatorContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/index.ts index e0819ff4e0..38c43d3aa9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/index.ts @@ -4,7 +4,7 @@ export { SingleDiscriminatorClient, SingleDiscriminatorClientOptions, -} from "./SingleDiscriminatorClient.js"; +} from "./singleDiscriminatorClient.js"; export { Bird, SeaGull, @@ -15,11 +15,11 @@ export { TRex, BirdUnion, DinosaurUnion, - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, - GetLegacyModelOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, + GetLegacyModelOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/index.ts index f3ab99e646..9ea7403d30 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/index.ts @@ -13,11 +13,11 @@ export { DinosaurUnion, } from "./models.js"; export { - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, - GetLegacyModelOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, + GetLegacyModelOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/options.ts index b8daabeeb9..467b22f905 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/models/options.ts @@ -3,16 +3,17 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface GetModelOptions extends OperationOptions {} +export interface GetModelOptionalParams extends OperationOptions {} -export interface PutModelOptions extends OperationOptions {} +export interface PutModelOptionalParams extends OperationOptions {} -export interface GetRecursiveModelOptions extends OperationOptions {} +export interface GetRecursiveModelOptionalParams extends OperationOptions {} -export interface PutRecursiveModelOptions extends OperationOptions {} +export interface PutRecursiveModelOptionalParams extends OperationOptions {} -export interface GetMissingDiscriminatorOptions extends OperationOptions {} +export interface GetMissingDiscriminatorOptionalParams + extends OperationOptions {} -export interface GetWrongDiscriminatorOptions extends OperationOptions {} +export interface GetWrongDiscriminatorOptionalParams extends OperationOptions {} -export interface GetLegacyModelOptions extends OperationOptions {} +export interface GetLegacyModelOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/SingleDiscriminatorClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/singleDiscriminatorClient.ts similarity index 68% rename from packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/SingleDiscriminatorClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/singleDiscriminatorClient.ts index d0c16ab383..0b9c47b882 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/SingleDiscriminatorClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/inheritance/single-discriminator/src/singleDiscriminatorClient.ts @@ -4,13 +4,13 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { BirdUnion, DinosaurUnion } from "./models/models.js"; import { - GetModelOptions, - PutModelOptions, - GetRecursiveModelOptions, - PutRecursiveModelOptions, - GetMissingDiscriminatorOptions, - GetWrongDiscriminatorOptions, - GetLegacyModelOptions, + GetModelOptionalParams, + PutModelOptionalParams, + GetRecursiveModelOptionalParams, + PutRecursiveModelOptionalParams, + GetMissingDiscriminatorOptionalParams, + GetWrongDiscriminatorOptionalParams, + GetLegacyModelOptionalParams, } from "./models/options.js"; import { getModel, @@ -25,7 +25,7 @@ import { SingleDiscriminatorContext, } from "./api/index.js"; -export { SingleDiscriminatorClientOptions } from "./api/SingleDiscriminatorContext.js"; +export { SingleDiscriminatorClientOptions } from "./api/singleDiscriminatorContext.js"; export class SingleDiscriminatorClient { private _client: SingleDiscriminatorContext; @@ -39,45 +39,45 @@ export class SingleDiscriminatorClient { } getModel( - options: GetModelOptions = { requestOptions: {} }, + options: GetModelOptionalParams = { requestOptions: {} }, ): Promise { return getModel(this._client, options); } putModel( input: BirdUnion, - options: PutModelOptions = { requestOptions: {} }, + options: PutModelOptionalParams = { requestOptions: {} }, ): Promise { return putModel(this._client, input, options); } getRecursiveModel( - options: GetRecursiveModelOptions = { requestOptions: {} }, + options: GetRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { return getRecursiveModel(this._client, options); } putRecursiveModel( input: BirdUnion, - options: PutRecursiveModelOptions = { requestOptions: {} }, + options: PutRecursiveModelOptionalParams = { requestOptions: {} }, ): Promise { return putRecursiveModel(this._client, input, options); } getMissingDiscriminator( - options: GetMissingDiscriminatorOptions = { requestOptions: {} }, + options: GetMissingDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { return getMissingDiscriminator(this._client, options); } getWrongDiscriminator( - options: GetWrongDiscriminatorOptions = { requestOptions: {} }, + options: GetWrongDiscriminatorOptionalParams = { requestOptions: {} }, ): Promise { return getWrongDiscriminator(this._client, options); } getLegacyModel( - options: GetLegacyModelOptions = { requestOptions: {} }, + options: GetLegacyModelOptionalParams = { requestOptions: {} }, ): Promise { return getLegacyModel(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/boolean/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/boolean/index.ts index 990bf2ecd2..3730d3cfc1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/boolean/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/boolean/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BooleanGetOptions, BooleanPutOptions } from "../../models/options.js"; +import { + BooleanGetOptionalParams, + BooleanPutOptionalParams, +} from "../../models/options.js"; export function _booleanGetSend( context: Client, - options: BooleanGetOptions = { requestOptions: {} }, + options: BooleanGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/boolean") @@ -38,7 +41,7 @@ export async function _booleanGetDeserialize( /** Get call */ export async function booleanGet( context: Client, - options: BooleanGetOptions = { requestOptions: {} }, + options: BooleanGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanGetSend(context, options); return _booleanGetDeserialize(result); @@ -47,7 +50,7 @@ export async function booleanGet( export function _booleanPutSend( context: Client, body: BooleanProperty, - options: BooleanPutOptions = { requestOptions: {} }, + options: BooleanPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/boolean") @@ -71,7 +74,7 @@ export async function _booleanPutDeserialize( export async function booleanPut( context: Client, body: BooleanProperty, - options: BooleanPutOptions = { requestOptions: {} }, + options: BooleanPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanPutSend(context, body, options); return _booleanPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/booleanLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/booleanLiteral/index.ts index 57f19428cf..13bd35516d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/booleanLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/booleanLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - BooleanLiteralGetOptions, - BooleanLiteralPutOptions, + BooleanLiteralGetOptionalParams, + BooleanLiteralPutOptionalParams, } from "../../models/options.js"; export function _booleanLiteralGetSend( context: Client, - options: BooleanLiteralGetOptions = { requestOptions: {} }, + options: BooleanLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/boolean/literal") @@ -41,7 +41,7 @@ export async function _booleanLiteralGetDeserialize( /** Get call */ export async function booleanLiteralGet( context: Client, - options: BooleanLiteralGetOptions = { requestOptions: {} }, + options: BooleanLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanLiteralGetSend(context, options); return _booleanLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function booleanLiteralGet( export function _booleanLiteralPutSend( context: Client, body: BooleanLiteralProperty, - options: BooleanLiteralPutOptions = { requestOptions: {} }, + options: BooleanLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/boolean/literal") @@ -74,7 +74,7 @@ export async function _booleanLiteralPutDeserialize( export async function booleanLiteralPut( context: Client, body: BooleanLiteralProperty, - options: BooleanLiteralPutOptions = { requestOptions: {} }, + options: BooleanLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanLiteralPutSend(context, body, options); return _booleanLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/bytes/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/bytes/index.ts index 101269f292..b7ed734526 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/bytes/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/bytes/index.ts @@ -13,11 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { stringToUint8Array, uint8ArrayToString } from "@azure/core-util"; -import { BytesGetOptions, BytesPutOptions } from "../../models/options.js"; +import { + BytesGetOptionalParams, + BytesPutOptionalParams, +} from "../../models/options.js"; export function _bytesGetSend( context: Client, - options: BytesGetOptions = { requestOptions: {} }, + options: BytesGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/bytes") @@ -42,7 +45,7 @@ export async function _bytesGetDeserialize( /** Get call */ export async function bytesGet( context: Client, - options: BytesGetOptions = { requestOptions: {} }, + options: BytesGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _bytesGetSend(context, options); return _bytesGetDeserialize(result); @@ -51,7 +54,7 @@ export async function bytesGet( export function _bytesPutSend( context: Client, body: BytesProperty, - options: BytesPutOptions = { requestOptions: {} }, + options: BytesPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/bytes") @@ -75,7 +78,7 @@ export async function _bytesPutDeserialize( export async function bytesPut( context: Client, body: BytesProperty, - options: BytesPutOptions = { requestOptions: {} }, + options: BytesPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _bytesPutSend(context, body, options); return _bytesPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsInt/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsInt/index.ts index e0b28812b7..86303bdd2c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsInt/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsInt/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - CollectionsIntGetOptions, - CollectionsIntPutOptions, + CollectionsIntGetOptionalParams, + CollectionsIntPutOptionalParams, } from "../../models/options.js"; export function _collectionsIntGetSend( context: Client, - options: CollectionsIntGetOptions = { requestOptions: {} }, + options: CollectionsIntGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/collections/int") @@ -41,7 +41,7 @@ export async function _collectionsIntGetDeserialize( /** Get call */ export async function collectionsIntGet( context: Client, - options: CollectionsIntGetOptions = { requestOptions: {} }, + options: CollectionsIntGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _collectionsIntGetSend(context, options); return _collectionsIntGetDeserialize(result); @@ -50,7 +50,7 @@ export async function collectionsIntGet( export function _collectionsIntPutSend( context: Client, body: CollectionsIntProperty, - options: CollectionsIntPutOptions = { requestOptions: {} }, + options: CollectionsIntPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/collections/int") @@ -74,7 +74,7 @@ export async function _collectionsIntPutDeserialize( export async function collectionsIntPut( context: Client, body: CollectionsIntProperty, - options: CollectionsIntPutOptions = { requestOptions: {} }, + options: CollectionsIntPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _collectionsIntPutSend(context, body, options); return _collectionsIntPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsModel/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsModel/index.ts index 7cc58ff20f..52066728eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsModel/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsModel/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - CollectionsModelGetOptions, - CollectionsModelPutOptions, + CollectionsModelGetOptionalParams, + CollectionsModelPutOptionalParams, } from "../../models/options.js"; export function _collectionsModelGetSend( context: Client, - options: CollectionsModelGetOptions = { requestOptions: {} }, + options: CollectionsModelGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/collections/model") @@ -41,7 +41,7 @@ export async function _collectionsModelGetDeserialize( /** Get call */ export async function collectionsModelGet( context: Client, - options: CollectionsModelGetOptions = { requestOptions: {} }, + options: CollectionsModelGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _collectionsModelGetSend(context, options); return _collectionsModelGetDeserialize(result); @@ -50,7 +50,7 @@ export async function collectionsModelGet( export function _collectionsModelPutSend( context: Client, body: CollectionsModelProperty, - options: CollectionsModelPutOptions = { requestOptions: {} }, + options: CollectionsModelPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/collections/model") @@ -76,7 +76,7 @@ export async function _collectionsModelPutDeserialize( export async function collectionsModelPut( context: Client, body: CollectionsModelProperty, - options: CollectionsModelPutOptions = { requestOptions: {} }, + options: CollectionsModelPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _collectionsModelPutSend(context, body, options); return _collectionsModelPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsString/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsString/index.ts index 06c73edaa6..6ab0360399 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsString/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/collectionsString/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - CollectionsStringGetOptions, - CollectionsStringPutOptions, + CollectionsStringGetOptionalParams, + CollectionsStringPutOptionalParams, } from "../../models/options.js"; export function _collectionsStringGetSend( context: Client, - options: CollectionsStringGetOptions = { requestOptions: {} }, + options: CollectionsStringGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/collections/string") @@ -41,7 +41,7 @@ export async function _collectionsStringGetDeserialize( /** Get call */ export async function collectionsStringGet( context: Client, - options: CollectionsStringGetOptions = { requestOptions: {} }, + options: CollectionsStringGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _collectionsStringGetSend(context, options); return _collectionsStringGetDeserialize(result); @@ -50,7 +50,7 @@ export async function collectionsStringGet( export function _collectionsStringPutSend( context: Client, body: CollectionsStringProperty, - options: CollectionsStringPutOptions = { requestOptions: {} }, + options: CollectionsStringPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/collections/string") @@ -74,7 +74,7 @@ export async function _collectionsStringPutDeserialize( export async function collectionsStringPut( context: Client, body: CollectionsStringProperty, - options: CollectionsStringPutOptions = { requestOptions: {} }, + options: CollectionsStringPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _collectionsStringPutSend(context, body, options); return _collectionsStringPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/datetime/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/datetime/index.ts index 680a111e5d..f5f9b561a8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/datetime/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/datetime/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DatetimeGetOptions, - DatetimePutOptions, + DatetimeGetOptionalParams, + DatetimePutOptionalParams, } from "../../models/options.js"; export function _datetimeGetSend( context: Client, - options: DatetimeGetOptions = { requestOptions: {} }, + options: DatetimeGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/datetime") @@ -41,7 +41,7 @@ export async function _datetimeGetDeserialize( /** Get call */ export async function datetimeGet( context: Client, - options: DatetimeGetOptions = { requestOptions: {} }, + options: DatetimeGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _datetimeGetSend(context, options); return _datetimeGetDeserialize(result); @@ -50,7 +50,7 @@ export async function datetimeGet( export function _datetimePutSend( context: Client, body: DatetimeProperty, - options: DatetimePutOptions = { requestOptions: {} }, + options: DatetimePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/datetime") @@ -74,7 +74,7 @@ export async function _datetimePutDeserialize( export async function datetimePut( context: Client, body: DatetimeProperty, - options: DatetimePutOptions = { requestOptions: {} }, + options: DatetimePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _datetimePutSend(context, body, options); return _datetimePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal/index.ts index d4c85ba14b..6017b69f83 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { DecimalGetOptions, DecimalPutOptions } from "../../models/options.js"; +import { + DecimalGetOptionalParams, + DecimalPutOptionalParams, +} from "../../models/options.js"; export function _decimalGetSend( context: Client, - options: DecimalGetOptions = { requestOptions: {} }, + options: DecimalGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/decimal") @@ -38,7 +41,7 @@ export async function _decimalGetDeserialize( /** Get call */ export async function decimalGet( context: Client, - options: DecimalGetOptions = { requestOptions: {} }, + options: DecimalGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalGetSend(context, options); return _decimalGetDeserialize(result); @@ -47,7 +50,7 @@ export async function decimalGet( export function _decimalPutSend( context: Client, body: DecimalProperty, - options: DecimalPutOptions = { requestOptions: {} }, + options: DecimalPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/decimal") @@ -71,7 +74,7 @@ export async function _decimalPutDeserialize( export async function decimalPut( context: Client, body: DecimalProperty, - options: DecimalPutOptions = { requestOptions: {} }, + options: DecimalPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalPutSend(context, body, options); return _decimalPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal128/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal128/index.ts index 738662a457..a3f7662273 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal128/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/decimal128/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Decimal128GetOptions, - Decimal128PutOptions, + Decimal128GetOptionalParams, + Decimal128PutOptionalParams, } from "../../models/options.js"; export function _decimal128GetSend( context: Client, - options: Decimal128GetOptions = { requestOptions: {} }, + options: Decimal128GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/decimal128") @@ -41,7 +41,7 @@ export async function _decimal128GetDeserialize( /** Get call */ export async function decimal128Get( context: Client, - options: Decimal128GetOptions = { requestOptions: {} }, + options: Decimal128GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimal128GetSend(context, options); return _decimal128GetDeserialize(result); @@ -50,7 +50,7 @@ export async function decimal128Get( export function _decimal128PutSend( context: Client, body: Decimal128Property, - options: Decimal128PutOptions = { requestOptions: {} }, + options: Decimal128PutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/decimal128") @@ -74,7 +74,7 @@ export async function _decimal128PutDeserialize( export async function decimal128Put( context: Client, body: Decimal128Property, - options: Decimal128PutOptions = { requestOptions: {} }, + options: Decimal128PutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimal128PutSend(context, body, options); return _decimal128PutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/dictionaryString/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/dictionaryString/index.ts index 9edb81de9d..d467152ca9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/dictionaryString/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/dictionaryString/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DictionaryStringGetOptions, - DictionaryStringPutOptions, + DictionaryStringGetOptionalParams, + DictionaryStringPutOptionalParams, } from "../../models/options.js"; export function _dictionaryStringGetSend( context: Client, - options: DictionaryStringGetOptions = { requestOptions: {} }, + options: DictionaryStringGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/dictionary/string") @@ -41,7 +41,7 @@ export async function _dictionaryStringGetDeserialize( /** Get call */ export async function dictionaryStringGet( context: Client, - options: DictionaryStringGetOptions = { requestOptions: {} }, + options: DictionaryStringGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _dictionaryStringGetSend(context, options); return _dictionaryStringGetDeserialize(result); @@ -50,7 +50,7 @@ export async function dictionaryStringGet( export function _dictionaryStringPutSend( context: Client, body: DictionaryStringProperty, - options: DictionaryStringPutOptions = { requestOptions: {} }, + options: DictionaryStringPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/dictionary/string") @@ -74,7 +74,7 @@ export async function _dictionaryStringPutDeserialize( export async function dictionaryStringPut( context: Client, body: DictionaryStringProperty, - options: DictionaryStringPutOptions = { requestOptions: {} }, + options: DictionaryStringPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _dictionaryStringPutSend(context, body, options); return _dictionaryStringPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/duration/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/duration/index.ts index 305ad3120e..8d7079ea83 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/duration/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/duration/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DurationGetOptions, - DurationPutOptions, + DurationGetOptionalParams, + DurationPutOptionalParams, } from "../../models/options.js"; export function _durationGetSend( context: Client, - options: DurationGetOptions = { requestOptions: {} }, + options: DurationGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/duration") @@ -41,7 +41,7 @@ export async function _durationGetDeserialize( /** Get call */ export async function durationGet( context: Client, - options: DurationGetOptions = { requestOptions: {} }, + options: DurationGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _durationGetSend(context, options); return _durationGetDeserialize(result); @@ -50,7 +50,7 @@ export async function durationGet( export function _durationPutSend( context: Client, body: DurationProperty, - options: DurationPutOptions = { requestOptions: {} }, + options: DurationPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/duration") @@ -74,7 +74,7 @@ export async function _durationPutDeserialize( export async function durationPut( context: Client, body: DurationProperty, - options: DurationPutOptions = { requestOptions: {} }, + options: DurationPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _durationPutSend(context, body, options); return _durationPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/enum/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/enum/index.ts index b1a8bef9dd..da4f0b3461 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/enum/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/enum/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { EnumGetOptions, EnumPutOptions } from "../../models/options.js"; +import { + EnumGetOptionalParams, + EnumPutOptionalParams, +} from "../../models/options.js"; export function _enumGetSend( context: Client, - options: EnumGetOptions = { requestOptions: {} }, + options: EnumGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/enum") @@ -38,7 +41,7 @@ export async function _enumGetDeserialize( /** Get call */ export async function enumGet( context: Client, - options: EnumGetOptions = { requestOptions: {} }, + options: EnumGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enumGetSend(context, options); return _enumGetDeserialize(result); @@ -47,7 +50,7 @@ export async function enumGet( export function _enumPutSend( context: Client, body: EnumProperty, - options: EnumPutOptions = { requestOptions: {} }, + options: EnumPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/enum") @@ -71,7 +74,7 @@ export async function _enumPutDeserialize( export async function enumPut( context: Client, body: EnumProperty, - options: EnumPutOptions = { requestOptions: {} }, + options: EnumPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enumPutSend(context, body, options); return _enumPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/extensibleEnum/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/extensibleEnum/index.ts index 761d8327f8..c5bfbad836 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/extensibleEnum/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/extensibleEnum/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ExtensibleEnumGetOptions, - ExtensibleEnumPutOptions, + ExtensibleEnumGetOptionalParams, + ExtensibleEnumPutOptionalParams, } from "../../models/options.js"; export function _extensibleEnumGetSend( context: Client, - options: ExtensibleEnumGetOptions = { requestOptions: {} }, + options: ExtensibleEnumGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/extensible-enum") @@ -41,7 +41,7 @@ export async function _extensibleEnumGetDeserialize( /** Get call */ export async function extensibleEnumGet( context: Client, - options: ExtensibleEnumGetOptions = { requestOptions: {} }, + options: ExtensibleEnumGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _extensibleEnumGetSend(context, options); return _extensibleEnumGetDeserialize(result); @@ -50,7 +50,7 @@ export async function extensibleEnumGet( export function _extensibleEnumPutSend( context: Client, body: ExtensibleEnumProperty, - options: ExtensibleEnumPutOptions = { requestOptions: {} }, + options: ExtensibleEnumPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/extensible-enum") @@ -74,7 +74,7 @@ export async function _extensibleEnumPutDeserialize( export async function extensibleEnumPut( context: Client, body: ExtensibleEnumProperty, - options: ExtensibleEnumPutOptions = { requestOptions: {} }, + options: ExtensibleEnumPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _extensibleEnumPutSend(context, body, options); return _extensibleEnumPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/float/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/float/index.ts index 1de96f7e9a..c19b2d0fe0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/float/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/float/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { FloatGetOptions, FloatPutOptions } from "../../models/options.js"; +import { + FloatGetOptionalParams, + FloatPutOptionalParams, +} from "../../models/options.js"; export function _floatGetSend( context: Client, - options: FloatGetOptions = { requestOptions: {} }, + options: FloatGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/float") @@ -38,7 +41,7 @@ export async function _floatGetDeserialize( /** Get call */ export async function floatGet( context: Client, - options: FloatGetOptions = { requestOptions: {} }, + options: FloatGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _floatGetSend(context, options); return _floatGetDeserialize(result); @@ -47,7 +50,7 @@ export async function floatGet( export function _floatPutSend( context: Client, body: FloatProperty, - options: FloatPutOptions = { requestOptions: {} }, + options: FloatPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/float") @@ -71,7 +74,7 @@ export async function _floatPutDeserialize( export async function floatPut( context: Client, body: FloatProperty, - options: FloatPutOptions = { requestOptions: {} }, + options: FloatPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _floatPutSend(context, body, options); return _floatPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/floatLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/floatLiteral/index.ts index 0f3fc0828d..b4b2737643 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/floatLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/floatLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - FloatLiteralGetOptions, - FloatLiteralPutOptions, + FloatLiteralGetOptionalParams, + FloatLiteralPutOptionalParams, } from "../../models/options.js"; export function _floatLiteralGetSend( context: Client, - options: FloatLiteralGetOptions = { requestOptions: {} }, + options: FloatLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/float/literal") @@ -41,7 +41,7 @@ export async function _floatLiteralGetDeserialize( /** Get call */ export async function floatLiteralGet( context: Client, - options: FloatLiteralGetOptions = { requestOptions: {} }, + options: FloatLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _floatLiteralGetSend(context, options); return _floatLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function floatLiteralGet( export function _floatLiteralPutSend( context: Client, body: FloatLiteralProperty, - options: FloatLiteralPutOptions = { requestOptions: {} }, + options: FloatLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/float/literal") @@ -74,7 +74,7 @@ export async function _floatLiteralPutDeserialize( export async function floatLiteralPut( context: Client, body: FloatLiteralProperty, - options: FloatLiteralPutOptions = { requestOptions: {} }, + options: FloatLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _floatLiteralPutSend(context, body, options); return _floatLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/index.ts index af4c9f28ab..b62326c011 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/index.ts @@ -5,7 +5,7 @@ export { createValueTypes, ValueTypesClientOptions, ValueTypesContext, -} from "./ValueTypesContext.js"; +} from "./valueTypesContext.js"; export { booleanGet, booleanPut } from "./boolean/index.js"; export { booleanLiteralGet, diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/int/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/int/index.ts index de04a4a0c2..c2640097a4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/int/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/int/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { IntGetOptions, IntPutOptions } from "../../models/options.js"; +import { + IntGetOptionalParams, + IntPutOptionalParams, +} from "../../models/options.js"; export function _intGetSend( context: Client, - options: IntGetOptions = { requestOptions: {} }, + options: IntGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/int") @@ -38,7 +41,7 @@ export async function _intGetDeserialize( /** Get call */ export async function intGet( context: Client, - options: IntGetOptions = { requestOptions: {} }, + options: IntGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _intGetSend(context, options); return _intGetDeserialize(result); @@ -47,7 +50,7 @@ export async function intGet( export function _intPutSend( context: Client, body: IntProperty, - options: IntPutOptions = { requestOptions: {} }, + options: IntPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/int") @@ -71,7 +74,7 @@ export async function _intPutDeserialize( export async function intPut( context: Client, body: IntProperty, - options: IntPutOptions = { requestOptions: {} }, + options: IntPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _intPutSend(context, body, options); return _intPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/intLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/intLiteral/index.ts index bf5efac16a..20c9e87eb6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/intLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/intLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - IntLiteralGetOptions, - IntLiteralPutOptions, + IntLiteralGetOptionalParams, + IntLiteralPutOptionalParams, } from "../../models/options.js"; export function _intLiteralGetSend( context: Client, - options: IntLiteralGetOptions = { requestOptions: {} }, + options: IntLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/int/literal") @@ -41,7 +41,7 @@ export async function _intLiteralGetDeserialize( /** Get call */ export async function intLiteralGet( context: Client, - options: IntLiteralGetOptions = { requestOptions: {} }, + options: IntLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _intLiteralGetSend(context, options); return _intLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function intLiteralGet( export function _intLiteralPutSend( context: Client, body: IntLiteralProperty, - options: IntLiteralPutOptions = { requestOptions: {} }, + options: IntLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/int/literal") @@ -74,7 +74,7 @@ export async function _intLiteralPutDeserialize( export async function intLiteralPut( context: Client, body: IntLiteralProperty, - options: IntLiteralPutOptions = { requestOptions: {} }, + options: IntLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _intLiteralPutSend(context, body, options); return _intLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/model/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/model/index.ts index 2c4663db8a..2e06dbb2f5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/model/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/model/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ModelGetOptions, ModelPutOptions } from "../../models/options.js"; +import { + ModelGetOptionalParams, + ModelPutOptionalParams, +} from "../../models/options.js"; export function _modelGetSend( context: Client, - options: ModelGetOptions = { requestOptions: {} }, + options: ModelGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/model") @@ -38,7 +41,7 @@ export async function _modelGetDeserialize( /** Get call */ export async function modelGet( context: Client, - options: ModelGetOptions = { requestOptions: {} }, + options: ModelGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _modelGetSend(context, options); return _modelGetDeserialize(result); @@ -47,7 +50,7 @@ export async function modelGet( export function _modelPutSend( context: Client, body: ModelProperty, - options: ModelPutOptions = { requestOptions: {} }, + options: ModelPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/model") @@ -71,7 +74,7 @@ export async function _modelPutDeserialize( export async function modelPut( context: Client, body: ModelProperty, - options: ModelPutOptions = { requestOptions: {} }, + options: ModelPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _modelPutSend(context, body, options); return _modelPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/never/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/never/index.ts index 0c90516b4a..3a03c0fd26 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/never/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/never/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { NeverGetOptions, NeverPutOptions } from "../../models/options.js"; +import { + NeverGetOptionalParams, + NeverPutOptionalParams, +} from "../../models/options.js"; export function _neverGetSend( context: Client, - options: NeverGetOptions = { requestOptions: {} }, + options: NeverGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/never") @@ -36,7 +39,7 @@ export async function _neverGetDeserialize( /** Get call */ export async function neverGet( context: Client, - options: NeverGetOptions = { requestOptions: {} }, + options: NeverGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _neverGetSend(context, options); return _neverGetDeserialize(result); @@ -45,7 +48,7 @@ export async function neverGet( export function _neverPutSend( context: Client, body: NeverProperty, - options: NeverPutOptions = { requestOptions: {} }, + options: NeverPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/never") @@ -66,7 +69,7 @@ export async function _neverPutDeserialize( export async function neverPut( context: Client, body: NeverProperty, - options: NeverPutOptions = { requestOptions: {} }, + options: NeverPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _neverPutSend(context, body, options); return _neverPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/string/index.ts index 6eb4a4b7d0..20d431d397 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/string/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/string/index.ts @@ -12,11 +12,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { StringGetOptions, StringPutOptions } from "../../models/options.js"; +import { + StringGetOptionalParams, + StringPutOptionalParams, +} from "../../models/options.js"; export function _stringGetSend( context: Client, - options: StringGetOptions = { requestOptions: {} }, + options: StringGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/string") @@ -38,7 +41,7 @@ export async function _stringGetDeserialize( /** Get call */ export async function stringGet( context: Client, - options: StringGetOptions = { requestOptions: {} }, + options: StringGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringGetSend(context, options); return _stringGetDeserialize(result); @@ -47,7 +50,7 @@ export async function stringGet( export function _stringPutSend( context: Client, body: StringProperty, - options: StringPutOptions = { requestOptions: {} }, + options: StringPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/string") @@ -71,7 +74,7 @@ export async function _stringPutDeserialize( export async function stringPut( context: Client, body: StringProperty, - options: StringPutOptions = { requestOptions: {} }, + options: StringPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringPutSend(context, body, options); return _stringPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/stringLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/stringLiteral/index.ts index dab076b021..df0a83c542 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/stringLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/stringLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - StringLiteralGetOptions, - StringLiteralPutOptions, + StringLiteralGetOptionalParams, + StringLiteralPutOptionalParams, } from "../../models/options.js"; export function _stringLiteralGetSend( context: Client, - options: StringLiteralGetOptions = { requestOptions: {} }, + options: StringLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/string/literal") @@ -41,7 +41,7 @@ export async function _stringLiteralGetDeserialize( /** Get call */ export async function stringLiteralGet( context: Client, - options: StringLiteralGetOptions = { requestOptions: {} }, + options: StringLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringLiteralGetSend(context, options); return _stringLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function stringLiteralGet( export function _stringLiteralPutSend( context: Client, body: StringLiteralProperty, - options: StringLiteralPutOptions = { requestOptions: {} }, + options: StringLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/string/literal") @@ -74,7 +74,7 @@ export async function _stringLiteralPutDeserialize( export async function stringLiteralPut( context: Client, body: StringLiteralProperty, - options: StringLiteralPutOptions = { requestOptions: {} }, + options: StringLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringLiteralPutSend(context, body, options); return _stringLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionEnumValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionEnumValue/index.ts index 63473694d1..2889b4460a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionEnumValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionEnumValue/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnionEnumValueGetOptions, - UnionEnumValuePutOptions, + UnionEnumValueGetOptionalParams, + UnionEnumValuePutOptionalParams, } from "../../models/options.js"; export function _unionEnumValueGetSend( context: Client, - options: UnionEnumValueGetOptions = { requestOptions: {} }, + options: UnionEnumValueGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union-enum-value") @@ -41,7 +41,7 @@ export async function _unionEnumValueGetDeserialize( /** Get call */ export async function unionEnumValueGet( context: Client, - options: UnionEnumValueGetOptions = { requestOptions: {} }, + options: UnionEnumValueGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionEnumValueGetSend(context, options); return _unionEnumValueGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unionEnumValueGet( export function _unionEnumValuePutSend( context: Client, body: UnionEnumValueProperty, - options: UnionEnumValuePutOptions = { requestOptions: {} }, + options: UnionEnumValuePutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union-enum-value") @@ -74,7 +74,7 @@ export async function _unionEnumValuePutDeserialize( export async function unionEnumValuePut( context: Client, body: UnionEnumValueProperty, - options: UnionEnumValuePutOptions = { requestOptions: {} }, + options: UnionEnumValuePutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionEnumValuePutSend(context, body, options); return _unionEnumValuePutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionFloatLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionFloatLiteral/index.ts index add361f104..aeffa2f668 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionFloatLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionFloatLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnionFloatLiteralGetOptions, - UnionFloatLiteralPutOptions, + UnionFloatLiteralGetOptionalParams, + UnionFloatLiteralPutOptionalParams, } from "../../models/options.js"; export function _unionFloatLiteralGetSend( context: Client, - options: UnionFloatLiteralGetOptions = { requestOptions: {} }, + options: UnionFloatLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union/float/literal") @@ -41,7 +41,7 @@ export async function _unionFloatLiteralGetDeserialize( /** Get call */ export async function unionFloatLiteralGet( context: Client, - options: UnionFloatLiteralGetOptions = { requestOptions: {} }, + options: UnionFloatLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionFloatLiteralGetSend(context, options); return _unionFloatLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unionFloatLiteralGet( export function _unionFloatLiteralPutSend( context: Client, body: UnionFloatLiteralProperty, - options: UnionFloatLiteralPutOptions = { requestOptions: {} }, + options: UnionFloatLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union/float/literal") @@ -74,7 +74,7 @@ export async function _unionFloatLiteralPutDeserialize( export async function unionFloatLiteralPut( context: Client, body: UnionFloatLiteralProperty, - options: UnionFloatLiteralPutOptions = { requestOptions: {} }, + options: UnionFloatLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionFloatLiteralPutSend(context, body, options); return _unionFloatLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionIntLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionIntLiteral/index.ts index e5eb467de0..e9c195aee4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionIntLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionIntLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnionIntLiteralGetOptions, - UnionIntLiteralPutOptions, + UnionIntLiteralGetOptionalParams, + UnionIntLiteralPutOptionalParams, } from "../../models/options.js"; export function _unionIntLiteralGetSend( context: Client, - options: UnionIntLiteralGetOptions = { requestOptions: {} }, + options: UnionIntLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union/int/literal") @@ -41,7 +41,7 @@ export async function _unionIntLiteralGetDeserialize( /** Get call */ export async function unionIntLiteralGet( context: Client, - options: UnionIntLiteralGetOptions = { requestOptions: {} }, + options: UnionIntLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionIntLiteralGetSend(context, options); return _unionIntLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unionIntLiteralGet( export function _unionIntLiteralPutSend( context: Client, body: UnionIntLiteralProperty, - options: UnionIntLiteralPutOptions = { requestOptions: {} }, + options: UnionIntLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union/int/literal") @@ -74,7 +74,7 @@ export async function _unionIntLiteralPutDeserialize( export async function unionIntLiteralPut( context: Client, body: UnionIntLiteralProperty, - options: UnionIntLiteralPutOptions = { requestOptions: {} }, + options: UnionIntLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionIntLiteralPutSend(context, body, options); return _unionIntLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionStringLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionStringLiteral/index.ts index a556cb7070..2b94873999 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionStringLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unionStringLiteral/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnionStringLiteralGetOptions, - UnionStringLiteralPutOptions, + UnionStringLiteralGetOptionalParams, + UnionStringLiteralPutOptionalParams, } from "../../models/options.js"; export function _unionStringLiteralGetSend( context: Client, - options: UnionStringLiteralGetOptions = { requestOptions: {} }, + options: UnionStringLiteralGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union/string/literal") @@ -41,7 +41,7 @@ export async function _unionStringLiteralGetDeserialize( /** Get call */ export async function unionStringLiteralGet( context: Client, - options: UnionStringLiteralGetOptions = { requestOptions: {} }, + options: UnionStringLiteralGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionStringLiteralGetSend(context, options); return _unionStringLiteralGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unionStringLiteralGet( export function _unionStringLiteralPutSend( context: Client, body: UnionStringLiteralProperty, - options: UnionStringLiteralPutOptions = { requestOptions: {} }, + options: UnionStringLiteralPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/union/string/literal") @@ -74,7 +74,7 @@ export async function _unionStringLiteralPutDeserialize( export async function unionStringLiteralPut( context: Client, body: UnionStringLiteralProperty, - options: UnionStringLiteralPutOptions = { requestOptions: {} }, + options: UnionStringLiteralPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unionStringLiteralPutSend(context, body, options); return _unionStringLiteralPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownArray/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownArray/index.ts index 0e6c396740..eba3aad49b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownArray/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownArray/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnknownArrayGetOptions, - UnknownArrayPutOptions, + UnknownArrayGetOptionalParams, + UnknownArrayPutOptionalParams, } from "../../models/options.js"; export function _unknownArrayGetSend( context: Client, - options: UnknownArrayGetOptions = { requestOptions: {} }, + options: UnknownArrayGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/array") @@ -41,7 +41,7 @@ export async function _unknownArrayGetDeserialize( /** Get call */ export async function unknownArrayGet( context: Client, - options: UnknownArrayGetOptions = { requestOptions: {} }, + options: UnknownArrayGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownArrayGetSend(context, options); return _unknownArrayGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unknownArrayGet( export function _unknownArrayPutSend( context: Client, body: UnknownArrayProperty, - options: UnknownArrayPutOptions = { requestOptions: {} }, + options: UnknownArrayPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/array") @@ -74,7 +74,7 @@ export async function _unknownArrayPutDeserialize( export async function unknownArrayPut( context: Client, body: UnknownArrayProperty, - options: UnknownArrayPutOptions = { requestOptions: {} }, + options: UnknownArrayPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownArrayPutSend(context, body, options); return _unknownArrayPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownDict/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownDict/index.ts index 2f795cf0d8..e79e57cd2f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownDict/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownDict/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnknownDictGetOptions, - UnknownDictPutOptions, + UnknownDictGetOptionalParams, + UnknownDictPutOptionalParams, } from "../../models/options.js"; export function _unknownDictGetSend( context: Client, - options: UnknownDictGetOptions = { requestOptions: {} }, + options: UnknownDictGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/dict") @@ -41,7 +41,7 @@ export async function _unknownDictGetDeserialize( /** Get call */ export async function unknownDictGet( context: Client, - options: UnknownDictGetOptions = { requestOptions: {} }, + options: UnknownDictGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownDictGetSend(context, options); return _unknownDictGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unknownDictGet( export function _unknownDictPutSend( context: Client, body: UnknownDictProperty, - options: UnknownDictPutOptions = { requestOptions: {} }, + options: UnknownDictPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/dict") @@ -74,7 +74,7 @@ export async function _unknownDictPutDeserialize( export async function unknownDictPut( context: Client, body: UnknownDictProperty, - options: UnknownDictPutOptions = { requestOptions: {} }, + options: UnknownDictPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownDictPutSend(context, body, options); return _unknownDictPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownInt/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownInt/index.ts index 88d26bf6e7..79d2e94fc8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownInt/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownInt/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnknownIntGetOptions, - UnknownIntPutOptions, + UnknownIntGetOptionalParams, + UnknownIntPutOptionalParams, } from "../../models/options.js"; export function _unknownIntGetSend( context: Client, - options: UnknownIntGetOptions = { requestOptions: {} }, + options: UnknownIntGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/int") @@ -41,7 +41,7 @@ export async function _unknownIntGetDeserialize( /** Get call */ export async function unknownIntGet( context: Client, - options: UnknownIntGetOptions = { requestOptions: {} }, + options: UnknownIntGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownIntGetSend(context, options); return _unknownIntGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unknownIntGet( export function _unknownIntPutSend( context: Client, body: UnknownIntProperty, - options: UnknownIntPutOptions = { requestOptions: {} }, + options: UnknownIntPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/int") @@ -74,7 +74,7 @@ export async function _unknownIntPutDeserialize( export async function unknownIntPut( context: Client, body: UnknownIntProperty, - options: UnknownIntPutOptions = { requestOptions: {} }, + options: UnknownIntPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownIntPutSend(context, body, options); return _unknownIntPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownString/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownString/index.ts index a976dfb973..3e8127a9ad 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownString/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/unknownString/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - UnknownStringGetOptions, - UnknownStringPutOptions, + UnknownStringGetOptionalParams, + UnknownStringPutOptionalParams, } from "../../models/options.js"; export function _unknownStringGetSend( context: Client, - options: UnknownStringGetOptions = { requestOptions: {} }, + options: UnknownStringGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/string") @@ -41,7 +41,7 @@ export async function _unknownStringGetDeserialize( /** Get call */ export async function unknownStringGet( context: Client, - options: UnknownStringGetOptions = { requestOptions: {} }, + options: UnknownStringGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownStringGetSend(context, options); return _unknownStringGetDeserialize(result); @@ -50,7 +50,7 @@ export async function unknownStringGet( export function _unknownStringPutSend( context: Client, body: UnknownStringProperty, - options: UnknownStringPutOptions = { requestOptions: {} }, + options: UnknownStringPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/property/value-types/unknown/string") @@ -74,7 +74,7 @@ export async function _unknownStringPutDeserialize( export async function unknownStringPut( context: Client, body: UnknownStringProperty, - options: UnknownStringPutOptions = { requestOptions: {} }, + options: UnknownStringPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownStringPutSend(context, body, options); return _unknownStringPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/ValueTypesContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/valueTypesContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/ValueTypesContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/api/valueTypesContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/boolean/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/boolean/index.ts index 015503dd85..e73eafc588 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/boolean/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/boolean/index.ts @@ -1,20 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { BooleanProperty } from "../../models/models.js"; import { booleanGet, booleanPut } from "../../api/boolean/index.js"; -import { BooleanGetOptions, BooleanPutOptions } from "../../models/options.js"; +import { + BooleanGetOptionalParams, + BooleanPutOptionalParams, +} from "../../models/options.js"; export interface BooleanOperations { - get: (options?: BooleanGetOptions) => Promise; - put: (body: BooleanProperty, options?: BooleanPutOptions) => Promise; + get: (options?: BooleanGetOptionalParams) => Promise; + put: ( + body: BooleanProperty, + options?: BooleanPutOptionalParams, + ) => Promise; } export function getBoolean(context: ValueTypesContext) { return { - get: (options?: BooleanGetOptions) => booleanGet(context, options), - put: (body: BooleanProperty, options?: BooleanPutOptions) => + get: (options?: BooleanGetOptionalParams) => booleanGet(context, options), + put: (body: BooleanProperty, options?: BooleanPutOptionalParams) => booleanPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/booleanLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/booleanLiteral/index.ts index 566b7e0156..a915db864d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/booleanLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/booleanLiteral/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { BooleanLiteralProperty } from "../../models/models.js"; import { booleanLiteralGet, booleanLiteralPut, } from "../../api/booleanLiteral/index.js"; import { - BooleanLiteralGetOptions, - BooleanLiteralPutOptions, + BooleanLiteralGetOptionalParams, + BooleanLiteralPutOptionalParams, } from "../../models/options.js"; export interface BooleanLiteralOperations { - get: (options?: BooleanLiteralGetOptions) => Promise; + get: ( + options?: BooleanLiteralGetOptionalParams, + ) => Promise; put: ( body: BooleanLiteralProperty, - options?: BooleanLiteralPutOptions, + options?: BooleanLiteralPutOptionalParams, ) => Promise; } export function getBooleanLiteral(context: ValueTypesContext) { return { - get: (options?: BooleanLiteralGetOptions) => + get: (options?: BooleanLiteralGetOptionalParams) => booleanLiteralGet(context, options), - put: (body: BooleanLiteralProperty, options?: BooleanLiteralPutOptions) => - booleanLiteralPut(context, body, options), + put: ( + body: BooleanLiteralProperty, + options?: BooleanLiteralPutOptionalParams, + ) => booleanLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/bytes/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/bytes/index.ts index d2e7859552..d2fd43fdb5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/bytes/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/bytes/index.ts @@ -1,20 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { BytesProperty } from "../../models/models.js"; import { bytesGet, bytesPut } from "../../api/bytes/index.js"; -import { BytesGetOptions, BytesPutOptions } from "../../models/options.js"; +import { + BytesGetOptionalParams, + BytesPutOptionalParams, +} from "../../models/options.js"; export interface BytesOperations { - get: (options?: BytesGetOptions) => Promise; - put: (body: BytesProperty, options?: BytesPutOptions) => Promise; + get: (options?: BytesGetOptionalParams) => Promise; + put: (body: BytesProperty, options?: BytesPutOptionalParams) => Promise; } export function getBytes(context: ValueTypesContext) { return { - get: (options?: BytesGetOptions) => bytesGet(context, options), - put: (body: BytesProperty, options?: BytesPutOptions) => + get: (options?: BytesGetOptionalParams) => bytesGet(context, options), + put: (body: BytesProperty, options?: BytesPutOptionalParams) => bytesPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsInt/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsInt/index.ts index c1e81d5ab2..88491d519c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsInt/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsInt/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { CollectionsIntProperty } from "../../models/models.js"; import { collectionsIntGet, collectionsIntPut, } from "../../api/collectionsInt/index.js"; import { - CollectionsIntGetOptions, - CollectionsIntPutOptions, + CollectionsIntGetOptionalParams, + CollectionsIntPutOptionalParams, } from "../../models/options.js"; export interface CollectionsIntOperations { - get: (options?: CollectionsIntGetOptions) => Promise; + get: ( + options?: CollectionsIntGetOptionalParams, + ) => Promise; put: ( body: CollectionsIntProperty, - options?: CollectionsIntPutOptions, + options?: CollectionsIntPutOptionalParams, ) => Promise; } export function getCollectionsInt(context: ValueTypesContext) { return { - get: (options?: CollectionsIntGetOptions) => + get: (options?: CollectionsIntGetOptionalParams) => collectionsIntGet(context, options), - put: (body: CollectionsIntProperty, options?: CollectionsIntPutOptions) => - collectionsIntPut(context, body, options), + put: ( + body: CollectionsIntProperty, + options?: CollectionsIntPutOptionalParams, + ) => collectionsIntPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsModel/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsModel/index.ts index d5c3c76d5e..276543839c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsModel/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsModel/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { CollectionsModelProperty } from "../../models/models.js"; import { collectionsModelGet, collectionsModelPut, } from "../../api/collectionsModel/index.js"; import { - CollectionsModelGetOptions, - CollectionsModelPutOptions, + CollectionsModelGetOptionalParams, + CollectionsModelPutOptionalParams, } from "../../models/options.js"; export interface CollectionsModelOperations { get: ( - options?: CollectionsModelGetOptions, + options?: CollectionsModelGetOptionalParams, ) => Promise; put: ( body: CollectionsModelProperty, - options?: CollectionsModelPutOptions, + options?: CollectionsModelPutOptionalParams, ) => Promise; } export function getCollectionsModel(context: ValueTypesContext) { return { - get: (options?: CollectionsModelGetOptions) => + get: (options?: CollectionsModelGetOptionalParams) => collectionsModelGet(context, options), put: ( body: CollectionsModelProperty, - options?: CollectionsModelPutOptions, + options?: CollectionsModelPutOptionalParams, ) => collectionsModelPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsString/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsString/index.ts index d082a7491d..84e7666020 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsString/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/collectionsString/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { CollectionsStringProperty } from "../../models/models.js"; import { collectionsStringGet, collectionsStringPut, } from "../../api/collectionsString/index.js"; import { - CollectionsStringGetOptions, - CollectionsStringPutOptions, + CollectionsStringGetOptionalParams, + CollectionsStringPutOptionalParams, } from "../../models/options.js"; export interface CollectionsStringOperations { get: ( - options?: CollectionsStringGetOptions, + options?: CollectionsStringGetOptionalParams, ) => Promise; put: ( body: CollectionsStringProperty, - options?: CollectionsStringPutOptions, + options?: CollectionsStringPutOptionalParams, ) => Promise; } export function getCollectionsString(context: ValueTypesContext) { return { - get: (options?: CollectionsStringGetOptions) => + get: (options?: CollectionsStringGetOptionalParams) => collectionsStringGet(context, options), put: ( body: CollectionsStringProperty, - options?: CollectionsStringPutOptions, + options?: CollectionsStringPutOptionalParams, ) => collectionsStringPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/datetime/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/datetime/index.ts index 5e1c9208fd..6b2b33431e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/datetime/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/datetime/index.ts @@ -1,23 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { DatetimeProperty } from "../../models/models.js"; import { datetimeGet, datetimePut } from "../../api/datetime/index.js"; import { - DatetimeGetOptions, - DatetimePutOptions, + DatetimeGetOptionalParams, + DatetimePutOptionalParams, } from "../../models/options.js"; export interface DatetimeOperations { - get: (options?: DatetimeGetOptions) => Promise; - put: (body: DatetimeProperty, options?: DatetimePutOptions) => Promise; + get: (options?: DatetimeGetOptionalParams) => Promise; + put: ( + body: DatetimeProperty, + options?: DatetimePutOptionalParams, + ) => Promise; } export function getDatetime(context: ValueTypesContext) { return { - get: (options?: DatetimeGetOptions) => datetimeGet(context, options), - put: (body: DatetimeProperty, options?: DatetimePutOptions) => + get: (options?: DatetimeGetOptionalParams) => datetimeGet(context, options), + put: (body: DatetimeProperty, options?: DatetimePutOptionalParams) => datetimePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal/index.ts index 916e343ab1..c3793f30a2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal/index.ts @@ -1,20 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { DecimalProperty } from "../../models/models.js"; import { decimalGet, decimalPut } from "../../api/decimal/index.js"; -import { DecimalGetOptions, DecimalPutOptions } from "../../models/options.js"; +import { + DecimalGetOptionalParams, + DecimalPutOptionalParams, +} from "../../models/options.js"; export interface DecimalOperations { - get: (options?: DecimalGetOptions) => Promise; - put: (body: DecimalProperty, options?: DecimalPutOptions) => Promise; + get: (options?: DecimalGetOptionalParams) => Promise; + put: ( + body: DecimalProperty, + options?: DecimalPutOptionalParams, + ) => Promise; } export function getDecimal(context: ValueTypesContext) { return { - get: (options?: DecimalGetOptions) => decimalGet(context, options), - put: (body: DecimalProperty, options?: DecimalPutOptions) => + get: (options?: DecimalGetOptionalParams) => decimalGet(context, options), + put: (body: DecimalProperty, options?: DecimalPutOptionalParams) => decimalPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal128/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal128/index.ts index 03b36e4d50..ba18ba68ea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal128/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/decimal128/index.ts @@ -1,26 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { Decimal128Property } from "../../models/models.js"; import { decimal128Get, decimal128Put } from "../../api/decimal128/index.js"; import { - Decimal128GetOptions, - Decimal128PutOptions, + Decimal128GetOptionalParams, + Decimal128PutOptionalParams, } from "../../models/options.js"; export interface Decimal128Operations { - get: (options?: Decimal128GetOptions) => Promise; + get: (options?: Decimal128GetOptionalParams) => Promise; put: ( body: Decimal128Property, - options?: Decimal128PutOptions, + options?: Decimal128PutOptionalParams, ) => Promise; } export function getDecimal128(context: ValueTypesContext) { return { - get: (options?: Decimal128GetOptions) => decimal128Get(context, options), - put: (body: Decimal128Property, options?: Decimal128PutOptions) => + get: (options?: Decimal128GetOptionalParams) => + decimal128Get(context, options), + put: (body: Decimal128Property, options?: Decimal128PutOptionalParams) => decimal128Put(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/dictionaryString/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/dictionaryString/index.ts index 1f1fa16ee4..e3101cf79f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/dictionaryString/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/dictionaryString/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { DictionaryStringProperty } from "../../models/models.js"; import { dictionaryStringGet, dictionaryStringPut, } from "../../api/dictionaryString/index.js"; import { - DictionaryStringGetOptions, - DictionaryStringPutOptions, + DictionaryStringGetOptionalParams, + DictionaryStringPutOptionalParams, } from "../../models/options.js"; export interface DictionaryStringOperations { get: ( - options?: DictionaryStringGetOptions, + options?: DictionaryStringGetOptionalParams, ) => Promise; put: ( body: DictionaryStringProperty, - options?: DictionaryStringPutOptions, + options?: DictionaryStringPutOptionalParams, ) => Promise; } export function getDictionaryString(context: ValueTypesContext) { return { - get: (options?: DictionaryStringGetOptions) => + get: (options?: DictionaryStringGetOptionalParams) => dictionaryStringGet(context, options), put: ( body: DictionaryStringProperty, - options?: DictionaryStringPutOptions, + options?: DictionaryStringPutOptionalParams, ) => dictionaryStringPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/duration/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/duration/index.ts index cd9b88c818..d511e66a1f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/duration/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/duration/index.ts @@ -1,23 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { DurationProperty } from "../../models/models.js"; import { durationGet, durationPut } from "../../api/duration/index.js"; import { - DurationGetOptions, - DurationPutOptions, + DurationGetOptionalParams, + DurationPutOptionalParams, } from "../../models/options.js"; export interface DurationOperations { - get: (options?: DurationGetOptions) => Promise; - put: (body: DurationProperty, options?: DurationPutOptions) => Promise; + get: (options?: DurationGetOptionalParams) => Promise; + put: ( + body: DurationProperty, + options?: DurationPutOptionalParams, + ) => Promise; } export function getDuration(context: ValueTypesContext) { return { - get: (options?: DurationGetOptions) => durationGet(context, options), - put: (body: DurationProperty, options?: DurationPutOptions) => + get: (options?: DurationGetOptionalParams) => durationGet(context, options), + put: (body: DurationProperty, options?: DurationPutOptionalParams) => durationPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/enum/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/enum/index.ts index bb279232d4..be0f4dd092 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/enum/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/enum/index.ts @@ -1,20 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { EnumProperty } from "../../models/models.js"; import { enumGet, enumPut } from "../../api/enum/index.js"; -import { EnumGetOptions, EnumPutOptions } from "../../models/options.js"; +import { + EnumGetOptionalParams, + EnumPutOptionalParams, +} from "../../models/options.js"; export interface EnumOperations { - get: (options?: EnumGetOptions) => Promise; - put: (body: EnumProperty, options?: EnumPutOptions) => Promise; + get: (options?: EnumGetOptionalParams) => Promise; + put: (body: EnumProperty, options?: EnumPutOptionalParams) => Promise; } export function getEnum(context: ValueTypesContext) { return { - get: (options?: EnumGetOptions) => enumGet(context, options), - put: (body: EnumProperty, options?: EnumPutOptions) => + get: (options?: EnumGetOptionalParams) => enumGet(context, options), + put: (body: EnumProperty, options?: EnumPutOptionalParams) => enumPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/extensibleEnum/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/extensibleEnum/index.ts index dc931f8cc8..a34f8f3e85 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/extensibleEnum/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/extensibleEnum/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { ExtensibleEnumProperty } from "../../models/models.js"; import { extensibleEnumGet, extensibleEnumPut, } from "../../api/extensibleEnum/index.js"; import { - ExtensibleEnumGetOptions, - ExtensibleEnumPutOptions, + ExtensibleEnumGetOptionalParams, + ExtensibleEnumPutOptionalParams, } from "../../models/options.js"; export interface ExtensibleEnumOperations { - get: (options?: ExtensibleEnumGetOptions) => Promise; + get: ( + options?: ExtensibleEnumGetOptionalParams, + ) => Promise; put: ( body: ExtensibleEnumProperty, - options?: ExtensibleEnumPutOptions, + options?: ExtensibleEnumPutOptionalParams, ) => Promise; } export function getExtensibleEnum(context: ValueTypesContext) { return { - get: (options?: ExtensibleEnumGetOptions) => + get: (options?: ExtensibleEnumGetOptionalParams) => extensibleEnumGet(context, options), - put: (body: ExtensibleEnumProperty, options?: ExtensibleEnumPutOptions) => - extensibleEnumPut(context, body, options), + put: ( + body: ExtensibleEnumProperty, + options?: ExtensibleEnumPutOptionalParams, + ) => extensibleEnumPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/float/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/float/index.ts index b125cef0eb..ceb799f3af 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/float/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/float/index.ts @@ -1,20 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { FloatProperty } from "../../models/models.js"; import { floatGet, floatPut } from "../../api/float/index.js"; -import { FloatGetOptions, FloatPutOptions } from "../../models/options.js"; +import { + FloatGetOptionalParams, + FloatPutOptionalParams, +} from "../../models/options.js"; export interface FloatOperations { - get: (options?: FloatGetOptions) => Promise; - put: (body: FloatProperty, options?: FloatPutOptions) => Promise; + get: (options?: FloatGetOptionalParams) => Promise; + put: (body: FloatProperty, options?: FloatPutOptionalParams) => Promise; } export function getFloat(context: ValueTypesContext) { return { - get: (options?: FloatGetOptions) => floatGet(context, options), - put: (body: FloatProperty, options?: FloatPutOptions) => + get: (options?: FloatGetOptionalParams) => floatGet(context, options), + put: (body: FloatProperty, options?: FloatPutOptionalParams) => floatPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/floatLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/floatLiteral/index.ts index 6106a7e3b6..9a32b0666c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/floatLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/floatLiteral/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { FloatLiteralProperty } from "../../models/models.js"; import { floatLiteralGet, floatLiteralPut, } from "../../api/floatLiteral/index.js"; import { - FloatLiteralGetOptions, - FloatLiteralPutOptions, + FloatLiteralGetOptionalParams, + FloatLiteralPutOptionalParams, } from "../../models/options.js"; export interface FloatLiteralOperations { - get: (options?: FloatLiteralGetOptions) => Promise; + get: ( + options?: FloatLiteralGetOptionalParams, + ) => Promise; put: ( body: FloatLiteralProperty, - options?: FloatLiteralPutOptions, + options?: FloatLiteralPutOptionalParams, ) => Promise; } export function getFloatLiteral(context: ValueTypesContext) { return { - get: (options?: FloatLiteralGetOptions) => + get: (options?: FloatLiteralGetOptionalParams) => floatLiteralGet(context, options), - put: (body: FloatLiteralProperty, options?: FloatLiteralPutOptions) => - floatLiteralPut(context, body, options), + put: ( + body: FloatLiteralProperty, + options?: FloatLiteralPutOptionalParams, + ) => floatLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/int/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/int/index.ts index 6657bd06c7..61e6a0b764 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/int/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/int/index.ts @@ -1,20 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { IntProperty } from "../../models/models.js"; import { intGet, intPut } from "../../api/int/index.js"; -import { IntGetOptions, IntPutOptions } from "../../models/options.js"; +import { + IntGetOptionalParams, + IntPutOptionalParams, +} from "../../models/options.js"; export interface IntOperations { - get: (options?: IntGetOptions) => Promise; - put: (body: IntProperty, options?: IntPutOptions) => Promise; + get: (options?: IntGetOptionalParams) => Promise; + put: (body: IntProperty, options?: IntPutOptionalParams) => Promise; } export function getInt(context: ValueTypesContext) { return { - get: (options?: IntGetOptions) => intGet(context, options), - put: (body: IntProperty, options?: IntPutOptions) => + get: (options?: IntGetOptionalParams) => intGet(context, options), + put: (body: IntProperty, options?: IntPutOptionalParams) => intPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/intLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/intLiteral/index.ts index 72e87221ae..b4fa1d8995 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/intLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/intLiteral/index.ts @@ -1,26 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { IntLiteralProperty } from "../../models/models.js"; import { intLiteralGet, intLiteralPut } from "../../api/intLiteral/index.js"; import { - IntLiteralGetOptions, - IntLiteralPutOptions, + IntLiteralGetOptionalParams, + IntLiteralPutOptionalParams, } from "../../models/options.js"; export interface IntLiteralOperations { - get: (options?: IntLiteralGetOptions) => Promise; + get: (options?: IntLiteralGetOptionalParams) => Promise; put: ( body: IntLiteralProperty, - options?: IntLiteralPutOptions, + options?: IntLiteralPutOptionalParams, ) => Promise; } export function getIntLiteral(context: ValueTypesContext) { return { - get: (options?: IntLiteralGetOptions) => intLiteralGet(context, options), - put: (body: IntLiteralProperty, options?: IntLiteralPutOptions) => + get: (options?: IntLiteralGetOptionalParams) => + intLiteralGet(context, options), + put: (body: IntLiteralProperty, options?: IntLiteralPutOptionalParams) => intLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/model/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/model/index.ts index e49f7c41e4..f75440e4fd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/model/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/model/index.ts @@ -1,20 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { ModelProperty } from "../../models/models.js"; import { modelGet, modelPut } from "../../api/model/index.js"; -import { ModelGetOptions, ModelPutOptions } from "../../models/options.js"; +import { + ModelGetOptionalParams, + ModelPutOptionalParams, +} from "../../models/options.js"; export interface ModelOperations { - get: (options?: ModelGetOptions) => Promise; - put: (body: ModelProperty, options?: ModelPutOptions) => Promise; + get: (options?: ModelGetOptionalParams) => Promise; + put: (body: ModelProperty, options?: ModelPutOptionalParams) => Promise; } export function getModel(context: ValueTypesContext) { return { - get: (options?: ModelGetOptions) => modelGet(context, options), - put: (body: ModelProperty, options?: ModelPutOptions) => + get: (options?: ModelGetOptionalParams) => modelGet(context, options), + put: (body: ModelProperty, options?: ModelPutOptionalParams) => modelPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/never/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/never/index.ts index fdacc40448..82b5738df6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/never/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/never/index.ts @@ -1,20 +1,23 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { NeverProperty } from "../../models/models.js"; import { neverGet, neverPut } from "../../api/never/index.js"; -import { NeverGetOptions, NeverPutOptions } from "../../models/options.js"; +import { + NeverGetOptionalParams, + NeverPutOptionalParams, +} from "../../models/options.js"; export interface NeverOperations { - get: (options?: NeverGetOptions) => Promise; - put: (body: NeverProperty, options?: NeverPutOptions) => Promise; + get: (options?: NeverGetOptionalParams) => Promise; + put: (body: NeverProperty, options?: NeverPutOptionalParams) => Promise; } export function getNever(context: ValueTypesContext) { return { - get: (options?: NeverGetOptions) => neverGet(context, options), - put: (body: NeverProperty, options?: NeverPutOptions) => + get: (options?: NeverGetOptionalParams) => neverGet(context, options), + put: (body: NeverProperty, options?: NeverPutOptionalParams) => neverPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/string/index.ts index d2dbde02b0..9817df4d5c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/string/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/string/index.ts @@ -1,20 +1,26 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { StringProperty } from "../../models/models.js"; import { stringGet, stringPut } from "../../api/string/index.js"; -import { StringGetOptions, StringPutOptions } from "../../models/options.js"; +import { + StringGetOptionalParams, + StringPutOptionalParams, +} from "../../models/options.js"; export interface StringOperations { - get: (options?: StringGetOptions) => Promise; - put: (body: StringProperty, options?: StringPutOptions) => Promise; + get: (options?: StringGetOptionalParams) => Promise; + put: ( + body: StringProperty, + options?: StringPutOptionalParams, + ) => Promise; } export function getString(context: ValueTypesContext) { return { - get: (options?: StringGetOptions) => stringGet(context, options), - put: (body: StringProperty, options?: StringPutOptions) => + get: (options?: StringGetOptionalParams) => stringGet(context, options), + put: (body: StringProperty, options?: StringPutOptionalParams) => stringPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/stringLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/stringLiteral/index.ts index 7b7430f3cf..a3e7939b68 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/stringLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/stringLiteral/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { StringLiteralProperty } from "../../models/models.js"; import { stringLiteralGet, stringLiteralPut, } from "../../api/stringLiteral/index.js"; import { - StringLiteralGetOptions, - StringLiteralPutOptions, + StringLiteralGetOptionalParams, + StringLiteralPutOptionalParams, } from "../../models/options.js"; export interface StringLiteralOperations { - get: (options?: StringLiteralGetOptions) => Promise; + get: ( + options?: StringLiteralGetOptionalParams, + ) => Promise; put: ( body: StringLiteralProperty, - options?: StringLiteralPutOptions, + options?: StringLiteralPutOptionalParams, ) => Promise; } export function getStringLiteral(context: ValueTypesContext) { return { - get: (options?: StringLiteralGetOptions) => + get: (options?: StringLiteralGetOptionalParams) => stringLiteralGet(context, options), - put: (body: StringLiteralProperty, options?: StringLiteralPutOptions) => - stringLiteralPut(context, body, options), + put: ( + body: StringLiteralProperty, + options?: StringLiteralPutOptionalParams, + ) => stringLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionEnumValue/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionEnumValue/index.ts index fad6da27f7..8951944d58 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionEnumValue/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionEnumValue/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnionEnumValueProperty } from "../../models/models.js"; import { unionEnumValueGet, unionEnumValuePut, } from "../../api/unionEnumValue/index.js"; import { - UnionEnumValueGetOptions, - UnionEnumValuePutOptions, + UnionEnumValueGetOptionalParams, + UnionEnumValuePutOptionalParams, } from "../../models/options.js"; export interface UnionEnumValueOperations { - get: (options?: UnionEnumValueGetOptions) => Promise; + get: ( + options?: UnionEnumValueGetOptionalParams, + ) => Promise; put: ( body: UnionEnumValueProperty, - options?: UnionEnumValuePutOptions, + options?: UnionEnumValuePutOptionalParams, ) => Promise; } export function getUnionEnumValue(context: ValueTypesContext) { return { - get: (options?: UnionEnumValueGetOptions) => + get: (options?: UnionEnumValueGetOptionalParams) => unionEnumValueGet(context, options), - put: (body: UnionEnumValueProperty, options?: UnionEnumValuePutOptions) => - unionEnumValuePut(context, body, options), + put: ( + body: UnionEnumValueProperty, + options?: UnionEnumValuePutOptionalParams, + ) => unionEnumValuePut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionFloatLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionFloatLiteral/index.ts index a3c0934340..9ec99c50f5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionFloatLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionFloatLiteral/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnionFloatLiteralProperty } from "../../models/models.js"; import { unionFloatLiteralGet, unionFloatLiteralPut, } from "../../api/unionFloatLiteral/index.js"; import { - UnionFloatLiteralGetOptions, - UnionFloatLiteralPutOptions, + UnionFloatLiteralGetOptionalParams, + UnionFloatLiteralPutOptionalParams, } from "../../models/options.js"; export interface UnionFloatLiteralOperations { get: ( - options?: UnionFloatLiteralGetOptions, + options?: UnionFloatLiteralGetOptionalParams, ) => Promise; put: ( body: UnionFloatLiteralProperty, - options?: UnionFloatLiteralPutOptions, + options?: UnionFloatLiteralPutOptionalParams, ) => Promise; } export function getUnionFloatLiteral(context: ValueTypesContext) { return { - get: (options?: UnionFloatLiteralGetOptions) => + get: (options?: UnionFloatLiteralGetOptionalParams) => unionFloatLiteralGet(context, options), put: ( body: UnionFloatLiteralProperty, - options?: UnionFloatLiteralPutOptions, + options?: UnionFloatLiteralPutOptionalParams, ) => unionFloatLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionIntLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionIntLiteral/index.ts index b1c33a77b5..2ddef3217e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionIntLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionIntLiteral/index.ts @@ -1,33 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnionIntLiteralProperty } from "../../models/models.js"; import { unionIntLiteralGet, unionIntLiteralPut, } from "../../api/unionIntLiteral/index.js"; import { - UnionIntLiteralGetOptions, - UnionIntLiteralPutOptions, + UnionIntLiteralGetOptionalParams, + UnionIntLiteralPutOptionalParams, } from "../../models/options.js"; export interface UnionIntLiteralOperations { get: ( - options?: UnionIntLiteralGetOptions, + options?: UnionIntLiteralGetOptionalParams, ) => Promise; put: ( body: UnionIntLiteralProperty, - options?: UnionIntLiteralPutOptions, + options?: UnionIntLiteralPutOptionalParams, ) => Promise; } export function getUnionIntLiteral(context: ValueTypesContext) { return { - get: (options?: UnionIntLiteralGetOptions) => + get: (options?: UnionIntLiteralGetOptionalParams) => unionIntLiteralGet(context, options), - put: (body: UnionIntLiteralProperty, options?: UnionIntLiteralPutOptions) => - unionIntLiteralPut(context, body, options), + put: ( + body: UnionIntLiteralProperty, + options?: UnionIntLiteralPutOptionalParams, + ) => unionIntLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionStringLiteral/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionStringLiteral/index.ts index 4580c550f3..fe2d67a826 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionStringLiteral/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unionStringLiteral/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnionStringLiteralProperty } from "../../models/models.js"; import { unionStringLiteralGet, unionStringLiteralPut, } from "../../api/unionStringLiteral/index.js"; import { - UnionStringLiteralGetOptions, - UnionStringLiteralPutOptions, + UnionStringLiteralGetOptionalParams, + UnionStringLiteralPutOptionalParams, } from "../../models/options.js"; export interface UnionStringLiteralOperations { get: ( - options?: UnionStringLiteralGetOptions, + options?: UnionStringLiteralGetOptionalParams, ) => Promise; put: ( body: UnionStringLiteralProperty, - options?: UnionStringLiteralPutOptions, + options?: UnionStringLiteralPutOptionalParams, ) => Promise; } export function getUnionStringLiteral(context: ValueTypesContext) { return { - get: (options?: UnionStringLiteralGetOptions) => + get: (options?: UnionStringLiteralGetOptionalParams) => unionStringLiteralGet(context, options), put: ( body: UnionStringLiteralProperty, - options?: UnionStringLiteralPutOptions, + options?: UnionStringLiteralPutOptionalParams, ) => unionStringLiteralPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownArray/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownArray/index.ts index 361a7aef2e..4a3b56afc2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownArray/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownArray/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnknownArrayProperty } from "../../models/models.js"; import { unknownArrayGet, unknownArrayPut, } from "../../api/unknownArray/index.js"; import { - UnknownArrayGetOptions, - UnknownArrayPutOptions, + UnknownArrayGetOptionalParams, + UnknownArrayPutOptionalParams, } from "../../models/options.js"; export interface UnknownArrayOperations { - get: (options?: UnknownArrayGetOptions) => Promise; + get: ( + options?: UnknownArrayGetOptionalParams, + ) => Promise; put: ( body: UnknownArrayProperty, - options?: UnknownArrayPutOptions, + options?: UnknownArrayPutOptionalParams, ) => Promise; } export function getUnknownArray(context: ValueTypesContext) { return { - get: (options?: UnknownArrayGetOptions) => + get: (options?: UnknownArrayGetOptionalParams) => unknownArrayGet(context, options), - put: (body: UnknownArrayProperty, options?: UnknownArrayPutOptions) => - unknownArrayPut(context, body, options), + put: ( + body: UnknownArrayProperty, + options?: UnknownArrayPutOptionalParams, + ) => unknownArrayPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownDict/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownDict/index.ts index ab3c7bd736..44fb50faa8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownDict/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownDict/index.ts @@ -1,26 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnknownDictProperty } from "../../models/models.js"; import { unknownDictGet, unknownDictPut } from "../../api/unknownDict/index.js"; import { - UnknownDictGetOptions, - UnknownDictPutOptions, + UnknownDictGetOptionalParams, + UnknownDictPutOptionalParams, } from "../../models/options.js"; export interface UnknownDictOperations { - get: (options?: UnknownDictGetOptions) => Promise; + get: (options?: UnknownDictGetOptionalParams) => Promise; put: ( body: UnknownDictProperty, - options?: UnknownDictPutOptions, + options?: UnknownDictPutOptionalParams, ) => Promise; } export function getUnknownDict(context: ValueTypesContext) { return { - get: (options?: UnknownDictGetOptions) => unknownDictGet(context, options), - put: (body: UnknownDictProperty, options?: UnknownDictPutOptions) => + get: (options?: UnknownDictGetOptionalParams) => + unknownDictGet(context, options), + put: (body: UnknownDictProperty, options?: UnknownDictPutOptionalParams) => unknownDictPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownInt/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownInt/index.ts index cf84060f0c..45cb978a6f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownInt/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownInt/index.ts @@ -1,26 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnknownIntProperty } from "../../models/models.js"; import { unknownIntGet, unknownIntPut } from "../../api/unknownInt/index.js"; import { - UnknownIntGetOptions, - UnknownIntPutOptions, + UnknownIntGetOptionalParams, + UnknownIntPutOptionalParams, } from "../../models/options.js"; export interface UnknownIntOperations { - get: (options?: UnknownIntGetOptions) => Promise; + get: (options?: UnknownIntGetOptionalParams) => Promise; put: ( body: UnknownIntProperty, - options?: UnknownIntPutOptions, + options?: UnknownIntPutOptionalParams, ) => Promise; } export function getUnknownInt(context: ValueTypesContext) { return { - get: (options?: UnknownIntGetOptions) => unknownIntGet(context, options), - put: (body: UnknownIntProperty, options?: UnknownIntPutOptions) => + get: (options?: UnknownIntGetOptionalParams) => + unknownIntGet(context, options), + put: (body: UnknownIntProperty, options?: UnknownIntPutOptionalParams) => unknownIntPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownString/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownString/index.ts index b0bea44408..b9c9fc5406 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownString/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/classic/unknownString/index.ts @@ -1,31 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ValueTypesContext } from "../../api/ValueTypesContext.js"; +import { ValueTypesContext } from "../../api/valueTypesContext.js"; import { UnknownStringProperty } from "../../models/models.js"; import { unknownStringGet, unknownStringPut, } from "../../api/unknownString/index.js"; import { - UnknownStringGetOptions, - UnknownStringPutOptions, + UnknownStringGetOptionalParams, + UnknownStringPutOptionalParams, } from "../../models/options.js"; export interface UnknownStringOperations { - get: (options?: UnknownStringGetOptions) => Promise; + get: ( + options?: UnknownStringGetOptionalParams, + ) => Promise; put: ( body: UnknownStringProperty, - options?: UnknownStringPutOptions, + options?: UnknownStringPutOptionalParams, ) => Promise; } export function getUnknownString(context: ValueTypesContext) { return { - get: (options?: UnknownStringGetOptions) => + get: (options?: UnknownStringGetOptionalParams) => unknownStringGet(context, options), - put: (body: UnknownStringProperty, options?: UnknownStringPutOptions) => - unknownStringPut(context, body, options), + put: ( + body: UnknownStringProperty, + options?: UnknownStringPutOptionalParams, + ) => unknownStringPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/index.ts index 9e30d2b6e2..9a82431638 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/index.ts @@ -4,9 +4,10 @@ export { ValueTypesClient, ValueTypesClientOptions, -} from "./ValueTypesClient.js"; +} from "./valueTypesClient.js"; export { UnionEnumValueProperty, + ExtendedEnum, UnionFloatLiteralProperty, UnionIntLiteralProperty, UnionStringLiteralProperty, @@ -38,64 +39,64 @@ export { BytesProperty, StringProperty, BooleanProperty, - BooleanGetOptions, - BooleanPutOptions, - StringGetOptions, - StringPutOptions, - BytesGetOptions, - BytesPutOptions, - IntGetOptions, - IntPutOptions, - FloatGetOptions, - FloatPutOptions, - DecimalGetOptions, - DecimalPutOptions, - Decimal128GetOptions, - Decimal128PutOptions, - DatetimeGetOptions, - DatetimePutOptions, - DurationGetOptions, - DurationPutOptions, - EnumGetOptions, - EnumPutOptions, - ExtensibleEnumGetOptions, - ExtensibleEnumPutOptions, - ModelGetOptions, - ModelPutOptions, - CollectionsStringGetOptions, - CollectionsStringPutOptions, - CollectionsIntGetOptions, - CollectionsIntPutOptions, - CollectionsModelGetOptions, - CollectionsModelPutOptions, - DictionaryStringGetOptions, - DictionaryStringPutOptions, - NeverGetOptions, - NeverPutOptions, - UnknownStringGetOptions, - UnknownStringPutOptions, - UnknownIntGetOptions, - UnknownIntPutOptions, - UnknownDictGetOptions, - UnknownDictPutOptions, - UnknownArrayGetOptions, - UnknownArrayPutOptions, - StringLiteralGetOptions, - StringLiteralPutOptions, - IntLiteralGetOptions, - IntLiteralPutOptions, - FloatLiteralGetOptions, - FloatLiteralPutOptions, - BooleanLiteralGetOptions, - BooleanLiteralPutOptions, - UnionStringLiteralGetOptions, - UnionStringLiteralPutOptions, - UnionIntLiteralGetOptions, - UnionIntLiteralPutOptions, - UnionFloatLiteralGetOptions, - UnionFloatLiteralPutOptions, - UnionEnumValueGetOptions, - UnionEnumValuePutOptions, + BooleanGetOptionalParams, + BooleanPutOptionalParams, + StringGetOptionalParams, + StringPutOptionalParams, + BytesGetOptionalParams, + BytesPutOptionalParams, + IntGetOptionalParams, + IntPutOptionalParams, + FloatGetOptionalParams, + FloatPutOptionalParams, + DecimalGetOptionalParams, + DecimalPutOptionalParams, + Decimal128GetOptionalParams, + Decimal128PutOptionalParams, + DatetimeGetOptionalParams, + DatetimePutOptionalParams, + DurationGetOptionalParams, + DurationPutOptionalParams, + EnumGetOptionalParams, + EnumPutOptionalParams, + ExtensibleEnumGetOptionalParams, + ExtensibleEnumPutOptionalParams, + ModelGetOptionalParams, + ModelPutOptionalParams, + CollectionsStringGetOptionalParams, + CollectionsStringPutOptionalParams, + CollectionsIntGetOptionalParams, + CollectionsIntPutOptionalParams, + CollectionsModelGetOptionalParams, + CollectionsModelPutOptionalParams, + DictionaryStringGetOptionalParams, + DictionaryStringPutOptionalParams, + NeverGetOptionalParams, + NeverPutOptionalParams, + UnknownStringGetOptionalParams, + UnknownStringPutOptionalParams, + UnknownIntGetOptionalParams, + UnknownIntPutOptionalParams, + UnknownDictGetOptionalParams, + UnknownDictPutOptionalParams, + UnknownArrayGetOptionalParams, + UnknownArrayPutOptionalParams, + StringLiteralGetOptionalParams, + StringLiteralPutOptionalParams, + IntLiteralGetOptionalParams, + IntLiteralPutOptionalParams, + FloatLiteralGetOptionalParams, + FloatLiteralPutOptionalParams, + BooleanLiteralGetOptionalParams, + BooleanLiteralPutOptionalParams, + UnionStringLiteralGetOptionalParams, + UnionStringLiteralPutOptionalParams, + UnionIntLiteralGetOptionalParams, + UnionIntLiteralPutOptionalParams, + UnionFloatLiteralGetOptionalParams, + UnionFloatLiteralPutOptionalParams, + UnionEnumValueGetOptionalParams, + UnionEnumValuePutOptionalParams, } from "./models/index.js"; export { BooleanOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/index.ts index 9a32a05e2a..f030383aab 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/index.ts @@ -3,6 +3,7 @@ export { UnionEnumValueProperty, + ExtendedEnum, UnionFloatLiteralProperty, UnionIntLiteralProperty, UnionStringLiteralProperty, @@ -36,62 +37,62 @@ export { BooleanProperty, } from "./models.js"; export { - BooleanGetOptions, - BooleanPutOptions, - StringGetOptions, - StringPutOptions, - BytesGetOptions, - BytesPutOptions, - IntGetOptions, - IntPutOptions, - FloatGetOptions, - FloatPutOptions, - DecimalGetOptions, - DecimalPutOptions, - Decimal128GetOptions, - Decimal128PutOptions, - DatetimeGetOptions, - DatetimePutOptions, - DurationGetOptions, - DurationPutOptions, - EnumGetOptions, - EnumPutOptions, - ExtensibleEnumGetOptions, - ExtensibleEnumPutOptions, - ModelGetOptions, - ModelPutOptions, - CollectionsStringGetOptions, - CollectionsStringPutOptions, - CollectionsIntGetOptions, - CollectionsIntPutOptions, - CollectionsModelGetOptions, - CollectionsModelPutOptions, - DictionaryStringGetOptions, - DictionaryStringPutOptions, - NeverGetOptions, - NeverPutOptions, - UnknownStringGetOptions, - UnknownStringPutOptions, - UnknownIntGetOptions, - UnknownIntPutOptions, - UnknownDictGetOptions, - UnknownDictPutOptions, - UnknownArrayGetOptions, - UnknownArrayPutOptions, - StringLiteralGetOptions, - StringLiteralPutOptions, - IntLiteralGetOptions, - IntLiteralPutOptions, - FloatLiteralGetOptions, - FloatLiteralPutOptions, - BooleanLiteralGetOptions, - BooleanLiteralPutOptions, - UnionStringLiteralGetOptions, - UnionStringLiteralPutOptions, - UnionIntLiteralGetOptions, - UnionIntLiteralPutOptions, - UnionFloatLiteralGetOptions, - UnionFloatLiteralPutOptions, - UnionEnumValueGetOptions, - UnionEnumValuePutOptions, + BooleanGetOptionalParams, + BooleanPutOptionalParams, + StringGetOptionalParams, + StringPutOptionalParams, + BytesGetOptionalParams, + BytesPutOptionalParams, + IntGetOptionalParams, + IntPutOptionalParams, + FloatGetOptionalParams, + FloatPutOptionalParams, + DecimalGetOptionalParams, + DecimalPutOptionalParams, + Decimal128GetOptionalParams, + Decimal128PutOptionalParams, + DatetimeGetOptionalParams, + DatetimePutOptionalParams, + DurationGetOptionalParams, + DurationPutOptionalParams, + EnumGetOptionalParams, + EnumPutOptionalParams, + ExtensibleEnumGetOptionalParams, + ExtensibleEnumPutOptionalParams, + ModelGetOptionalParams, + ModelPutOptionalParams, + CollectionsStringGetOptionalParams, + CollectionsStringPutOptionalParams, + CollectionsIntGetOptionalParams, + CollectionsIntPutOptionalParams, + CollectionsModelGetOptionalParams, + CollectionsModelPutOptionalParams, + DictionaryStringGetOptionalParams, + DictionaryStringPutOptionalParams, + NeverGetOptionalParams, + NeverPutOptionalParams, + UnknownStringGetOptionalParams, + UnknownStringPutOptionalParams, + UnknownIntGetOptionalParams, + UnknownIntPutOptionalParams, + UnknownDictGetOptionalParams, + UnknownDictPutOptionalParams, + UnknownArrayGetOptionalParams, + UnknownArrayPutOptionalParams, + StringLiteralGetOptionalParams, + StringLiteralPutOptionalParams, + IntLiteralGetOptionalParams, + IntLiteralPutOptionalParams, + FloatLiteralGetOptionalParams, + FloatLiteralPutOptionalParams, + BooleanLiteralGetOptionalParams, + BooleanLiteralPutOptionalParams, + UnionStringLiteralGetOptionalParams, + UnionStringLiteralPutOptionalParams, + UnionIntLiteralGetOptionalParams, + UnionIntLiteralPutOptionalParams, + UnionFloatLiteralGetOptionalParams, + UnionFloatLiteralPutOptionalParams, + UnionEnumValueGetOptionalParams, + UnionEnumValuePutOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/models.ts index 495601ded6..c877c62881 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/models.ts @@ -7,6 +7,10 @@ export interface UnionEnumValueProperty { property: "value2"; } +/** Type of ExtendedEnum */ +/** "value2" */ +export type ExtendedEnum = string; + /** Model with a union of float literal as property. */ export interface UnionFloatLiteralProperty { /** Property */ diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/options.ts index eb3ed64540..80b8b93068 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/models/options.ts @@ -3,118 +3,118 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface BooleanGetOptions extends OperationOptions {} +export interface BooleanGetOptionalParams extends OperationOptions {} -export interface BooleanPutOptions extends OperationOptions {} +export interface BooleanPutOptionalParams extends OperationOptions {} -export interface StringGetOptions extends OperationOptions {} +export interface StringGetOptionalParams extends OperationOptions {} -export interface StringPutOptions extends OperationOptions {} +export interface StringPutOptionalParams extends OperationOptions {} -export interface BytesGetOptions extends OperationOptions {} +export interface BytesGetOptionalParams extends OperationOptions {} -export interface BytesPutOptions extends OperationOptions {} +export interface BytesPutOptionalParams extends OperationOptions {} -export interface IntGetOptions extends OperationOptions {} +export interface IntGetOptionalParams extends OperationOptions {} -export interface IntPutOptions extends OperationOptions {} +export interface IntPutOptionalParams extends OperationOptions {} -export interface FloatGetOptions extends OperationOptions {} +export interface FloatGetOptionalParams extends OperationOptions {} -export interface FloatPutOptions extends OperationOptions {} +export interface FloatPutOptionalParams extends OperationOptions {} -export interface DecimalGetOptions extends OperationOptions {} +export interface DecimalGetOptionalParams extends OperationOptions {} -export interface DecimalPutOptions extends OperationOptions {} +export interface DecimalPutOptionalParams extends OperationOptions {} -export interface Decimal128GetOptions extends OperationOptions {} +export interface Decimal128GetOptionalParams extends OperationOptions {} -export interface Decimal128PutOptions extends OperationOptions {} +export interface Decimal128PutOptionalParams extends OperationOptions {} -export interface DatetimeGetOptions extends OperationOptions {} +export interface DatetimeGetOptionalParams extends OperationOptions {} -export interface DatetimePutOptions extends OperationOptions {} +export interface DatetimePutOptionalParams extends OperationOptions {} -export interface DurationGetOptions extends OperationOptions {} +export interface DurationGetOptionalParams extends OperationOptions {} -export interface DurationPutOptions extends OperationOptions {} +export interface DurationPutOptionalParams extends OperationOptions {} -export interface EnumGetOptions extends OperationOptions {} +export interface EnumGetOptionalParams extends OperationOptions {} -export interface EnumPutOptions extends OperationOptions {} +export interface EnumPutOptionalParams extends OperationOptions {} -export interface ExtensibleEnumGetOptions extends OperationOptions {} +export interface ExtensibleEnumGetOptionalParams extends OperationOptions {} -export interface ExtensibleEnumPutOptions extends OperationOptions {} +export interface ExtensibleEnumPutOptionalParams extends OperationOptions {} -export interface ModelGetOptions extends OperationOptions {} +export interface ModelGetOptionalParams extends OperationOptions {} -export interface ModelPutOptions extends OperationOptions {} +export interface ModelPutOptionalParams extends OperationOptions {} -export interface CollectionsStringGetOptions extends OperationOptions {} +export interface CollectionsStringGetOptionalParams extends OperationOptions {} -export interface CollectionsStringPutOptions extends OperationOptions {} +export interface CollectionsStringPutOptionalParams extends OperationOptions {} -export interface CollectionsIntGetOptions extends OperationOptions {} +export interface CollectionsIntGetOptionalParams extends OperationOptions {} -export interface CollectionsIntPutOptions extends OperationOptions {} +export interface CollectionsIntPutOptionalParams extends OperationOptions {} -export interface CollectionsModelGetOptions extends OperationOptions {} +export interface CollectionsModelGetOptionalParams extends OperationOptions {} -export interface CollectionsModelPutOptions extends OperationOptions {} +export interface CollectionsModelPutOptionalParams extends OperationOptions {} -export interface DictionaryStringGetOptions extends OperationOptions {} +export interface DictionaryStringGetOptionalParams extends OperationOptions {} -export interface DictionaryStringPutOptions extends OperationOptions {} +export interface DictionaryStringPutOptionalParams extends OperationOptions {} -export interface NeverGetOptions extends OperationOptions {} +export interface NeverGetOptionalParams extends OperationOptions {} -export interface NeverPutOptions extends OperationOptions {} +export interface NeverPutOptionalParams extends OperationOptions {} -export interface UnknownStringGetOptions extends OperationOptions {} +export interface UnknownStringGetOptionalParams extends OperationOptions {} -export interface UnknownStringPutOptions extends OperationOptions {} +export interface UnknownStringPutOptionalParams extends OperationOptions {} -export interface UnknownIntGetOptions extends OperationOptions {} +export interface UnknownIntGetOptionalParams extends OperationOptions {} -export interface UnknownIntPutOptions extends OperationOptions {} +export interface UnknownIntPutOptionalParams extends OperationOptions {} -export interface UnknownDictGetOptions extends OperationOptions {} +export interface UnknownDictGetOptionalParams extends OperationOptions {} -export interface UnknownDictPutOptions extends OperationOptions {} +export interface UnknownDictPutOptionalParams extends OperationOptions {} -export interface UnknownArrayGetOptions extends OperationOptions {} +export interface UnknownArrayGetOptionalParams extends OperationOptions {} -export interface UnknownArrayPutOptions extends OperationOptions {} +export interface UnknownArrayPutOptionalParams extends OperationOptions {} -export interface StringLiteralGetOptions extends OperationOptions {} +export interface StringLiteralGetOptionalParams extends OperationOptions {} -export interface StringLiteralPutOptions extends OperationOptions {} +export interface StringLiteralPutOptionalParams extends OperationOptions {} -export interface IntLiteralGetOptions extends OperationOptions {} +export interface IntLiteralGetOptionalParams extends OperationOptions {} -export interface IntLiteralPutOptions extends OperationOptions {} +export interface IntLiteralPutOptionalParams extends OperationOptions {} -export interface FloatLiteralGetOptions extends OperationOptions {} +export interface FloatLiteralGetOptionalParams extends OperationOptions {} -export interface FloatLiteralPutOptions extends OperationOptions {} +export interface FloatLiteralPutOptionalParams extends OperationOptions {} -export interface BooleanLiteralGetOptions extends OperationOptions {} +export interface BooleanLiteralGetOptionalParams extends OperationOptions {} -export interface BooleanLiteralPutOptions extends OperationOptions {} +export interface BooleanLiteralPutOptionalParams extends OperationOptions {} -export interface UnionStringLiteralGetOptions extends OperationOptions {} +export interface UnionStringLiteralGetOptionalParams extends OperationOptions {} -export interface UnionStringLiteralPutOptions extends OperationOptions {} +export interface UnionStringLiteralPutOptionalParams extends OperationOptions {} -export interface UnionIntLiteralGetOptions extends OperationOptions {} +export interface UnionIntLiteralGetOptionalParams extends OperationOptions {} -export interface UnionIntLiteralPutOptions extends OperationOptions {} +export interface UnionIntLiteralPutOptionalParams extends OperationOptions {} -export interface UnionFloatLiteralGetOptions extends OperationOptions {} +export interface UnionFloatLiteralGetOptionalParams extends OperationOptions {} -export interface UnionFloatLiteralPutOptions extends OperationOptions {} +export interface UnionFloatLiteralPutOptionalParams extends OperationOptions {} -export interface UnionEnumValueGetOptions extends OperationOptions {} +export interface UnionEnumValueGetOptionalParams extends OperationOptions {} -export interface UnionEnumValuePutOptions extends OperationOptions {} +export interface UnionEnumValuePutOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/models.ts index 6f829bf5b2..b4525b2ae4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/models.ts @@ -76,7 +76,7 @@ export interface DurationProperty { /** Model with enum properties */ export interface EnumProperty { /** Property */ - property: "ValueOne" | "ValueTwo"; + property: FixedInnerEnum; } /** Model with extensible enum properties */ @@ -196,5 +196,7 @@ export interface UnionEnumValueProperty { property: "value2"; } +/** Enum that will be used as a property for model EnumProperty. Non-extensible. */ +export type FixedInnerEnum = "ValueOne" | "ValueTwo"; /** Alias for InnerEnum */ export type InnerEnum = string | "ValueOne" | "ValueTwo"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/outputModels.ts index 9f35cb9e51..eeb2a1a1c9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/outputModels.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/rest/outputModels.ts @@ -76,7 +76,7 @@ export interface DurationPropertyOutput { /** Model with enum properties */ export interface EnumPropertyOutput { /** Property */ - property: "ValueOne" | "ValueTwo"; + property: FixedInnerEnumOutput; } /** Model with extensible enum properties */ @@ -196,5 +196,7 @@ export interface UnionEnumValuePropertyOutput { property: "value2"; } +/** Enum that will be used as a property for model EnumProperty. Non-extensible. */ +export type FixedInnerEnumOutput = "ValueOne" | "ValueTwo"; /** Alias for InnerEnumOutput */ export type InnerEnumOutput = string | "ValueOne" | "ValueTwo"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/ValueTypesClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/valueTypesClient.ts similarity index 99% rename from packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/ValueTypesClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/valueTypesClient.ts index 132392c284..01e366d360 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/ValueTypesClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/propertyTypes/generated/src/valueTypesClient.ts @@ -106,7 +106,7 @@ import { ValueTypesContext, } from "./api/index.js"; -export { ValueTypesClientOptions } from "./api/ValueTypesContext.js"; +export { ValueTypesClientOptions } from "./api/valueTypesContext.js"; export class ValueTypesClient { private _client: ValueTypesContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/index.ts index 88107c085c..d5246c208d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/index.ts @@ -6,4 +6,4 @@ export { createUsage, UsageClientOptions, UsageContext, -} from "./UsageContext.js"; +} from "./usageContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/operations.ts index ff0ffe00ca..eac1888990 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/operations.ts @@ -18,15 +18,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "../models/options.js"; export function _inputSend( context: Client, inputParameter: InputRecord, - options: InputOptions = { requestOptions: {} }, + options: InputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/usage/input") @@ -49,7 +49,7 @@ export async function _inputDeserialize( export async function input( context: Client, inputParameter: InputRecord, - options: InputOptions = { requestOptions: {} }, + options: InputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _inputSend(context, inputParameter, options); return _inputDeserialize(result); @@ -57,7 +57,7 @@ export async function input( export function _outputSend( context: Client, - options: OutputOptions = { requestOptions: {} }, + options: OutputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/usage/output") @@ -78,7 +78,7 @@ export async function _outputDeserialize( export async function output( context: Client, - options: OutputOptions = { requestOptions: {} }, + options: OutputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _outputSend(context, options); return _outputDeserialize(result); @@ -87,7 +87,7 @@ export async function output( export function _inputAndOutputSend( context: Client, body: InputOutputRecord, - options: InputAndOutputOptions = { requestOptions: {} }, + options: InputAndOutputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/usage/input-output") @@ -112,7 +112,7 @@ export async function _inputAndOutputDeserialize( export async function inputAndOutput( context: Client, body: InputOutputRecord, - options: InputAndOutputOptions = { requestOptions: {} }, + options: InputAndOutputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _inputAndOutputSend(context, body, options); return _inputAndOutputDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/UsageContext.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/usageContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/UsageContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/api/usageContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/index.ts index 9212f4ab04..265368ee5c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/index.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { UsageClient, UsageClientOptions } from "./UsageClient.js"; +export { UsageClient, UsageClientOptions } from "./usageClient.js"; export { InputRecord, OutputRecord, InputOutputRecord, - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/index.ts index d33265b180..ffd2fc54d5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/index.ts @@ -3,7 +3,7 @@ export { InputRecord, OutputRecord, InputOutputRecord } from "./models.js"; export { - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/options.ts index c6d6831465..3013c20ec0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/models/options.ts @@ -3,8 +3,8 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface InputOptions extends OperationOptions {} +export interface InputOptionalParams extends OperationOptions {} -export interface OutputOptions extends OperationOptions {} +export interface OutputOptionalParams extends OperationOptions {} -export interface InputAndOutputOptions extends OperationOptions {} +export interface InputAndOutputOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/UsageClient.ts b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/usageClient.ts similarity index 77% rename from packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/UsageClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/usageClient.ts index da42de4ec0..cdd91afa30 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/UsageClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/models/usage/generated/src/usageClient.ts @@ -8,9 +8,9 @@ import { InputOutputRecord, } from "./models/models.js"; import { - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "./models/options.js"; import { input, @@ -21,7 +21,7 @@ import { UsageContext, } from "./api/index.js"; -export { UsageClientOptions } from "./api/UsageContext.js"; +export { UsageClientOptions } from "./api/usageContext.js"; export class UsageClient { private _client: UsageContext; @@ -36,20 +36,20 @@ export class UsageClient { input( inputParameter: InputRecord, - options: InputOptions = { requestOptions: {} }, + options: InputOptionalParams = { requestOptions: {} }, ): Promise { return input(this._client, inputParameter, options); } output( - options: OutputOptions = { requestOptions: {} }, + options: OutputOptionalParams = { requestOptions: {} }, ): Promise { return output(this._client, options); } inputAndOutput( body: InputOutputRecord, - options: InputAndOutputOptions = { requestOptions: {} }, + options: InputAndOutputOptionalParams = { requestOptions: {} }, ): Promise { return inputAndOutput(this._client, body, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/BodyOptionalityContext.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/bodyOptionalityContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/BodyOptionalityContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/bodyOptionalityContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/index.ts index 9183b2fc8b..4c214471d3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/index.ts @@ -5,5 +5,5 @@ export { createBodyOptionality, BodyOptionalityClientOptions, BodyOptionalityContext, -} from "./BodyOptionalityContext.js"; +} from "./bodyOptionalityContext.js"; export { requiredExplicit, requiredImplicit } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/operations.ts index f65cd9d628..7bff7fa7ee 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/operations.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - RequiredExplicitOptions, - RequiredImplicitOptions, + RequiredExplicitOptionalParams, + RequiredImplicitOptionalParams, } from "../models/options.js"; export function _requiredExplicitSend( context: Client, body: BodyModel, - options: RequiredExplicitOptions = { requestOptions: {} }, + options: RequiredExplicitOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/body-optionality/required-explicit") @@ -43,7 +43,7 @@ export async function _requiredExplicitDeserialize( export async function requiredExplicit( context: Client, body: BodyModel, - options: RequiredExplicitOptions = { requestOptions: {} }, + options: RequiredExplicitOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requiredExplicitSend(context, body, options); return _requiredExplicitDeserialize(result); @@ -52,7 +52,7 @@ export async function requiredExplicit( export function _requiredImplicitSend( context: Client, body: BodyModel, - options: RequiredImplicitOptions = { requestOptions: {} }, + options: RequiredImplicitOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/body-optionality/required-implicit") @@ -75,7 +75,7 @@ export async function _requiredImplicitDeserialize( export async function requiredImplicit( context: Client, body: BodyModel, - options: RequiredImplicitOptions = { requestOptions: {} }, + options: RequiredImplicitOptionalParams = { requestOptions: {} }, ): Promise { const result = await _requiredImplicitSend(context, body, options); return _requiredImplicitDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/optionalExplicit/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/optionalExplicit/index.ts index ef18163202..3321e55168 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/optionalExplicit/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/api/optionalExplicit/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - OptionalExplicitSetOptions, - OptionalExplicitOmitOptions, + OptionalExplicitSetOptionalParams, + OptionalExplicitOmitOptionalParams, } from "../../models/options.js"; export function _setSend( context: Client, body?: BodyModel, - options: OptionalExplicitSetOptions = { requestOptions: {} }, + options: OptionalExplicitSetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/body-optionality/optional-explicit/set") @@ -43,7 +43,7 @@ export async function _setDeserialize( export async function set( context: Client, body?: BodyModel, - options: OptionalExplicitSetOptions = { requestOptions: {} }, + options: OptionalExplicitSetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _setSend(context, body, options); return _setDeserialize(result); @@ -52,7 +52,7 @@ export async function set( export function _omitSend( context: Client, body?: BodyModel, - options: OptionalExplicitOmitOptions = { requestOptions: {} }, + options: OptionalExplicitOmitOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/body-optionality/optional-explicit/omit") @@ -73,7 +73,7 @@ export async function _omitDeserialize(result: Omit204Response): Promise { export async function omit( context: Client, body?: BodyModel, - options: OptionalExplicitOmitOptions = { requestOptions: {} }, + options: OptionalExplicitOmitOptionalParams = { requestOptions: {} }, ): Promise { const result = await _omitSend(context, body, options); return _omitDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/BodyOptionalityClient.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/bodyOptionalityClient.ts similarity index 83% rename from packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/BodyOptionalityClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/bodyOptionalityClient.ts index 4a963ad689..eec77f056a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/BodyOptionalityClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/bodyOptionalityClient.ts @@ -4,8 +4,8 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { BodyModel } from "./models/models.js"; import { - RequiredExplicitOptions, - RequiredImplicitOptions, + RequiredExplicitOptionalParams, + RequiredImplicitOptionalParams, } from "./models/options.js"; import { getOptionalExplicitOperations, @@ -19,7 +19,7 @@ import { requiredImplicit, } from "./api/index.js"; -export { BodyOptionalityClientOptions } from "./api/BodyOptionalityContext.js"; +export { BodyOptionalityClientOptions } from "./api/bodyOptionalityContext.js"; export class BodyOptionalityClient { private _client: BodyOptionalityContext; @@ -35,14 +35,14 @@ export class BodyOptionalityClient { requiredExplicit( body: BodyModel, - options: RequiredExplicitOptions = { requestOptions: {} }, + options: RequiredExplicitOptionalParams = { requestOptions: {} }, ): Promise { return requiredExplicit(this._client, body, options); } requiredImplicit( body: BodyModel, - options: RequiredImplicitOptions = { requestOptions: {} }, + options: RequiredImplicitOptionalParams = { requestOptions: {} }, ): Promise { return requiredImplicit(this._client, body, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/classic/optionalExplicit/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/classic/optionalExplicit/index.ts index 6af36862ec..1a4ea9866b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/classic/optionalExplicit/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/classic/optionalExplicit/index.ts @@ -1,30 +1,30 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { BodyOptionalityContext } from "../../api/BodyOptionalityContext.js"; +import { BodyOptionalityContext } from "../../api/bodyOptionalityContext.js"; import { BodyModel } from "../../models/models.js"; import { set, omit } from "../../api/optionalExplicit/index.js"; import { - OptionalExplicitSetOptions, - OptionalExplicitOmitOptions, + OptionalExplicitSetOptionalParams, + OptionalExplicitOmitOptionalParams, } from "../../models/options.js"; export interface OptionalExplicitOperations { set: ( body?: BodyModel, - options?: OptionalExplicitSetOptions, + options?: OptionalExplicitSetOptionalParams, ) => Promise; omit: ( body?: BodyModel, - options?: OptionalExplicitOmitOptions, + options?: OptionalExplicitOmitOptionalParams, ) => Promise; } export function getOptionalExplicit(context: BodyOptionalityContext) { return { - set: (body?: BodyModel, options?: OptionalExplicitSetOptions) => + set: (body?: BodyModel, options?: OptionalExplicitSetOptionalParams) => set(context, body, options), - omit: (body?: BodyModel, options?: OptionalExplicitOmitOptions) => + omit: (body?: BodyModel, options?: OptionalExplicitOmitOptionalParams) => omit(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.ts index 2d16682d2d..4cc4210743 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.ts @@ -4,12 +4,12 @@ export { BodyOptionalityClient, BodyOptionalityClientOptions, -} from "./BodyOptionalityClient.js"; +} from "./bodyOptionalityClient.js"; export { BodyModel, - RequiredExplicitOptions, - RequiredImplicitOptions, - OptionalExplicitSetOptions, - OptionalExplicitOmitOptions, + RequiredExplicitOptionalParams, + RequiredImplicitOptionalParams, + OptionalExplicitSetOptionalParams, + OptionalExplicitOmitOptionalParams, } from "./models/index.js"; export { OptionalExplicitOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/index.ts index 391b3ab592..9fafa6b199 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/index.ts @@ -3,8 +3,8 @@ export { BodyModel } from "./models.js"; export { - RequiredExplicitOptions, - RequiredImplicitOptions, - OptionalExplicitSetOptions, - OptionalExplicitOmitOptions, + RequiredExplicitOptionalParams, + RequiredImplicitOptionalParams, + OptionalExplicitSetOptionalParams, + OptionalExplicitOmitOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/options.ts index 9621a14b12..3c514e40fc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/models/options.ts @@ -3,10 +3,10 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface RequiredExplicitOptions extends OperationOptions {} +export interface RequiredExplicitOptionalParams extends OperationOptions {} -export interface RequiredImplicitOptions extends OperationOptions {} +export interface RequiredImplicitOptionalParams extends OperationOptions {} -export interface OptionalExplicitSetOptions extends OperationOptions {} +export interface OptionalExplicitSetOptionalParams extends OperationOptions {} -export interface OptionalExplicitOmitOptions extends OperationOptions {} +export interface OptionalExplicitOmitOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/CollectionFormatContext.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/collectionFormatContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/CollectionFormatContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/collectionFormatContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/header/index.ts index 6b49df14fc..3f0bac2f98 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/header/index.ts @@ -11,12 +11,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { HeaderCsvOptions } from "../../models/options.js"; +import { HeaderCsvOptionalParams } from "../../models/options.js"; export function _headerCsvSend( context: Client, colors: string[], - options: HeaderCsvOptions = { requestOptions: {} }, + options: HeaderCsvOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/collection-format/header/csv") @@ -39,7 +39,7 @@ export async function _headerCsvDeserialize( export async function headerCsv( context: Client, colors: string[], - options: HeaderCsvOptions = { requestOptions: {} }, + options: HeaderCsvOptionalParams = { requestOptions: {} }, ): Promise { const result = await _headerCsvSend(context, colors, options); return _headerCsvDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/index.ts index adb430f41f..2a2047aa69 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/index.ts @@ -5,7 +5,7 @@ export { createCollectionFormat, CollectionFormatClientOptions, CollectionFormatContext, -} from "./CollectionFormatContext.js"; +} from "./collectionFormatContext.js"; export { headerCsv } from "./header/index.js"; export { queryMulti, diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/query/index.ts index f3eaf0600a..956dae98f2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/api/query/index.ts @@ -19,17 +19,17 @@ import { createRestError, } from "@azure-rest/core-client"; import { - QueryMultiOptions, - QuerySsvOptions, - QueryTsvOptions, - QueryPipesOptions, - QueryCsvOptions, + QueryMultiOptionalParams, + QuerySsvOptionalParams, + QueryTsvOptionalParams, + QueryPipesOptionalParams, + QueryCsvOptionalParams, } from "../../models/options.js"; export function _queryMultiSend( context: Client, colors: string[], - options: QueryMultiOptions = { requestOptions: {} }, + options: QueryMultiOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/collection-format/query/multi") @@ -52,7 +52,7 @@ export async function _queryMultiDeserialize( export async function queryMulti( context: Client, colors: string[], - options: QueryMultiOptions = { requestOptions: {} }, + options: QueryMultiOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryMultiSend(context, colors, options); return _queryMultiDeserialize(result); @@ -61,7 +61,7 @@ export async function queryMulti( export function _querySsvSend( context: Client, colors: string[], - options: QuerySsvOptions = { requestOptions: {} }, + options: QuerySsvOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/collection-format/query/ssv") @@ -84,7 +84,7 @@ export async function _querySsvDeserialize( export async function querySsv( context: Client, colors: string[], - options: QuerySsvOptions = { requestOptions: {} }, + options: QuerySsvOptionalParams = { requestOptions: {} }, ): Promise { const result = await _querySsvSend(context, colors, options); return _querySsvDeserialize(result); @@ -93,7 +93,7 @@ export async function querySsv( export function _queryTsvSend( context: Client, colors: string[], - options: QueryTsvOptions = { requestOptions: {} }, + options: QueryTsvOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/collection-format/query/tsv") @@ -116,7 +116,7 @@ export async function _queryTsvDeserialize( export async function queryTsv( context: Client, colors: string[], - options: QueryTsvOptions = { requestOptions: {} }, + options: QueryTsvOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryTsvSend(context, colors, options); return _queryTsvDeserialize(result); @@ -125,7 +125,7 @@ export async function queryTsv( export function _queryPipesSend( context: Client, colors: string[], - options: QueryPipesOptions = { requestOptions: {} }, + options: QueryPipesOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/collection-format/query/pipes") @@ -148,7 +148,7 @@ export async function _queryPipesDeserialize( export async function queryPipes( context: Client, colors: string[], - options: QueryPipesOptions = { requestOptions: {} }, + options: QueryPipesOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryPipesSend(context, colors, options); return _queryPipesDeserialize(result); @@ -157,7 +157,7 @@ export async function queryPipes( export function _queryCsvSend( context: Client, colors: string[], - options: QueryCsvOptions = { requestOptions: {} }, + options: QueryCsvOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/collection-format/query/csv") @@ -180,7 +180,7 @@ export async function _queryCsvDeserialize( export async function queryCsv( context: Client, colors: string[], - options: QueryCsvOptions = { requestOptions: {} }, + options: QueryCsvOptionalParams = { requestOptions: {} }, ): Promise { const result = await _queryCsvSend(context, colors, options); return _queryCsvDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/header/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/header/index.ts index 39c24b0f6b..fef90001d9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/header/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/header/index.ts @@ -1,17 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { CollectionFormatContext } from "../../api/CollectionFormatContext.js"; +import { CollectionFormatContext } from "../../api/collectionFormatContext.js"; import { headerCsv } from "../../api/header/index.js"; -import { HeaderCsvOptions } from "../../models/options.js"; +import { HeaderCsvOptionalParams } from "../../models/options.js"; export interface HeaderOperations { - csv: (colors: string[], options?: HeaderCsvOptions) => Promise; + csv: (colors: string[], options?: HeaderCsvOptionalParams) => Promise; } export function getHeader(context: CollectionFormatContext) { return { - csv: (colors: string[], options?: HeaderCsvOptions) => + csv: (colors: string[], options?: HeaderCsvOptionalParams) => headerCsv(context, colors, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/query/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/query/index.ts index 8013fdd249..3699b2ec76 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/query/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/classic/query/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { CollectionFormatContext } from "../../api/CollectionFormatContext.js"; +import { CollectionFormatContext } from "../../api/collectionFormatContext.js"; import { queryMulti, querySsv, @@ -10,32 +10,38 @@ import { queryCsv, } from "../../api/query/index.js"; import { - QueryMultiOptions, - QuerySsvOptions, - QueryTsvOptions, - QueryPipesOptions, - QueryCsvOptions, + QueryMultiOptionalParams, + QuerySsvOptionalParams, + QueryTsvOptionalParams, + QueryPipesOptionalParams, + QueryCsvOptionalParams, } from "../../models/options.js"; export interface QueryOperations { - multi: (colors: string[], options?: QueryMultiOptions) => Promise; - ssv: (colors: string[], options?: QuerySsvOptions) => Promise; - tsv: (colors: string[], options?: QueryTsvOptions) => Promise; - pipes: (colors: string[], options?: QueryPipesOptions) => Promise; - csv: (colors: string[], options?: QueryCsvOptions) => Promise; + multi: ( + colors: string[], + options?: QueryMultiOptionalParams, + ) => Promise; + ssv: (colors: string[], options?: QuerySsvOptionalParams) => Promise; + tsv: (colors: string[], options?: QueryTsvOptionalParams) => Promise; + pipes: ( + colors: string[], + options?: QueryPipesOptionalParams, + ) => Promise; + csv: (colors: string[], options?: QueryCsvOptionalParams) => Promise; } export function getQuery(context: CollectionFormatContext) { return { - multi: (colors: string[], options?: QueryMultiOptions) => + multi: (colors: string[], options?: QueryMultiOptionalParams) => queryMulti(context, colors, options), - ssv: (colors: string[], options?: QuerySsvOptions) => + ssv: (colors: string[], options?: QuerySsvOptionalParams) => querySsv(context, colors, options), - tsv: (colors: string[], options?: QueryTsvOptions) => + tsv: (colors: string[], options?: QueryTsvOptionalParams) => queryTsv(context, colors, options), - pipes: (colors: string[], options?: QueryPipesOptions) => + pipes: (colors: string[], options?: QueryPipesOptionalParams) => queryPipes(context, colors, options), - csv: (colors: string[], options?: QueryCsvOptions) => + csv: (colors: string[], options?: QueryCsvOptionalParams) => queryCsv(context, colors, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/CollectionFormatClient.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/collectionFormatClient.ts similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/CollectionFormatClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/collectionFormatClient.ts index 2683b122d2..e7bea681ab 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/CollectionFormatClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/collectionFormatClient.ts @@ -13,7 +13,7 @@ import { CollectionFormatContext, } from "./api/index.js"; -export { CollectionFormatClientOptions } from "./api/CollectionFormatContext.js"; +export { CollectionFormatClientOptions } from "./api/collectionFormatContext.js"; export class CollectionFormatClient { private _client: CollectionFormatContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.ts index e951c92d7b..e299a10154 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.ts @@ -4,13 +4,13 @@ export { CollectionFormatClient, CollectionFormatClientOptions, -} from "./CollectionFormatClient.js"; +} from "./collectionFormatClient.js"; export { - QueryMultiOptions, - QuerySsvOptions, - QueryTsvOptions, - QueryPipesOptions, - QueryCsvOptions, - HeaderCsvOptions, + QueryMultiOptionalParams, + QuerySsvOptionalParams, + QueryTsvOptionalParams, + QueryPipesOptionalParams, + QueryCsvOptionalParams, + HeaderCsvOptionalParams, } from "./models/index.js"; export { HeaderOperations, QueryOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/index.ts index a2f9a190cc..e04661aa32 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/index.ts @@ -2,10 +2,10 @@ // Licensed under the MIT license. export { - QueryMultiOptions, - QuerySsvOptions, - QueryTsvOptions, - QueryPipesOptions, - QueryCsvOptions, - HeaderCsvOptions, + QueryMultiOptionalParams, + QuerySsvOptionalParams, + QueryTsvOptionalParams, + QueryPipesOptionalParams, + QueryCsvOptionalParams, + HeaderCsvOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/options.ts index 35eafdd2c4..e2965a6805 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/models/options.ts @@ -3,14 +3,14 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface QueryMultiOptions extends OperationOptions {} +export interface QueryMultiOptionalParams extends OperationOptions {} -export interface QuerySsvOptions extends OperationOptions {} +export interface QuerySsvOptionalParams extends OperationOptions {} -export interface QueryTsvOptions extends OperationOptions {} +export interface QueryTsvOptionalParams extends OperationOptions {} -export interface QueryPipesOptions extends OperationOptions {} +export interface QueryPipesOptionalParams extends OperationOptions {} -export interface QueryCsvOptions extends OperationOptions {} +export interface QueryCsvOptionalParams extends OperationOptions {} -export interface HeaderCsvOptions extends OperationOptions {} +export interface HeaderCsvOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/alias/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/alias/index.ts index e738e29f6e..9149ae49c8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/alias/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/alias/index.ts @@ -13,15 +13,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - AliasSpreadAsRequestBodyOptions, - AliasSpreadAsRequestParameterOptions, - AliasSpreadWithMultipleParametersOptions, + AliasSpreadAsRequestBodyOptionalParams, + AliasSpreadAsRequestParameterOptionalParams, + AliasSpreadWithMultipleParametersOptionalParams, } from "../../models/options.js"; export function _aliasSpreadAsRequestBodySend( context: Client, name: string, - options: AliasSpreadAsRequestBodyOptions = { requestOptions: {} }, + options: AliasSpreadAsRequestBodyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/spread/alias/request-body") @@ -44,7 +44,7 @@ export async function _aliasSpreadAsRequestBodyDeserialize( export async function aliasSpreadAsRequestBody( context: Client, name: string, - options: AliasSpreadAsRequestBodyOptions = { requestOptions: {} }, + options: AliasSpreadAsRequestBodyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _aliasSpreadAsRequestBodySend(context, name, options); return _aliasSpreadAsRequestBodyDeserialize(result); @@ -55,7 +55,7 @@ export function _aliasSpreadAsRequestParameterSend( id: string, xMsTestHeader: string, name: string, - options: AliasSpreadAsRequestParameterOptions = { requestOptions: {} }, + options: AliasSpreadAsRequestParameterOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/spread/alias/request-parameter/{id}", id) @@ -81,7 +81,7 @@ export async function aliasSpreadAsRequestParameter( id: string, xMsTestHeader: string, name: string, - options: AliasSpreadAsRequestParameterOptions = { requestOptions: {} }, + options: AliasSpreadAsRequestParameterOptionalParams = { requestOptions: {} }, ): Promise { const result = await _aliasSpreadAsRequestParameterSend( context, @@ -103,7 +103,9 @@ export function _aliasSpreadWithMultipleParametersSend( prop4: string, prop5: string, prop6: string, - options: AliasSpreadWithMultipleParametersOptions = { requestOptions: {} }, + options: AliasSpreadWithMultipleParametersOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path("/parameters/spread/alias/multiple-parameters/{id}", id) @@ -141,7 +143,9 @@ export async function aliasSpreadWithMultipleParameters( prop4: string, prop5: string, prop6: string, - options: AliasSpreadWithMultipleParametersOptions = { requestOptions: {} }, + options: AliasSpreadWithMultipleParametersOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _aliasSpreadWithMultipleParametersSend( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/index.ts index 1f45690b7f..022f25d359 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/index.ts @@ -5,7 +5,7 @@ export { createSpread, SpreadClientOptions, SpreadContext, -} from "./SpreadContext.js"; +} from "./spreadContext.js"; export { aliasSpreadAsRequestBody, aliasSpreadAsRequestParameter, diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/model/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/model/index.ts index a8923d1be8..db41f3ea8e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/model/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/model/index.ts @@ -11,12 +11,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ModelSpreadAsRequestBodyOptions } from "../../models/options.js"; +import { ModelSpreadAsRequestBodyOptionalParams } from "../../models/options.js"; export function _modelSpreadAsRequestBodySend( context: Client, body: BodyParameter, - options: ModelSpreadAsRequestBodyOptions = { requestOptions: {} }, + options: ModelSpreadAsRequestBodyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/parameters/spread/model/request-body") @@ -39,7 +39,7 @@ export async function _modelSpreadAsRequestBodyDeserialize( export async function modelSpreadAsRequestBody( context: Client, body: BodyParameter, - options: ModelSpreadAsRequestBodyOptions = { requestOptions: {} }, + options: ModelSpreadAsRequestBodyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _modelSpreadAsRequestBodySend(context, body, options); return _modelSpreadAsRequestBodyDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/SpreadContext.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/spreadContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/SpreadContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/api/spreadContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/alias/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/alias/index.ts index 9b59449671..ff8f464b13 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/alias/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/alias/index.ts @@ -1,28 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { SpreadContext } from "../../api/SpreadContext.js"; +import { SpreadContext } from "../../api/spreadContext.js"; import { aliasSpreadAsRequestBody, aliasSpreadAsRequestParameter, aliasSpreadWithMultipleParameters, } from "../../api/alias/index.js"; import { - AliasSpreadAsRequestBodyOptions, - AliasSpreadAsRequestParameterOptions, - AliasSpreadWithMultipleParametersOptions, + AliasSpreadAsRequestBodyOptionalParams, + AliasSpreadAsRequestParameterOptionalParams, + AliasSpreadWithMultipleParametersOptionalParams, } from "../../models/options.js"; export interface AliasOperations { spreadAsRequestBody: ( name: string, - options?: AliasSpreadAsRequestBodyOptions, + options?: AliasSpreadAsRequestBodyOptionalParams, ) => Promise; spreadAsRequestParameter: ( id: string, xMsTestHeader: string, name: string, - options?: AliasSpreadAsRequestParameterOptions, + options?: AliasSpreadAsRequestParameterOptionalParams, ) => Promise; spreadWithMultipleParameters: ( id: string, @@ -33,7 +33,7 @@ export interface AliasOperations { prop4: string, prop5: string, prop6: string, - options?: AliasSpreadWithMultipleParametersOptions, + options?: AliasSpreadWithMultipleParametersOptionalParams, ) => Promise; } @@ -41,13 +41,13 @@ export function getAlias(context: SpreadContext) { return { spreadAsRequestBody: ( name: string, - options?: AliasSpreadAsRequestBodyOptions, + options?: AliasSpreadAsRequestBodyOptionalParams, ) => aliasSpreadAsRequestBody(context, name, options), spreadAsRequestParameter: ( id: string, xMsTestHeader: string, name: string, - options?: AliasSpreadAsRequestParameterOptions, + options?: AliasSpreadAsRequestParameterOptionalParams, ) => aliasSpreadAsRequestParameter(context, id, xMsTestHeader, name, options), spreadWithMultipleParameters: ( @@ -59,7 +59,7 @@ export function getAlias(context: SpreadContext) { prop4: string, prop5: string, prop6: string, - options?: AliasSpreadWithMultipleParametersOptions, + options?: AliasSpreadWithMultipleParametersOptionalParams, ) => aliasSpreadWithMultipleParameters( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/model/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/model/index.ts index 044c8baa1c..4b17bdf1eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/model/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/classic/model/index.ts @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { SpreadContext } from "../../api/SpreadContext.js"; +import { SpreadContext } from "../../api/spreadContext.js"; import { BodyParameter } from "../../models/models.js"; import { modelSpreadAsRequestBody } from "../../api/model/index.js"; -import { ModelSpreadAsRequestBodyOptions } from "../../models/options.js"; +import { ModelSpreadAsRequestBodyOptionalParams } from "../../models/options.js"; export interface ModelOperations { spreadAsRequestBody: ( body: BodyParameter, - options?: ModelSpreadAsRequestBodyOptions, + options?: ModelSpreadAsRequestBodyOptionalParams, ) => Promise; } @@ -17,7 +17,7 @@ export function getModel(context: SpreadContext) { return { spreadAsRequestBody: ( body: BodyParameter, - options?: ModelSpreadAsRequestBodyOptions, + options?: ModelSpreadAsRequestBodyOptionalParams, ) => modelSpreadAsRequestBody(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.ts index 7f67cb7c61..390ffec023 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { SpreadClient, SpreadClientOptions } from "./SpreadClient.js"; +export { SpreadClient, SpreadClientOptions } from "./spreadClient.js"; export { BodyParameter, - ModelSpreadAsRequestBodyOptions, - AliasSpreadAsRequestBodyOptions, - AliasSpreadAsRequestParameterOptions, - AliasSpreadWithMultipleParametersOptions, + ModelSpreadAsRequestBodyOptionalParams, + AliasSpreadAsRequestBodyOptionalParams, + AliasSpreadAsRequestParameterOptionalParams, + AliasSpreadWithMultipleParametersOptionalParams, } from "./models/index.js"; export { AliasOperations, ModelOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/index.ts index 806cd89848..811c07d0c1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/index.ts @@ -3,8 +3,8 @@ export { BodyParameter } from "./models.js"; export { - ModelSpreadAsRequestBodyOptions, - AliasSpreadAsRequestBodyOptions, - AliasSpreadAsRequestParameterOptions, - AliasSpreadWithMultipleParametersOptions, + ModelSpreadAsRequestBodyOptionalParams, + AliasSpreadAsRequestBodyOptionalParams, + AliasSpreadAsRequestParameterOptionalParams, + AliasSpreadWithMultipleParametersOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/options.ts index 7775443966..70271a0f3c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/models/options.ts @@ -3,12 +3,14 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ModelSpreadAsRequestBodyOptions extends OperationOptions {} +export interface ModelSpreadAsRequestBodyOptionalParams + extends OperationOptions {} -export interface AliasSpreadAsRequestBodyOptions extends OperationOptions {} +export interface AliasSpreadAsRequestBodyOptionalParams + extends OperationOptions {} -export interface AliasSpreadAsRequestParameterOptions +export interface AliasSpreadAsRequestParameterOptionalParams extends OperationOptions {} -export interface AliasSpreadWithMultipleParametersOptions +export interface AliasSpreadWithMultipleParametersOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/SpreadClient.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/spreadClient.ts similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/SpreadClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/spreadClient.ts index 7080297717..526b71002d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/SpreadClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/spreadClient.ts @@ -10,7 +10,7 @@ import { SpreadContext, } from "./api/index.js"; -export { SpreadClientOptions } from "./api/SpreadContext.js"; +export { SpreadClientOptions } from "./api/spreadContext.js"; export class SpreadClient { private _client: SpreadContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/index.ts new file mode 100644 index 0000000000..dddda4ce89 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createMediaType, + MediaTypeClientOptions, + MediaTypeContext, +} from "./mediaTypeContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/mediaTypeContext.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/mediaTypeContext.ts new file mode 100644 index 0000000000..21acbe0c55 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/mediaTypeContext.ts @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ClientOptions } from "@azure-rest/core-client"; +import { MediaTypeContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface MediaTypeClientOptions extends ClientOptions {} + +export { MediaTypeContext } from "../rest/index.js"; + +/** Test the payload with different media types and different types of the payload itself. */ +export function createMediaType( + options: MediaTypeClientOptions = {}, +): MediaTypeContext { + const clientContext = getClient(options); + return clientContext; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/stringBody/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/stringBody/index.ts new file mode 100644 index 0000000000..5969fbe5d3 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/api/stringBody/index.ts @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + GetAsJson200Response, + GetAsText200Response, + MediaTypeContext as Client, + SendAsJson200Response, + SendAsText200Response, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + StringBodySendAsTextOptionalParams, + StringBodyGetAsTextOptionalParams, + StringBodySendAsJsonOptionalParams, + StringBodyGetAsJsonOptionalParams, +} from "../../models/options.js"; + +export function _sendAsTextSend( + context: Client, + text: string, + options: StringBodySendAsTextOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/payload/media-type/string-body/sendAsText") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: (options.contentType as any) ?? "text/plain", + body: text, + }); +} + +export async function _sendAsTextDeserialize( + result: SendAsText200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return; +} + +export async function sendAsText( + context: Client, + text: string, + options: StringBodySendAsTextOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _sendAsTextSend(context, text, options); + return _sendAsTextDeserialize(result); +} + +export function _getAsTextSend( + context: Client, + options: StringBodyGetAsTextOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/payload/media-type/string-body/getAsText") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getAsTextDeserialize( + result: GetAsText200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return result.body; +} + +export async function getAsText( + context: Client, + options: StringBodyGetAsTextOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getAsTextSend(context, options); + return _getAsTextDeserialize(result); +} + +export function _sendAsJsonSend( + context: Client, + text: string, + options: StringBodySendAsJsonOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/payload/media-type/string-body/sendAsJson") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: (options.contentType as any) ?? "application/json", + body: text, + }); +} + +export async function _sendAsJsonDeserialize( + result: SendAsJson200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return; +} + +export async function sendAsJson( + context: Client, + text: string, + options: StringBodySendAsJsonOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _sendAsJsonSend(context, text, options); + return _sendAsJsonDeserialize(result); +} + +export function _getAsJsonSend( + context: Client, + options: StringBodyGetAsJsonOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/payload/media-type/string-body/getAsJson") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _getAsJsonDeserialize( + result: GetAsJson200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return result.body; +} + +export async function getAsJson( + context: Client, + options: StringBodyGetAsJsonOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getAsJsonSend(context, options); + return _getAsJsonDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/index.ts new file mode 100644 index 0000000000..8545fd6bf5 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/index.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { StringBodyOperations } from "./stringBody/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/stringBody/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/stringBody/index.ts new file mode 100644 index 0000000000..0e4376946b --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/classic/stringBody/index.ts @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { MediaTypeContext } from "../../api/mediaTypeContext.js"; +import { + sendAsText, + getAsText, + sendAsJson, + getAsJson, +} from "../../api/stringBody/index.js"; +import { + StringBodySendAsTextOptionalParams, + StringBodyGetAsTextOptionalParams, + StringBodySendAsJsonOptionalParams, + StringBodyGetAsJsonOptionalParams, +} from "../../models/options.js"; + +export interface StringBodyOperations { + sendAsText: ( + text: string, + options?: StringBodySendAsTextOptionalParams, + ) => Promise; + getAsText: (options?: StringBodyGetAsTextOptionalParams) => Promise; + sendAsJson: ( + text: string, + options?: StringBodySendAsJsonOptionalParams, + ) => Promise; + getAsJson: (options?: StringBodyGetAsJsonOptionalParams) => Promise; +} + +export function getStringBody(context: MediaTypeContext) { + return { + sendAsText: (text: string, options?: StringBodySendAsTextOptionalParams) => + sendAsText(context, text, options), + getAsText: (options?: StringBodyGetAsTextOptionalParams) => + getAsText(context, options), + sendAsJson: (text: string, options?: StringBodySendAsJsonOptionalParams) => + sendAsJson(context, text, options), + getAsJson: (options?: StringBodyGetAsJsonOptionalParams) => + getAsJson(context, options), + }; +} + +export function getStringBodyOperations( + context: MediaTypeContext, +): StringBodyOperations { + return { + ...getStringBody(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.ts new file mode 100644 index 0000000000..77f2e19aac --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { MediaTypeClient, MediaTypeClientOptions } from "./mediaTypeClient.js"; +export { + StringBodySendAsTextOptionalParams, + StringBodyGetAsTextOptionalParams, + StringBodySendAsJsonOptionalParams, + StringBodyGetAsJsonOptionalParams, +} from "./models/index.js"; +export { StringBodyOperations } from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/logger.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/logger.ts new file mode 100644 index 0000000000..7afb8eab7e --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("payload-mediaType"); diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/mediaTypeClient.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/mediaTypeClient.ts new file mode 100644 index 0000000000..a83426ceb8 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/mediaTypeClient.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Pipeline } from "@azure/core-rest-pipeline"; +import { + getStringBodyOperations, + StringBodyOperations, +} from "./classic/stringBody/index.js"; +import { + createMediaType, + MediaTypeClientOptions, + MediaTypeContext, +} from "./api/index.js"; + +export { MediaTypeClientOptions } from "./api/mediaTypeContext.js"; + +export class MediaTypeClient { + private _client: MediaTypeContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Test the payload with different media types and different types of the payload itself. */ + constructor(options: MediaTypeClientOptions = {}) { + this._client = createMediaType(options); + this.pipeline = this._client.pipeline; + this.stringBody = getStringBodyOperations(this._client); + } + + /** The operation groups for StringBody */ + public readonly stringBody: StringBodyOperations; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/index.ts new file mode 100644 index 0000000000..044926d510 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + StringBodySendAsTextOptionalParams, + StringBodyGetAsTextOptionalParams, + StringBodySendAsJsonOptionalParams, + StringBodyGetAsJsonOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/options.ts new file mode 100644 index 0000000000..45ad4ae19b --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/models/options.ts @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface StringBodySendAsTextOptionalParams extends OperationOptions { + contentType?: string; +} + +export interface StringBodyGetAsTextOptionalParams extends OperationOptions {} + +export interface StringBodySendAsJsonOptionalParams extends OperationOptions { + contentType?: string; +} + +export interface StringBodyGetAsJsonOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/clientDefinitions.ts new file mode 100644 index 0000000000..d331bab722 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/clientDefinitions.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + SendAsTextParameters, + GetAsTextParameters, + SendAsJsonParameters, + GetAsJsonParameters, +} from "./parameters.js"; +import { + SendAsText200Response, + GetAsText200Response, + SendAsJson200Response, + GetAsJson200Response, +} from "./responses.js"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface SendAsText { + post(options: SendAsTextParameters): StreamableMethod; +} + +export interface GetAsText { + get(options?: GetAsTextParameters): StreamableMethod; +} + +export interface SendAsJson { + post(options: SendAsJsonParameters): StreamableMethod; +} + +export interface GetAsJson { + get(options?: GetAsJsonParameters): StreamableMethod; +} + +export interface Routes { + /** Resource for '/payload/media-type/string-body/sendAsText' has methods for the following verbs: post */ + (path: "/payload/media-type/string-body/sendAsText"): SendAsText; + /** Resource for '/payload/media-type/string-body/getAsText' has methods for the following verbs: get */ + (path: "/payload/media-type/string-body/getAsText"): GetAsText; + /** Resource for '/payload/media-type/string-body/sendAsJson' has methods for the following verbs: post */ + (path: "/payload/media-type/string-body/sendAsJson"): SendAsJson; + /** Resource for '/payload/media-type/string-body/getAsJson' has methods for the following verbs: get */ + (path: "/payload/media-type/string-body/getAsJson"): GetAsJson; +} + +export type MediaTypeContext = Client & { + path: Routes; +}; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/index.ts new file mode 100644 index 0000000000..422db68f62 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import MediaTypeClient from "./mediaTypeClient.js"; + +export * from "./mediaTypeClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; + +export default MediaTypeClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/mediaTypeClient.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/mediaTypeClient.ts new file mode 100644 index 0000000000..d17886c76c --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/mediaTypeClient.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { MediaTypeContext } from "./clientDefinitions.js"; + +/** + * Initialize a new instance of `MediaTypeContext` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: ClientOptions = {}, +): MediaTypeContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-payload-mediaType-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + + const client = getClient(endpointUrl, options) as MediaTypeContext; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + return client; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/parameters.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/parameters.ts new file mode 100644 index 0000000000..52303a3c5e --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/parameters.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; + +export interface SendAsTextBodyParam { + body: string; +} + +export interface SendAsTextMediaTypesParam { + contentType: "text/plain"; +} + +export type SendAsTextParameters = SendAsTextMediaTypesParam & + SendAsTextBodyParam & + RequestParameters; +export type GetAsTextParameters = RequestParameters; + +export interface SendAsJsonBodyParam { + body: string; +} + +export interface SendAsJsonMediaTypesParam { + contentType: "application/json"; +} + +export type SendAsJsonParameters = SendAsJsonMediaTypesParam & + SendAsJsonBodyParam & + RequestParameters; +export type GetAsJsonParameters = RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/responses.ts new file mode 100644 index 0000000000..4adf334d07 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/rest/responses.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { HttpResponse } from "@azure-rest/core-client"; + +/** The request has succeeded. */ +export interface SendAsText200Response extends HttpResponse { + status: "200"; +} + +/** The request has succeeded. */ +export interface GetAsText200Response extends HttpResponse { + status: "200"; + body: string; +} + +/** The request has succeeded. */ +export interface SendAsJson200Response extends HttpResponse { + status: "200"; +} + +/** The request has succeeded. */ +export interface GetAsJson200Response extends HttpResponse { + status: "200"; + body: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml new file mode 100644 index 0000000000..46cea84f61 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: false + generateTest: false + addCredentials: false + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/payload-mediaType" + description: "Payload Media Type Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/index.ts index 7c45798210..c3e9f5e240 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/index.ts @@ -6,4 +6,4 @@ export { createPageable, PageableClientOptions, PageableContext, -} from "./PageableContext.js"; +} from "./pageableContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/operations.ts index 4aa5143528..5dc52f27ff 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PagedUser, User } from "../models/models.js"; +import { User, PagedUser } from "../models/models.js"; import { PagedAsyncIterableIterator } from "../models/pagingTypes.js"; import { buildPagedAsyncIterator } from "./pagingHelpers.js"; import { List200Response, PageableContext as Client } from "../rest/index.js"; @@ -10,11 +10,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ListOptions } from "../models/options.js"; +import { ListOptionalParams } from "../models/options.js"; export function _listSend( context: Client, - options: ListOptions = { requestOptions: {} }, + options: ListOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/payload/pageable") @@ -40,7 +40,7 @@ export async function _listDeserialize( /** List users */ export function list( context: Client, - options: ListOptions = { requestOptions: {} }, + options: ListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/PageableContext.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/pageableContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/PageableContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/api/pageableContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/index.ts index 9107e55f0e..0f97f8118f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/index.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { PageableClient, PageableClientOptions } from "./PageableClient.js"; +export { PageableClient, PageableClientOptions } from "./pageableClient.js"; export { - PagedUser, User, - ListOptions, + PagedUser, + ListOptionalParams, PageSettings, ContinuablePage, PagedAsyncIterableIterator, diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/index.ts index 5bffc4d5ff..55f83c9adf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/index.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { PagedUser, User } from "./models.js"; -export { ListOptions } from "./options.js"; +export { User, PagedUser } from "./models.js"; +export { ListOptionalParams } from "./options.js"; export { PageSettings, ContinuablePage, diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/models.ts index 10bef29973..dec1da7f96 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/models.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +/** User model */ +export interface User { + /** User name */ + name: string; +} + /** Paged collection of User items */ export interface PagedUser { /** The User items on this page */ value: User[]; /** The link to the next page of items */ - readonly nextLink?: string; -} - -/** User model */ -export interface User { - /** User name */ - name: string; + nextLink?: string; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/options.ts index e644e0ef53..4257c4cda0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/models/options.ts @@ -3,7 +3,7 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ListOptions extends OperationOptions { +export interface ListOptionalParams extends OperationOptions { /** The maximum number of result items per page. */ maxpagesize?: number; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/PageableClient.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/pageableClient.ts similarity index 81% rename from packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/PageableClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/pageableClient.ts index e82cc11d00..1f146daf23 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/PageableClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/pageableClient.ts @@ -3,7 +3,7 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { User } from "./models/models.js"; -import { ListOptions } from "./models/options.js"; +import { ListOptionalParams } from "./models/options.js"; import { PagedAsyncIterableIterator } from "./models/pagingTypes.js"; import { list, @@ -12,7 +12,7 @@ import { PageableContext, } from "./api/index.js"; -export { PageableClientOptions } from "./api/PageableContext.js"; +export { PageableClientOptions } from "./api/pageableContext.js"; export class PageableClient { private _client: PageableContext; @@ -27,7 +27,7 @@ export class PageableClient { /** List users */ list( - options: ListOptions = { requestOptions: {} }, + options: ListOptionalParams = { requestOptions: {} }, ): PagedAsyncIterableIterator { return list(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/boolean/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/boolean/index.ts index b6cf4b9bda..346fd8ed35 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/boolean/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/boolean/index.ts @@ -11,11 +11,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { BooleanGetOptions, BooleanPutOptions } from "../../models/options.js"; +import { + BooleanGetOptionalParams, + BooleanPutOptionalParams, +} from "../../models/options.js"; export function _booleanGetSend( context: Client, - options: BooleanGetOptions = { requestOptions: {} }, + options: BooleanGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/boolean") @@ -35,7 +38,7 @@ export async function _booleanGetDeserialize( /** get boolean value */ export async function booleanGet( context: Client, - options: BooleanGetOptions = { requestOptions: {} }, + options: BooleanGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanGetSend(context, options); return _booleanGetDeserialize(result); @@ -44,7 +47,7 @@ export async function booleanGet( export function _booleanPutSend( context: Client, body: boolean, - options: BooleanPutOptions = { requestOptions: {} }, + options: BooleanPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/boolean") @@ -65,7 +68,7 @@ export async function _booleanPutDeserialize( export async function booleanPut( context: Client, body: boolean, - options: BooleanPutOptions = { requestOptions: {} }, + options: BooleanPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _booleanPutSend(context, body, options); return _booleanPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Type/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Type/index.ts index 06ba124e6a..2cf78f2f76 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Type/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Type/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Decimal128TypeResponseBodyOptions, - Decimal128TypeRequestBodyOptions, - Decimal128TypeRequestParameterOptions, + Decimal128TypeResponseBodyOptionalParams, + Decimal128TypeRequestBodyOptionalParams, + Decimal128TypeRequestParameterOptionalParams, } from "../../models/options.js"; export function _decimal128TypeResponseBodySend( context: Client, - options: Decimal128TypeResponseBodyOptions = { requestOptions: {} }, + options: Decimal128TypeResponseBodyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal128/response_body") @@ -39,7 +39,7 @@ export async function _decimal128TypeResponseBodyDeserialize( export async function decimal128TypeResponseBody( context: Client, - options: Decimal128TypeResponseBodyOptions = { requestOptions: {} }, + options: Decimal128TypeResponseBodyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimal128TypeResponseBodySend(context, options); return _decimal128TypeResponseBodyDeserialize(result); @@ -48,7 +48,7 @@ export async function decimal128TypeResponseBody( export function _decimal128TypeRequestBodySend( context: Client, body: number, - options: Decimal128TypeRequestBodyOptions = { requestOptions: {} }, + options: Decimal128TypeRequestBodyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal128/resquest_body") @@ -68,7 +68,7 @@ export async function _decimal128TypeRequestBodyDeserialize( export async function decimal128TypeRequestBody( context: Client, body: number, - options: Decimal128TypeRequestBodyOptions = { requestOptions: {} }, + options: Decimal128TypeRequestBodyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimal128TypeRequestBodySend(context, body, options); return _decimal128TypeRequestBodyDeserialize(result); @@ -77,7 +77,9 @@ export async function decimal128TypeRequestBody( export function _decimal128TypeRequestParameterSend( context: Client, value: number, - options: Decimal128TypeRequestParameterOptions = { requestOptions: {} }, + options: Decimal128TypeRequestParameterOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { return context .path("/type/scalar/decimal128/request_parameter") @@ -100,7 +102,9 @@ export async function _decimal128TypeRequestParameterDeserialize( export async function decimal128TypeRequestParameter( context: Client, value: number, - options: Decimal128TypeRequestParameterOptions = { requestOptions: {} }, + options: Decimal128TypeRequestParameterOptionalParams = { + requestOptions: {}, + }, ): Promise { const result = await _decimal128TypeRequestParameterSend( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Verify/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Verify/index.ts index d423772670..0e808bf385 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Verify/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimal128Verify/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - Decimal128VerifyPrepareVerifyOptions, - Decimal128VerifyVerifyOptions, + Decimal128VerifyPrepareVerifyOptionalParams, + Decimal128VerifyVerifyOptionalParams, } from "../../models/options.js"; export function _decimal128VerifyPrepareVerifySend( context: Client, - options: Decimal128VerifyPrepareVerifyOptions = { requestOptions: {} }, + options: Decimal128VerifyPrepareVerifyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal128/prepare_verify") @@ -37,7 +37,7 @@ export async function _decimal128VerifyPrepareVerifyDeserialize( export async function decimal128VerifyPrepareVerify( context: Client, - options: Decimal128VerifyPrepareVerifyOptions = { requestOptions: {} }, + options: Decimal128VerifyPrepareVerifyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimal128VerifyPrepareVerifySend(context, options); return _decimal128VerifyPrepareVerifyDeserialize(result); @@ -46,7 +46,7 @@ export async function decimal128VerifyPrepareVerify( export function _decimal128VerifyVerifySend( context: Client, body: number, - options: Decimal128VerifyVerifyOptions = { requestOptions: {} }, + options: Decimal128VerifyVerifyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal128/verify") @@ -66,7 +66,7 @@ export async function _decimal128VerifyVerifyDeserialize( export async function decimal128VerifyVerify( context: Client, body: number, - options: Decimal128VerifyVerifyOptions = { requestOptions: {} }, + options: Decimal128VerifyVerifyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimal128VerifyVerifySend(context, body, options); return _decimal128VerifyVerifyDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalType/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalType/index.ts index bdd987325b..d17311f01b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalType/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalType/index.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DecimalTypeResponseBodyOptions, - DecimalTypeRequestBodyOptions, - DecimalTypeRequestParameterOptions, + DecimalTypeResponseBodyOptionalParams, + DecimalTypeRequestBodyOptionalParams, + DecimalTypeRequestParameterOptionalParams, } from "../../models/options.js"; export function _decimalTypeResponseBodySend( context: Client, - options: DecimalTypeResponseBodyOptions = { requestOptions: {} }, + options: DecimalTypeResponseBodyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal/response_body") @@ -39,7 +39,7 @@ export async function _decimalTypeResponseBodyDeserialize( export async function decimalTypeResponseBody( context: Client, - options: DecimalTypeResponseBodyOptions = { requestOptions: {} }, + options: DecimalTypeResponseBodyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalTypeResponseBodySend(context, options); return _decimalTypeResponseBodyDeserialize(result); @@ -48,7 +48,7 @@ export async function decimalTypeResponseBody( export function _decimalTypeRequestBodySend( context: Client, body: number, - options: DecimalTypeRequestBodyOptions = { requestOptions: {} }, + options: DecimalTypeRequestBodyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal/resquest_body") @@ -68,7 +68,7 @@ export async function _decimalTypeRequestBodyDeserialize( export async function decimalTypeRequestBody( context: Client, body: number, - options: DecimalTypeRequestBodyOptions = { requestOptions: {} }, + options: DecimalTypeRequestBodyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalTypeRequestBodySend(context, body, options); return _decimalTypeRequestBodyDeserialize(result); @@ -77,7 +77,7 @@ export async function decimalTypeRequestBody( export function _decimalTypeRequestParameterSend( context: Client, value: number, - options: DecimalTypeRequestParameterOptions = { requestOptions: {} }, + options: DecimalTypeRequestParameterOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal/request_parameter") @@ -100,7 +100,7 @@ export async function _decimalTypeRequestParameterDeserialize( export async function decimalTypeRequestParameter( context: Client, value: number, - options: DecimalTypeRequestParameterOptions = { requestOptions: {} }, + options: DecimalTypeRequestParameterOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalTypeRequestParameterSend( context, diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalVerify/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalVerify/index.ts index c02a8b861c..10c25ea6dd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalVerify/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/decimalVerify/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - DecimalVerifyPrepareVerifyOptions, - DecimalVerifyVerifyOptions, + DecimalVerifyPrepareVerifyOptionalParams, + DecimalVerifyVerifyOptionalParams, } from "../../models/options.js"; export function _decimalVerifyPrepareVerifySend( context: Client, - options: DecimalVerifyPrepareVerifyOptions = { requestOptions: {} }, + options: DecimalVerifyPrepareVerifyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal/prepare_verify") @@ -37,7 +37,7 @@ export async function _decimalVerifyPrepareVerifyDeserialize( export async function decimalVerifyPrepareVerify( context: Client, - options: DecimalVerifyPrepareVerifyOptions = { requestOptions: {} }, + options: DecimalVerifyPrepareVerifyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalVerifyPrepareVerifySend(context, options); return _decimalVerifyPrepareVerifyDeserialize(result); @@ -46,7 +46,7 @@ export async function decimalVerifyPrepareVerify( export function _decimalVerifyVerifySend( context: Client, body: number, - options: DecimalVerifyVerifyOptions = { requestOptions: {} }, + options: DecimalVerifyVerifyOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/decimal/verify") @@ -66,7 +66,7 @@ export async function _decimalVerifyVerifyDeserialize( export async function decimalVerifyVerify( context: Client, body: number, - options: DecimalVerifyVerifyOptions = { requestOptions: {} }, + options: DecimalVerifyVerifyOptionalParams = { requestOptions: {} }, ): Promise { const result = await _decimalVerifyVerifySend(context, body, options); return _decimalVerifyVerifyDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/index.ts index 5cea767ffe..c240f9ef8e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/index.ts @@ -5,7 +5,7 @@ export { createScalar, ScalarClientOptions, ScalarContext, -} from "./ScalarContext.js"; +} from "./scalarContext.js"; export { booleanGet, booleanPut } from "./boolean/index.js"; export { decimal128TypeResponseBody, diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/ScalarContext.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/scalarContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/ScalarContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/scalarContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/string/index.ts index f8ae4db2df..b11ba40dd3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/string/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/string/index.ts @@ -11,11 +11,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { StringGetOptions, StringPutOptions } from "../../models/options.js"; +import { + StringGetOptionalParams, + StringPutOptionalParams, +} from "../../models/options.js"; export function _stringGetSend( context: Client, - options: StringGetOptions = { requestOptions: {} }, + options: StringGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/string") @@ -35,7 +38,7 @@ export async function _stringGetDeserialize( /** get string value */ export async function stringGet( context: Client, - options: StringGetOptions = { requestOptions: {} }, + options: StringGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringGetSend(context, options); return _stringGetDeserialize(result); @@ -44,7 +47,7 @@ export async function stringGet( export function _stringPutSend( context: Client, body: string, - options: StringPutOptions = { requestOptions: {} }, + options: StringPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/string") @@ -65,7 +68,7 @@ export async function _stringPutDeserialize( export async function stringPut( context: Client, body: string, - options: StringPutOptions = { requestOptions: {} }, + options: StringPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringPutSend(context, body, options); return _stringPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/unknown/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/unknown/index.ts index 6fa91ef275..19d9ca2fbe 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/unknown/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/api/unknown/index.ts @@ -11,11 +11,14 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { UnknownGetOptions, UnknownPutOptions } from "../../models/options.js"; +import { + UnknownGetOptionalParams, + UnknownPutOptionalParams, +} from "../../models/options.js"; export function _unknownGetSend( context: Client, - options: UnknownGetOptions = { requestOptions: {} }, + options: UnknownGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/unknown") @@ -35,7 +38,7 @@ export async function _unknownGetDeserialize( /** get unknown value */ export async function unknownGet( context: Client, - options: UnknownGetOptions = { requestOptions: {} }, + options: UnknownGetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownGetSend(context, options); return _unknownGetDeserialize(result); @@ -44,7 +47,7 @@ export async function unknownGet( export function _unknownPutSend( context: Client, body: unknown, - options: UnknownPutOptions = { requestOptions: {} }, + options: UnknownPutOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/scalar/unknown") @@ -65,7 +68,7 @@ export async function _unknownPutDeserialize( export async function unknownPut( context: Client, body: unknown, - options: UnknownPutOptions = { requestOptions: {} }, + options: UnknownPutOptionalParams = { requestOptions: {} }, ): Promise { const result = await _unknownPutSend(context, body, options); return _unknownPutDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/boolean/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/boolean/index.ts index e08b81c2da..35575fd830 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/boolean/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/boolean/index.ts @@ -1,19 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { booleanGet, booleanPut } from "../../api/boolean/index.js"; -import { BooleanGetOptions, BooleanPutOptions } from "../../models/options.js"; +import { + BooleanGetOptionalParams, + BooleanPutOptionalParams, +} from "../../models/options.js"; export interface BooleanOperations { - get: (options?: BooleanGetOptions) => Promise; - put: (body: boolean, options?: BooleanPutOptions) => Promise; + get: (options?: BooleanGetOptionalParams) => Promise; + put: (body: boolean, options?: BooleanPutOptionalParams) => Promise; } export function getBoolean(context: ScalarContext) { return { - get: (options?: BooleanGetOptions) => booleanGet(context, options), - put: (body: boolean, options?: BooleanPutOptions) => + get: (options?: BooleanGetOptionalParams) => booleanGet(context, options), + put: (body: boolean, options?: BooleanPutOptionalParams) => booleanPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Type/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Type/index.ts index f86075e818..3c8951de59 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Type/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Type/index.ts @@ -1,41 +1,43 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { decimal128TypeResponseBody, decimal128TypeRequestBody, decimal128TypeRequestParameter, } from "../../api/decimal128Type/index.js"; import { - Decimal128TypeResponseBodyOptions, - Decimal128TypeRequestBodyOptions, - Decimal128TypeRequestParameterOptions, + Decimal128TypeResponseBodyOptionalParams, + Decimal128TypeRequestBodyOptionalParams, + Decimal128TypeRequestParameterOptionalParams, } from "../../models/options.js"; export interface Decimal128TypeOperations { responseBody: ( - options?: Decimal128TypeResponseBodyOptions, + options?: Decimal128TypeResponseBodyOptionalParams, ) => Promise; requestBody: ( body: number, - options?: Decimal128TypeRequestBodyOptions, + options?: Decimal128TypeRequestBodyOptionalParams, ) => Promise; requestParameter: ( value: number, - options?: Decimal128TypeRequestParameterOptions, + options?: Decimal128TypeRequestParameterOptionalParams, ) => Promise; } export function getDecimal128Type(context: ScalarContext) { return { - responseBody: (options?: Decimal128TypeResponseBodyOptions) => + responseBody: (options?: Decimal128TypeResponseBodyOptionalParams) => decimal128TypeResponseBody(context, options), - requestBody: (body: number, options?: Decimal128TypeRequestBodyOptions) => - decimal128TypeRequestBody(context, body, options), + requestBody: ( + body: number, + options?: Decimal128TypeRequestBodyOptionalParams, + ) => decimal128TypeRequestBody(context, body, options), requestParameter: ( value: number, - options?: Decimal128TypeRequestParameterOptions, + options?: Decimal128TypeRequestParameterOptionalParams, ) => decimal128TypeRequestParameter(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Verify/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Verify/index.ts index a6af1a39b9..08d29e6e6e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Verify/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimal128Verify/index.ts @@ -1,31 +1,31 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { decimal128VerifyPrepareVerify, decimal128VerifyVerify, } from "../../api/decimal128Verify/index.js"; import { - Decimal128VerifyPrepareVerifyOptions, - Decimal128VerifyVerifyOptions, + Decimal128VerifyPrepareVerifyOptionalParams, + Decimal128VerifyVerifyOptionalParams, } from "../../models/options.js"; export interface Decimal128VerifyOperations { prepareVerify: ( - options?: Decimal128VerifyPrepareVerifyOptions, + options?: Decimal128VerifyPrepareVerifyOptionalParams, ) => Promise; verify: ( body: number, - options?: Decimal128VerifyVerifyOptions, + options?: Decimal128VerifyVerifyOptionalParams, ) => Promise; } export function getDecimal128Verify(context: ScalarContext) { return { - prepareVerify: (options?: Decimal128VerifyPrepareVerifyOptions) => + prepareVerify: (options?: Decimal128VerifyPrepareVerifyOptionalParams) => decimal128VerifyPrepareVerify(context, options), - verify: (body: number, options?: Decimal128VerifyVerifyOptions) => + verify: (body: number, options?: Decimal128VerifyVerifyOptionalParams) => decimal128VerifyVerify(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalType/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalType/index.ts index 3001d9c34a..504d125869 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalType/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalType/index.ts @@ -1,39 +1,43 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { decimalTypeResponseBody, decimalTypeRequestBody, decimalTypeRequestParameter, } from "../../api/decimalType/index.js"; import { - DecimalTypeResponseBodyOptions, - DecimalTypeRequestBodyOptions, - DecimalTypeRequestParameterOptions, + DecimalTypeResponseBodyOptionalParams, + DecimalTypeRequestBodyOptionalParams, + DecimalTypeRequestParameterOptionalParams, } from "../../models/options.js"; export interface DecimalTypeOperations { - responseBody: (options?: DecimalTypeResponseBodyOptions) => Promise; + responseBody: ( + options?: DecimalTypeResponseBodyOptionalParams, + ) => Promise; requestBody: ( body: number, - options?: DecimalTypeRequestBodyOptions, + options?: DecimalTypeRequestBodyOptionalParams, ) => Promise; requestParameter: ( value: number, - options?: DecimalTypeRequestParameterOptions, + options?: DecimalTypeRequestParameterOptionalParams, ) => Promise; } export function getDecimalType(context: ScalarContext) { return { - responseBody: (options?: DecimalTypeResponseBodyOptions) => + responseBody: (options?: DecimalTypeResponseBodyOptionalParams) => decimalTypeResponseBody(context, options), - requestBody: (body: number, options?: DecimalTypeRequestBodyOptions) => - decimalTypeRequestBody(context, body, options), + requestBody: ( + body: number, + options?: DecimalTypeRequestBodyOptionalParams, + ) => decimalTypeRequestBody(context, body, options), requestParameter: ( value: number, - options?: DecimalTypeRequestParameterOptions, + options?: DecimalTypeRequestParameterOptionalParams, ) => decimalTypeRequestParameter(context, value, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalVerify/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalVerify/index.ts index d8df4d732c..0712c49878 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalVerify/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/decimalVerify/index.ts @@ -1,28 +1,31 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { decimalVerifyPrepareVerify, decimalVerifyVerify, } from "../../api/decimalVerify/index.js"; import { - DecimalVerifyPrepareVerifyOptions, - DecimalVerifyVerifyOptions, + DecimalVerifyPrepareVerifyOptionalParams, + DecimalVerifyVerifyOptionalParams, } from "../../models/options.js"; export interface DecimalVerifyOperations { prepareVerify: ( - options?: DecimalVerifyPrepareVerifyOptions, + options?: DecimalVerifyPrepareVerifyOptionalParams, ) => Promise; - verify: (body: number, options?: DecimalVerifyVerifyOptions) => Promise; + verify: ( + body: number, + options?: DecimalVerifyVerifyOptionalParams, + ) => Promise; } export function getDecimalVerify(context: ScalarContext) { return { - prepareVerify: (options?: DecimalVerifyPrepareVerifyOptions) => + prepareVerify: (options?: DecimalVerifyPrepareVerifyOptionalParams) => decimalVerifyPrepareVerify(context, options), - verify: (body: number, options?: DecimalVerifyVerifyOptions) => + verify: (body: number, options?: DecimalVerifyVerifyOptionalParams) => decimalVerifyVerify(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/string/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/string/index.ts index c642d431d3..b441733b1c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/string/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/string/index.ts @@ -1,19 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { stringGet, stringPut } from "../../api/string/index.js"; -import { StringGetOptions, StringPutOptions } from "../../models/options.js"; +import { + StringGetOptionalParams, + StringPutOptionalParams, +} from "../../models/options.js"; export interface StringOperations { - get: (options?: StringGetOptions) => Promise; - put: (body: string, options?: StringPutOptions) => Promise; + get: (options?: StringGetOptionalParams) => Promise; + put: (body: string, options?: StringPutOptionalParams) => Promise; } export function getString(context: ScalarContext) { return { - get: (options?: StringGetOptions) => stringGet(context, options), - put: (body: string, options?: StringPutOptions) => + get: (options?: StringGetOptionalParams) => stringGet(context, options), + put: (body: string, options?: StringPutOptionalParams) => stringPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/unknown/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/unknown/index.ts index 47d9455a4c..64565e6ece 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/unknown/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/classic/unknown/index.ts @@ -1,19 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { ScalarContext } from "../../api/ScalarContext.js"; +import { ScalarContext } from "../../api/scalarContext.js"; import { unknownGet, unknownPut } from "../../api/unknown/index.js"; -import { UnknownGetOptions, UnknownPutOptions } from "../../models/options.js"; +import { + UnknownGetOptionalParams, + UnknownPutOptionalParams, +} from "../../models/options.js"; export interface UnknownOperations { - get: (options?: UnknownGetOptions) => Promise; - put: (body: unknown, options?: UnknownPutOptions) => Promise; + get: (options?: UnknownGetOptionalParams) => Promise; + put: (body: unknown, options?: UnknownPutOptionalParams) => Promise; } export function getUnknown(context: ScalarContext) { return { - get: (options?: UnknownGetOptions) => unknownGet(context, options), - put: (body: unknown, options?: UnknownPutOptions) => + get: (options?: UnknownGetOptionalParams) => unknownGet(context, options), + put: (body: unknown, options?: UnknownPutOptionalParams) => unknownPut(context, body, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/index.ts index fae729bd72..c9dec5b7d6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/index.ts @@ -1,24 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ScalarClient, ScalarClientOptions } from "./ScalarClient.js"; +export { ScalarClient, ScalarClientOptions } from "./scalarClient.js"; export { - StringGetOptions, - StringPutOptions, - BooleanGetOptions, - BooleanPutOptions, - UnknownGetOptions, - UnknownPutOptions, - DecimalTypeResponseBodyOptions, - DecimalTypeRequestBodyOptions, - DecimalTypeRequestParameterOptions, - Decimal128TypeResponseBodyOptions, - Decimal128TypeRequestBodyOptions, - Decimal128TypeRequestParameterOptions, - DecimalVerifyPrepareVerifyOptions, - DecimalVerifyVerifyOptions, - Decimal128VerifyPrepareVerifyOptions, - Decimal128VerifyVerifyOptions, + StringGetOptionalParams, + StringPutOptionalParams, + BooleanGetOptionalParams, + BooleanPutOptionalParams, + UnknownGetOptionalParams, + UnknownPutOptionalParams, + DecimalTypeResponseBodyOptionalParams, + DecimalTypeRequestBodyOptionalParams, + DecimalTypeRequestParameterOptionalParams, + Decimal128TypeResponseBodyOptionalParams, + Decimal128TypeRequestBodyOptionalParams, + Decimal128TypeRequestParameterOptionalParams, + DecimalVerifyPrepareVerifyOptionalParams, + DecimalVerifyVerifyOptionalParams, + Decimal128VerifyPrepareVerifyOptionalParams, + Decimal128VerifyVerifyOptionalParams, } from "./models/index.js"; export { BooleanOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/index.ts index 86368038b0..71bdf7b60e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/index.ts @@ -2,20 +2,20 @@ // Licensed under the MIT license. export { - StringGetOptions, - StringPutOptions, - BooleanGetOptions, - BooleanPutOptions, - UnknownGetOptions, - UnknownPutOptions, - DecimalTypeResponseBodyOptions, - DecimalTypeRequestBodyOptions, - DecimalTypeRequestParameterOptions, - Decimal128TypeResponseBodyOptions, - Decimal128TypeRequestBodyOptions, - Decimal128TypeRequestParameterOptions, - DecimalVerifyPrepareVerifyOptions, - DecimalVerifyVerifyOptions, - Decimal128VerifyPrepareVerifyOptions, - Decimal128VerifyVerifyOptions, + StringGetOptionalParams, + StringPutOptionalParams, + BooleanGetOptionalParams, + BooleanPutOptionalParams, + UnknownGetOptionalParams, + UnknownPutOptionalParams, + DecimalTypeResponseBodyOptionalParams, + DecimalTypeRequestBodyOptionalParams, + DecimalTypeRequestParameterOptionalParams, + Decimal128TypeResponseBodyOptionalParams, + Decimal128TypeRequestBodyOptionalParams, + Decimal128TypeRequestParameterOptionalParams, + DecimalVerifyPrepareVerifyOptionalParams, + DecimalVerifyVerifyOptionalParams, + Decimal128VerifyPrepareVerifyOptionalParams, + Decimal128VerifyVerifyOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/options.ts index a58a7235d6..3c2f3e010d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/models/options.ts @@ -3,36 +3,43 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface StringGetOptions extends OperationOptions {} +export interface StringGetOptionalParams extends OperationOptions {} -export interface StringPutOptions extends OperationOptions {} +export interface StringPutOptionalParams extends OperationOptions {} -export interface BooleanGetOptions extends OperationOptions {} +export interface BooleanGetOptionalParams extends OperationOptions {} -export interface BooleanPutOptions extends OperationOptions {} +export interface BooleanPutOptionalParams extends OperationOptions {} -export interface UnknownGetOptions extends OperationOptions {} +export interface UnknownGetOptionalParams extends OperationOptions {} -export interface UnknownPutOptions extends OperationOptions {} +export interface UnknownPutOptionalParams extends OperationOptions {} -export interface DecimalTypeResponseBodyOptions extends OperationOptions {} +export interface DecimalTypeResponseBodyOptionalParams + extends OperationOptions {} -export interface DecimalTypeRequestBodyOptions extends OperationOptions {} +export interface DecimalTypeRequestBodyOptionalParams + extends OperationOptions {} -export interface DecimalTypeRequestParameterOptions extends OperationOptions {} +export interface DecimalTypeRequestParameterOptionalParams + extends OperationOptions {} -export interface Decimal128TypeResponseBodyOptions extends OperationOptions {} +export interface Decimal128TypeResponseBodyOptionalParams + extends OperationOptions {} -export interface Decimal128TypeRequestBodyOptions extends OperationOptions {} +export interface Decimal128TypeRequestBodyOptionalParams + extends OperationOptions {} -export interface Decimal128TypeRequestParameterOptions +export interface Decimal128TypeRequestParameterOptionalParams extends OperationOptions {} -export interface DecimalVerifyPrepareVerifyOptions extends OperationOptions {} +export interface DecimalVerifyPrepareVerifyOptionalParams + extends OperationOptions {} -export interface DecimalVerifyVerifyOptions extends OperationOptions {} +export interface DecimalVerifyVerifyOptionalParams extends OperationOptions {} -export interface Decimal128VerifyPrepareVerifyOptions +export interface Decimal128VerifyPrepareVerifyOptionalParams extends OperationOptions {} -export interface Decimal128VerifyVerifyOptions extends OperationOptions {} +export interface Decimal128VerifyVerifyOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/ScalarClient.ts b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/scalarClient.ts similarity index 97% rename from packages/typespec-ts/test/modularIntegration/generated/scalar/src/ScalarClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/scalar/src/scalarClient.ts index ce8b882c1e..973b615657 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/scalar/src/ScalarClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/scalar/src/scalarClient.ts @@ -36,7 +36,7 @@ import { ScalarContext, } from "./api/index.js"; -export { ScalarClientOptions } from "./api/ScalarContext.js"; +export { ScalarClientOptions } from "./api/scalarContext.js"; export class ScalarClient { private _client: ScalarContext; diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/index.ts index cc505bafeb..d28585afde 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { createJson, JsonClientOptions, JsonContext } from "./JsonContext.js"; +export { createJson, JsonClientOptions, JsonContext } from "./jsonContext.js"; export { send, get } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/JsonContext.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/jsonContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/JsonContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/jsonContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/operations.ts index f64488c41b..2d592657e6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/api/operations.ts @@ -12,12 +12,12 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { SendOptions, GetOptions } from "../models/options.js"; +import { SendOptionalParams, GetOptionalParams } from "../models/options.js"; export function _sendSend( context: Client, body: JsonEncodedNameModel, - options: SendOptions = { requestOptions: {} }, + options: SendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/serialization/encoded-name/json/property") @@ -38,7 +38,7 @@ export async function _sendDeserialize(result: Send204Response): Promise { export async function send( context: Client, body: JsonEncodedNameModel, - options: SendOptions = { requestOptions: {} }, + options: SendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _sendSend(context, body, options); return _sendDeserialize(result); @@ -46,7 +46,7 @@ export async function send( export function _getSend( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/serialization/encoded-name/json/property") @@ -67,7 +67,7 @@ export async function _getDeserialize( export async function get( context: Client, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, options); return _getDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.ts index bda482767c..43c9306b18 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { JsonClient, JsonClientOptions } from "./JsonClient.js"; +export { JsonClient, JsonClientOptions } from "./jsonClient.js"; export { JsonEncodedNameModel, - SendOptions, - GetOptions, + SendOptionalParams, + GetOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/JsonClient.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/jsonClient.ts similarity index 76% rename from packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/JsonClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/jsonClient.ts index b02d8314a0..7144b418d7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/JsonClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/jsonClient.ts @@ -3,7 +3,7 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { JsonEncodedNameModel } from "./models/models.js"; -import { SendOptions, GetOptions } from "./models/options.js"; +import { SendOptionalParams, GetOptionalParams } from "./models/options.js"; import { createJson, JsonClientOptions, @@ -12,7 +12,7 @@ import { get, } from "./api/index.js"; -export { JsonClientOptions } from "./api/JsonContext.js"; +export { JsonClientOptions } from "./api/jsonContext.js"; export class JsonClient { private _client: JsonContext; @@ -27,13 +27,13 @@ export class JsonClient { send( body: JsonEncodedNameModel, - options: SendOptions = { requestOptions: {} }, + options: SendOptionalParams = { requestOptions: {} }, ): Promise { return send(this._client, body, options); } get( - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { return get(this._client, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/index.ts index a89618202f..fa71dd546b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/index.ts @@ -2,4 +2,4 @@ // Licensed under the MIT license. export { JsonEncodedNameModel } from "./models.js"; -export { SendOptions, GetOptions } from "./options.js"; +export { SendOptionalParams, GetOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/options.ts index c088a02d53..080796b90f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/models/options.ts @@ -3,6 +3,6 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface SendOptions extends OperationOptions {} +export interface SendOptionalParams extends OperationOptions {} -export interface GetOptions extends OperationOptions {} +export interface GetOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/index.ts index 55e1385c14..a38a56e150 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/index.ts @@ -5,5 +5,5 @@ export { createNotDefined, NotDefinedClientOptions, NotDefinedContext, -} from "./NotDefinedContext.js"; +} from "./notDefinedContext.js"; export { valid } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/NotDefinedContext.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/notDefinedContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/NotDefinedContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/notDefinedContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/operations.ts index df3c8a2f3a..198d3f0891 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/api/operations.ts @@ -10,11 +10,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { ValidOptions } from "../models/options.js"; +import { ValidOptionalParams } from "../models/options.js"; export function _validSend( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/server/endpoint/not-defined/valid") @@ -33,7 +33,7 @@ export async function _validDeserialize( export async function valid( context: Client, - options: ValidOptions = { requestOptions: {} }, + options: ValidOptionalParams = { requestOptions: {} }, ): Promise { const result = await _validSend(context, options); return _validDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.ts index 9900b3acd9..5bcf07b7b7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.ts @@ -4,5 +4,5 @@ export { NotDefinedClient, NotDefinedClientOptions, -} from "./NotDefinedClient.js"; -export { ValidOptions } from "./models/index.js"; +} from "./notDefinedClient.js"; +export { ValidOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/index.ts index 5b70d6a6ea..850c44d2de 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { ValidOptions } from "./options.js"; +export { ValidOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/options.ts index 4e5df1fa81..b74e8e2895 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/models/options.ts @@ -3,4 +3,4 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface ValidOptions extends OperationOptions {} +export interface ValidOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/NotDefinedClient.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/notDefinedClient.ts similarity index 78% rename from packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/NotDefinedClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/notDefinedClient.ts index 4b828732ab..3aa37ae76b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/NotDefinedClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/notDefinedClient.ts @@ -8,9 +8,9 @@ import { NotDefinedContext, valid, } from "./api/index.js"; -import { ValidOptions } from "./models/options.js"; +import { ValidOptionalParams } from "./models/options.js"; -export { NotDefinedClientOptions } from "./api/NotDefinedContext.js"; +export { NotDefinedClientOptions } from "./api/notDefinedContext.js"; export class NotDefinedClient { private _client: NotDefinedContext; @@ -23,7 +23,7 @@ export class NotDefinedClient { this.pipeline = this._client.pipeline; } - valid(options: ValidOptions = { requestOptions: {} }): Promise { + valid(options: ValidOptionalParams = { requestOptions: {} }): Promise { return valid(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/index.ts index 12d5c7df63..6acba0a500 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/index.ts @@ -5,5 +5,5 @@ export { createMultiple, MultipleClientOptions, MultipleContext, -} from "./MultipleContext.js"; +} from "./multipleContext.js"; export { noOperationParams, withOperationPathParam } from "./operations.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/MultipleContext.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/multipleContext.ts similarity index 60% rename from packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/MultipleContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/multipleContext.ts index b2ee0f3aac..f9436459f8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/MultipleContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/multipleContext.ts @@ -1,18 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +import { Versions } from "../models/models.js"; import { ClientOptions } from "@azure-rest/core-client"; import { MultipleContext } from "../rest/index.js"; import getClient from "../rest/index.js"; -export interface MultipleClientOptions extends ClientOptions {} +export interface MultipleClientOptions extends ClientOptions { + /** Pass in v1.0 for API version. */ + apiVersion?: Versions; +} export { MultipleContext } from "../rest/index.js"; export function createMultiple( - endpoint: string, + endpointParam: string, options: MultipleClientOptions = {}, ): MultipleContext { - const clientContext = getClient(endpoint, options); + const clientContext = getClient(endpointParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/operations.ts index c867024838..f5c86ea481 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/api/operations.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - NoOperationParamsOptions, - WithOperationPathParamOptions, + NoOperationParamsOptionalParams, + WithOperationPathParamOptionalParams, } from "../models/options.js"; export function _noOperationParamsSend( context: Client, - options: NoOperationParamsOptions = { requestOptions: {} }, + options: NoOperationParamsOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/") @@ -37,7 +37,7 @@ export async function _noOperationParamsDeserialize( export async function noOperationParams( context: Client, - options: NoOperationParamsOptions = { requestOptions: {} }, + options: NoOperationParamsOptionalParams = { requestOptions: {} }, ): Promise { const result = await _noOperationParamsSend(context, options); return _noOperationParamsDeserialize(result); @@ -46,7 +46,7 @@ export async function noOperationParams( export function _withOperationPathParamSend( context: Client, keyword: string, - options: WithOperationPathParamOptions = { requestOptions: {} }, + options: WithOperationPathParamOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/{keyword}", keyword) @@ -66,7 +66,7 @@ export async function _withOperationPathParamDeserialize( export async function withOperationPathParam( context: Client, keyword: string, - options: WithOperationPathParamOptions = { requestOptions: {} }, + options: WithOperationPathParamOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withOperationPathParamSend(context, keyword, options); return _withOperationPathParamDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.ts index 07dbbbc2f0..1eeb443d49 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { MultipleClient, MultipleClientOptions } from "./MultipleClient.js"; +export { MultipleClient, MultipleClientOptions } from "./multipleClient.js"; export { Versions, - NoOperationParamsOptions, - WithOperationPathParamOptions, + NoOperationParamsOptionalParams, + WithOperationPathParamOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/index.ts index 659c4be1a5..94e11c5e7b 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/index.ts @@ -3,6 +3,6 @@ export { Versions } from "./models.js"; export { - NoOperationParamsOptions, - WithOperationPathParamOptions, + NoOperationParamsOptionalParams, + WithOperationPathParamOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/models.ts index b77f4ac4bb..b88ebd374a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/models.ts @@ -2,5 +2,5 @@ // Licensed under the MIT license. /** Service versions */ -/** "v1.0" */ -export type Versions = string; +/** */ +export type Versions = "v1.0"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/options.ts index 914c33974e..0a2599b655 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/models/options.ts @@ -3,6 +3,7 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface NoOperationParamsOptions extends OperationOptions {} +export interface NoOperationParamsOptionalParams extends OperationOptions {} -export interface WithOperationPathParamOptions extends OperationOptions {} +export interface WithOperationPathParamOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/MultipleClient.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/multipleClient.ts similarity index 64% rename from packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/MultipleClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/multipleClient.ts index 2fd8a83bfa..6de6a50560 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/MultipleClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/multipleClient.ts @@ -3,8 +3,8 @@ import { Pipeline } from "@azure/core-rest-pipeline"; import { - NoOperationParamsOptions, - WithOperationPathParamOptions, + NoOperationParamsOptionalParams, + WithOperationPathParamOptionalParams, } from "./models/options.js"; import { createMultiple, @@ -14,27 +14,27 @@ import { withOperationPathParam, } from "./api/index.js"; -export { MultipleClientOptions } from "./api/MultipleContext.js"; +export { MultipleClientOptions } from "./api/multipleContext.js"; export class MultipleClient { private _client: MultipleContext; /** The pipeline used by this client to make requests */ public readonly pipeline: Pipeline; - constructor(endpoint: string, options: MultipleClientOptions = {}) { - this._client = createMultiple(endpoint, options); + constructor(endpointParam: string, options: MultipleClientOptions = {}) { + this._client = createMultiple(endpointParam, options); this.pipeline = this._client.pipeline; } noOperationParams( - options: NoOperationParamsOptions = { requestOptions: {} }, + options: NoOperationParamsOptionalParams = { requestOptions: {} }, ): Promise { return noOperationParams(this._client, options); } withOperationPathParam( keyword: string, - options: WithOperationPathParamOptions = { requestOptions: {} }, + options: WithOperationPathParamOptionalParams = { requestOptions: {} }, ): Promise { return withOperationPathParam(this._client, keyword, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/index.ts index 016641c690..c11e477ed8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/index.ts @@ -7,5 +7,6 @@ export * from "./multipleClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; +export * from "./models.js"; export default MultipleClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/models.ts new file mode 100644 index 0000000000..73ba43f52e --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/models.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** Service versions */ +export type Versions = "v1.0"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/multipleClient.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/multipleClient.ts index c45f4936f1..6c74150fa1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/multipleClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/rest/multipleClient.ts @@ -4,9 +4,10 @@ import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "../logger.js"; import { MultipleContext } from "./clientDefinitions.js"; +import { Versions } from "./models.js"; export interface MultipleContextOptions extends ClientOptions { - apiVersion?: string; + apiVersion?: Versions; } /** diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/index.ts index 6c426a0f0e..c1b7fd6960 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/index.ts @@ -6,4 +6,4 @@ export { createSingle, SingleClientOptions, SingleContext, -} from "./SingleContext.js"; +} from "./singleContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/operations.ts index 6f547c8eec..2d368c366c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/operations.ts @@ -7,11 +7,11 @@ import { operationOptionsToRequestParameters, createRestError, } from "@azure-rest/core-client"; -import { MyOpOptions } from "../models/options.js"; +import { MyOpOptionalParams } from "../models/options.js"; export function _myOpSend( context: Client, - options: MyOpOptions = { requestOptions: {} }, + options: MyOpOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/server/path/single/myOp") @@ -28,7 +28,7 @@ export async function _myOpDeserialize(result: MyOp200Response): Promise { export async function myOp( context: Client, - options: MyOpOptions = { requestOptions: {} }, + options: MyOpOptionalParams = { requestOptions: {} }, ): Promise { const result = await _myOpSend(context, options); return _myOpDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/SingleContext.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/singleContext.ts similarity index 85% rename from packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/SingleContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/singleContext.ts index 2dd7b6873c..1e7b9c461a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/SingleContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/api/singleContext.ts @@ -11,9 +11,9 @@ export { SingleContext } from "../rest/index.js"; /** Illustrates server with a single path parameter @server */ export function createSingle( - endpoint: string, + endpointParam: string, options: SingleClientOptions = {}, ): SingleContext { - const clientContext = getClient(endpoint, options); + const clientContext = getClient(endpointParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.ts index 9d1e53bf19..607634a5ef 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { SingleClient, SingleClientOptions } from "./SingleClient.js"; -export { MyOpOptions } from "./models/index.js"; +export { SingleClient, SingleClientOptions } from "./singleClient.js"; +export { MyOpOptionalParams } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/index.ts index 0f02b0a66a..fd2905b199 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/index.ts @@ -1,4 +1,4 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { MyOpOptions } from "./options.js"; +export { MyOpOptionalParams } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/options.ts index 3e561387a6..88b08ed6bf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/models/options.ts @@ -3,4 +3,4 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface MyOpOptions extends OperationOptions {} +export interface MyOpOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/SingleClient.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/singleClient.ts similarity index 62% rename from packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/SingleClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/singleClient.ts index bd967bcaa4..c48add9da9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/SingleClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/singleClient.ts @@ -8,9 +8,9 @@ import { SingleClientOptions, SingleContext, } from "./api/index.js"; -import { MyOpOptions } from "./models/options.js"; +import { MyOpOptionalParams } from "./models/options.js"; -export { SingleClientOptions } from "./api/SingleContext.js"; +export { SingleClientOptions } from "./api/singleContext.js"; export class SingleClient { private _client: SingleContext; @@ -18,12 +18,12 @@ export class SingleClient { public readonly pipeline: Pipeline; /** Illustrates server with a single path parameter @server */ - constructor(endpoint: string, options: SingleClientOptions = {}) { - this._client = createSingle(endpoint, options); + constructor(endpointParam: string, options: SingleClientOptions = {}) { + this._client = createSingle(endpointParam, options); this.pipeline = this._client.pipeline; } - myOp(options: MyOpOptions = { requestOptions: {} }): Promise { + myOp(options: MyOpOptionalParams = { requestOptions: {} }): Promise { return myOp(this._client, options); } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/index.ts index 543a73f7fe..e08c1e2f76 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/index.ts @@ -5,7 +5,7 @@ export { createNotVersioned, NotVersionedClientOptions, NotVersionedContext, -} from "./NotVersionedContext.js"; +} from "./notVersionedContext.js"; export { withoutApiVersion, withQueryApiVersion, diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/NotVersionedContext.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/notVersionedContext.ts similarity index 86% rename from packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/NotVersionedContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/notVersionedContext.ts index 69d30858be..d32a0819dd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/NotVersionedContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/notVersionedContext.ts @@ -11,9 +11,9 @@ export { NotVersionedContext } from "../rest/index.js"; /** Illustrates not-versioned server. */ export function createNotVersioned( - endpoint: string, + endpointParam: string, options: NotVersionedClientOptions = {}, ): NotVersionedContext { - const clientContext = getClient(endpoint, options); + const clientContext = getClient(endpointParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/operations.ts index 5df2296016..178cb44696 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/api/operations.ts @@ -13,14 +13,14 @@ import { createRestError, } from "@azure-rest/core-client"; import { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, } from "../models/options.js"; export function _withoutApiVersionSend( context: Client, - options: WithoutApiVersionOptions = { requestOptions: {} }, + options: WithoutApiVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/server/versions/not-versioned/without-api-version") @@ -39,7 +39,7 @@ export async function _withoutApiVersionDeserialize( export async function withoutApiVersion( context: Client, - options: WithoutApiVersionOptions = { requestOptions: {} }, + options: WithoutApiVersionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withoutApiVersionSend(context, options); return _withoutApiVersionDeserialize(result); @@ -48,7 +48,7 @@ export async function withoutApiVersion( export function _withQueryApiVersionSend( context: Client, apiVersion: string, - options: WithQueryApiVersionOptions = { requestOptions: {} }, + options: WithQueryApiVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/server/versions/not-versioned/with-query-api-version") @@ -71,7 +71,7 @@ export async function _withQueryApiVersionDeserialize( export async function withQueryApiVersion( context: Client, apiVersion: string, - options: WithQueryApiVersionOptions = { requestOptions: {} }, + options: WithQueryApiVersionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withQueryApiVersionSend(context, apiVersion, options); return _withQueryApiVersionDeserialize(result); @@ -80,7 +80,7 @@ export async function withQueryApiVersion( export function _withPathApiVersionSend( context: Client, apiVersion: string, - options: WithPathApiVersionOptions = { requestOptions: {} }, + options: WithPathApiVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -103,7 +103,7 @@ export async function _withPathApiVersionDeserialize( export async function withPathApiVersion( context: Client, apiVersion: string, - options: WithPathApiVersionOptions = { requestOptions: {} }, + options: WithPathApiVersionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withPathApiVersionSend(context, apiVersion, options); return _withPathApiVersionDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.ts index 123538d091..947869e08f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.ts @@ -4,9 +4,9 @@ export { NotVersionedClient, NotVersionedClientOptions, -} from "./NotVersionedClient.js"; +} from "./notVersionedClient.js"; export { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/index.ts index 33dbe0801c..0db4b4ed31 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. export { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/options.ts index c7a4995916..3a5b24914d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/models/options.ts @@ -3,8 +3,8 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface WithoutApiVersionOptions extends OperationOptions {} +export interface WithoutApiVersionOptionalParams extends OperationOptions {} -export interface WithQueryApiVersionOptions extends OperationOptions {} +export interface WithQueryApiVersionOptionalParams extends OperationOptions {} -export interface WithPathApiVersionOptions extends OperationOptions {} +export interface WithPathApiVersionOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/NotVersionedClient.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/notVersionedClient.ts similarity index 65% rename from packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/NotVersionedClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/notVersionedClient.ts index 8c24fae743..6eda64a921 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/NotVersionedClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/notVersionedClient.ts @@ -11,12 +11,12 @@ import { withPathApiVersion, } from "./api/index.js"; import { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, } from "./models/options.js"; -export { NotVersionedClientOptions } from "./api/NotVersionedContext.js"; +export { NotVersionedClientOptions } from "./api/notVersionedContext.js"; export class NotVersionedClient { private _client: NotVersionedContext; @@ -24,27 +24,27 @@ export class NotVersionedClient { public readonly pipeline: Pipeline; /** Illustrates not-versioned server. */ - constructor(endpoint: string, options: NotVersionedClientOptions = {}) { - this._client = createNotVersioned(endpoint, options); + constructor(endpointParam: string, options: NotVersionedClientOptions = {}) { + this._client = createNotVersioned(endpointParam, options); this.pipeline = this._client.pipeline; } withoutApiVersion( - options: WithoutApiVersionOptions = { requestOptions: {} }, + options: WithoutApiVersionOptionalParams = { requestOptions: {} }, ): Promise { return withoutApiVersion(this._client, options); } withQueryApiVersion( apiVersion: string, - options: WithQueryApiVersionOptions = { requestOptions: {} }, + options: WithQueryApiVersionOptionalParams = { requestOptions: {} }, ): Promise { return withQueryApiVersion(this._client, apiVersion, options); } withPathApiVersion( apiVersion: string, - options: WithPathApiVersionOptions = { requestOptions: {} }, + options: WithPathApiVersionOptionalParams = { requestOptions: {} }, ): Promise { return withPathApiVersion(this._client, apiVersion, options); } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/index.ts index 62282e5794..78949156d1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/index.ts @@ -5,9 +5,10 @@ export { withoutApiVersion, withQueryApiVersion, withPathApiVersion, + withQueryOldApiVersion, } from "./operations.js"; export { createVersioned, VersionedClientOptions, VersionedContext, -} from "./VersionedContext.js"; +} from "./versionedContext.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/operations.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/operations.ts index f60387062f..baea2dbcb5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/operations.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/operations.ts @@ -6,6 +6,7 @@ import { WithoutApiVersion200Response, WithPathApiVersion200Response, WithQueryApiVersion200Response, + WithQueryOldApiVersion200Response, } from "../rest/index.js"; import { StreamableMethod, @@ -13,14 +14,15 @@ import { createRestError, } from "@azure-rest/core-client"; import { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, + WithQueryOldApiVersionOptionalParams, } from "../models/options.js"; export function _withoutApiVersionSend( context: Client, - options: WithoutApiVersionOptions = { requestOptions: {} }, + options: WithoutApiVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/server/versions/versioned/without-api-version") @@ -39,7 +41,7 @@ export async function _withoutApiVersionDeserialize( export async function withoutApiVersion( context: Client, - options: WithoutApiVersionOptions = { requestOptions: {} }, + options: WithoutApiVersionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withoutApiVersionSend(context, options); return _withoutApiVersionDeserialize(result); @@ -47,7 +49,7 @@ export async function withoutApiVersion( export function _withQueryApiVersionSend( context: Client, - options: WithQueryApiVersionOptions = { requestOptions: {} }, + options: WithQueryApiVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/server/versions/versioned/with-query-api-version") @@ -71,7 +73,7 @@ export async function _withQueryApiVersionDeserialize( export async function withQueryApiVersion( context: Client, - options: WithQueryApiVersionOptions = { requestOptions: {} }, + options: WithQueryApiVersionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withQueryApiVersionSend(context, options); return _withQueryApiVersionDeserialize(result); @@ -80,7 +82,7 @@ export async function withQueryApiVersion( export function _withPathApiVersionSend( context: Client, apiVersion: string, - options: WithPathApiVersionOptions = { requestOptions: {} }, + options: WithPathApiVersionOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path( @@ -103,8 +105,40 @@ export async function _withPathApiVersionDeserialize( export async function withPathApiVersion( context: Client, apiVersion: string, - options: WithPathApiVersionOptions = { requestOptions: {} }, + options: WithPathApiVersionOptionalParams = { requestOptions: {} }, ): Promise { const result = await _withPathApiVersionSend(context, apiVersion, options); return _withPathApiVersionDeserialize(result); } + +export function _withQueryOldApiVersionSend( + context: Client, + options: WithQueryOldApiVersionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/server/versions/versioned/with-query-old-api-version") + .head({ + ...operationOptionsToRequestParameters(options), + queryParameters: { + "api-version": options?.apiVersion ?? "2022-12-01-preview", + }, + }); +} + +export async function _withQueryOldApiVersionDeserialize( + result: WithQueryOldApiVersion200Response, +): Promise { + if (result.status !== "200") { + throw createRestError(result); + } + + return; +} + +export async function withQueryOldApiVersion( + context: Client, + options: WithQueryOldApiVersionOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _withQueryOldApiVersionSend(context, options); + return _withQueryOldApiVersionDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/VersionedContext.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/versionedContext.ts similarity index 85% rename from packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/VersionedContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/versionedContext.ts index 47fe0e5fdf..0291ba12eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/VersionedContext.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/api/versionedContext.ts @@ -11,9 +11,9 @@ export { VersionedContext } from "../rest/index.js"; /** Illustrates versioned server. */ export function createVersioned( - endpoint: string, + endpointParam: string, options: VersionedClientOptions = {}, ): VersionedContext { - const clientContext = getClient(endpoint, options); + const clientContext = getClient(endpointParam, options); return clientContext; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.ts index 781b5193c6..92daf8fb46 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.ts @@ -1,9 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { VersionedClient, VersionedClientOptions } from "./VersionedClient.js"; +export { VersionedClient, VersionedClientOptions } from "./versionedClient.js"; export { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + Versions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, + WithQueryOldApiVersionOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/index.ts index 33dbe0801c..a78eadbe51 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/index.ts @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +export { Versions } from "./models.js"; export { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, + WithQueryOldApiVersionOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/models.ts new file mode 100644 index 0000000000..b21a97d1e5 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/models.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +/** The version of the API. */ +/** */ +export type Versions = "2021-01-01-preview" | "2022-12-01-preview"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/options.ts index a7f7db6fae..e283f9ecf5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/models/options.ts @@ -3,10 +3,14 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface WithoutApiVersionOptions extends OperationOptions {} +export interface WithoutApiVersionOptionalParams extends OperationOptions {} -export interface WithQueryApiVersionOptions extends OperationOptions { +export interface WithQueryApiVersionOptionalParams extends OperationOptions { apiVersion?: string; } -export interface WithPathApiVersionOptions extends OperationOptions {} +export interface WithPathApiVersionOptionalParams extends OperationOptions {} + +export interface WithQueryOldApiVersionOptionalParams extends OperationOptions { + apiVersion?: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/clientDefinitions.ts index 5ed3d8695c..4f0be8d890 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/clientDefinitions.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/clientDefinitions.ts @@ -5,11 +5,13 @@ import { WithoutApiVersionParameters, WithQueryApiVersionParameters, WithPathApiVersionParameters, + WithQueryOldApiVersionParameters, } from "./parameters.js"; import { WithoutApiVersion200Response, WithQueryApiVersion200Response, WithPathApiVersion200Response, + WithQueryOldApiVersion200Response, } from "./responses.js"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -31,6 +33,12 @@ export interface WithPathApiVersion { ): StreamableMethod; } +export interface WithQueryOldApiVersion { + head( + options?: WithQueryOldApiVersionParameters, + ): StreamableMethod; +} + export interface Routes { /** Resource for '/server/versions/versioned/without-api-version' has methods for the following verbs: head */ (path: "/server/versions/versioned/without-api-version"): WithoutApiVersion; @@ -43,6 +51,10 @@ export interface Routes { path: "/server/versions/versioned/with-path-api-version/{apiVersion}", apiVersion: string, ): WithPathApiVersion; + /** Resource for '/server/versions/versioned/with-query-old-api-version' has methods for the following verbs: head */ + ( + path: "/server/versions/versioned/with-query-old-api-version", + ): WithQueryOldApiVersion; } export type VersionedContext = Client & { diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/parameters.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/parameters.ts index 1591399969..57eafe8fe5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/parameters.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/parameters.ts @@ -16,3 +16,14 @@ export interface WithQueryApiVersionQueryParam { export type WithQueryApiVersionParameters = WithQueryApiVersionQueryParam & RequestParameters; export type WithPathApiVersionParameters = RequestParameters; + +export interface WithQueryOldApiVersionQueryParamProperties { + "api-version": string; +} + +export interface WithQueryOldApiVersionQueryParam { + queryParameters: WithQueryOldApiVersionQueryParamProperties; +} + +export type WithQueryOldApiVersionParameters = + WithQueryOldApiVersionQueryParam & RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/responses.ts index 82277c5841..4b91c8fa54 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/responses.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/rest/responses.ts @@ -17,3 +17,8 @@ export interface WithQueryApiVersion200Response extends HttpResponse { export interface WithPathApiVersion200Response extends HttpResponse { status: "200"; } + +/** The request has succeeded. */ +export interface WithQueryOldApiVersion200Response extends HttpResponse { + status: "200"; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/VersionedClient.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/versionedClient.ts similarity index 54% rename from packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/VersionedClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/versionedClient.ts index f7c0631c1b..39d26fbb03 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/VersionedClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/versionedClient.ts @@ -2,21 +2,23 @@ // Licensed under the MIT license. import { Pipeline } from "@azure/core-rest-pipeline"; +import { + WithoutApiVersionOptionalParams, + WithQueryApiVersionOptionalParams, + WithPathApiVersionOptionalParams, + WithQueryOldApiVersionOptionalParams, +} from "./models/options.js"; import { withoutApiVersion, withQueryApiVersion, withPathApiVersion, + withQueryOldApiVersion, createVersioned, VersionedClientOptions, VersionedContext, } from "./api/index.js"; -import { - WithoutApiVersionOptions, - WithQueryApiVersionOptions, - WithPathApiVersionOptions, -} from "./models/options.js"; -export { VersionedClientOptions } from "./api/VersionedContext.js"; +export { VersionedClientOptions } from "./api/versionedContext.js"; export class VersionedClient { private _client: VersionedContext; @@ -24,27 +26,33 @@ export class VersionedClient { public readonly pipeline: Pipeline; /** Illustrates versioned server. */ - constructor(endpoint: string, options: VersionedClientOptions = {}) { - this._client = createVersioned(endpoint, options); + constructor(endpointParam: string, options: VersionedClientOptions = {}) { + this._client = createVersioned(endpointParam, options); this.pipeline = this._client.pipeline; } withoutApiVersion( - options: WithoutApiVersionOptions = { requestOptions: {} }, + options: WithoutApiVersionOptionalParams = { requestOptions: {} }, ): Promise { return withoutApiVersion(this._client, options); } withQueryApiVersion( - options: WithQueryApiVersionOptions = { requestOptions: {} }, + options: WithQueryApiVersionOptionalParams = { requestOptions: {} }, ): Promise { return withQueryApiVersion(this._client, options); } withPathApiVersion( apiVersion: string, - options: WithPathApiVersionOptions = { requestOptions: {} }, + options: WithPathApiVersionOptionalParams = { requestOptions: {} }, ): Promise { return withPathApiVersion(this._client, apiVersion, options); } + + withQueryOldApiVersion( + options: WithQueryOldApiVersionOptionalParams = { requestOptions: {} }, + ): Promise { + return withQueryOldApiVersion(this._client, options); + } } diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/index.ts new file mode 100644 index 0000000000..2e85e5a9ec --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/index.ts @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + createSpecialWords, + SpecialWordsClientOptions, + SpecialWordsContext, +} from "./specialWordsContext.js"; +export { modelPropertiesSameAsModel } from "./modelProperties/index.js"; +export { + modelsWithAnd, + modelsWithAs, + modelsWithAssert, + modelsWithAsync, + modelsWithAwait, + modelsWithBreak, + modelsWithClass, + modelsWithConstructor, + modelsWithContinue, + modelsWithDef, + modelsWithDel, + modelsWithElif, + modelsWithElse, + modelsWithExcept, + modelsWithExec, + modelsWithFinally, + modelsWithFor, + modelsWithFrom, + modelsWithGlobal, + modelsWithIf, + modelsWithImport, + modelsWithIn, + modelsWithIs, + modelsWithLambda, + modelsWithNot, + modelsWithOr, + modelsWithPass, + modelsWithRaise, + modelsWithReturn, + modelsWithTry, + modelsWithWhile, + modelsWithWith, + modelsWithYield, +} from "./models/index.js"; +export { + operationsAnd, + operationsAs, + operationsAssert, + operationsAsync, + operationsAwait, + operationsBreak, + operationsClass, + operationsConstructor, + operationsContinue, + operationsDef, + operationsDel, + operationsElif, + operationsElse, + operationsExcept, + operationsExec, + operationsFinally, + operationsFor, + operationsFrom, + operationsGlobal, + operationsIf, + operationsImport, + operationsIn, + operationsIs, + operationsLambda, + operationsNot, + operationsOr, + operationsPass, + operationsRaise, + operationsReturn, + operationsTry, + operationsWhile, + operationsWith, + operationsYield, +} from "./operations/index.js"; +export { + parametersWithAnd, + parametersWithAs, + parametersWithAssert, + parametersWithAsync, + parametersWithAwait, + parametersWithBreak, + parametersWithClass, + parametersWithConstructor, + parametersWithContinue, + parametersWithDef, + parametersWithDel, + parametersWithElif, + parametersWithElse, + parametersWithExcept, + parametersWithExec, + parametersWithFinally, + parametersWithFor, + parametersWithFrom, + parametersWithGlobal, + parametersWithIf, + parametersWithImport, + parametersWithIn, + parametersWithIs, + parametersWithLambda, + parametersWithNot, + parametersWithOr, + parametersWithPass, + parametersWithRaise, + parametersWithReturn, + parametersWithTry, + parametersWithWhile, + parametersWithWith, + parametersWithYield, + parametersWithCancellationToken, +} from "./parameters/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/modelProperties/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/modelProperties/index.ts new file mode 100644 index 0000000000..2dee77d834 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/modelProperties/index.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { SameAsModel } from "../../models/models.js"; +import { + ModelPropertiesSameAsModel204Response, + SpecialWordsContext as Client, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { ModelPropertiesSameAsModelOptionalParams } from "../../models/options.js"; + +export function _modelPropertiesSameAsModelSend( + context: Client, + body: SameAsModel, + options: ModelPropertiesSameAsModelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/model-properties/same-as-model") + .post({ + ...operationOptionsToRequestParameters(options), + body: { SameAsModel: body["sameAsModel"] }, + }); +} + +export async function _modelPropertiesSameAsModelDeserialize( + result: ModelPropertiesSameAsModel204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelPropertiesSameAsModel( + context: Client, + body: SameAsModel, + options: ModelPropertiesSameAsModelOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelPropertiesSameAsModelSend(context, body, options); + return _modelPropertiesSameAsModelDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/models/index.ts new file mode 100644 index 0000000000..bb9bd75cfc --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/models/index.ts @@ -0,0 +1,1170 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + And, + As, + Assert, + Async, + Await, + Break, + Class, + Constructor, + Continue, + Def, + Del, + Elif, + Else, + Except, + Exec, + Finally, + For, + From, + Global, + If, + Import, + In, + Is, + Lambda, + Not, + Or, + Pass, + Raise, + Return, + Try, + While, + With, + Yield, +} from "../../models/models.js"; +import { + ModelsWithAnd204Response, + ModelsWithAs204Response, + ModelsWithAssert204Response, + ModelsWithAsync204Response, + ModelsWithAwait204Response, + ModelsWithBreak204Response, + ModelsWithClass204Response, + ModelsWithConstructor204Response, + ModelsWithContinue204Response, + ModelsWithDef204Response, + ModelsWithDel204Response, + ModelsWithElif204Response, + ModelsWithElse204Response, + ModelsWithExcept204Response, + ModelsWithExec204Response, + ModelsWithFinally204Response, + ModelsWithFor204Response, + ModelsWithFrom204Response, + ModelsWithGlobal204Response, + ModelsWithIf204Response, + ModelsWithImport204Response, + ModelsWithIn204Response, + ModelsWithIs204Response, + ModelsWithLambda204Response, + ModelsWithNot204Response, + ModelsWithOr204Response, + ModelsWithPass204Response, + ModelsWithRaise204Response, + ModelsWithReturn204Response, + ModelsWithTry204Response, + ModelsWithWhile204Response, + ModelsWithWith204Response, + ModelsWithYield204Response, + SpecialWordsContext as Client, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + ModelsWithAndOptionalParams, + ModelsWithAsOptionalParams, + ModelsWithAssertOptionalParams, + ModelsWithAsyncOptionalParams, + ModelsWithAwaitOptionalParams, + ModelsWithBreakOptionalParams, + ModelsWithClassOptionalParams, + ModelsWithConstructorOptionalParams, + ModelsWithContinueOptionalParams, + ModelsWithDefOptionalParams, + ModelsWithDelOptionalParams, + ModelsWithElifOptionalParams, + ModelsWithElseOptionalParams, + ModelsWithExceptOptionalParams, + ModelsWithExecOptionalParams, + ModelsWithFinallyOptionalParams, + ModelsWithForOptionalParams, + ModelsWithFromOptionalParams, + ModelsWithGlobalOptionalParams, + ModelsWithIfOptionalParams, + ModelsWithImportOptionalParams, + ModelsWithInOptionalParams, + ModelsWithIsOptionalParams, + ModelsWithLambdaOptionalParams, + ModelsWithNotOptionalParams, + ModelsWithOrOptionalParams, + ModelsWithPassOptionalParams, + ModelsWithRaiseOptionalParams, + ModelsWithReturnOptionalParams, + ModelsWithTryOptionalParams, + ModelsWithWhileOptionalParams, + ModelsWithWithOptionalParams, + ModelsWithYieldOptionalParams, +} from "../../models/options.js"; + +export function _modelsWithAndSend( + context: Client, + body: And, + options: ModelsWithAndOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/and") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithAndDeserialize( + result: ModelsWithAnd204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithAnd( + context: Client, + body: And, + options: ModelsWithAndOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithAndSend(context, body, options); + return _modelsWithAndDeserialize(result); +} + +export function _modelsWithAsSend( + context: Client, + body: As, + options: ModelsWithAsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/as") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithAsDeserialize( + result: ModelsWithAs204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithAs( + context: Client, + body: As, + options: ModelsWithAsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithAsSend(context, body, options); + return _modelsWithAsDeserialize(result); +} + +export function _modelsWithAssertSend( + context: Client, + body: Assert, + options: ModelsWithAssertOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/assert") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithAssertDeserialize( + result: ModelsWithAssert204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithAssert( + context: Client, + body: Assert, + options: ModelsWithAssertOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithAssertSend(context, body, options); + return _modelsWithAssertDeserialize(result); +} + +export function _modelsWithAsyncSend( + context: Client, + body: Async, + options: ModelsWithAsyncOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/async") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithAsyncDeserialize( + result: ModelsWithAsync204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithAsync( + context: Client, + body: Async, + options: ModelsWithAsyncOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithAsyncSend(context, body, options); + return _modelsWithAsyncDeserialize(result); +} + +export function _modelsWithAwaitSend( + context: Client, + body: Await, + options: ModelsWithAwaitOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/await") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithAwaitDeserialize( + result: ModelsWithAwait204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithAwait( + context: Client, + body: Await, + options: ModelsWithAwaitOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithAwaitSend(context, body, options); + return _modelsWithAwaitDeserialize(result); +} + +export function _modelsWithBreakSend( + context: Client, + body: Break, + options: ModelsWithBreakOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/break") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithBreakDeserialize( + result: ModelsWithBreak204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithBreak( + context: Client, + body: Break, + options: ModelsWithBreakOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithBreakSend(context, body, options); + return _modelsWithBreakDeserialize(result); +} + +export function _modelsWithClassSend( + context: Client, + body: Class, + options: ModelsWithClassOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/class") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithClassDeserialize( + result: ModelsWithClass204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithClass( + context: Client, + body: Class, + options: ModelsWithClassOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithClassSend(context, body, options); + return _modelsWithClassDeserialize(result); +} + +export function _modelsWithConstructorSend( + context: Client, + body: Constructor, + options: ModelsWithConstructorOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/constructor") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithConstructorDeserialize( + result: ModelsWithConstructor204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithConstructor( + context: Client, + body: Constructor, + options: ModelsWithConstructorOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithConstructorSend(context, body, options); + return _modelsWithConstructorDeserialize(result); +} + +export function _modelsWithContinueSend( + context: Client, + body: Continue, + options: ModelsWithContinueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/continue") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithContinueDeserialize( + result: ModelsWithContinue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithContinue( + context: Client, + body: Continue, + options: ModelsWithContinueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithContinueSend(context, body, options); + return _modelsWithContinueDeserialize(result); +} + +export function _modelsWithDefSend( + context: Client, + body: Def, + options: ModelsWithDefOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/def") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithDefDeserialize( + result: ModelsWithDef204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithDef( + context: Client, + body: Def, + options: ModelsWithDefOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithDefSend(context, body, options); + return _modelsWithDefDeserialize(result); +} + +export function _modelsWithDelSend( + context: Client, + body: Del, + options: ModelsWithDelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/del") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithDelDeserialize( + result: ModelsWithDel204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithDel( + context: Client, + body: Del, + options: ModelsWithDelOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithDelSend(context, body, options); + return _modelsWithDelDeserialize(result); +} + +export function _modelsWithElifSend( + context: Client, + body: Elif, + options: ModelsWithElifOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/elif") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithElifDeserialize( + result: ModelsWithElif204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithElif( + context: Client, + body: Elif, + options: ModelsWithElifOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithElifSend(context, body, options); + return _modelsWithElifDeserialize(result); +} + +export function _modelsWithElseSend( + context: Client, + body: Else, + options: ModelsWithElseOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/else") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithElseDeserialize( + result: ModelsWithElse204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithElse( + context: Client, + body: Else, + options: ModelsWithElseOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithElseSend(context, body, options); + return _modelsWithElseDeserialize(result); +} + +export function _modelsWithExceptSend( + context: Client, + body: Except, + options: ModelsWithExceptOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/except") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithExceptDeserialize( + result: ModelsWithExcept204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithExcept( + context: Client, + body: Except, + options: ModelsWithExceptOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithExceptSend(context, body, options); + return _modelsWithExceptDeserialize(result); +} + +export function _modelsWithExecSend( + context: Client, + body: Exec, + options: ModelsWithExecOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/exec") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithExecDeserialize( + result: ModelsWithExec204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithExec( + context: Client, + body: Exec, + options: ModelsWithExecOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithExecSend(context, body, options); + return _modelsWithExecDeserialize(result); +} + +export function _modelsWithFinallySend( + context: Client, + body: Finally, + options: ModelsWithFinallyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/finally") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithFinallyDeserialize( + result: ModelsWithFinally204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithFinally( + context: Client, + body: Finally, + options: ModelsWithFinallyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithFinallySend(context, body, options); + return _modelsWithFinallyDeserialize(result); +} + +export function _modelsWithForSend( + context: Client, + body: For, + options: ModelsWithForOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/for") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithForDeserialize( + result: ModelsWithFor204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithFor( + context: Client, + body: For, + options: ModelsWithForOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithForSend(context, body, options); + return _modelsWithForDeserialize(result); +} + +export function _modelsWithFromSend( + context: Client, + body: From, + options: ModelsWithFromOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/from") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithFromDeserialize( + result: ModelsWithFrom204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithFrom( + context: Client, + body: From, + options: ModelsWithFromOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithFromSend(context, body, options); + return _modelsWithFromDeserialize(result); +} + +export function _modelsWithGlobalSend( + context: Client, + body: Global, + options: ModelsWithGlobalOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/global") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithGlobalDeserialize( + result: ModelsWithGlobal204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithGlobal( + context: Client, + body: Global, + options: ModelsWithGlobalOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithGlobalSend(context, body, options); + return _modelsWithGlobalDeserialize(result); +} + +export function _modelsWithIfSend( + context: Client, + body: If, + options: ModelsWithIfOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/if") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithIfDeserialize( + result: ModelsWithIf204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithIf( + context: Client, + body: If, + options: ModelsWithIfOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithIfSend(context, body, options); + return _modelsWithIfDeserialize(result); +} + +export function _modelsWithImportSend( + context: Client, + body: Import, + options: ModelsWithImportOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/import") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithImportDeserialize( + result: ModelsWithImport204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithImport( + context: Client, + body: Import, + options: ModelsWithImportOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithImportSend(context, body, options); + return _modelsWithImportDeserialize(result); +} + +export function _modelsWithInSend( + context: Client, + body: In, + options: ModelsWithInOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/in") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithInDeserialize( + result: ModelsWithIn204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithIn( + context: Client, + body: In, + options: ModelsWithInOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithInSend(context, body, options); + return _modelsWithInDeserialize(result); +} + +export function _modelsWithIsSend( + context: Client, + body: Is, + options: ModelsWithIsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/is") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithIsDeserialize( + result: ModelsWithIs204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithIs( + context: Client, + body: Is, + options: ModelsWithIsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithIsSend(context, body, options); + return _modelsWithIsDeserialize(result); +} + +export function _modelsWithLambdaSend( + context: Client, + body: Lambda, + options: ModelsWithLambdaOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/lambda") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithLambdaDeserialize( + result: ModelsWithLambda204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithLambda( + context: Client, + body: Lambda, + options: ModelsWithLambdaOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithLambdaSend(context, body, options); + return _modelsWithLambdaDeserialize(result); +} + +export function _modelsWithNotSend( + context: Client, + body: Not, + options: ModelsWithNotOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/not") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithNotDeserialize( + result: ModelsWithNot204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithNot( + context: Client, + body: Not, + options: ModelsWithNotOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithNotSend(context, body, options); + return _modelsWithNotDeserialize(result); +} + +export function _modelsWithOrSend( + context: Client, + body: Or, + options: ModelsWithOrOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/or") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithOrDeserialize( + result: ModelsWithOr204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithOr( + context: Client, + body: Or, + options: ModelsWithOrOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithOrSend(context, body, options); + return _modelsWithOrDeserialize(result); +} + +export function _modelsWithPassSend( + context: Client, + body: Pass, + options: ModelsWithPassOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/pass") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithPassDeserialize( + result: ModelsWithPass204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithPass( + context: Client, + body: Pass, + options: ModelsWithPassOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithPassSend(context, body, options); + return _modelsWithPassDeserialize(result); +} + +export function _modelsWithRaiseSend( + context: Client, + body: Raise, + options: ModelsWithRaiseOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/raise") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithRaiseDeserialize( + result: ModelsWithRaise204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithRaise( + context: Client, + body: Raise, + options: ModelsWithRaiseOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithRaiseSend(context, body, options); + return _modelsWithRaiseDeserialize(result); +} + +export function _modelsWithReturnSend( + context: Client, + body: Return, + options: ModelsWithReturnOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/return") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithReturnDeserialize( + result: ModelsWithReturn204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithReturn( + context: Client, + body: Return, + options: ModelsWithReturnOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithReturnSend(context, body, options); + return _modelsWithReturnDeserialize(result); +} + +export function _modelsWithTrySend( + context: Client, + body: Try, + options: ModelsWithTryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/try") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithTryDeserialize( + result: ModelsWithTry204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithTry( + context: Client, + body: Try, + options: ModelsWithTryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithTrySend(context, body, options); + return _modelsWithTryDeserialize(result); +} + +export function _modelsWithWhileSend( + context: Client, + body: While, + options: ModelsWithWhileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/while") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithWhileDeserialize( + result: ModelsWithWhile204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithWhile( + context: Client, + body: While, + options: ModelsWithWhileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithWhileSend(context, body, options); + return _modelsWithWhileDeserialize(result); +} + +export function _modelsWithWithSend( + context: Client, + body: With, + options: ModelsWithWithOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/with") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithWithDeserialize( + result: ModelsWithWith204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithWith( + context: Client, + body: With, + options: ModelsWithWithOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithWithSend(context, body, options); + return _modelsWithWithDeserialize(result); +} + +export function _modelsWithYieldSend( + context: Client, + body: Yield, + options: ModelsWithYieldOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/models/yield") + .post({ + ...operationOptionsToRequestParameters(options), + body: { name: body["name"] }, + }); +} + +export async function _modelsWithYieldDeserialize( + result: ModelsWithYield204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function modelsWithYield( + context: Client, + body: Yield, + options: ModelsWithYieldOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _modelsWithYieldSend(context, body, options); + return _modelsWithYieldDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/operations/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/operations/index.ts new file mode 100644 index 0000000000..14f81ffe1b --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/operations/index.ts @@ -0,0 +1,970 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + OperationsAnd204Response, + OperationsAs204Response, + OperationsAssert204Response, + OperationsAsync204Response, + OperationsAwait204Response, + OperationsBreak204Response, + OperationsClass204Response, + OperationsConstructor204Response, + OperationsContinue204Response, + OperationsDef204Response, + OperationsDel204Response, + OperationsElif204Response, + OperationsElse204Response, + OperationsExcept204Response, + OperationsExec204Response, + OperationsFinally204Response, + OperationsFor204Response, + OperationsFrom204Response, + OperationsGlobal204Response, + OperationsIf204Response, + OperationsImport204Response, + OperationsIn204Response, + OperationsIs204Response, + OperationsLambda204Response, + OperationsNot204Response, + OperationsOr204Response, + OperationsPass204Response, + OperationsRaise204Response, + OperationsReturn204Response, + OperationsTry204Response, + OperationsWhile204Response, + OperationsWith204Response, + OperationsYield204Response, + SpecialWordsContext as Client, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + OperationsAndOptionalParams, + OperationsAsOptionalParams, + OperationsAssertOptionalParams, + OperationsAsyncOptionalParams, + OperationsAwaitOptionalParams, + OperationsBreakOptionalParams, + OperationsClassOptionalParams, + OperationsConstructorOptionalParams, + OperationsContinueOptionalParams, + OperationsDefOptionalParams, + OperationsDelOptionalParams, + OperationsElifOptionalParams, + OperationsElseOptionalParams, + OperationsExceptOptionalParams, + OperationsExecOptionalParams, + OperationsFinallyOptionalParams, + OperationsForOptionalParams, + OperationsFromOptionalParams, + OperationsGlobalOptionalParams, + OperationsIfOptionalParams, + OperationsImportOptionalParams, + OperationsInOptionalParams, + OperationsIsOptionalParams, + OperationsLambdaOptionalParams, + OperationsNotOptionalParams, + OperationsOrOptionalParams, + OperationsPassOptionalParams, + OperationsRaiseOptionalParams, + OperationsReturnOptionalParams, + OperationsTryOptionalParams, + OperationsWhileOptionalParams, + OperationsWithOptionalParams, + OperationsYieldOptionalParams, +} from "../../models/options.js"; + +export function _operationsAndSend( + context: Client, + options: OperationsAndOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/and") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsAndDeserialize( + result: OperationsAnd204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsAnd( + context: Client, + options: OperationsAndOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsAndSend(context, options); + return _operationsAndDeserialize(result); +} + +export function _operationsAsSend( + context: Client, + options: OperationsAsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/as") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsAsDeserialize( + result: OperationsAs204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsAs( + context: Client, + options: OperationsAsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsAsSend(context, options); + return _operationsAsDeserialize(result); +} + +export function _operationsAssertSend( + context: Client, + options: OperationsAssertOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/assert") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsAssertDeserialize( + result: OperationsAssert204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsAssert( + context: Client, + options: OperationsAssertOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsAssertSend(context, options); + return _operationsAssertDeserialize(result); +} + +export function _operationsAsyncSend( + context: Client, + options: OperationsAsyncOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/async") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsAsyncDeserialize( + result: OperationsAsync204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsAsync( + context: Client, + options: OperationsAsyncOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsAsyncSend(context, options); + return _operationsAsyncDeserialize(result); +} + +export function _operationsAwaitSend( + context: Client, + options: OperationsAwaitOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/await") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsAwaitDeserialize( + result: OperationsAwait204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsAwait( + context: Client, + options: OperationsAwaitOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsAwaitSend(context, options); + return _operationsAwaitDeserialize(result); +} + +export function _operationsBreakSend( + context: Client, + options: OperationsBreakOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/break") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsBreakDeserialize( + result: OperationsBreak204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsBreak( + context: Client, + options: OperationsBreakOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsBreakSend(context, options); + return _operationsBreakDeserialize(result); +} + +export function _operationsClassSend( + context: Client, + options: OperationsClassOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/class") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsClassDeserialize( + result: OperationsClass204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsClass( + context: Client, + options: OperationsClassOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsClassSend(context, options); + return _operationsClassDeserialize(result); +} + +export function _operationsConstructorSend( + context: Client, + options: OperationsConstructorOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/constructor") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsConstructorDeserialize( + result: OperationsConstructor204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsConstructor( + context: Client, + options: OperationsConstructorOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsConstructorSend(context, options); + return _operationsConstructorDeserialize(result); +} + +export function _operationsContinueSend( + context: Client, + options: OperationsContinueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/continue") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsContinueDeserialize( + result: OperationsContinue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsContinue( + context: Client, + options: OperationsContinueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsContinueSend(context, options); + return _operationsContinueDeserialize(result); +} + +export function _operationsDefSend( + context: Client, + options: OperationsDefOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/def") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsDefDeserialize( + result: OperationsDef204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsDef( + context: Client, + options: OperationsDefOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsDefSend(context, options); + return _operationsDefDeserialize(result); +} + +export function _operationsDelSend( + context: Client, + options: OperationsDelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/del") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsDelDeserialize( + result: OperationsDel204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsDel( + context: Client, + options: OperationsDelOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsDelSend(context, options); + return _operationsDelDeserialize(result); +} + +export function _operationsElifSend( + context: Client, + options: OperationsElifOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/elif") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsElifDeserialize( + result: OperationsElif204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsElif( + context: Client, + options: OperationsElifOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsElifSend(context, options); + return _operationsElifDeserialize(result); +} + +export function _operationsElseSend( + context: Client, + options: OperationsElseOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/else") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsElseDeserialize( + result: OperationsElse204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsElse( + context: Client, + options: OperationsElseOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsElseSend(context, options); + return _operationsElseDeserialize(result); +} + +export function _operationsExceptSend( + context: Client, + options: OperationsExceptOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/except") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsExceptDeserialize( + result: OperationsExcept204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsExcept( + context: Client, + options: OperationsExceptOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsExceptSend(context, options); + return _operationsExceptDeserialize(result); +} + +export function _operationsExecSend( + context: Client, + options: OperationsExecOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/exec") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsExecDeserialize( + result: OperationsExec204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsExec( + context: Client, + options: OperationsExecOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsExecSend(context, options); + return _operationsExecDeserialize(result); +} + +export function _operationsFinallySend( + context: Client, + options: OperationsFinallyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/finally") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsFinallyDeserialize( + result: OperationsFinally204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsFinally( + context: Client, + options: OperationsFinallyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsFinallySend(context, options); + return _operationsFinallyDeserialize(result); +} + +export function _operationsForSend( + context: Client, + options: OperationsForOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/for") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsForDeserialize( + result: OperationsFor204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsFor( + context: Client, + options: OperationsForOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsForSend(context, options); + return _operationsForDeserialize(result); +} + +export function _operationsFromSend( + context: Client, + options: OperationsFromOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/from") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsFromDeserialize( + result: OperationsFrom204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsFrom( + context: Client, + options: OperationsFromOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsFromSend(context, options); + return _operationsFromDeserialize(result); +} + +export function _operationsGlobalSend( + context: Client, + options: OperationsGlobalOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/global") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsGlobalDeserialize( + result: OperationsGlobal204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsGlobal( + context: Client, + options: OperationsGlobalOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsGlobalSend(context, options); + return _operationsGlobalDeserialize(result); +} + +export function _operationsIfSend( + context: Client, + options: OperationsIfOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/if") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsIfDeserialize( + result: OperationsIf204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsIf( + context: Client, + options: OperationsIfOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsIfSend(context, options); + return _operationsIfDeserialize(result); +} + +export function _operationsImportSend( + context: Client, + options: OperationsImportOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/import") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsImportDeserialize( + result: OperationsImport204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsImport( + context: Client, + options: OperationsImportOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsImportSend(context, options); + return _operationsImportDeserialize(result); +} + +export function _operationsInSend( + context: Client, + options: OperationsInOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/in") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsInDeserialize( + result: OperationsIn204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsIn( + context: Client, + options: OperationsInOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsInSend(context, options); + return _operationsInDeserialize(result); +} + +export function _operationsIsSend( + context: Client, + options: OperationsIsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/is") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsIsDeserialize( + result: OperationsIs204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsIs( + context: Client, + options: OperationsIsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsIsSend(context, options); + return _operationsIsDeserialize(result); +} + +export function _operationsLambdaSend( + context: Client, + options: OperationsLambdaOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/lambda") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsLambdaDeserialize( + result: OperationsLambda204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsLambda( + context: Client, + options: OperationsLambdaOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsLambdaSend(context, options); + return _operationsLambdaDeserialize(result); +} + +export function _operationsNotSend( + context: Client, + options: OperationsNotOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/not") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsNotDeserialize( + result: OperationsNot204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsNot( + context: Client, + options: OperationsNotOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsNotSend(context, options); + return _operationsNotDeserialize(result); +} + +export function _operationsOrSend( + context: Client, + options: OperationsOrOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/or") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsOrDeserialize( + result: OperationsOr204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsOr( + context: Client, + options: OperationsOrOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsOrSend(context, options); + return _operationsOrDeserialize(result); +} + +export function _operationsPassSend( + context: Client, + options: OperationsPassOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/pass") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsPassDeserialize( + result: OperationsPass204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsPass( + context: Client, + options: OperationsPassOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsPassSend(context, options); + return _operationsPassDeserialize(result); +} + +export function _operationsRaiseSend( + context: Client, + options: OperationsRaiseOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/raise") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsRaiseDeserialize( + result: OperationsRaise204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsRaise( + context: Client, + options: OperationsRaiseOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsRaiseSend(context, options); + return _operationsRaiseDeserialize(result); +} + +export function _operationsReturnSend( + context: Client, + options: OperationsReturnOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/return") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsReturnDeserialize( + result: OperationsReturn204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsReturn( + context: Client, + options: OperationsReturnOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsReturnSend(context, options); + return _operationsReturnDeserialize(result); +} + +export function _operationsTrySend( + context: Client, + options: OperationsTryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/try") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsTryDeserialize( + result: OperationsTry204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsTry( + context: Client, + options: OperationsTryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsTrySend(context, options); + return _operationsTryDeserialize(result); +} + +export function _operationsWhileSend( + context: Client, + options: OperationsWhileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/while") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsWhileDeserialize( + result: OperationsWhile204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsWhile( + context: Client, + options: OperationsWhileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsWhileSend(context, options); + return _operationsWhileDeserialize(result); +} + +export function _operationsWithSend( + context: Client, + options: OperationsWithOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/with") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsWithDeserialize( + result: OperationsWith204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsWith( + context: Client, + options: OperationsWithOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsWithSend(context, options); + return _operationsWithDeserialize(result); +} + +export function _operationsYieldSend( + context: Client, + options: OperationsYieldOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/operations/yield") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsYieldDeserialize( + result: OperationsYield204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function operationsYield( + context: Client, + options: OperationsYieldOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationsYieldSend(context, options); + return _operationsYieldDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/parameters/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/parameters/index.ts new file mode 100644 index 0000000000..caace36b9c --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/parameters/index.ts @@ -0,0 +1,1189 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + ParametersWithAnd204Response, + ParametersWithAs204Response, + ParametersWithAssert204Response, + ParametersWithAsync204Response, + ParametersWithAwait204Response, + ParametersWithBreak204Response, + ParametersWithCancellationToken204Response, + ParametersWithClass204Response, + ParametersWithConstructor204Response, + ParametersWithContinue204Response, + ParametersWithDef204Response, + ParametersWithDel204Response, + ParametersWithElif204Response, + ParametersWithElse204Response, + ParametersWithExcept204Response, + ParametersWithExec204Response, + ParametersWithFinally204Response, + ParametersWithFor204Response, + ParametersWithFrom204Response, + ParametersWithGlobal204Response, + ParametersWithIf204Response, + ParametersWithImport204Response, + ParametersWithIn204Response, + ParametersWithIs204Response, + ParametersWithLambda204Response, + ParametersWithNot204Response, + ParametersWithOr204Response, + ParametersWithPass204Response, + ParametersWithRaise204Response, + ParametersWithReturn204Response, + ParametersWithTry204Response, + ParametersWithWhile204Response, + ParametersWithWith204Response, + ParametersWithYield204Response, + SpecialWordsContext as Client, +} from "../../rest/index.js"; +import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, +} from "@azure-rest/core-client"; +import { + ParametersWithAndOptionalParams, + ParametersWithAsOptionalParams, + ParametersWithAssertOptionalParams, + ParametersWithAsyncOptionalParams, + ParametersWithAwaitOptionalParams, + ParametersWithBreakOptionalParams, + ParametersWithClassOptionalParams, + ParametersWithConstructorOptionalParams, + ParametersWithContinueOptionalParams, + ParametersWithDefOptionalParams, + ParametersWithDelOptionalParams, + ParametersWithElifOptionalParams, + ParametersWithElseOptionalParams, + ParametersWithExceptOptionalParams, + ParametersWithExecOptionalParams, + ParametersWithFinallyOptionalParams, + ParametersWithForOptionalParams, + ParametersWithFromOptionalParams, + ParametersWithGlobalOptionalParams, + ParametersWithIfOptionalParams, + ParametersWithImportOptionalParams, + ParametersWithInOptionalParams, + ParametersWithIsOptionalParams, + ParametersWithLambdaOptionalParams, + ParametersWithNotOptionalParams, + ParametersWithOrOptionalParams, + ParametersWithPassOptionalParams, + ParametersWithRaiseOptionalParams, + ParametersWithReturnOptionalParams, + ParametersWithTryOptionalParams, + ParametersWithWhileOptionalParams, + ParametersWithWithOptionalParams, + ParametersWithYieldOptionalParams, + ParametersWithCancellationTokenOptionalParams, +} from "../../models/options.js"; + +export function _parametersWithAndSend( + context: Client, + and: string, + options: ParametersWithAndOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/and") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { and: and }, + }); +} + +export async function _parametersWithAndDeserialize( + result: ParametersWithAnd204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithAnd( + context: Client, + and: string, + options: ParametersWithAndOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithAndSend(context, and, options); + return _parametersWithAndDeserialize(result); +} + +export function _parametersWithAsSend( + context: Client, + asParam: string, + options: ParametersWithAsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/as") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { as: asParam }, + }); +} + +export async function _parametersWithAsDeserialize( + result: ParametersWithAs204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithAs( + context: Client, + asParam: string, + options: ParametersWithAsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithAsSend(context, asParam, options); + return _parametersWithAsDeserialize(result); +} + +export function _parametersWithAssertSend( + context: Client, + assertParam: string, + options: ParametersWithAssertOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/assert") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { assert: assertParam }, + }); +} + +export async function _parametersWithAssertDeserialize( + result: ParametersWithAssert204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithAssert( + context: Client, + assertParam: string, + options: ParametersWithAssertOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithAssertSend(context, assertParam, options); + return _parametersWithAssertDeserialize(result); +} + +export function _parametersWithAsyncSend( + context: Client, + asyncParam: string, + options: ParametersWithAsyncOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/async") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { async: asyncParam }, + }); +} + +export async function _parametersWithAsyncDeserialize( + result: ParametersWithAsync204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithAsync( + context: Client, + asyncParam: string, + options: ParametersWithAsyncOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithAsyncSend(context, asyncParam, options); + return _parametersWithAsyncDeserialize(result); +} + +export function _parametersWithAwaitSend( + context: Client, + awaitParam: string, + options: ParametersWithAwaitOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/await") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { await: awaitParam }, + }); +} + +export async function _parametersWithAwaitDeserialize( + result: ParametersWithAwait204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithAwait( + context: Client, + awaitParam: string, + options: ParametersWithAwaitOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithAwaitSend(context, awaitParam, options); + return _parametersWithAwaitDeserialize(result); +} + +export function _parametersWithBreakSend( + context: Client, + breakParam: string, + options: ParametersWithBreakOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/break") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { break: breakParam }, + }); +} + +export async function _parametersWithBreakDeserialize( + result: ParametersWithBreak204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithBreak( + context: Client, + breakParam: string, + options: ParametersWithBreakOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithBreakSend(context, breakParam, options); + return _parametersWithBreakDeserialize(result); +} + +export function _parametersWithClassSend( + context: Client, + classParam: string, + options: ParametersWithClassOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/class") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { class: classParam }, + }); +} + +export async function _parametersWithClassDeserialize( + result: ParametersWithClass204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithClass( + context: Client, + classParam: string, + options: ParametersWithClassOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithClassSend(context, classParam, options); + return _parametersWithClassDeserialize(result); +} + +export function _parametersWithConstructorSend( + context: Client, + constructorParam: string, + options: ParametersWithConstructorOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/constructor") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { constructor: constructorParam as any }, + }); +} + +export async function _parametersWithConstructorDeserialize( + result: ParametersWithConstructor204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithConstructor( + context: Client, + constructorParam: string, + options: ParametersWithConstructorOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithConstructorSend( + context, + constructorParam, + options, + ); + return _parametersWithConstructorDeserialize(result); +} + +export function _parametersWithContinueSend( + context: Client, + continueParam: string, + options: ParametersWithContinueOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/continue") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { continue: continueParam }, + }); +} + +export async function _parametersWithContinueDeserialize( + result: ParametersWithContinue204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithContinue( + context: Client, + continueParam: string, + options: ParametersWithContinueOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithContinueSend( + context, + continueParam, + options, + ); + return _parametersWithContinueDeserialize(result); +} + +export function _parametersWithDefSend( + context: Client, + def: string, + options: ParametersWithDefOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/def") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { def: def }, + }); +} + +export async function _parametersWithDefDeserialize( + result: ParametersWithDef204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithDef( + context: Client, + def: string, + options: ParametersWithDefOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithDefSend(context, def, options); + return _parametersWithDefDeserialize(result); +} + +export function _parametersWithDelSend( + context: Client, + del: string, + options: ParametersWithDelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/del") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { del: del }, + }); +} + +export async function _parametersWithDelDeserialize( + result: ParametersWithDel204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithDel( + context: Client, + del: string, + options: ParametersWithDelOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithDelSend(context, del, options); + return _parametersWithDelDeserialize(result); +} + +export function _parametersWithElifSend( + context: Client, + elif: string, + options: ParametersWithElifOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/elif") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { elif: elif }, + }); +} + +export async function _parametersWithElifDeserialize( + result: ParametersWithElif204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithElif( + context: Client, + elif: string, + options: ParametersWithElifOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithElifSend(context, elif, options); + return _parametersWithElifDeserialize(result); +} + +export function _parametersWithElseSend( + context: Client, + elseParam: string, + options: ParametersWithElseOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/else") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { else: elseParam }, + }); +} + +export async function _parametersWithElseDeserialize( + result: ParametersWithElse204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithElse( + context: Client, + elseParam: string, + options: ParametersWithElseOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithElseSend(context, elseParam, options); + return _parametersWithElseDeserialize(result); +} + +export function _parametersWithExceptSend( + context: Client, + except: string, + options: ParametersWithExceptOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/except") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { except: except }, + }); +} + +export async function _parametersWithExceptDeserialize( + result: ParametersWithExcept204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithExcept( + context: Client, + except: string, + options: ParametersWithExceptOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithExceptSend(context, except, options); + return _parametersWithExceptDeserialize(result); +} + +export function _parametersWithExecSend( + context: Client, + exec: string, + options: ParametersWithExecOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/exec") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { exec: exec }, + }); +} + +export async function _parametersWithExecDeserialize( + result: ParametersWithExec204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithExec( + context: Client, + exec: string, + options: ParametersWithExecOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithExecSend(context, exec, options); + return _parametersWithExecDeserialize(result); +} + +export function _parametersWithFinallySend( + context: Client, + finallyParam: string, + options: ParametersWithFinallyOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/finally") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { finally: finallyParam }, + }); +} + +export async function _parametersWithFinallyDeserialize( + result: ParametersWithFinally204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithFinally( + context: Client, + finallyParam: string, + options: ParametersWithFinallyOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithFinallySend( + context, + finallyParam, + options, + ); + return _parametersWithFinallyDeserialize(result); +} + +export function _parametersWithForSend( + context: Client, + forParam: string, + options: ParametersWithForOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/for") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { for: forParam }, + }); +} + +export async function _parametersWithForDeserialize( + result: ParametersWithFor204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithFor( + context: Client, + forParam: string, + options: ParametersWithForOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithForSend(context, forParam, options); + return _parametersWithForDeserialize(result); +} + +export function _parametersWithFromSend( + context: Client, + fromParam: string, + options: ParametersWithFromOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/from") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { from: fromParam }, + }); +} + +export async function _parametersWithFromDeserialize( + result: ParametersWithFrom204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithFrom( + context: Client, + fromParam: string, + options: ParametersWithFromOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithFromSend(context, fromParam, options); + return _parametersWithFromDeserialize(result); +} + +export function _parametersWithGlobalSend( + context: Client, + global: string, + options: ParametersWithGlobalOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/global") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { global: global }, + }); +} + +export async function _parametersWithGlobalDeserialize( + result: ParametersWithGlobal204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithGlobal( + context: Client, + global: string, + options: ParametersWithGlobalOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithGlobalSend(context, global, options); + return _parametersWithGlobalDeserialize(result); +} + +export function _parametersWithIfSend( + context: Client, + ifParam: string, + options: ParametersWithIfOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/if") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { if: ifParam }, + }); +} + +export async function _parametersWithIfDeserialize( + result: ParametersWithIf204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithIf( + context: Client, + ifParam: string, + options: ParametersWithIfOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithIfSend(context, ifParam, options); + return _parametersWithIfDeserialize(result); +} + +export function _parametersWithImportSend( + context: Client, + importParam: string, + options: ParametersWithImportOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/import") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { import: importParam }, + }); +} + +export async function _parametersWithImportDeserialize( + result: ParametersWithImport204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithImport( + context: Client, + importParam: string, + options: ParametersWithImportOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithImportSend(context, importParam, options); + return _parametersWithImportDeserialize(result); +} + +export function _parametersWithInSend( + context: Client, + inParam: string, + options: ParametersWithInOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/in") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { in: inParam }, + }); +} + +export async function _parametersWithInDeserialize( + result: ParametersWithIn204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithIn( + context: Client, + inParam: string, + options: ParametersWithInOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithInSend(context, inParam, options); + return _parametersWithInDeserialize(result); +} + +export function _parametersWithIsSend( + context: Client, + is: string, + options: ParametersWithIsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/is") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { is: is }, + }); +} + +export async function _parametersWithIsDeserialize( + result: ParametersWithIs204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithIs( + context: Client, + is: string, + options: ParametersWithIsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithIsSend(context, is, options); + return _parametersWithIsDeserialize(result); +} + +export function _parametersWithLambdaSend( + context: Client, + lambda: string, + options: ParametersWithLambdaOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/lambda") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { lambda: lambda }, + }); +} + +export async function _parametersWithLambdaDeserialize( + result: ParametersWithLambda204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithLambda( + context: Client, + lambda: string, + options: ParametersWithLambdaOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithLambdaSend(context, lambda, options); + return _parametersWithLambdaDeserialize(result); +} + +export function _parametersWithNotSend( + context: Client, + not: string, + options: ParametersWithNotOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/not") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { not: not }, + }); +} + +export async function _parametersWithNotDeserialize( + result: ParametersWithNot204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithNot( + context: Client, + not: string, + options: ParametersWithNotOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithNotSend(context, not, options); + return _parametersWithNotDeserialize(result); +} + +export function _parametersWithOrSend( + context: Client, + or: string, + options: ParametersWithOrOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/or") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { or: or }, + }); +} + +export async function _parametersWithOrDeserialize( + result: ParametersWithOr204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithOr( + context: Client, + or: string, + options: ParametersWithOrOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithOrSend(context, or, options); + return _parametersWithOrDeserialize(result); +} + +export function _parametersWithPassSend( + context: Client, + pass: string, + options: ParametersWithPassOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/pass") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { pass: pass }, + }); +} + +export async function _parametersWithPassDeserialize( + result: ParametersWithPass204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithPass( + context: Client, + pass: string, + options: ParametersWithPassOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithPassSend(context, pass, options); + return _parametersWithPassDeserialize(result); +} + +export function _parametersWithRaiseSend( + context: Client, + raise: string, + options: ParametersWithRaiseOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/raise") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { raise: raise }, + }); +} + +export async function _parametersWithRaiseDeserialize( + result: ParametersWithRaise204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithRaise( + context: Client, + raise: string, + options: ParametersWithRaiseOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithRaiseSend(context, raise, options); + return _parametersWithRaiseDeserialize(result); +} + +export function _parametersWithReturnSend( + context: Client, + returnParam: string, + options: ParametersWithReturnOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/return") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { return: returnParam }, + }); +} + +export async function _parametersWithReturnDeserialize( + result: ParametersWithReturn204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithReturn( + context: Client, + returnParam: string, + options: ParametersWithReturnOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithReturnSend(context, returnParam, options); + return _parametersWithReturnDeserialize(result); +} + +export function _parametersWithTrySend( + context: Client, + tryParam: string, + options: ParametersWithTryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/try") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { try: tryParam }, + }); +} + +export async function _parametersWithTryDeserialize( + result: ParametersWithTry204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithTry( + context: Client, + tryParam: string, + options: ParametersWithTryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithTrySend(context, tryParam, options); + return _parametersWithTryDeserialize(result); +} + +export function _parametersWithWhileSend( + context: Client, + whileParam: string, + options: ParametersWithWhileOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/while") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { while: whileParam }, + }); +} + +export async function _parametersWithWhileDeserialize( + result: ParametersWithWhile204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithWhile( + context: Client, + whileParam: string, + options: ParametersWithWhileOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithWhileSend(context, whileParam, options); + return _parametersWithWhileDeserialize(result); +} + +export function _parametersWithWithSend( + context: Client, + withParam: string, + options: ParametersWithWithOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/with") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { with: withParam }, + }); +} + +export async function _parametersWithWithDeserialize( + result: ParametersWithWith204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithWith( + context: Client, + withParam: string, + options: ParametersWithWithOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithWithSend(context, withParam, options); + return _parametersWithWithDeserialize(result); +} + +export function _parametersWithYieldSend( + context: Client, + yieldParam: string, + options: ParametersWithYieldOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/special-words/parameters/yield") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { yield: yieldParam }, + }); +} + +export async function _parametersWithYieldDeserialize( + result: ParametersWithYield204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithYield( + context: Client, + yieldParam: string, + options: ParametersWithYieldOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _parametersWithYieldSend(context, yieldParam, options); + return _parametersWithYieldDeserialize(result); +} + +export function _parametersWithCancellationTokenSend( + context: Client, + cancellationToken: string, + options: ParametersWithCancellationTokenOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path("/special-words/parameters/cancellationToken") + .get({ + ...operationOptionsToRequestParameters(options), + queryParameters: { cancellationToken: cancellationToken }, + }); +} + +export async function _parametersWithCancellationTokenDeserialize( + result: ParametersWithCancellationToken204Response, +): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; +} + +export async function parametersWithCancellationToken( + context: Client, + cancellationToken: string, + options: ParametersWithCancellationTokenOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _parametersWithCancellationTokenSend( + context, + cancellationToken, + options, + ); + return _parametersWithCancellationTokenDeserialize(result); +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/specialWordsContext.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/specialWordsContext.ts new file mode 100644 index 0000000000..9ca56282a4 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/api/specialWordsContext.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { ClientOptions } from "@azure-rest/core-client"; +import { SpecialWordsContext } from "../rest/index.js"; +import getClient from "../rest/index.js"; + +export interface SpecialWordsClientOptions extends ClientOptions {} + +export { SpecialWordsContext } from "../rest/index.js"; + +/** + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ``` + */ +export function createSpecialWords( + options: SpecialWordsClientOptions = {}, +): SpecialWordsContext { + const clientContext = getClient(options); + return clientContext; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/index.ts new file mode 100644 index 0000000000..7cbedf7ac5 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/index.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { ModelPropertiesOperations } from "./modelProperties/index.js"; +export { ModelsOperations } from "./models/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { ParametersOperations } from "./parameters/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/modelProperties/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/modelProperties/index.ts new file mode 100644 index 0000000000..5063ae34d4 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/modelProperties/index.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { SpecialWordsContext } from "../../api/specialWordsContext.js"; +import { SameAsModel } from "../../models/models.js"; +import { modelPropertiesSameAsModel } from "../../api/modelProperties/index.js"; +import { ModelPropertiesSameAsModelOptionalParams } from "../../models/options.js"; + +export interface ModelPropertiesOperations { + sameAsModel: ( + body: SameAsModel, + options?: ModelPropertiesSameAsModelOptionalParams, + ) => Promise; +} + +export function getModelProperties(context: SpecialWordsContext) { + return { + sameAsModel: ( + body: SameAsModel, + options?: ModelPropertiesSameAsModelOptionalParams, + ) => modelPropertiesSameAsModel(context, body, options), + }; +} + +export function getModelPropertiesOperations( + context: SpecialWordsContext, +): ModelPropertiesOperations { + return { + ...getModelProperties(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/models/index.ts new file mode 100644 index 0000000000..16ee222749 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/models/index.ts @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { SpecialWordsContext } from "../../api/specialWordsContext.js"; +import { + And, + As, + Assert, + Async, + Await, + Break, + Class, + Constructor, + Continue, + Def, + Del, + Elif, + Else, + Except, + Exec, + Finally, + For, + From, + Global, + If, + Import, + In, + Is, + Lambda, + Not, + Or, + Pass, + Raise, + Return, + Try, + While, + With, + Yield, +} from "../../models/models.js"; +import { + modelsWithAnd, + modelsWithAs, + modelsWithAssert, + modelsWithAsync, + modelsWithAwait, + modelsWithBreak, + modelsWithClass, + modelsWithConstructor, + modelsWithContinue, + modelsWithDef, + modelsWithDel, + modelsWithElif, + modelsWithElse, + modelsWithExcept, + modelsWithExec, + modelsWithFinally, + modelsWithFor, + modelsWithFrom, + modelsWithGlobal, + modelsWithIf, + modelsWithImport, + modelsWithIn, + modelsWithIs, + modelsWithLambda, + modelsWithNot, + modelsWithOr, + modelsWithPass, + modelsWithRaise, + modelsWithReturn, + modelsWithTry, + modelsWithWhile, + modelsWithWith, + modelsWithYield, +} from "../../api/models/index.js"; +import { + ModelsWithAndOptionalParams, + ModelsWithAsOptionalParams, + ModelsWithAssertOptionalParams, + ModelsWithAsyncOptionalParams, + ModelsWithAwaitOptionalParams, + ModelsWithBreakOptionalParams, + ModelsWithClassOptionalParams, + ModelsWithConstructorOptionalParams, + ModelsWithContinueOptionalParams, + ModelsWithDefOptionalParams, + ModelsWithDelOptionalParams, + ModelsWithElifOptionalParams, + ModelsWithElseOptionalParams, + ModelsWithExceptOptionalParams, + ModelsWithExecOptionalParams, + ModelsWithFinallyOptionalParams, + ModelsWithForOptionalParams, + ModelsWithFromOptionalParams, + ModelsWithGlobalOptionalParams, + ModelsWithIfOptionalParams, + ModelsWithImportOptionalParams, + ModelsWithInOptionalParams, + ModelsWithIsOptionalParams, + ModelsWithLambdaOptionalParams, + ModelsWithNotOptionalParams, + ModelsWithOrOptionalParams, + ModelsWithPassOptionalParams, + ModelsWithRaiseOptionalParams, + ModelsWithReturnOptionalParams, + ModelsWithTryOptionalParams, + ModelsWithWhileOptionalParams, + ModelsWithWithOptionalParams, + ModelsWithYieldOptionalParams, +} from "../../models/options.js"; + +export interface ModelsOperations { + withAnd: (body: And, options?: ModelsWithAndOptionalParams) => Promise; + withAs: (body: As, options?: ModelsWithAsOptionalParams) => Promise; + withAssert: ( + body: Assert, + options?: ModelsWithAssertOptionalParams, + ) => Promise; + withAsync: ( + body: Async, + options?: ModelsWithAsyncOptionalParams, + ) => Promise; + withAwait: ( + body: Await, + options?: ModelsWithAwaitOptionalParams, + ) => Promise; + withBreak: ( + body: Break, + options?: ModelsWithBreakOptionalParams, + ) => Promise; + withClass: ( + body: Class, + options?: ModelsWithClassOptionalParams, + ) => Promise; + withConstructor: ( + body: Constructor, + options?: ModelsWithConstructorOptionalParams, + ) => Promise; + withContinue: ( + body: Continue, + options?: ModelsWithContinueOptionalParams, + ) => Promise; + withDef: (body: Def, options?: ModelsWithDefOptionalParams) => Promise; + withDel: (body: Del, options?: ModelsWithDelOptionalParams) => Promise; + withElif: ( + body: Elif, + options?: ModelsWithElifOptionalParams, + ) => Promise; + withElse: ( + body: Else, + options?: ModelsWithElseOptionalParams, + ) => Promise; + withExcept: ( + body: Except, + options?: ModelsWithExceptOptionalParams, + ) => Promise; + withExec: ( + body: Exec, + options?: ModelsWithExecOptionalParams, + ) => Promise; + withFinally: ( + body: Finally, + options?: ModelsWithFinallyOptionalParams, + ) => Promise; + withFor: (body: For, options?: ModelsWithForOptionalParams) => Promise; + withFrom: ( + body: From, + options?: ModelsWithFromOptionalParams, + ) => Promise; + withGlobal: ( + body: Global, + options?: ModelsWithGlobalOptionalParams, + ) => Promise; + withIf: (body: If, options?: ModelsWithIfOptionalParams) => Promise; + withImport: ( + body: Import, + options?: ModelsWithImportOptionalParams, + ) => Promise; + withIn: (body: In, options?: ModelsWithInOptionalParams) => Promise; + withIs: (body: Is, options?: ModelsWithIsOptionalParams) => Promise; + withLambda: ( + body: Lambda, + options?: ModelsWithLambdaOptionalParams, + ) => Promise; + withNot: (body: Not, options?: ModelsWithNotOptionalParams) => Promise; + withOr: (body: Or, options?: ModelsWithOrOptionalParams) => Promise; + withPass: ( + body: Pass, + options?: ModelsWithPassOptionalParams, + ) => Promise; + withRaise: ( + body: Raise, + options?: ModelsWithRaiseOptionalParams, + ) => Promise; + withReturn: ( + body: Return, + options?: ModelsWithReturnOptionalParams, + ) => Promise; + withTry: (body: Try, options?: ModelsWithTryOptionalParams) => Promise; + withWhile: ( + body: While, + options?: ModelsWithWhileOptionalParams, + ) => Promise; + withWith: ( + body: With, + options?: ModelsWithWithOptionalParams, + ) => Promise; + withYield: ( + body: Yield, + options?: ModelsWithYieldOptionalParams, + ) => Promise; +} + +export function getModels(context: SpecialWordsContext) { + return { + withAnd: (body: And, options?: ModelsWithAndOptionalParams) => + modelsWithAnd(context, body, options), + withAs: (body: As, options?: ModelsWithAsOptionalParams) => + modelsWithAs(context, body, options), + withAssert: (body: Assert, options?: ModelsWithAssertOptionalParams) => + modelsWithAssert(context, body, options), + withAsync: (body: Async, options?: ModelsWithAsyncOptionalParams) => + modelsWithAsync(context, body, options), + withAwait: (body: Await, options?: ModelsWithAwaitOptionalParams) => + modelsWithAwait(context, body, options), + withBreak: (body: Break, options?: ModelsWithBreakOptionalParams) => + modelsWithBreak(context, body, options), + withClass: (body: Class, options?: ModelsWithClassOptionalParams) => + modelsWithClass(context, body, options), + withConstructor: ( + body: Constructor, + options?: ModelsWithConstructorOptionalParams, + ) => modelsWithConstructor(context, body, options), + withContinue: ( + body: Continue, + options?: ModelsWithContinueOptionalParams, + ) => modelsWithContinue(context, body, options), + withDef: (body: Def, options?: ModelsWithDefOptionalParams) => + modelsWithDef(context, body, options), + withDel: (body: Del, options?: ModelsWithDelOptionalParams) => + modelsWithDel(context, body, options), + withElif: (body: Elif, options?: ModelsWithElifOptionalParams) => + modelsWithElif(context, body, options), + withElse: (body: Else, options?: ModelsWithElseOptionalParams) => + modelsWithElse(context, body, options), + withExcept: (body: Except, options?: ModelsWithExceptOptionalParams) => + modelsWithExcept(context, body, options), + withExec: (body: Exec, options?: ModelsWithExecOptionalParams) => + modelsWithExec(context, body, options), + withFinally: (body: Finally, options?: ModelsWithFinallyOptionalParams) => + modelsWithFinally(context, body, options), + withFor: (body: For, options?: ModelsWithForOptionalParams) => + modelsWithFor(context, body, options), + withFrom: (body: From, options?: ModelsWithFromOptionalParams) => + modelsWithFrom(context, body, options), + withGlobal: (body: Global, options?: ModelsWithGlobalOptionalParams) => + modelsWithGlobal(context, body, options), + withIf: (body: If, options?: ModelsWithIfOptionalParams) => + modelsWithIf(context, body, options), + withImport: (body: Import, options?: ModelsWithImportOptionalParams) => + modelsWithImport(context, body, options), + withIn: (body: In, options?: ModelsWithInOptionalParams) => + modelsWithIn(context, body, options), + withIs: (body: Is, options?: ModelsWithIsOptionalParams) => + modelsWithIs(context, body, options), + withLambda: (body: Lambda, options?: ModelsWithLambdaOptionalParams) => + modelsWithLambda(context, body, options), + withNot: (body: Not, options?: ModelsWithNotOptionalParams) => + modelsWithNot(context, body, options), + withOr: (body: Or, options?: ModelsWithOrOptionalParams) => + modelsWithOr(context, body, options), + withPass: (body: Pass, options?: ModelsWithPassOptionalParams) => + modelsWithPass(context, body, options), + withRaise: (body: Raise, options?: ModelsWithRaiseOptionalParams) => + modelsWithRaise(context, body, options), + withReturn: (body: Return, options?: ModelsWithReturnOptionalParams) => + modelsWithReturn(context, body, options), + withTry: (body: Try, options?: ModelsWithTryOptionalParams) => + modelsWithTry(context, body, options), + withWhile: (body: While, options?: ModelsWithWhileOptionalParams) => + modelsWithWhile(context, body, options), + withWith: (body: With, options?: ModelsWithWithOptionalParams) => + modelsWithWith(context, body, options), + withYield: (body: Yield, options?: ModelsWithYieldOptionalParams) => + modelsWithYield(context, body, options), + }; +} + +export function getModelsOperations( + context: SpecialWordsContext, +): ModelsOperations { + return { + ...getModels(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/operations/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/operations/index.ts new file mode 100644 index 0000000000..6c7825b8eb --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/operations/index.ts @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { SpecialWordsContext } from "../../api/specialWordsContext.js"; +import { + operationsAnd, + operationsAs, + operationsAssert, + operationsAsync, + operationsAwait, + operationsBreak, + operationsClass, + operationsConstructor, + operationsContinue, + operationsDef, + operationsDel, + operationsElif, + operationsElse, + operationsExcept, + operationsExec, + operationsFinally, + operationsFor, + operationsFrom, + operationsGlobal, + operationsIf, + operationsImport, + operationsIn, + operationsIs, + operationsLambda, + operationsNot, + operationsOr, + operationsPass, + operationsRaise, + operationsReturn, + operationsTry, + operationsWhile, + operationsWith, + operationsYield, +} from "../../api/operations/index.js"; +import { + OperationsAndOptionalParams, + OperationsAsOptionalParams, + OperationsAssertOptionalParams, + OperationsAsyncOptionalParams, + OperationsAwaitOptionalParams, + OperationsBreakOptionalParams, + OperationsClassOptionalParams, + OperationsConstructorOptionalParams, + OperationsContinueOptionalParams, + OperationsDefOptionalParams, + OperationsDelOptionalParams, + OperationsElifOptionalParams, + OperationsElseOptionalParams, + OperationsExceptOptionalParams, + OperationsExecOptionalParams, + OperationsFinallyOptionalParams, + OperationsForOptionalParams, + OperationsFromOptionalParams, + OperationsGlobalOptionalParams, + OperationsIfOptionalParams, + OperationsImportOptionalParams, + OperationsInOptionalParams, + OperationsIsOptionalParams, + OperationsLambdaOptionalParams, + OperationsNotOptionalParams, + OperationsOrOptionalParams, + OperationsPassOptionalParams, + OperationsRaiseOptionalParams, + OperationsReturnOptionalParams, + OperationsTryOptionalParams, + OperationsWhileOptionalParams, + OperationsWithOptionalParams, + OperationsYieldOptionalParams, +} from "../../models/options.js"; + +export interface OperationsOperations { + and: (options?: OperationsAndOptionalParams) => Promise; + as: (options?: OperationsAsOptionalParams) => Promise; + assert: (options?: OperationsAssertOptionalParams) => Promise; + async: (options?: OperationsAsyncOptionalParams) => Promise; + await: (options?: OperationsAwaitOptionalParams) => Promise; + break: (options?: OperationsBreakOptionalParams) => Promise; + class: (options?: OperationsClassOptionalParams) => Promise; + constructor: (options?: OperationsConstructorOptionalParams) => Promise; + continue: (options?: OperationsContinueOptionalParams) => Promise; + def: (options?: OperationsDefOptionalParams) => Promise; + del: (options?: OperationsDelOptionalParams) => Promise; + elif: (options?: OperationsElifOptionalParams) => Promise; + else: (options?: OperationsElseOptionalParams) => Promise; + except: (options?: OperationsExceptOptionalParams) => Promise; + exec: (options?: OperationsExecOptionalParams) => Promise; + finally: (options?: OperationsFinallyOptionalParams) => Promise; + for: (options?: OperationsForOptionalParams) => Promise; + from: (options?: OperationsFromOptionalParams) => Promise; + global: (options?: OperationsGlobalOptionalParams) => Promise; + if: (options?: OperationsIfOptionalParams) => Promise; + import: (options?: OperationsImportOptionalParams) => Promise; + in: (options?: OperationsInOptionalParams) => Promise; + is: (options?: OperationsIsOptionalParams) => Promise; + lambda: (options?: OperationsLambdaOptionalParams) => Promise; + not: (options?: OperationsNotOptionalParams) => Promise; + or: (options?: OperationsOrOptionalParams) => Promise; + pass: (options?: OperationsPassOptionalParams) => Promise; + raise: (options?: OperationsRaiseOptionalParams) => Promise; + return: (options?: OperationsReturnOptionalParams) => Promise; + try: (options?: OperationsTryOptionalParams) => Promise; + while: (options?: OperationsWhileOptionalParams) => Promise; + with: (options?: OperationsWithOptionalParams) => Promise; + yield: (options?: OperationsYieldOptionalParams) => Promise; +} + +export function getOperations(context: SpecialWordsContext) { + return { + and: (options?: OperationsAndOptionalParams) => + operationsAnd(context, options), + as: (options?: OperationsAsOptionalParams) => + operationsAs(context, options), + assert: (options?: OperationsAssertOptionalParams) => + operationsAssert(context, options), + async: (options?: OperationsAsyncOptionalParams) => + operationsAsync(context, options), + await: (options?: OperationsAwaitOptionalParams) => + operationsAwait(context, options), + break: (options?: OperationsBreakOptionalParams) => + operationsBreak(context, options), + class: (options?: OperationsClassOptionalParams) => + operationsClass(context, options), + constructor: (options?: OperationsConstructorOptionalParams) => + operationsConstructor(context, options), + continue: (options?: OperationsContinueOptionalParams) => + operationsContinue(context, options), + def: (options?: OperationsDefOptionalParams) => + operationsDef(context, options), + del: (options?: OperationsDelOptionalParams) => + operationsDel(context, options), + elif: (options?: OperationsElifOptionalParams) => + operationsElif(context, options), + else: (options?: OperationsElseOptionalParams) => + operationsElse(context, options), + except: (options?: OperationsExceptOptionalParams) => + operationsExcept(context, options), + exec: (options?: OperationsExecOptionalParams) => + operationsExec(context, options), + finally: (options?: OperationsFinallyOptionalParams) => + operationsFinally(context, options), + for: (options?: OperationsForOptionalParams) => + operationsFor(context, options), + from: (options?: OperationsFromOptionalParams) => + operationsFrom(context, options), + global: (options?: OperationsGlobalOptionalParams) => + operationsGlobal(context, options), + if: (options?: OperationsIfOptionalParams) => + operationsIf(context, options), + import: (options?: OperationsImportOptionalParams) => + operationsImport(context, options), + in: (options?: OperationsInOptionalParams) => + operationsIn(context, options), + is: (options?: OperationsIsOptionalParams) => + operationsIs(context, options), + lambda: (options?: OperationsLambdaOptionalParams) => + operationsLambda(context, options), + not: (options?: OperationsNotOptionalParams) => + operationsNot(context, options), + or: (options?: OperationsOrOptionalParams) => + operationsOr(context, options), + pass: (options?: OperationsPassOptionalParams) => + operationsPass(context, options), + raise: (options?: OperationsRaiseOptionalParams) => + operationsRaise(context, options), + return: (options?: OperationsReturnOptionalParams) => + operationsReturn(context, options), + try: (options?: OperationsTryOptionalParams) => + operationsTry(context, options), + while: (options?: OperationsWhileOptionalParams) => + operationsWhile(context, options), + with: (options?: OperationsWithOptionalParams) => + operationsWith(context, options), + yield: (options?: OperationsYieldOptionalParams) => + operationsYield(context, options), + }; +} + +export function getOperationsOperations( + context: SpecialWordsContext, +): OperationsOperations { + return { + ...getOperations(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/parameters/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/parameters/index.ts new file mode 100644 index 0000000000..405fe6b354 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/classic/parameters/index.ts @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { SpecialWordsContext } from "../../api/specialWordsContext.js"; +import { + parametersWithAnd, + parametersWithAs, + parametersWithAssert, + parametersWithAsync, + parametersWithAwait, + parametersWithBreak, + parametersWithClass, + parametersWithConstructor, + parametersWithContinue, + parametersWithDef, + parametersWithDel, + parametersWithElif, + parametersWithElse, + parametersWithExcept, + parametersWithExec, + parametersWithFinally, + parametersWithFor, + parametersWithFrom, + parametersWithGlobal, + parametersWithIf, + parametersWithImport, + parametersWithIn, + parametersWithIs, + parametersWithLambda, + parametersWithNot, + parametersWithOr, + parametersWithPass, + parametersWithRaise, + parametersWithReturn, + parametersWithTry, + parametersWithWhile, + parametersWithWith, + parametersWithYield, + parametersWithCancellationToken, +} from "../../api/parameters/index.js"; +import { + ParametersWithAndOptionalParams, + ParametersWithAsOptionalParams, + ParametersWithAssertOptionalParams, + ParametersWithAsyncOptionalParams, + ParametersWithAwaitOptionalParams, + ParametersWithBreakOptionalParams, + ParametersWithClassOptionalParams, + ParametersWithConstructorOptionalParams, + ParametersWithContinueOptionalParams, + ParametersWithDefOptionalParams, + ParametersWithDelOptionalParams, + ParametersWithElifOptionalParams, + ParametersWithElseOptionalParams, + ParametersWithExceptOptionalParams, + ParametersWithExecOptionalParams, + ParametersWithFinallyOptionalParams, + ParametersWithForOptionalParams, + ParametersWithFromOptionalParams, + ParametersWithGlobalOptionalParams, + ParametersWithIfOptionalParams, + ParametersWithImportOptionalParams, + ParametersWithInOptionalParams, + ParametersWithIsOptionalParams, + ParametersWithLambdaOptionalParams, + ParametersWithNotOptionalParams, + ParametersWithOrOptionalParams, + ParametersWithPassOptionalParams, + ParametersWithRaiseOptionalParams, + ParametersWithReturnOptionalParams, + ParametersWithTryOptionalParams, + ParametersWithWhileOptionalParams, + ParametersWithWithOptionalParams, + ParametersWithYieldOptionalParams, + ParametersWithCancellationTokenOptionalParams, +} from "../../models/options.js"; + +export interface ParametersOperations { + withAnd: ( + and: string, + options?: ParametersWithAndOptionalParams, + ) => Promise; + withAs: ( + asParam: string, + options?: ParametersWithAsOptionalParams, + ) => Promise; + withAssert: ( + assertParam: string, + options?: ParametersWithAssertOptionalParams, + ) => Promise; + withAsync: ( + asyncParam: string, + options?: ParametersWithAsyncOptionalParams, + ) => Promise; + withAwait: ( + awaitParam: string, + options?: ParametersWithAwaitOptionalParams, + ) => Promise; + withBreak: ( + breakParam: string, + options?: ParametersWithBreakOptionalParams, + ) => Promise; + withClass: ( + classParam: string, + options?: ParametersWithClassOptionalParams, + ) => Promise; + withConstructor: ( + constructorParam: string, + options?: ParametersWithConstructorOptionalParams, + ) => Promise; + withContinue: ( + continueParam: string, + options?: ParametersWithContinueOptionalParams, + ) => Promise; + withDef: ( + def: string, + options?: ParametersWithDefOptionalParams, + ) => Promise; + withDel: ( + del: string, + options?: ParametersWithDelOptionalParams, + ) => Promise; + withElif: ( + elif: string, + options?: ParametersWithElifOptionalParams, + ) => Promise; + withElse: ( + elseParam: string, + options?: ParametersWithElseOptionalParams, + ) => Promise; + withExcept: ( + except: string, + options?: ParametersWithExceptOptionalParams, + ) => Promise; + withExec: ( + exec: string, + options?: ParametersWithExecOptionalParams, + ) => Promise; + withFinally: ( + finallyParam: string, + options?: ParametersWithFinallyOptionalParams, + ) => Promise; + withFor: ( + forParam: string, + options?: ParametersWithForOptionalParams, + ) => Promise; + withFrom: ( + fromParam: string, + options?: ParametersWithFromOptionalParams, + ) => Promise; + withGlobal: ( + global: string, + options?: ParametersWithGlobalOptionalParams, + ) => Promise; + withIf: ( + ifParam: string, + options?: ParametersWithIfOptionalParams, + ) => Promise; + withImport: ( + importParam: string, + options?: ParametersWithImportOptionalParams, + ) => Promise; + withIn: ( + inParam: string, + options?: ParametersWithInOptionalParams, + ) => Promise; + withIs: ( + is: string, + options?: ParametersWithIsOptionalParams, + ) => Promise; + withLambda: ( + lambda: string, + options?: ParametersWithLambdaOptionalParams, + ) => Promise; + withNot: ( + not: string, + options?: ParametersWithNotOptionalParams, + ) => Promise; + withOr: ( + or: string, + options?: ParametersWithOrOptionalParams, + ) => Promise; + withPass: ( + pass: string, + options?: ParametersWithPassOptionalParams, + ) => Promise; + withRaise: ( + raise: string, + options?: ParametersWithRaiseOptionalParams, + ) => Promise; + withReturn: ( + returnParam: string, + options?: ParametersWithReturnOptionalParams, + ) => Promise; + withTry: ( + tryParam: string, + options?: ParametersWithTryOptionalParams, + ) => Promise; + withWhile: ( + whileParam: string, + options?: ParametersWithWhileOptionalParams, + ) => Promise; + withWith: ( + withParam: string, + options?: ParametersWithWithOptionalParams, + ) => Promise; + withYield: ( + yieldParam: string, + options?: ParametersWithYieldOptionalParams, + ) => Promise; + withCancellationToken: ( + cancellationToken: string, + options?: ParametersWithCancellationTokenOptionalParams, + ) => Promise; +} + +export function getParameters(context: SpecialWordsContext) { + return { + withAnd: (and: string, options?: ParametersWithAndOptionalParams) => + parametersWithAnd(context, and, options), + withAs: (asParam: string, options?: ParametersWithAsOptionalParams) => + parametersWithAs(context, asParam, options), + withAssert: ( + assertParam: string, + options?: ParametersWithAssertOptionalParams, + ) => parametersWithAssert(context, assertParam, options), + withAsync: ( + asyncParam: string, + options?: ParametersWithAsyncOptionalParams, + ) => parametersWithAsync(context, asyncParam, options), + withAwait: ( + awaitParam: string, + options?: ParametersWithAwaitOptionalParams, + ) => parametersWithAwait(context, awaitParam, options), + withBreak: ( + breakParam: string, + options?: ParametersWithBreakOptionalParams, + ) => parametersWithBreak(context, breakParam, options), + withClass: ( + classParam: string, + options?: ParametersWithClassOptionalParams, + ) => parametersWithClass(context, classParam, options), + withConstructor: ( + constructorParam: string, + options?: ParametersWithConstructorOptionalParams, + ) => parametersWithConstructor(context, constructorParam, options), + withContinue: ( + continueParam: string, + options?: ParametersWithContinueOptionalParams, + ) => parametersWithContinue(context, continueParam, options), + withDef: (def: string, options?: ParametersWithDefOptionalParams) => + parametersWithDef(context, def, options), + withDel: (del: string, options?: ParametersWithDelOptionalParams) => + parametersWithDel(context, del, options), + withElif: (elif: string, options?: ParametersWithElifOptionalParams) => + parametersWithElif(context, elif, options), + withElse: (elseParam: string, options?: ParametersWithElseOptionalParams) => + parametersWithElse(context, elseParam, options), + withExcept: ( + except: string, + options?: ParametersWithExceptOptionalParams, + ) => parametersWithExcept(context, except, options), + withExec: (exec: string, options?: ParametersWithExecOptionalParams) => + parametersWithExec(context, exec, options), + withFinally: ( + finallyParam: string, + options?: ParametersWithFinallyOptionalParams, + ) => parametersWithFinally(context, finallyParam, options), + withFor: (forParam: string, options?: ParametersWithForOptionalParams) => + parametersWithFor(context, forParam, options), + withFrom: (fromParam: string, options?: ParametersWithFromOptionalParams) => + parametersWithFrom(context, fromParam, options), + withGlobal: ( + global: string, + options?: ParametersWithGlobalOptionalParams, + ) => parametersWithGlobal(context, global, options), + withIf: (ifParam: string, options?: ParametersWithIfOptionalParams) => + parametersWithIf(context, ifParam, options), + withImport: ( + importParam: string, + options?: ParametersWithImportOptionalParams, + ) => parametersWithImport(context, importParam, options), + withIn: (inParam: string, options?: ParametersWithInOptionalParams) => + parametersWithIn(context, inParam, options), + withIs: (is: string, options?: ParametersWithIsOptionalParams) => + parametersWithIs(context, is, options), + withLambda: ( + lambda: string, + options?: ParametersWithLambdaOptionalParams, + ) => parametersWithLambda(context, lambda, options), + withNot: (not: string, options?: ParametersWithNotOptionalParams) => + parametersWithNot(context, not, options), + withOr: (or: string, options?: ParametersWithOrOptionalParams) => + parametersWithOr(context, or, options), + withPass: (pass: string, options?: ParametersWithPassOptionalParams) => + parametersWithPass(context, pass, options), + withRaise: (raise: string, options?: ParametersWithRaiseOptionalParams) => + parametersWithRaise(context, raise, options), + withReturn: ( + returnParam: string, + options?: ParametersWithReturnOptionalParams, + ) => parametersWithReturn(context, returnParam, options), + withTry: (tryParam: string, options?: ParametersWithTryOptionalParams) => + parametersWithTry(context, tryParam, options), + withWhile: ( + whileParam: string, + options?: ParametersWithWhileOptionalParams, + ) => parametersWithWhile(context, whileParam, options), + withWith: (withParam: string, options?: ParametersWithWithOptionalParams) => + parametersWithWith(context, withParam, options), + withYield: ( + yieldParam: string, + options?: ParametersWithYieldOptionalParams, + ) => parametersWithYield(context, yieldParam, options), + withCancellationToken: ( + cancellationToken: string, + options?: ParametersWithCancellationTokenOptionalParams, + ) => parametersWithCancellationToken(context, cancellationToken, options), + }; +} + +export function getParametersOperations( + context: SpecialWordsContext, +): ParametersOperations { + return { + ...getParameters(context), + }; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/index.ts new file mode 100644 index 0000000000..61b1ebab15 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/index.ts @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + SpecialWordsClient, + SpecialWordsClientOptions, +} from "./specialWordsClient.js"; +export { + SameAsModel, + And, + As, + Assert, + Async, + Await, + Break, + Class, + Constructor, + Continue, + Def, + Del, + Elif, + Else, + Except, + Exec, + Finally, + For, + From, + Global, + If, + Import, + In, + Is, + Lambda, + Not, + Or, + Pass, + Raise, + Return, + Try, + While, + With, + Yield, + ModelsWithAndOptionalParams, + ModelsWithAsOptionalParams, + ModelsWithAssertOptionalParams, + ModelsWithAsyncOptionalParams, + ModelsWithAwaitOptionalParams, + ModelsWithBreakOptionalParams, + ModelsWithClassOptionalParams, + ModelsWithConstructorOptionalParams, + ModelsWithContinueOptionalParams, + ModelsWithDefOptionalParams, + ModelsWithDelOptionalParams, + ModelsWithElifOptionalParams, + ModelsWithElseOptionalParams, + ModelsWithExceptOptionalParams, + ModelsWithExecOptionalParams, + ModelsWithFinallyOptionalParams, + ModelsWithForOptionalParams, + ModelsWithFromOptionalParams, + ModelsWithGlobalOptionalParams, + ModelsWithIfOptionalParams, + ModelsWithImportOptionalParams, + ModelsWithInOptionalParams, + ModelsWithIsOptionalParams, + ModelsWithLambdaOptionalParams, + ModelsWithNotOptionalParams, + ModelsWithOrOptionalParams, + ModelsWithPassOptionalParams, + ModelsWithRaiseOptionalParams, + ModelsWithReturnOptionalParams, + ModelsWithTryOptionalParams, + ModelsWithWhileOptionalParams, + ModelsWithWithOptionalParams, + ModelsWithYieldOptionalParams, + ModelPropertiesSameAsModelOptionalParams, + OperationsAndOptionalParams, + OperationsAsOptionalParams, + OperationsAssertOptionalParams, + OperationsAsyncOptionalParams, + OperationsAwaitOptionalParams, + OperationsBreakOptionalParams, + OperationsClassOptionalParams, + OperationsConstructorOptionalParams, + OperationsContinueOptionalParams, + OperationsDefOptionalParams, + OperationsDelOptionalParams, + OperationsElifOptionalParams, + OperationsElseOptionalParams, + OperationsExceptOptionalParams, + OperationsExecOptionalParams, + OperationsFinallyOptionalParams, + OperationsForOptionalParams, + OperationsFromOptionalParams, + OperationsGlobalOptionalParams, + OperationsIfOptionalParams, + OperationsImportOptionalParams, + OperationsInOptionalParams, + OperationsIsOptionalParams, + OperationsLambdaOptionalParams, + OperationsNotOptionalParams, + OperationsOrOptionalParams, + OperationsPassOptionalParams, + OperationsRaiseOptionalParams, + OperationsReturnOptionalParams, + OperationsTryOptionalParams, + OperationsWhileOptionalParams, + OperationsWithOptionalParams, + OperationsYieldOptionalParams, + ParametersWithAndOptionalParams, + ParametersWithAsOptionalParams, + ParametersWithAssertOptionalParams, + ParametersWithAsyncOptionalParams, + ParametersWithAwaitOptionalParams, + ParametersWithBreakOptionalParams, + ParametersWithClassOptionalParams, + ParametersWithConstructorOptionalParams, + ParametersWithContinueOptionalParams, + ParametersWithDefOptionalParams, + ParametersWithDelOptionalParams, + ParametersWithElifOptionalParams, + ParametersWithElseOptionalParams, + ParametersWithExceptOptionalParams, + ParametersWithExecOptionalParams, + ParametersWithFinallyOptionalParams, + ParametersWithForOptionalParams, + ParametersWithFromOptionalParams, + ParametersWithGlobalOptionalParams, + ParametersWithIfOptionalParams, + ParametersWithImportOptionalParams, + ParametersWithInOptionalParams, + ParametersWithIsOptionalParams, + ParametersWithLambdaOptionalParams, + ParametersWithNotOptionalParams, + ParametersWithOrOptionalParams, + ParametersWithPassOptionalParams, + ParametersWithRaiseOptionalParams, + ParametersWithReturnOptionalParams, + ParametersWithTryOptionalParams, + ParametersWithWhileOptionalParams, + ParametersWithWithOptionalParams, + ParametersWithYieldOptionalParams, + ParametersWithCancellationTokenOptionalParams, +} from "./models/index.js"; +export { + ModelPropertiesOperations, + ModelsOperations, + OperationsOperations, + ParametersOperations, +} from "./classic/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/logger.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/logger.ts new file mode 100644 index 0000000000..6cc74fb90b --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("special-words"); diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/index.ts new file mode 100644 index 0000000000..a9f4a76672 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/index.ts @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + SameAsModel, + And, + As, + Assert, + Async, + Await, + Break, + Class, + Constructor, + Continue, + Def, + Del, + Elif, + Else, + Except, + Exec, + Finally, + For, + From, + Global, + If, + Import, + In, + Is, + Lambda, + Not, + Or, + Pass, + Raise, + Return, + Try, + While, + With, + Yield, +} from "./models.js"; +export { + ModelsWithAndOptionalParams, + ModelsWithAsOptionalParams, + ModelsWithAssertOptionalParams, + ModelsWithAsyncOptionalParams, + ModelsWithAwaitOptionalParams, + ModelsWithBreakOptionalParams, + ModelsWithClassOptionalParams, + ModelsWithConstructorOptionalParams, + ModelsWithContinueOptionalParams, + ModelsWithDefOptionalParams, + ModelsWithDelOptionalParams, + ModelsWithElifOptionalParams, + ModelsWithElseOptionalParams, + ModelsWithExceptOptionalParams, + ModelsWithExecOptionalParams, + ModelsWithFinallyOptionalParams, + ModelsWithForOptionalParams, + ModelsWithFromOptionalParams, + ModelsWithGlobalOptionalParams, + ModelsWithIfOptionalParams, + ModelsWithImportOptionalParams, + ModelsWithInOptionalParams, + ModelsWithIsOptionalParams, + ModelsWithLambdaOptionalParams, + ModelsWithNotOptionalParams, + ModelsWithOrOptionalParams, + ModelsWithPassOptionalParams, + ModelsWithRaiseOptionalParams, + ModelsWithReturnOptionalParams, + ModelsWithTryOptionalParams, + ModelsWithWhileOptionalParams, + ModelsWithWithOptionalParams, + ModelsWithYieldOptionalParams, + ModelPropertiesSameAsModelOptionalParams, + OperationsAndOptionalParams, + OperationsAsOptionalParams, + OperationsAssertOptionalParams, + OperationsAsyncOptionalParams, + OperationsAwaitOptionalParams, + OperationsBreakOptionalParams, + OperationsClassOptionalParams, + OperationsConstructorOptionalParams, + OperationsContinueOptionalParams, + OperationsDefOptionalParams, + OperationsDelOptionalParams, + OperationsElifOptionalParams, + OperationsElseOptionalParams, + OperationsExceptOptionalParams, + OperationsExecOptionalParams, + OperationsFinallyOptionalParams, + OperationsForOptionalParams, + OperationsFromOptionalParams, + OperationsGlobalOptionalParams, + OperationsIfOptionalParams, + OperationsImportOptionalParams, + OperationsInOptionalParams, + OperationsIsOptionalParams, + OperationsLambdaOptionalParams, + OperationsNotOptionalParams, + OperationsOrOptionalParams, + OperationsPassOptionalParams, + OperationsRaiseOptionalParams, + OperationsReturnOptionalParams, + OperationsTryOptionalParams, + OperationsWhileOptionalParams, + OperationsWithOptionalParams, + OperationsYieldOptionalParams, + ParametersWithAndOptionalParams, + ParametersWithAsOptionalParams, + ParametersWithAssertOptionalParams, + ParametersWithAsyncOptionalParams, + ParametersWithAwaitOptionalParams, + ParametersWithBreakOptionalParams, + ParametersWithClassOptionalParams, + ParametersWithConstructorOptionalParams, + ParametersWithContinueOptionalParams, + ParametersWithDefOptionalParams, + ParametersWithDelOptionalParams, + ParametersWithElifOptionalParams, + ParametersWithElseOptionalParams, + ParametersWithExceptOptionalParams, + ParametersWithExecOptionalParams, + ParametersWithFinallyOptionalParams, + ParametersWithForOptionalParams, + ParametersWithFromOptionalParams, + ParametersWithGlobalOptionalParams, + ParametersWithIfOptionalParams, + ParametersWithImportOptionalParams, + ParametersWithInOptionalParams, + ParametersWithIsOptionalParams, + ParametersWithLambdaOptionalParams, + ParametersWithNotOptionalParams, + ParametersWithOrOptionalParams, + ParametersWithPassOptionalParams, + ParametersWithRaiseOptionalParams, + ParametersWithReturnOptionalParams, + ParametersWithTryOptionalParams, + ParametersWithWhileOptionalParams, + ParametersWithWithOptionalParams, + ParametersWithYieldOptionalParams, + ParametersWithCancellationTokenOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/models.ts new file mode 100644 index 0000000000..63f8a6a843 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/models.ts @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export interface SameAsModel { + sameAsModel: string; +} + +export interface And { + name: string; +} + +export interface As { + name: string; +} + +export interface Assert { + name: string; +} + +export interface Async { + name: string; +} + +export interface Await { + name: string; +} + +export interface Break { + name: string; +} + +export interface Class { + name: string; +} + +export interface Constructor { + name: string; +} + +export interface Continue { + name: string; +} + +export interface Def { + name: string; +} + +export interface Del { + name: string; +} + +export interface Elif { + name: string; +} + +export interface Else { + name: string; +} + +export interface Except { + name: string; +} + +export interface Exec { + name: string; +} + +export interface Finally { + name: string; +} + +export interface For { + name: string; +} + +export interface From { + name: string; +} + +export interface Global { + name: string; +} + +export interface If { + name: string; +} + +export interface Import { + name: string; +} + +export interface In { + name: string; +} + +export interface Is { + name: string; +} + +export interface Lambda { + name: string; +} + +export interface Not { + name: string; +} + +export interface Or { + name: string; +} + +export interface Pass { + name: string; +} + +export interface Raise { + name: string; +} + +export interface Return { + name: string; +} + +export interface Try { + name: string; +} + +export interface While { + name: string; +} + +export interface With { + name: string; +} + +export interface Yield { + name: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/options.ts new file mode 100644 index 0000000000..fb097b0fb9 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/models/options.ts @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { OperationOptions } from "@azure-rest/core-client"; + +export interface ModelsWithAndOptionalParams extends OperationOptions {} + +export interface ModelsWithAsOptionalParams extends OperationOptions {} + +export interface ModelsWithAssertOptionalParams extends OperationOptions {} + +export interface ModelsWithAsyncOptionalParams extends OperationOptions {} + +export interface ModelsWithAwaitOptionalParams extends OperationOptions {} + +export interface ModelsWithBreakOptionalParams extends OperationOptions {} + +export interface ModelsWithClassOptionalParams extends OperationOptions {} + +export interface ModelsWithConstructorOptionalParams extends OperationOptions {} + +export interface ModelsWithContinueOptionalParams extends OperationOptions {} + +export interface ModelsWithDefOptionalParams extends OperationOptions {} + +export interface ModelsWithDelOptionalParams extends OperationOptions {} + +export interface ModelsWithElifOptionalParams extends OperationOptions {} + +export interface ModelsWithElseOptionalParams extends OperationOptions {} + +export interface ModelsWithExceptOptionalParams extends OperationOptions {} + +export interface ModelsWithExecOptionalParams extends OperationOptions {} + +export interface ModelsWithFinallyOptionalParams extends OperationOptions {} + +export interface ModelsWithForOptionalParams extends OperationOptions {} + +export interface ModelsWithFromOptionalParams extends OperationOptions {} + +export interface ModelsWithGlobalOptionalParams extends OperationOptions {} + +export interface ModelsWithIfOptionalParams extends OperationOptions {} + +export interface ModelsWithImportOptionalParams extends OperationOptions {} + +export interface ModelsWithInOptionalParams extends OperationOptions {} + +export interface ModelsWithIsOptionalParams extends OperationOptions {} + +export interface ModelsWithLambdaOptionalParams extends OperationOptions {} + +export interface ModelsWithNotOptionalParams extends OperationOptions {} + +export interface ModelsWithOrOptionalParams extends OperationOptions {} + +export interface ModelsWithPassOptionalParams extends OperationOptions {} + +export interface ModelsWithRaiseOptionalParams extends OperationOptions {} + +export interface ModelsWithReturnOptionalParams extends OperationOptions {} + +export interface ModelsWithTryOptionalParams extends OperationOptions {} + +export interface ModelsWithWhileOptionalParams extends OperationOptions {} + +export interface ModelsWithWithOptionalParams extends OperationOptions {} + +export interface ModelsWithYieldOptionalParams extends OperationOptions {} + +export interface ModelPropertiesSameAsModelOptionalParams + extends OperationOptions {} + +export interface OperationsAndOptionalParams extends OperationOptions {} + +export interface OperationsAsOptionalParams extends OperationOptions {} + +export interface OperationsAssertOptionalParams extends OperationOptions {} + +export interface OperationsAsyncOptionalParams extends OperationOptions {} + +export interface OperationsAwaitOptionalParams extends OperationOptions {} + +export interface OperationsBreakOptionalParams extends OperationOptions {} + +export interface OperationsClassOptionalParams extends OperationOptions {} + +export interface OperationsConstructorOptionalParams extends OperationOptions {} + +export interface OperationsContinueOptionalParams extends OperationOptions {} + +export interface OperationsDefOptionalParams extends OperationOptions {} + +export interface OperationsDelOptionalParams extends OperationOptions {} + +export interface OperationsElifOptionalParams extends OperationOptions {} + +export interface OperationsElseOptionalParams extends OperationOptions {} + +export interface OperationsExceptOptionalParams extends OperationOptions {} + +export interface OperationsExecOptionalParams extends OperationOptions {} + +export interface OperationsFinallyOptionalParams extends OperationOptions {} + +export interface OperationsForOptionalParams extends OperationOptions {} + +export interface OperationsFromOptionalParams extends OperationOptions {} + +export interface OperationsGlobalOptionalParams extends OperationOptions {} + +export interface OperationsIfOptionalParams extends OperationOptions {} + +export interface OperationsImportOptionalParams extends OperationOptions {} + +export interface OperationsInOptionalParams extends OperationOptions {} + +export interface OperationsIsOptionalParams extends OperationOptions {} + +export interface OperationsLambdaOptionalParams extends OperationOptions {} + +export interface OperationsNotOptionalParams extends OperationOptions {} + +export interface OperationsOrOptionalParams extends OperationOptions {} + +export interface OperationsPassOptionalParams extends OperationOptions {} + +export interface OperationsRaiseOptionalParams extends OperationOptions {} + +export interface OperationsReturnOptionalParams extends OperationOptions {} + +export interface OperationsTryOptionalParams extends OperationOptions {} + +export interface OperationsWhileOptionalParams extends OperationOptions {} + +export interface OperationsWithOptionalParams extends OperationOptions {} + +export interface OperationsYieldOptionalParams extends OperationOptions {} + +export interface ParametersWithAndOptionalParams extends OperationOptions {} + +export interface ParametersWithAsOptionalParams extends OperationOptions {} + +export interface ParametersWithAssertOptionalParams extends OperationOptions {} + +export interface ParametersWithAsyncOptionalParams extends OperationOptions {} + +export interface ParametersWithAwaitOptionalParams extends OperationOptions {} + +export interface ParametersWithBreakOptionalParams extends OperationOptions {} + +export interface ParametersWithClassOptionalParams extends OperationOptions {} + +export interface ParametersWithConstructorOptionalParams + extends OperationOptions {} + +export interface ParametersWithContinueOptionalParams + extends OperationOptions {} + +export interface ParametersWithDefOptionalParams extends OperationOptions {} + +export interface ParametersWithDelOptionalParams extends OperationOptions {} + +export interface ParametersWithElifOptionalParams extends OperationOptions {} + +export interface ParametersWithElseOptionalParams extends OperationOptions {} + +export interface ParametersWithExceptOptionalParams extends OperationOptions {} + +export interface ParametersWithExecOptionalParams extends OperationOptions {} + +export interface ParametersWithFinallyOptionalParams extends OperationOptions {} + +export interface ParametersWithForOptionalParams extends OperationOptions {} + +export interface ParametersWithFromOptionalParams extends OperationOptions {} + +export interface ParametersWithGlobalOptionalParams extends OperationOptions {} + +export interface ParametersWithIfOptionalParams extends OperationOptions {} + +export interface ParametersWithImportOptionalParams extends OperationOptions {} + +export interface ParametersWithInOptionalParams extends OperationOptions {} + +export interface ParametersWithIsOptionalParams extends OperationOptions {} + +export interface ParametersWithLambdaOptionalParams extends OperationOptions {} + +export interface ParametersWithNotOptionalParams extends OperationOptions {} + +export interface ParametersWithOrOptionalParams extends OperationOptions {} + +export interface ParametersWithPassOptionalParams extends OperationOptions {} + +export interface ParametersWithRaiseOptionalParams extends OperationOptions {} + +export interface ParametersWithReturnOptionalParams extends OperationOptions {} + +export interface ParametersWithTryOptionalParams extends OperationOptions {} + +export interface ParametersWithWhileOptionalParams extends OperationOptions {} + +export interface ParametersWithWithOptionalParams extends OperationOptions {} + +export interface ParametersWithYieldOptionalParams extends OperationOptions {} + +export interface ParametersWithCancellationTokenOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/clientDefinitions.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/clientDefinitions.ts new file mode 100644 index 0000000000..5bfe838ff0 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/clientDefinitions.ts @@ -0,0 +1,1029 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + ModelsWithAndParameters, + ModelsWithAsParameters, + ModelsWithAssertParameters, + ModelsWithAsyncParameters, + ModelsWithAwaitParameters, + ModelsWithBreakParameters, + ModelsWithClassParameters, + ModelsWithConstructorParameters, + ModelsWithContinueParameters, + ModelsWithDefParameters, + ModelsWithDelParameters, + ModelsWithElifParameters, + ModelsWithElseParameters, + ModelsWithExceptParameters, + ModelsWithExecParameters, + ModelsWithFinallyParameters, + ModelsWithForParameters, + ModelsWithFromParameters, + ModelsWithGlobalParameters, + ModelsWithIfParameters, + ModelsWithImportParameters, + ModelsWithInParameters, + ModelsWithIsParameters, + ModelsWithLambdaParameters, + ModelsWithNotParameters, + ModelsWithOrParameters, + ModelsWithPassParameters, + ModelsWithRaiseParameters, + ModelsWithReturnParameters, + ModelsWithTryParameters, + ModelsWithWhileParameters, + ModelsWithWithParameters, + ModelsWithYieldParameters, + ModelPropertiesSameAsModelParameters, + OperationsAndParameters, + OperationsAsParameters, + OperationsAssertParameters, + OperationsAsyncParameters, + OperationsAwaitParameters, + OperationsBreakParameters, + OperationsClassParameters, + OperationsConstructorParameters, + OperationsContinueParameters, + OperationsDefParameters, + OperationsDelParameters, + OperationsElifParameters, + OperationsElseParameters, + OperationsExceptParameters, + OperationsExecParameters, + OperationsFinallyParameters, + OperationsForParameters, + OperationsFromParameters, + OperationsGlobalParameters, + OperationsIfParameters, + OperationsImportParameters, + OperationsInParameters, + OperationsIsParameters, + OperationsLambdaParameters, + OperationsNotParameters, + OperationsOrParameters, + OperationsPassParameters, + OperationsRaiseParameters, + OperationsReturnParameters, + OperationsTryParameters, + OperationsWhileParameters, + OperationsWithParameters, + OperationsYieldParameters, + ParametersWithAndParameters, + ParametersWithAsParameters, + ParametersWithAssertParameters, + ParametersWithAsyncParameters, + ParametersWithAwaitParameters, + ParametersWithBreakParameters, + ParametersWithClassParameters, + ParametersWithConstructorParameters, + ParametersWithContinueParameters, + ParametersWithDefParameters, + ParametersWithDelParameters, + ParametersWithElifParameters, + ParametersWithElseParameters, + ParametersWithExceptParameters, + ParametersWithExecParameters, + ParametersWithFinallyParameters, + ParametersWithForParameters, + ParametersWithFromParameters, + ParametersWithGlobalParameters, + ParametersWithIfParameters, + ParametersWithImportParameters, + ParametersWithInParameters, + ParametersWithIsParameters, + ParametersWithLambdaParameters, + ParametersWithNotParameters, + ParametersWithOrParameters, + ParametersWithPassParameters, + ParametersWithRaiseParameters, + ParametersWithReturnParameters, + ParametersWithTryParameters, + ParametersWithWhileParameters, + ParametersWithWithParameters, + ParametersWithYieldParameters, + ParametersWithCancellationTokenParameters, +} from "./parameters.js"; +import { + ModelsWithAnd204Response, + ModelsWithAs204Response, + ModelsWithAssert204Response, + ModelsWithAsync204Response, + ModelsWithAwait204Response, + ModelsWithBreak204Response, + ModelsWithClass204Response, + ModelsWithConstructor204Response, + ModelsWithContinue204Response, + ModelsWithDef204Response, + ModelsWithDel204Response, + ModelsWithElif204Response, + ModelsWithElse204Response, + ModelsWithExcept204Response, + ModelsWithExec204Response, + ModelsWithFinally204Response, + ModelsWithFor204Response, + ModelsWithFrom204Response, + ModelsWithGlobal204Response, + ModelsWithIf204Response, + ModelsWithImport204Response, + ModelsWithIn204Response, + ModelsWithIs204Response, + ModelsWithLambda204Response, + ModelsWithNot204Response, + ModelsWithOr204Response, + ModelsWithPass204Response, + ModelsWithRaise204Response, + ModelsWithReturn204Response, + ModelsWithTry204Response, + ModelsWithWhile204Response, + ModelsWithWith204Response, + ModelsWithYield204Response, + ModelPropertiesSameAsModel204Response, + OperationsAnd204Response, + OperationsAs204Response, + OperationsAssert204Response, + OperationsAsync204Response, + OperationsAwait204Response, + OperationsBreak204Response, + OperationsClass204Response, + OperationsConstructor204Response, + OperationsContinue204Response, + OperationsDef204Response, + OperationsDel204Response, + OperationsElif204Response, + OperationsElse204Response, + OperationsExcept204Response, + OperationsExec204Response, + OperationsFinally204Response, + OperationsFor204Response, + OperationsFrom204Response, + OperationsGlobal204Response, + OperationsIf204Response, + OperationsImport204Response, + OperationsIn204Response, + OperationsIs204Response, + OperationsLambda204Response, + OperationsNot204Response, + OperationsOr204Response, + OperationsPass204Response, + OperationsRaise204Response, + OperationsReturn204Response, + OperationsTry204Response, + OperationsWhile204Response, + OperationsWith204Response, + OperationsYield204Response, + ParametersWithAnd204Response, + ParametersWithAs204Response, + ParametersWithAssert204Response, + ParametersWithAsync204Response, + ParametersWithAwait204Response, + ParametersWithBreak204Response, + ParametersWithClass204Response, + ParametersWithConstructor204Response, + ParametersWithContinue204Response, + ParametersWithDef204Response, + ParametersWithDel204Response, + ParametersWithElif204Response, + ParametersWithElse204Response, + ParametersWithExcept204Response, + ParametersWithExec204Response, + ParametersWithFinally204Response, + ParametersWithFor204Response, + ParametersWithFrom204Response, + ParametersWithGlobal204Response, + ParametersWithIf204Response, + ParametersWithImport204Response, + ParametersWithIn204Response, + ParametersWithIs204Response, + ParametersWithLambda204Response, + ParametersWithNot204Response, + ParametersWithOr204Response, + ParametersWithPass204Response, + ParametersWithRaise204Response, + ParametersWithReturn204Response, + ParametersWithTry204Response, + ParametersWithWhile204Response, + ParametersWithWith204Response, + ParametersWithYield204Response, + ParametersWithCancellationToken204Response, +} from "./responses.js"; +import { Client, StreamableMethod } from "@azure-rest/core-client"; + +export interface ModelsWithAnd { + post( + options: ModelsWithAndParameters, + ): StreamableMethod; +} + +export interface ModelsWithAs { + post( + options: ModelsWithAsParameters, + ): StreamableMethod; +} + +export interface ModelsWithAssert { + post( + options: ModelsWithAssertParameters, + ): StreamableMethod; +} + +export interface ModelsWithAsync { + post( + options: ModelsWithAsyncParameters, + ): StreamableMethod; +} + +export interface ModelsWithAwait { + post( + options: ModelsWithAwaitParameters, + ): StreamableMethod; +} + +export interface ModelsWithBreak { + post( + options: ModelsWithBreakParameters, + ): StreamableMethod; +} + +export interface ModelsWithClass { + post( + options: ModelsWithClassParameters, + ): StreamableMethod; +} + +export interface ModelsWithConstructor { + post( + options: ModelsWithConstructorParameters, + ): StreamableMethod; +} + +export interface ModelsWithContinue { + post( + options: ModelsWithContinueParameters, + ): StreamableMethod; +} + +export interface ModelsWithDef { + post( + options: ModelsWithDefParameters, + ): StreamableMethod; +} + +export interface ModelsWithDel { + post( + options: ModelsWithDelParameters, + ): StreamableMethod; +} + +export interface ModelsWithElif { + post( + options: ModelsWithElifParameters, + ): StreamableMethod; +} + +export interface ModelsWithElse { + post( + options: ModelsWithElseParameters, + ): StreamableMethod; +} + +export interface ModelsWithExcept { + post( + options: ModelsWithExceptParameters, + ): StreamableMethod; +} + +export interface ModelsWithExec { + post( + options: ModelsWithExecParameters, + ): StreamableMethod; +} + +export interface ModelsWithFinally { + post( + options: ModelsWithFinallyParameters, + ): StreamableMethod; +} + +export interface ModelsWithFor { + post( + options: ModelsWithForParameters, + ): StreamableMethod; +} + +export interface ModelsWithFrom { + post( + options: ModelsWithFromParameters, + ): StreamableMethod; +} + +export interface ModelsWithGlobal { + post( + options: ModelsWithGlobalParameters, + ): StreamableMethod; +} + +export interface ModelsWithIf { + post( + options: ModelsWithIfParameters, + ): StreamableMethod; +} + +export interface ModelsWithImport { + post( + options: ModelsWithImportParameters, + ): StreamableMethod; +} + +export interface ModelsWithIn { + post( + options: ModelsWithInParameters, + ): StreamableMethod; +} + +export interface ModelsWithIs { + post( + options: ModelsWithIsParameters, + ): StreamableMethod; +} + +export interface ModelsWithLambda { + post( + options: ModelsWithLambdaParameters, + ): StreamableMethod; +} + +export interface ModelsWithNot { + post( + options: ModelsWithNotParameters, + ): StreamableMethod; +} + +export interface ModelsWithOr { + post( + options: ModelsWithOrParameters, + ): StreamableMethod; +} + +export interface ModelsWithPass { + post( + options: ModelsWithPassParameters, + ): StreamableMethod; +} + +export interface ModelsWithRaise { + post( + options: ModelsWithRaiseParameters, + ): StreamableMethod; +} + +export interface ModelsWithReturn { + post( + options: ModelsWithReturnParameters, + ): StreamableMethod; +} + +export interface ModelsWithTry { + post( + options: ModelsWithTryParameters, + ): StreamableMethod; +} + +export interface ModelsWithWhile { + post( + options: ModelsWithWhileParameters, + ): StreamableMethod; +} + +export interface ModelsWithWith { + post( + options: ModelsWithWithParameters, + ): StreamableMethod; +} + +export interface ModelsWithYield { + post( + options: ModelsWithYieldParameters, + ): StreamableMethod; +} + +export interface ModelPropertiesSameAsModel { + post( + options: ModelPropertiesSameAsModelParameters, + ): StreamableMethod; +} + +export interface OperationsAnd { + get( + options?: OperationsAndParameters, + ): StreamableMethod; +} + +export interface OperationsAs { + get( + options?: OperationsAsParameters, + ): StreamableMethod; +} + +export interface OperationsAssert { + get( + options?: OperationsAssertParameters, + ): StreamableMethod; +} + +export interface OperationsAsync { + get( + options?: OperationsAsyncParameters, + ): StreamableMethod; +} + +export interface OperationsAwait { + get( + options?: OperationsAwaitParameters, + ): StreamableMethod; +} + +export interface OperationsBreak { + get( + options?: OperationsBreakParameters, + ): StreamableMethod; +} + +export interface OperationsClass { + get( + options?: OperationsClassParameters, + ): StreamableMethod; +} + +export interface OperationsConstructor { + get( + options?: OperationsConstructorParameters, + ): StreamableMethod; +} + +export interface OperationsContinue { + get( + options?: OperationsContinueParameters, + ): StreamableMethod; +} + +export interface OperationsDef { + get( + options?: OperationsDefParameters, + ): StreamableMethod; +} + +export interface OperationsDel { + get( + options?: OperationsDelParameters, + ): StreamableMethod; +} + +export interface OperationsElif { + get( + options?: OperationsElifParameters, + ): StreamableMethod; +} + +export interface OperationsElse { + get( + options?: OperationsElseParameters, + ): StreamableMethod; +} + +export interface OperationsExcept { + get( + options?: OperationsExceptParameters, + ): StreamableMethod; +} + +export interface OperationsExec { + get( + options?: OperationsExecParameters, + ): StreamableMethod; +} + +export interface OperationsFinally { + get( + options?: OperationsFinallyParameters, + ): StreamableMethod; +} + +export interface OperationsFor { + get( + options?: OperationsForParameters, + ): StreamableMethod; +} + +export interface OperationsFrom { + get( + options?: OperationsFromParameters, + ): StreamableMethod; +} + +export interface OperationsGlobal { + get( + options?: OperationsGlobalParameters, + ): StreamableMethod; +} + +export interface OperationsIf { + get( + options?: OperationsIfParameters, + ): StreamableMethod; +} + +export interface OperationsImport { + get( + options?: OperationsImportParameters, + ): StreamableMethod; +} + +export interface OperationsIn { + get( + options?: OperationsInParameters, + ): StreamableMethod; +} + +export interface OperationsIs { + get( + options?: OperationsIsParameters, + ): StreamableMethod; +} + +export interface OperationsLambda { + get( + options?: OperationsLambdaParameters, + ): StreamableMethod; +} + +export interface OperationsNot { + get( + options?: OperationsNotParameters, + ): StreamableMethod; +} + +export interface OperationsOr { + get( + options?: OperationsOrParameters, + ): StreamableMethod; +} + +export interface OperationsPass { + get( + options?: OperationsPassParameters, + ): StreamableMethod; +} + +export interface OperationsRaise { + get( + options?: OperationsRaiseParameters, + ): StreamableMethod; +} + +export interface OperationsReturn { + get( + options?: OperationsReturnParameters, + ): StreamableMethod; +} + +export interface OperationsTry { + get( + options?: OperationsTryParameters, + ): StreamableMethod; +} + +export interface OperationsWhile { + get( + options?: OperationsWhileParameters, + ): StreamableMethod; +} + +export interface OperationsWith { + get( + options?: OperationsWithParameters, + ): StreamableMethod; +} + +export interface OperationsYield { + get( + options?: OperationsYieldParameters, + ): StreamableMethod; +} + +export interface ParametersWithAnd { + get( + options: ParametersWithAndParameters, + ): StreamableMethod; +} + +export interface ParametersWithAs { + get( + options: ParametersWithAsParameters, + ): StreamableMethod; +} + +export interface ParametersWithAssert { + get( + options: ParametersWithAssertParameters, + ): StreamableMethod; +} + +export interface ParametersWithAsync { + get( + options: ParametersWithAsyncParameters, + ): StreamableMethod; +} + +export interface ParametersWithAwait { + get( + options: ParametersWithAwaitParameters, + ): StreamableMethod; +} + +export interface ParametersWithBreak { + get( + options: ParametersWithBreakParameters, + ): StreamableMethod; +} + +export interface ParametersWithClass { + get( + options: ParametersWithClassParameters, + ): StreamableMethod; +} + +export interface ParametersWithConstructor { + get( + options: ParametersWithConstructorParameters, + ): StreamableMethod; +} + +export interface ParametersWithContinue { + get( + options: ParametersWithContinueParameters, + ): StreamableMethod; +} + +export interface ParametersWithDef { + get( + options: ParametersWithDefParameters, + ): StreamableMethod; +} + +export interface ParametersWithDel { + get( + options: ParametersWithDelParameters, + ): StreamableMethod; +} + +export interface ParametersWithElif { + get( + options: ParametersWithElifParameters, + ): StreamableMethod; +} + +export interface ParametersWithElse { + get( + options: ParametersWithElseParameters, + ): StreamableMethod; +} + +export interface ParametersWithExcept { + get( + options: ParametersWithExceptParameters, + ): StreamableMethod; +} + +export interface ParametersWithExec { + get( + options: ParametersWithExecParameters, + ): StreamableMethod; +} + +export interface ParametersWithFinally { + get( + options: ParametersWithFinallyParameters, + ): StreamableMethod; +} + +export interface ParametersWithFor { + get( + options: ParametersWithForParameters, + ): StreamableMethod; +} + +export interface ParametersWithFrom { + get( + options: ParametersWithFromParameters, + ): StreamableMethod; +} + +export interface ParametersWithGlobal { + get( + options: ParametersWithGlobalParameters, + ): StreamableMethod; +} + +export interface ParametersWithIf { + get( + options: ParametersWithIfParameters, + ): StreamableMethod; +} + +export interface ParametersWithImport { + get( + options: ParametersWithImportParameters, + ): StreamableMethod; +} + +export interface ParametersWithIn { + get( + options: ParametersWithInParameters, + ): StreamableMethod; +} + +export interface ParametersWithIs { + get( + options: ParametersWithIsParameters, + ): StreamableMethod; +} + +export interface ParametersWithLambda { + get( + options: ParametersWithLambdaParameters, + ): StreamableMethod; +} + +export interface ParametersWithNot { + get( + options: ParametersWithNotParameters, + ): StreamableMethod; +} + +export interface ParametersWithOr { + get( + options: ParametersWithOrParameters, + ): StreamableMethod; +} + +export interface ParametersWithPass { + get( + options: ParametersWithPassParameters, + ): StreamableMethod; +} + +export interface ParametersWithRaise { + get( + options: ParametersWithRaiseParameters, + ): StreamableMethod; +} + +export interface ParametersWithReturn { + get( + options: ParametersWithReturnParameters, + ): StreamableMethod; +} + +export interface ParametersWithTry { + get( + options: ParametersWithTryParameters, + ): StreamableMethod; +} + +export interface ParametersWithWhile { + get( + options: ParametersWithWhileParameters, + ): StreamableMethod; +} + +export interface ParametersWithWith { + get( + options: ParametersWithWithParameters, + ): StreamableMethod; +} + +export interface ParametersWithYield { + get( + options: ParametersWithYieldParameters, + ): StreamableMethod; +} + +export interface ParametersWithCancellationToken { + get( + options: ParametersWithCancellationTokenParameters, + ): StreamableMethod; +} + +export interface Routes { + /** Resource for '/special-words/models/and' has methods for the following verbs: post */ + (path: "/special-words/models/and"): ModelsWithAnd; + /** Resource for '/special-words/models/as' has methods for the following verbs: post */ + (path: "/special-words/models/as"): ModelsWithAs; + /** Resource for '/special-words/models/assert' has methods for the following verbs: post */ + (path: "/special-words/models/assert"): ModelsWithAssert; + /** Resource for '/special-words/models/async' has methods for the following verbs: post */ + (path: "/special-words/models/async"): ModelsWithAsync; + /** Resource for '/special-words/models/await' has methods for the following verbs: post */ + (path: "/special-words/models/await"): ModelsWithAwait; + /** Resource for '/special-words/models/break' has methods for the following verbs: post */ + (path: "/special-words/models/break"): ModelsWithBreak; + /** Resource for '/special-words/models/class' has methods for the following verbs: post */ + (path: "/special-words/models/class"): ModelsWithClass; + /** Resource for '/special-words/models/constructor' has methods for the following verbs: post */ + (path: "/special-words/models/constructor"): ModelsWithConstructor; + /** Resource for '/special-words/models/continue' has methods for the following verbs: post */ + (path: "/special-words/models/continue"): ModelsWithContinue; + /** Resource for '/special-words/models/def' has methods for the following verbs: post */ + (path: "/special-words/models/def"): ModelsWithDef; + /** Resource for '/special-words/models/del' has methods for the following verbs: post */ + (path: "/special-words/models/del"): ModelsWithDel; + /** Resource for '/special-words/models/elif' has methods for the following verbs: post */ + (path: "/special-words/models/elif"): ModelsWithElif; + /** Resource for '/special-words/models/else' has methods for the following verbs: post */ + (path: "/special-words/models/else"): ModelsWithElse; + /** Resource for '/special-words/models/except' has methods for the following verbs: post */ + (path: "/special-words/models/except"): ModelsWithExcept; + /** Resource for '/special-words/models/exec' has methods for the following verbs: post */ + (path: "/special-words/models/exec"): ModelsWithExec; + /** Resource for '/special-words/models/finally' has methods for the following verbs: post */ + (path: "/special-words/models/finally"): ModelsWithFinally; + /** Resource for '/special-words/models/for' has methods for the following verbs: post */ + (path: "/special-words/models/for"): ModelsWithFor; + /** Resource for '/special-words/models/from' has methods for the following verbs: post */ + (path: "/special-words/models/from"): ModelsWithFrom; + /** Resource for '/special-words/models/global' has methods for the following verbs: post */ + (path: "/special-words/models/global"): ModelsWithGlobal; + /** Resource for '/special-words/models/if' has methods for the following verbs: post */ + (path: "/special-words/models/if"): ModelsWithIf; + /** Resource for '/special-words/models/import' has methods for the following verbs: post */ + (path: "/special-words/models/import"): ModelsWithImport; + /** Resource for '/special-words/models/in' has methods for the following verbs: post */ + (path: "/special-words/models/in"): ModelsWithIn; + /** Resource for '/special-words/models/is' has methods for the following verbs: post */ + (path: "/special-words/models/is"): ModelsWithIs; + /** Resource for '/special-words/models/lambda' has methods for the following verbs: post */ + (path: "/special-words/models/lambda"): ModelsWithLambda; + /** Resource for '/special-words/models/not' has methods for the following verbs: post */ + (path: "/special-words/models/not"): ModelsWithNot; + /** Resource for '/special-words/models/or' has methods for the following verbs: post */ + (path: "/special-words/models/or"): ModelsWithOr; + /** Resource for '/special-words/models/pass' has methods for the following verbs: post */ + (path: "/special-words/models/pass"): ModelsWithPass; + /** Resource for '/special-words/models/raise' has methods for the following verbs: post */ + (path: "/special-words/models/raise"): ModelsWithRaise; + /** Resource for '/special-words/models/return' has methods for the following verbs: post */ + (path: "/special-words/models/return"): ModelsWithReturn; + /** Resource for '/special-words/models/try' has methods for the following verbs: post */ + (path: "/special-words/models/try"): ModelsWithTry; + /** Resource for '/special-words/models/while' has methods for the following verbs: post */ + (path: "/special-words/models/while"): ModelsWithWhile; + /** Resource for '/special-words/models/with' has methods for the following verbs: post */ + (path: "/special-words/models/with"): ModelsWithWith; + /** Resource for '/special-words/models/yield' has methods for the following verbs: post */ + (path: "/special-words/models/yield"): ModelsWithYield; + /** Resource for '/special-words/model-properties/same-as-model' has methods for the following verbs: post */ + ( + path: "/special-words/model-properties/same-as-model", + ): ModelPropertiesSameAsModel; + /** Resource for '/special-words/operations/and' has methods for the following verbs: get */ + (path: "/special-words/operations/and"): OperationsAnd; + /** Resource for '/special-words/operations/as' has methods for the following verbs: get */ + (path: "/special-words/operations/as"): OperationsAs; + /** Resource for '/special-words/operations/assert' has methods for the following verbs: get */ + (path: "/special-words/operations/assert"): OperationsAssert; + /** Resource for '/special-words/operations/async' has methods for the following verbs: get */ + (path: "/special-words/operations/async"): OperationsAsync; + /** Resource for '/special-words/operations/await' has methods for the following verbs: get */ + (path: "/special-words/operations/await"): OperationsAwait; + /** Resource for '/special-words/operations/break' has methods for the following verbs: get */ + (path: "/special-words/operations/break"): OperationsBreak; + /** Resource for '/special-words/operations/class' has methods for the following verbs: get */ + (path: "/special-words/operations/class"): OperationsClass; + /** Resource for '/special-words/operations/constructor' has methods for the following verbs: get */ + (path: "/special-words/operations/constructor"): OperationsConstructor; + /** Resource for '/special-words/operations/continue' has methods for the following verbs: get */ + (path: "/special-words/operations/continue"): OperationsContinue; + /** Resource for '/special-words/operations/def' has methods for the following verbs: get */ + (path: "/special-words/operations/def"): OperationsDef; + /** Resource for '/special-words/operations/del' has methods for the following verbs: get */ + (path: "/special-words/operations/del"): OperationsDel; + /** Resource for '/special-words/operations/elif' has methods for the following verbs: get */ + (path: "/special-words/operations/elif"): OperationsElif; + /** Resource for '/special-words/operations/else' has methods for the following verbs: get */ + (path: "/special-words/operations/else"): OperationsElse; + /** Resource for '/special-words/operations/except' has methods for the following verbs: get */ + (path: "/special-words/operations/except"): OperationsExcept; + /** Resource for '/special-words/operations/exec' has methods for the following verbs: get */ + (path: "/special-words/operations/exec"): OperationsExec; + /** Resource for '/special-words/operations/finally' has methods for the following verbs: get */ + (path: "/special-words/operations/finally"): OperationsFinally; + /** Resource for '/special-words/operations/for' has methods for the following verbs: get */ + (path: "/special-words/operations/for"): OperationsFor; + /** Resource for '/special-words/operations/from' has methods for the following verbs: get */ + (path: "/special-words/operations/from"): OperationsFrom; + /** Resource for '/special-words/operations/global' has methods for the following verbs: get */ + (path: "/special-words/operations/global"): OperationsGlobal; + /** Resource for '/special-words/operations/if' has methods for the following verbs: get */ + (path: "/special-words/operations/if"): OperationsIf; + /** Resource for '/special-words/operations/import' has methods for the following verbs: get */ + (path: "/special-words/operations/import"): OperationsImport; + /** Resource for '/special-words/operations/in' has methods for the following verbs: get */ + (path: "/special-words/operations/in"): OperationsIn; + /** Resource for '/special-words/operations/is' has methods for the following verbs: get */ + (path: "/special-words/operations/is"): OperationsIs; + /** Resource for '/special-words/operations/lambda' has methods for the following verbs: get */ + (path: "/special-words/operations/lambda"): OperationsLambda; + /** Resource for '/special-words/operations/not' has methods for the following verbs: get */ + (path: "/special-words/operations/not"): OperationsNot; + /** Resource for '/special-words/operations/or' has methods for the following verbs: get */ + (path: "/special-words/operations/or"): OperationsOr; + /** Resource for '/special-words/operations/pass' has methods for the following verbs: get */ + (path: "/special-words/operations/pass"): OperationsPass; + /** Resource for '/special-words/operations/raise' has methods for the following verbs: get */ + (path: "/special-words/operations/raise"): OperationsRaise; + /** Resource for '/special-words/operations/return' has methods for the following verbs: get */ + (path: "/special-words/operations/return"): OperationsReturn; + /** Resource for '/special-words/operations/try' has methods for the following verbs: get */ + (path: "/special-words/operations/try"): OperationsTry; + /** Resource for '/special-words/operations/while' has methods for the following verbs: get */ + (path: "/special-words/operations/while"): OperationsWhile; + /** Resource for '/special-words/operations/with' has methods for the following verbs: get */ + (path: "/special-words/operations/with"): OperationsWith; + /** Resource for '/special-words/operations/yield' has methods for the following verbs: get */ + (path: "/special-words/operations/yield"): OperationsYield; + /** Resource for '/special-words/parameters/and' has methods for the following verbs: get */ + (path: "/special-words/parameters/and"): ParametersWithAnd; + /** Resource for '/special-words/parameters/as' has methods for the following verbs: get */ + (path: "/special-words/parameters/as"): ParametersWithAs; + /** Resource for '/special-words/parameters/assert' has methods for the following verbs: get */ + (path: "/special-words/parameters/assert"): ParametersWithAssert; + /** Resource for '/special-words/parameters/async' has methods for the following verbs: get */ + (path: "/special-words/parameters/async"): ParametersWithAsync; + /** Resource for '/special-words/parameters/await' has methods for the following verbs: get */ + (path: "/special-words/parameters/await"): ParametersWithAwait; + /** Resource for '/special-words/parameters/break' has methods for the following verbs: get */ + (path: "/special-words/parameters/break"): ParametersWithBreak; + /** Resource for '/special-words/parameters/class' has methods for the following verbs: get */ + (path: "/special-words/parameters/class"): ParametersWithClass; + /** Resource for '/special-words/parameters/constructor' has methods for the following verbs: get */ + (path: "/special-words/parameters/constructor"): ParametersWithConstructor; + /** Resource for '/special-words/parameters/continue' has methods for the following verbs: get */ + (path: "/special-words/parameters/continue"): ParametersWithContinue; + /** Resource for '/special-words/parameters/def' has methods for the following verbs: get */ + (path: "/special-words/parameters/def"): ParametersWithDef; + /** Resource for '/special-words/parameters/del' has methods for the following verbs: get */ + (path: "/special-words/parameters/del"): ParametersWithDel; + /** Resource for '/special-words/parameters/elif' has methods for the following verbs: get */ + (path: "/special-words/parameters/elif"): ParametersWithElif; + /** Resource for '/special-words/parameters/else' has methods for the following verbs: get */ + (path: "/special-words/parameters/else"): ParametersWithElse; + /** Resource for '/special-words/parameters/except' has methods for the following verbs: get */ + (path: "/special-words/parameters/except"): ParametersWithExcept; + /** Resource for '/special-words/parameters/exec' has methods for the following verbs: get */ + (path: "/special-words/parameters/exec"): ParametersWithExec; + /** Resource for '/special-words/parameters/finally' has methods for the following verbs: get */ + (path: "/special-words/parameters/finally"): ParametersWithFinally; + /** Resource for '/special-words/parameters/for' has methods for the following verbs: get */ + (path: "/special-words/parameters/for"): ParametersWithFor; + /** Resource for '/special-words/parameters/from' has methods for the following verbs: get */ + (path: "/special-words/parameters/from"): ParametersWithFrom; + /** Resource for '/special-words/parameters/global' has methods for the following verbs: get */ + (path: "/special-words/parameters/global"): ParametersWithGlobal; + /** Resource for '/special-words/parameters/if' has methods for the following verbs: get */ + (path: "/special-words/parameters/if"): ParametersWithIf; + /** Resource for '/special-words/parameters/import' has methods for the following verbs: get */ + (path: "/special-words/parameters/import"): ParametersWithImport; + /** Resource for '/special-words/parameters/in' has methods for the following verbs: get */ + (path: "/special-words/parameters/in"): ParametersWithIn; + /** Resource for '/special-words/parameters/is' has methods for the following verbs: get */ + (path: "/special-words/parameters/is"): ParametersWithIs; + /** Resource for '/special-words/parameters/lambda' has methods for the following verbs: get */ + (path: "/special-words/parameters/lambda"): ParametersWithLambda; + /** Resource for '/special-words/parameters/not' has methods for the following verbs: get */ + (path: "/special-words/parameters/not"): ParametersWithNot; + /** Resource for '/special-words/parameters/or' has methods for the following verbs: get */ + (path: "/special-words/parameters/or"): ParametersWithOr; + /** Resource for '/special-words/parameters/pass' has methods for the following verbs: get */ + (path: "/special-words/parameters/pass"): ParametersWithPass; + /** Resource for '/special-words/parameters/raise' has methods for the following verbs: get */ + (path: "/special-words/parameters/raise"): ParametersWithRaise; + /** Resource for '/special-words/parameters/return' has methods for the following verbs: get */ + (path: "/special-words/parameters/return"): ParametersWithReturn; + /** Resource for '/special-words/parameters/try' has methods for the following verbs: get */ + (path: "/special-words/parameters/try"): ParametersWithTry; + /** Resource for '/special-words/parameters/while' has methods for the following verbs: get */ + (path: "/special-words/parameters/while"): ParametersWithWhile; + /** Resource for '/special-words/parameters/with' has methods for the following verbs: get */ + (path: "/special-words/parameters/with"): ParametersWithWith; + /** Resource for '/special-words/parameters/yield' has methods for the following verbs: get */ + (path: "/special-words/parameters/yield"): ParametersWithYield; + /** Resource for '/special-words/parameters/cancellationToken' has methods for the following verbs: get */ + ( + path: "/special-words/parameters/cancellationToken", + ): ParametersWithCancellationToken; +} + +export type SpecialWordsContext = Client & { + path: Routes; +}; diff --git a/packages/typespec-ts/test/integration/generated/projection/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/index.ts similarity index 61% rename from packages/typespec-ts/test/integration/generated/projection/src/index.ts rename to packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/index.ts index f9c095ddd8..4b21e1b3d1 100644 --- a/packages/typespec-ts/test/integration/generated/projection/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/index.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import ProjectionClient from "./projectionClient.js"; +import SpecialWordsClient from "./specialWordsClient.js"; -export * from "./projectionClient.js"; +export * from "./specialWordsClient.js"; export * from "./parameters.js"; export * from "./responses.js"; export * from "./clientDefinitions.js"; export * from "./models.js"; -export default ProjectionClient; +export default SpecialWordsClient; diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/models.ts new file mode 100644 index 0000000000..1d09a8fcd6 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/models.ts @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export interface And { + name: string; +} + +export interface As { + name: string; +} + +export interface Assert { + name: string; +} + +export interface Async { + name: string; +} + +export interface Await { + name: string; +} + +export interface Break { + name: string; +} + +export interface Class { + name: string; +} + +export interface Constructor { + name: string; +} + +export interface Continue { + name: string; +} + +export interface Def { + name: string; +} + +export interface Del { + name: string; +} + +export interface Elif { + name: string; +} + +export interface Else { + name: string; +} + +export interface Except { + name: string; +} + +export interface Exec { + name: string; +} + +export interface Finally { + name: string; +} + +export interface For { + name: string; +} + +export interface From { + name: string; +} + +export interface Global { + name: string; +} + +export interface If { + name: string; +} + +export interface Import { + name: string; +} + +export interface In { + name: string; +} + +export interface Is { + name: string; +} + +export interface Lambda { + name: string; +} + +export interface Not { + name: string; +} + +export interface Or { + name: string; +} + +export interface Pass { + name: string; +} + +export interface Raise { + name: string; +} + +export interface Return { + name: string; +} + +export interface Try { + name: string; +} + +export interface While { + name: string; +} + +export interface With { + name: string; +} + +export interface Yield { + name: string; +} + +export interface SameAsModel { + SameAsModel: string; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/parameters.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/parameters.ts new file mode 100644 index 0000000000..cc2cd8b71a --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/parameters.ts @@ -0,0 +1,680 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { RequestParameters } from "@azure-rest/core-client"; +import { + And, + As, + Assert, + Async, + Await, + Break, + Class, + Constructor, + Continue, + Def, + Del, + Elif, + Else, + Except, + Exec, + Finally, + For, + From, + Global, + If, + Import, + In, + Is, + Lambda, + Not, + Or, + Pass, + Raise, + Return, + Try, + While, + With, + Yield, + SameAsModel, +} from "./models.js"; + +export interface ModelsWithAndBodyParam { + body: And; +} + +export type ModelsWithAndParameters = ModelsWithAndBodyParam & + RequestParameters; + +export interface ModelsWithAsBodyParam { + body: As; +} + +export type ModelsWithAsParameters = ModelsWithAsBodyParam & RequestParameters; + +export interface ModelsWithAssertBodyParam { + body: Assert; +} + +export type ModelsWithAssertParameters = ModelsWithAssertBodyParam & + RequestParameters; + +export interface ModelsWithAsyncBodyParam { + body: Async; +} + +export type ModelsWithAsyncParameters = ModelsWithAsyncBodyParam & + RequestParameters; + +export interface ModelsWithAwaitBodyParam { + body: Await; +} + +export type ModelsWithAwaitParameters = ModelsWithAwaitBodyParam & + RequestParameters; + +export interface ModelsWithBreakBodyParam { + body: Break; +} + +export type ModelsWithBreakParameters = ModelsWithBreakBodyParam & + RequestParameters; + +export interface ModelsWithClassBodyParam { + body: Class; +} + +export type ModelsWithClassParameters = ModelsWithClassBodyParam & + RequestParameters; + +export interface ModelsWithConstructorBodyParam { + body: Constructor; +} + +export type ModelsWithConstructorParameters = ModelsWithConstructorBodyParam & + RequestParameters; + +export interface ModelsWithContinueBodyParam { + body: Continue; +} + +export type ModelsWithContinueParameters = ModelsWithContinueBodyParam & + RequestParameters; + +export interface ModelsWithDefBodyParam { + body: Def; +} + +export type ModelsWithDefParameters = ModelsWithDefBodyParam & + RequestParameters; + +export interface ModelsWithDelBodyParam { + body: Del; +} + +export type ModelsWithDelParameters = ModelsWithDelBodyParam & + RequestParameters; + +export interface ModelsWithElifBodyParam { + body: Elif; +} + +export type ModelsWithElifParameters = ModelsWithElifBodyParam & + RequestParameters; + +export interface ModelsWithElseBodyParam { + body: Else; +} + +export type ModelsWithElseParameters = ModelsWithElseBodyParam & + RequestParameters; + +export interface ModelsWithExceptBodyParam { + body: Except; +} + +export type ModelsWithExceptParameters = ModelsWithExceptBodyParam & + RequestParameters; + +export interface ModelsWithExecBodyParam { + body: Exec; +} + +export type ModelsWithExecParameters = ModelsWithExecBodyParam & + RequestParameters; + +export interface ModelsWithFinallyBodyParam { + body: Finally; +} + +export type ModelsWithFinallyParameters = ModelsWithFinallyBodyParam & + RequestParameters; + +export interface ModelsWithForBodyParam { + body: For; +} + +export type ModelsWithForParameters = ModelsWithForBodyParam & + RequestParameters; + +export interface ModelsWithFromBodyParam { + body: From; +} + +export type ModelsWithFromParameters = ModelsWithFromBodyParam & + RequestParameters; + +export interface ModelsWithGlobalBodyParam { + body: Global; +} + +export type ModelsWithGlobalParameters = ModelsWithGlobalBodyParam & + RequestParameters; + +export interface ModelsWithIfBodyParam { + body: If; +} + +export type ModelsWithIfParameters = ModelsWithIfBodyParam & RequestParameters; + +export interface ModelsWithImportBodyParam { + body: Import; +} + +export type ModelsWithImportParameters = ModelsWithImportBodyParam & + RequestParameters; + +export interface ModelsWithInBodyParam { + body: In; +} + +export type ModelsWithInParameters = ModelsWithInBodyParam & RequestParameters; + +export interface ModelsWithIsBodyParam { + body: Is; +} + +export type ModelsWithIsParameters = ModelsWithIsBodyParam & RequestParameters; + +export interface ModelsWithLambdaBodyParam { + body: Lambda; +} + +export type ModelsWithLambdaParameters = ModelsWithLambdaBodyParam & + RequestParameters; + +export interface ModelsWithNotBodyParam { + body: Not; +} + +export type ModelsWithNotParameters = ModelsWithNotBodyParam & + RequestParameters; + +export interface ModelsWithOrBodyParam { + body: Or; +} + +export type ModelsWithOrParameters = ModelsWithOrBodyParam & RequestParameters; + +export interface ModelsWithPassBodyParam { + body: Pass; +} + +export type ModelsWithPassParameters = ModelsWithPassBodyParam & + RequestParameters; + +export interface ModelsWithRaiseBodyParam { + body: Raise; +} + +export type ModelsWithRaiseParameters = ModelsWithRaiseBodyParam & + RequestParameters; + +export interface ModelsWithReturnBodyParam { + body: Return; +} + +export type ModelsWithReturnParameters = ModelsWithReturnBodyParam & + RequestParameters; + +export interface ModelsWithTryBodyParam { + body: Try; +} + +export type ModelsWithTryParameters = ModelsWithTryBodyParam & + RequestParameters; + +export interface ModelsWithWhileBodyParam { + body: While; +} + +export type ModelsWithWhileParameters = ModelsWithWhileBodyParam & + RequestParameters; + +export interface ModelsWithWithBodyParam { + body: With; +} + +export type ModelsWithWithParameters = ModelsWithWithBodyParam & + RequestParameters; + +export interface ModelsWithYieldBodyParam { + body: Yield; +} + +export type ModelsWithYieldParameters = ModelsWithYieldBodyParam & + RequestParameters; + +export interface ModelPropertiesSameAsModelBodyParam { + body: SameAsModel; +} + +export type ModelPropertiesSameAsModelParameters = + ModelPropertiesSameAsModelBodyParam & RequestParameters; +export type OperationsAndParameters = RequestParameters; +export type OperationsAsParameters = RequestParameters; +export type OperationsAssertParameters = RequestParameters; +export type OperationsAsyncParameters = RequestParameters; +export type OperationsAwaitParameters = RequestParameters; +export type OperationsBreakParameters = RequestParameters; +export type OperationsClassParameters = RequestParameters; +export type OperationsConstructorParameters = RequestParameters; +export type OperationsContinueParameters = RequestParameters; +export type OperationsDefParameters = RequestParameters; +export type OperationsDelParameters = RequestParameters; +export type OperationsElifParameters = RequestParameters; +export type OperationsElseParameters = RequestParameters; +export type OperationsExceptParameters = RequestParameters; +export type OperationsExecParameters = RequestParameters; +export type OperationsFinallyParameters = RequestParameters; +export type OperationsForParameters = RequestParameters; +export type OperationsFromParameters = RequestParameters; +export type OperationsGlobalParameters = RequestParameters; +export type OperationsIfParameters = RequestParameters; +export type OperationsImportParameters = RequestParameters; +export type OperationsInParameters = RequestParameters; +export type OperationsIsParameters = RequestParameters; +export type OperationsLambdaParameters = RequestParameters; +export type OperationsNotParameters = RequestParameters; +export type OperationsOrParameters = RequestParameters; +export type OperationsPassParameters = RequestParameters; +export type OperationsRaiseParameters = RequestParameters; +export type OperationsReturnParameters = RequestParameters; +export type OperationsTryParameters = RequestParameters; +export type OperationsWhileParameters = RequestParameters; +export type OperationsWithParameters = RequestParameters; +export type OperationsYieldParameters = RequestParameters; + +export interface ParametersWithAndQueryParamProperties { + and: string; +} + +export interface ParametersWithAndQueryParam { + queryParameters: ParametersWithAndQueryParamProperties; +} + +export type ParametersWithAndParameters = ParametersWithAndQueryParam & + RequestParameters; + +export interface ParametersWithAsQueryParamProperties { + as: string; +} + +export interface ParametersWithAsQueryParam { + queryParameters: ParametersWithAsQueryParamProperties; +} + +export type ParametersWithAsParameters = ParametersWithAsQueryParam & + RequestParameters; + +export interface ParametersWithAssertQueryParamProperties { + assert: string; +} + +export interface ParametersWithAssertQueryParam { + queryParameters: ParametersWithAssertQueryParamProperties; +} + +export type ParametersWithAssertParameters = ParametersWithAssertQueryParam & + RequestParameters; + +export interface ParametersWithAsyncQueryParamProperties { + async: string; +} + +export interface ParametersWithAsyncQueryParam { + queryParameters: ParametersWithAsyncQueryParamProperties; +} + +export type ParametersWithAsyncParameters = ParametersWithAsyncQueryParam & + RequestParameters; + +export interface ParametersWithAwaitQueryParamProperties { + await: string; +} + +export interface ParametersWithAwaitQueryParam { + queryParameters: ParametersWithAwaitQueryParamProperties; +} + +export type ParametersWithAwaitParameters = ParametersWithAwaitQueryParam & + RequestParameters; + +export interface ParametersWithBreakQueryParamProperties { + break: string; +} + +export interface ParametersWithBreakQueryParam { + queryParameters: ParametersWithBreakQueryParamProperties; +} + +export type ParametersWithBreakParameters = ParametersWithBreakQueryParam & + RequestParameters; + +export interface ParametersWithClassQueryParamProperties { + class: string; +} + +export interface ParametersWithClassQueryParam { + queryParameters: ParametersWithClassQueryParamProperties; +} + +export type ParametersWithClassParameters = ParametersWithClassQueryParam & + RequestParameters; + +export interface ParametersWithConstructorQueryParamProperties { + constructor: string; +} + +export interface ParametersWithConstructorQueryParam { + queryParameters: ParametersWithConstructorQueryParamProperties; +} + +export type ParametersWithConstructorParameters = + ParametersWithConstructorQueryParam & RequestParameters; + +export interface ParametersWithContinueQueryParamProperties { + continue: string; +} + +export interface ParametersWithContinueQueryParam { + queryParameters: ParametersWithContinueQueryParamProperties; +} + +export type ParametersWithContinueParameters = + ParametersWithContinueQueryParam & RequestParameters; + +export interface ParametersWithDefQueryParamProperties { + def: string; +} + +export interface ParametersWithDefQueryParam { + queryParameters: ParametersWithDefQueryParamProperties; +} + +export type ParametersWithDefParameters = ParametersWithDefQueryParam & + RequestParameters; + +export interface ParametersWithDelQueryParamProperties { + del: string; +} + +export interface ParametersWithDelQueryParam { + queryParameters: ParametersWithDelQueryParamProperties; +} + +export type ParametersWithDelParameters = ParametersWithDelQueryParam & + RequestParameters; + +export interface ParametersWithElifQueryParamProperties { + elif: string; +} + +export interface ParametersWithElifQueryParam { + queryParameters: ParametersWithElifQueryParamProperties; +} + +export type ParametersWithElifParameters = ParametersWithElifQueryParam & + RequestParameters; + +export interface ParametersWithElseQueryParamProperties { + else: string; +} + +export interface ParametersWithElseQueryParam { + queryParameters: ParametersWithElseQueryParamProperties; +} + +export type ParametersWithElseParameters = ParametersWithElseQueryParam & + RequestParameters; + +export interface ParametersWithExceptQueryParamProperties { + except: string; +} + +export interface ParametersWithExceptQueryParam { + queryParameters: ParametersWithExceptQueryParamProperties; +} + +export type ParametersWithExceptParameters = ParametersWithExceptQueryParam & + RequestParameters; + +export interface ParametersWithExecQueryParamProperties { + exec: string; +} + +export interface ParametersWithExecQueryParam { + queryParameters: ParametersWithExecQueryParamProperties; +} + +export type ParametersWithExecParameters = ParametersWithExecQueryParam & + RequestParameters; + +export interface ParametersWithFinallyQueryParamProperties { + finally: string; +} + +export interface ParametersWithFinallyQueryParam { + queryParameters: ParametersWithFinallyQueryParamProperties; +} + +export type ParametersWithFinallyParameters = ParametersWithFinallyQueryParam & + RequestParameters; + +export interface ParametersWithForQueryParamProperties { + for: string; +} + +export interface ParametersWithForQueryParam { + queryParameters: ParametersWithForQueryParamProperties; +} + +export type ParametersWithForParameters = ParametersWithForQueryParam & + RequestParameters; + +export interface ParametersWithFromQueryParamProperties { + from: string; +} + +export interface ParametersWithFromQueryParam { + queryParameters: ParametersWithFromQueryParamProperties; +} + +export type ParametersWithFromParameters = ParametersWithFromQueryParam & + RequestParameters; + +export interface ParametersWithGlobalQueryParamProperties { + global: string; +} + +export interface ParametersWithGlobalQueryParam { + queryParameters: ParametersWithGlobalQueryParamProperties; +} + +export type ParametersWithGlobalParameters = ParametersWithGlobalQueryParam & + RequestParameters; + +export interface ParametersWithIfQueryParamProperties { + if: string; +} + +export interface ParametersWithIfQueryParam { + queryParameters: ParametersWithIfQueryParamProperties; +} + +export type ParametersWithIfParameters = ParametersWithIfQueryParam & + RequestParameters; + +export interface ParametersWithImportQueryParamProperties { + import: string; +} + +export interface ParametersWithImportQueryParam { + queryParameters: ParametersWithImportQueryParamProperties; +} + +export type ParametersWithImportParameters = ParametersWithImportQueryParam & + RequestParameters; + +export interface ParametersWithInQueryParamProperties { + in: string; +} + +export interface ParametersWithInQueryParam { + queryParameters: ParametersWithInQueryParamProperties; +} + +export type ParametersWithInParameters = ParametersWithInQueryParam & + RequestParameters; + +export interface ParametersWithIsQueryParamProperties { + is: string; +} + +export interface ParametersWithIsQueryParam { + queryParameters: ParametersWithIsQueryParamProperties; +} + +export type ParametersWithIsParameters = ParametersWithIsQueryParam & + RequestParameters; + +export interface ParametersWithLambdaQueryParamProperties { + lambda: string; +} + +export interface ParametersWithLambdaQueryParam { + queryParameters: ParametersWithLambdaQueryParamProperties; +} + +export type ParametersWithLambdaParameters = ParametersWithLambdaQueryParam & + RequestParameters; + +export interface ParametersWithNotQueryParamProperties { + not: string; +} + +export interface ParametersWithNotQueryParam { + queryParameters: ParametersWithNotQueryParamProperties; +} + +export type ParametersWithNotParameters = ParametersWithNotQueryParam & + RequestParameters; + +export interface ParametersWithOrQueryParamProperties { + or: string; +} + +export interface ParametersWithOrQueryParam { + queryParameters: ParametersWithOrQueryParamProperties; +} + +export type ParametersWithOrParameters = ParametersWithOrQueryParam & + RequestParameters; + +export interface ParametersWithPassQueryParamProperties { + pass: string; +} + +export interface ParametersWithPassQueryParam { + queryParameters: ParametersWithPassQueryParamProperties; +} + +export type ParametersWithPassParameters = ParametersWithPassQueryParam & + RequestParameters; + +export interface ParametersWithRaiseQueryParamProperties { + raise: string; +} + +export interface ParametersWithRaiseQueryParam { + queryParameters: ParametersWithRaiseQueryParamProperties; +} + +export type ParametersWithRaiseParameters = ParametersWithRaiseQueryParam & + RequestParameters; + +export interface ParametersWithReturnQueryParamProperties { + return: string; +} + +export interface ParametersWithReturnQueryParam { + queryParameters: ParametersWithReturnQueryParamProperties; +} + +export type ParametersWithReturnParameters = ParametersWithReturnQueryParam & + RequestParameters; + +export interface ParametersWithTryQueryParamProperties { + try: string; +} + +export interface ParametersWithTryQueryParam { + queryParameters: ParametersWithTryQueryParamProperties; +} + +export type ParametersWithTryParameters = ParametersWithTryQueryParam & + RequestParameters; + +export interface ParametersWithWhileQueryParamProperties { + while: string; +} + +export interface ParametersWithWhileQueryParam { + queryParameters: ParametersWithWhileQueryParamProperties; +} + +export type ParametersWithWhileParameters = ParametersWithWhileQueryParam & + RequestParameters; + +export interface ParametersWithWithQueryParamProperties { + with: string; +} + +export interface ParametersWithWithQueryParam { + queryParameters: ParametersWithWithQueryParamProperties; +} + +export type ParametersWithWithParameters = ParametersWithWithQueryParam & + RequestParameters; + +export interface ParametersWithYieldQueryParamProperties { + yield: string; +} + +export interface ParametersWithYieldQueryParam { + queryParameters: ParametersWithYieldQueryParamProperties; +} + +export type ParametersWithYieldParameters = ParametersWithYieldQueryParam & + RequestParameters; + +export interface ParametersWithCancellationTokenQueryParamProperties { + cancellationToken: string; +} + +export interface ParametersWithCancellationTokenQueryParam { + queryParameters: ParametersWithCancellationTokenQueryParamProperties; +} + +export type ParametersWithCancellationTokenParameters = + ParametersWithCancellationTokenQueryParam & RequestParameters; diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/responses.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/responses.ts new file mode 100644 index 0000000000..1dc5cb1660 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/responses.ts @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { HttpResponse } from "@azure-rest/core-client"; + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithAnd204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithAs204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithAssert204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithAsync204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithAwait204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithBreak204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithClass204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithConstructor204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithContinue204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithDef204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithDel204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithElif204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithElse204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithExcept204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithExec204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithFinally204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithFor204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithFrom204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithGlobal204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithIf204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithImport204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithIn204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithIs204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithLambda204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithNot204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithOr204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithPass204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithRaise204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithReturn204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithTry204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithWhile204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithWith204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelsWithYield204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ModelPropertiesSameAsModel204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsAnd204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsAs204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsAssert204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsAsync204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsAwait204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsBreak204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsClass204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsConstructor204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsContinue204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsDef204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsDel204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsElif204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsElse204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsExcept204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsExec204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsFinally204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsFor204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsFrom204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsGlobal204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsIf204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsImport204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsIn204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsIs204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsLambda204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsNot204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsOr204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsPass204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsRaise204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsReturn204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsTry204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsWhile204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsWith204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface OperationsYield204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithAnd204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithAs204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithAssert204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithAsync204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithAwait204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithBreak204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithClass204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithConstructor204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithContinue204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithDef204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithDel204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithElif204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithElse204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithExcept204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithExec204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithFinally204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithFor204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithFrom204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithGlobal204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithIf204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithImport204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithIn204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithIs204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithLambda204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithNot204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithOr204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithPass204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithRaise204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithReturn204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithTry204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithWhile204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithWith204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithYield204Response extends HttpResponse { + status: "204"; +} + +/** There is no content to send for this request, but the headers may be useful. */ +export interface ParametersWithCancellationToken204Response + extends HttpResponse { + status: "204"; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/specialWordsClient.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/specialWordsClient.ts new file mode 100644 index 0000000000..3c45ea7338 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/rest/specialWordsClient.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; +import { SpecialWordsContext } from "./clientDefinitions.js"; + +/** + * Initialize a new instance of `SpecialWordsContext` + * @param options - the parameter for all optional parameters + */ +export default function createClient( + options: ClientOptions = {}, +): SpecialWordsContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `http://localhost:3000`; + const userAgentInfo = `azsdk-js-special-words-rest/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` + : `${userAgentInfo}`; + options = { + ...options, + userAgentOptions: { + userAgentPrefix, + }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + }; + + const client = getClient(endpointUrl, options) as SpecialWordsContext; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + return client; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/specialWordsClient.ts b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/specialWordsClient.ts new file mode 100644 index 0000000000..7ec34ccd2b --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/src/specialWordsClient.ts @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Pipeline } from "@azure/core-rest-pipeline"; +import { + getModelsOperations, + ModelsOperations, +} from "./classic/models/index.js"; +import { + getModelPropertiesOperations, + ModelPropertiesOperations, +} from "./classic/modelProperties/index.js"; +import { + getOperationsOperations, + OperationsOperations, +} from "./classic/operations/index.js"; +import { + getParametersOperations, + ParametersOperations, +} from "./classic/parameters/index.js"; +import { + createSpecialWords, + SpecialWordsClientOptions, + SpecialWordsContext, +} from "./api/index.js"; + +export { SpecialWordsClientOptions } from "./api/specialWordsContext.js"; + +export class SpecialWordsClient { + private _client: SpecialWordsContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ``` + */ + constructor(options: SpecialWordsClientOptions = {}) { + this._client = createSpecialWords(options); + this.pipeline = this._client.pipeline; + this.models = getModelsOperations(this._client); + this.modelProperties = getModelPropertiesOperations(this._client); + this.operations = getOperationsOperations(this._client); + this.parameters = getParametersOperations(this._client); + } + + /** The operation groups for Models */ + public readonly models: ModelsOperations; + /** The operation groups for ModelProperties */ + public readonly modelProperties: ModelPropertiesOperations; + /** The operation groups for Operations */ + public readonly operations: OperationsOperations; + /** The operation groups for Parameters */ + public readonly parameters: ParametersOperations; +} diff --git a/packages/typespec-ts/test/modularIntegration/generated/specialWords/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/specialWords/tspconfig.yaml new file mode 100644 index 0000000000..ac85e7e807 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/generated/specialWords/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: false + generateTest: false + addCredentials: false + azureSdkForJs: false + isTypeSpecTest: true + title: SpecialWordsClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/special-words" + description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/enumsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/enumsOnly/index.ts index d054dd5b54..ce5dceaf7f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/enumsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/enumsOnly/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - EnumsOnlyGetOptions, - EnumsOnlySendOptions, + EnumsOnlyGetOptionalParams, + EnumsOnlySendOptionalParams, } from "../../models/options.js"; export function _enumsOnlyGetSend( context: Client, - options: EnumsOnlyGetOptions = { requestOptions: {} }, + options: EnumsOnlyGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/enums-only") @@ -40,7 +40,7 @@ export async function _enumsOnlyGetDeserialize( export async function enumsOnlyGet( context: Client, - options: EnumsOnlyGetOptions = { requestOptions: {} }, + options: EnumsOnlyGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: EnumsOnlyCases }> { const result = await _enumsOnlyGetSend(context, options); return _enumsOnlyGetDeserialize(result); @@ -49,7 +49,7 @@ export async function enumsOnlyGet( export function _enumsOnlySendSend( context: Client, prop: EnumsOnlyCases, - options: EnumsOnlySendOptions = { requestOptions: {} }, + options: EnumsOnlySendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/enums-only") @@ -72,7 +72,7 @@ export async function _enumsOnlySendDeserialize( export async function enumsOnlySend( context: Client, prop: EnumsOnlyCases, - options: EnumsOnlySendOptions = { requestOptions: {} }, + options: EnumsOnlySendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _enumsOnlySendSend(context, prop, options); return _enumsOnlySendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/floatsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/floatsOnly/index.ts index 2fc09e52eb..7d5f84a271 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/floatsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/floatsOnly/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - FloatsOnlyGetOptions, - FloatsOnlySendOptions, + FloatsOnlyGetOptionalParams, + FloatsOnlySendOptionalParams, } from "../../models/options.js"; export function _floatsOnlyGetSend( context: Client, - options: FloatsOnlyGetOptions = { requestOptions: {} }, + options: FloatsOnlyGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/floats-only") @@ -39,7 +39,7 @@ export async function _floatsOnlyGetDeserialize( export async function floatsOnlyGet( context: Client, - options: FloatsOnlyGetOptions = { requestOptions: {} }, + options: FloatsOnlyGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: 1.1 | 2.2 | 3.3 }> { const result = await _floatsOnlyGetSend(context, options); return _floatsOnlyGetDeserialize(result); @@ -48,7 +48,7 @@ export async function floatsOnlyGet( export function _floatsOnlySendSend( context: Client, prop: 1.1 | 2.2 | 3.3, - options: FloatsOnlySendOptions = { requestOptions: {} }, + options: FloatsOnlySendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/floats-only") @@ -71,7 +71,7 @@ export async function _floatsOnlySendDeserialize( export async function floatsOnlySend( context: Client, prop: 1.1 | 2.2 | 3.3, - options: FloatsOnlySendOptions = { requestOptions: {} }, + options: FloatsOnlySendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _floatsOnlySendSend(context, prop, options); return _floatsOnlySendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/index.ts index 4bae708187..08b8efa323 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/index.ts @@ -5,7 +5,7 @@ export { createUnion, UnionClientOptions, UnionContext, -} from "./UnionContext.js"; +} from "./unionContext.js"; export { enumsOnlyGet, enumsOnlySend } from "./enumsOnly/index.js"; export { floatsOnlyGet, floatsOnlySend } from "./floatsOnly/index.js"; export { intsOnlyGet, intsOnlySend } from "./intsOnly/index.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/intsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/intsOnly/index.ts index 8a5e3ed16e..c8d95d67cd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/intsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/intsOnly/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - IntsOnlyGetOptions, - IntsOnlySendOptions, + IntsOnlyGetOptionalParams, + IntsOnlySendOptionalParams, } from "../../models/options.js"; export function _intsOnlyGetSend( context: Client, - options: IntsOnlyGetOptions = { requestOptions: {} }, + options: IntsOnlyGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/ints-only") @@ -39,7 +39,7 @@ export async function _intsOnlyGetDeserialize( export async function intsOnlyGet( context: Client, - options: IntsOnlyGetOptions = { requestOptions: {} }, + options: IntsOnlyGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: 1 | 2 | 3 }> { const result = await _intsOnlyGetSend(context, options); return _intsOnlyGetDeserialize(result); @@ -48,7 +48,7 @@ export async function intsOnlyGet( export function _intsOnlySendSend( context: Client, prop: 1 | 2 | 3, - options: IntsOnlySendOptions = { requestOptions: {} }, + options: IntsOnlySendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/ints-only") @@ -71,7 +71,7 @@ export async function _intsOnlySendDeserialize( export async function intsOnlySend( context: Client, prop: 1 | 2 | 3, - options: IntsOnlySendOptions = { requestOptions: {} }, + options: IntsOnlySendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _intsOnlySendSend(context, prop, options); return _intsOnlySendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedLiterals/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedLiterals/index.ts index 5f69da8781..37dcf7c532 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedLiterals/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedLiterals/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - MixedLiteralsGetOptions, - MixedLiteralsSendOptions, + MixedLiteralsGetOptionalParams, + MixedLiteralsSendOptionalParams, } from "../../models/options.js"; export function _mixedLiteralsGetSend( context: Client, - options: MixedLiteralsGetOptions = { requestOptions: {} }, + options: MixedLiteralsGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/mixed-literals") @@ -45,7 +45,7 @@ export async function _mixedLiteralsGetDeserialize( export async function mixedLiteralsGet( context: Client, - options: MixedLiteralsGetOptions = { requestOptions: {} }, + options: MixedLiteralsGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: MixedLiteralsCases }> { const result = await _mixedLiteralsGetSend(context, options); return _mixedLiteralsGetDeserialize(result); @@ -54,7 +54,7 @@ export async function mixedLiteralsGet( export function _mixedLiteralsSendSend( context: Client, prop: MixedLiteralsCases, - options: MixedLiteralsSendOptions = { requestOptions: {} }, + options: MixedLiteralsSendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/mixed-literals") @@ -84,7 +84,7 @@ export async function _mixedLiteralsSendDeserialize( export async function mixedLiteralsSend( context: Client, prop: MixedLiteralsCases, - options: MixedLiteralsSendOptions = { requestOptions: {} }, + options: MixedLiteralsSendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _mixedLiteralsSendSend(context, prop, options); return _mixedLiteralsSendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedTypes/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedTypes/index.ts index 0e9ebaa127..01ef58fff0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedTypes/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/mixedTypes/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - MixedTypesGetOptions, - MixedTypesSendOptions, + MixedTypesGetOptionalParams, + MixedTypesSendOptionalParams, } from "../../models/options.js"; export function _mixedTypesGetSend( context: Client, - options: MixedTypesGetOptions = { requestOptions: {} }, + options: MixedTypesGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/mixed-types") @@ -45,7 +45,7 @@ export async function _mixedTypesGetDeserialize( export async function mixedTypesGet( context: Client, - options: MixedTypesGetOptions = { requestOptions: {} }, + options: MixedTypesGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: MixedTypesCases }> { const result = await _mixedTypesGetSend(context, options); return _mixedTypesGetDeserialize(result); @@ -54,7 +54,7 @@ export async function mixedTypesGet( export function _mixedTypesSendSend( context: Client, prop: MixedTypesCases, - options: MixedTypesSendOptions = { requestOptions: {} }, + options: MixedTypesSendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/mixed-types") @@ -84,7 +84,7 @@ export async function _mixedTypesSendDeserialize( export async function mixedTypesSend( context: Client, prop: MixedTypesCases, - options: MixedTypesSendOptions = { requestOptions: {} }, + options: MixedTypesSendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _mixedTypesSendSend(context, prop, options); return _mixedTypesSendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/modelsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/modelsOnly/index.ts index 7359659cca..52115bbbb7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/modelsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/modelsOnly/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - ModelsOnlyGetOptions, - ModelsOnlySendOptions, + ModelsOnlyGetOptionalParams, + ModelsOnlySendOptionalParams, } from "../../models/options.js"; export function _modelsOnlyGetSend( context: Client, - options: ModelsOnlyGetOptions = { requestOptions: {} }, + options: ModelsOnlyGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/models-only") @@ -40,7 +40,7 @@ export async function _modelsOnlyGetDeserialize( export async function modelsOnlyGet( context: Client, - options: ModelsOnlyGetOptions = { requestOptions: {} }, + options: ModelsOnlyGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: Cat | Dog }> { const result = await _modelsOnlyGetSend(context, options); return _modelsOnlyGetDeserialize(result); @@ -49,7 +49,7 @@ export async function modelsOnlyGet( export function _modelsOnlySendSend( context: Client, prop: Cat | Dog, - options: ModelsOnlySendOptions = { requestOptions: {} }, + options: ModelsOnlySendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/models-only") @@ -72,7 +72,7 @@ export async function _modelsOnlySendDeserialize( export async function modelsOnlySend( context: Client, prop: Cat | Dog, - options: ModelsOnlySendOptions = { requestOptions: {} }, + options: ModelsOnlySendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _modelsOnlySendSend(context, prop, options); return _modelsOnlySendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringAndArray/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringAndArray/index.ts index d02907d7b9..4bc15d215e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringAndArray/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringAndArray/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - StringAndArrayGetOptions, - StringAndArraySendOptions, + StringAndArrayGetOptionalParams, + StringAndArraySendOptionalParams, } from "../../models/options.js"; export function _stringAndArrayGetSend( context: Client, - options: StringAndArrayGetOptions = { requestOptions: {} }, + options: StringAndArrayGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/string-and-array") @@ -43,7 +43,7 @@ export async function _stringAndArrayGetDeserialize( export async function stringAndArrayGet( context: Client, - options: StringAndArrayGetOptions = { requestOptions: {} }, + options: StringAndArrayGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: StringAndArrayCases }> { const result = await _stringAndArrayGetSend(context, options); return _stringAndArrayGetDeserialize(result); @@ -52,7 +52,7 @@ export async function stringAndArrayGet( export function _stringAndArraySendSend( context: Client, prop: StringAndArrayCases, - options: StringAndArraySendOptions = { requestOptions: {} }, + options: StringAndArraySendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/string-and-array") @@ -75,7 +75,7 @@ export async function _stringAndArraySendDeserialize( export async function stringAndArraySend( context: Client, prop: StringAndArrayCases, - options: StringAndArraySendOptions = { requestOptions: {} }, + options: StringAndArraySendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringAndArraySendSend(context, prop, options); return _stringAndArraySendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensible/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensible/index.ts index 7694404b3f..aca87f6fdc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensible/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensible/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - StringExtensibleGetOptions, - StringExtensibleSendOptions, + StringExtensibleGetOptionalParams, + StringExtensibleSendOptionalParams, } from "../../models/options.js"; export function _stringExtensibleGetSend( context: Client, - options: StringExtensibleGetOptions = { requestOptions: {} }, + options: StringExtensibleGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/string-extensible") @@ -39,7 +39,7 @@ export async function _stringExtensibleGetDeserialize( export async function stringExtensibleGet( context: Client, - options: StringExtensibleGetOptions = { requestOptions: {} }, + options: StringExtensibleGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: string | "b" | "c" }> { const result = await _stringExtensibleGetSend(context, options); return _stringExtensibleGetDeserialize(result); @@ -48,7 +48,7 @@ export async function stringExtensibleGet( export function _stringExtensibleSendSend( context: Client, prop: string | "b" | "c", - options: StringExtensibleSendOptions = { requestOptions: {} }, + options: StringExtensibleSendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/string-extensible") @@ -71,7 +71,7 @@ export async function _stringExtensibleSendDeserialize( export async function stringExtensibleSend( context: Client, prop: string | "b" | "c", - options: StringExtensibleSendOptions = { requestOptions: {} }, + options: StringExtensibleSendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringExtensibleSendSend(context, prop, options); return _stringExtensibleSendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensibleNamed/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensibleNamed/index.ts index d5e30927d5..35f0e3c9ca 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensibleNamed/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringExtensibleNamed/index.ts @@ -13,13 +13,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - StringExtensibleNamedGetOptions, - StringExtensibleNamedSendOptions, + StringExtensibleNamedGetOptionalParams, + StringExtensibleNamedSendOptionalParams, } from "../../models/options.js"; export function _stringExtensibleNamedGetSend( context: Client, - options: StringExtensibleNamedGetOptions = { requestOptions: {} }, + options: StringExtensibleNamedGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/string-extensible-named") @@ -40,7 +40,7 @@ export async function _stringExtensibleNamedGetDeserialize( export async function stringExtensibleNamedGet( context: Client, - options: StringExtensibleNamedGetOptions = { requestOptions: {} }, + options: StringExtensibleNamedGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: StringExtensibleNamedUnion }> { const result = await _stringExtensibleNamedGetSend(context, options); return _stringExtensibleNamedGetDeserialize(result); @@ -49,7 +49,7 @@ export async function stringExtensibleNamedGet( export function _stringExtensibleNamedSendSend( context: Client, prop: StringExtensibleNamedUnion, - options: StringExtensibleNamedSendOptions = { requestOptions: {} }, + options: StringExtensibleNamedSendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/string-extensible-named") @@ -72,7 +72,7 @@ export async function _stringExtensibleNamedSendDeserialize( export async function stringExtensibleNamedSend( context: Client, prop: StringExtensibleNamedUnion, - options: StringExtensibleNamedSendOptions = { requestOptions: {} }, + options: StringExtensibleNamedSendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringExtensibleNamedSendSend(context, prop, options); return _stringExtensibleNamedSendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringsOnly/index.ts index 6f0d70ff83..ff80ff2699 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/stringsOnly/index.ts @@ -12,13 +12,13 @@ import { createRestError, } from "@azure-rest/core-client"; import { - StringsOnlyGetOptions, - StringsOnlySendOptions, + StringsOnlyGetOptionalParams, + StringsOnlySendOptionalParams, } from "../../models/options.js"; export function _stringsOnlyGetSend( context: Client, - options: StringsOnlyGetOptions = { requestOptions: {} }, + options: StringsOnlyGetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/strings-only") @@ -39,7 +39,7 @@ export async function _stringsOnlyGetDeserialize( export async function stringsOnlyGet( context: Client, - options: StringsOnlyGetOptions = { requestOptions: {} }, + options: StringsOnlyGetOptionalParams = { requestOptions: {} }, ): Promise<{ prop: "a" | "b" | "c" }> { const result = await _stringsOnlyGetSend(context, options); return _stringsOnlyGetDeserialize(result); @@ -48,7 +48,7 @@ export async function stringsOnlyGet( export function _stringsOnlySendSend( context: Client, prop: "a" | "b" | "c", - options: StringsOnlySendOptions = { requestOptions: {} }, + options: StringsOnlySendOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/union/strings-only") @@ -71,7 +71,7 @@ export async function _stringsOnlySendDeserialize( export async function stringsOnlySend( context: Client, prop: "a" | "b" | "c", - options: StringsOnlySendOptions = { requestOptions: {} }, + options: StringsOnlySendOptionalParams = { requestOptions: {} }, ): Promise { const result = await _stringsOnlySendSend(context, prop, options); return _stringsOnlySendDeserialize(result); diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/UnionContext.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/api/unionContext.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/unions/src/api/UnionContext.ts rename to packages/typespec-ts/test/modularIntegration/generated/unions/src/api/unionContext.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/enumsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/enumsOnly/index.ts index 2484912a6c..b0d9499696 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/enumsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/enumsOnly/index.ts @@ -1,23 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { EnumsOnlyCases } from "../../models/models.js"; import { enumsOnlyGet, enumsOnlySend } from "../../api/enumsOnly/index.js"; import { - EnumsOnlyGetOptions, - EnumsOnlySendOptions, + EnumsOnlyGetOptionalParams, + EnumsOnlySendOptionalParams, } from "../../models/options.js"; export interface EnumsOnlyOperations { - get: (options?: EnumsOnlyGetOptions) => Promise<{ prop: EnumsOnlyCases }>; - send: (prop: EnumsOnlyCases, options?: EnumsOnlySendOptions) => Promise; + get: ( + options?: EnumsOnlyGetOptionalParams, + ) => Promise<{ prop: EnumsOnlyCases }>; + send: ( + prop: EnumsOnlyCases, + options?: EnumsOnlySendOptionalParams, + ) => Promise; } export function getEnumsOnly(context: UnionContext) { return { - get: (options?: EnumsOnlyGetOptions) => enumsOnlyGet(context, options), - send: (prop: EnumsOnlyCases, options?: EnumsOnlySendOptions) => + get: (options?: EnumsOnlyGetOptionalParams) => + enumsOnlyGet(context, options), + send: (prop: EnumsOnlyCases, options?: EnumsOnlySendOptionalParams) => enumsOnlySend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/floatsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/floatsOnly/index.ts index 1a8aaa139f..75fd5fb4af 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/floatsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/floatsOnly/index.ts @@ -1,25 +1,28 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { floatsOnlyGet, floatsOnlySend } from "../../api/floatsOnly/index.js"; import { - FloatsOnlyGetOptions, - FloatsOnlySendOptions, + FloatsOnlyGetOptionalParams, + FloatsOnlySendOptionalParams, } from "../../models/options.js"; export interface FloatsOnlyOperations { - get: (options?: FloatsOnlyGetOptions) => Promise<{ prop: 1.1 | 2.2 | 3.3 }>; + get: ( + options?: FloatsOnlyGetOptionalParams, + ) => Promise<{ prop: 1.1 | 2.2 | 3.3 }>; send: ( prop: 1.1 | 2.2 | 3.3, - options?: FloatsOnlySendOptions, + options?: FloatsOnlySendOptionalParams, ) => Promise; } export function getFloatsOnly(context: UnionContext) { return { - get: (options?: FloatsOnlyGetOptions) => floatsOnlyGet(context, options), - send: (prop: 1.1 | 2.2 | 3.3, options?: FloatsOnlySendOptions) => + get: (options?: FloatsOnlyGetOptionalParams) => + floatsOnlyGet(context, options), + send: (prop: 1.1 | 2.2 | 3.3, options?: FloatsOnlySendOptionalParams) => floatsOnlySend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/intsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/intsOnly/index.ts index 8fc52fdcb5..c8a7ce9f6e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/intsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/intsOnly/index.ts @@ -1,22 +1,25 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { intsOnlyGet, intsOnlySend } from "../../api/intsOnly/index.js"; import { - IntsOnlyGetOptions, - IntsOnlySendOptions, + IntsOnlyGetOptionalParams, + IntsOnlySendOptionalParams, } from "../../models/options.js"; export interface IntsOnlyOperations { - get: (options?: IntsOnlyGetOptions) => Promise<{ prop: 1 | 2 | 3 }>; - send: (prop: 1 | 2 | 3, options?: IntsOnlySendOptions) => Promise; + get: (options?: IntsOnlyGetOptionalParams) => Promise<{ prop: 1 | 2 | 3 }>; + send: ( + prop: 1 | 2 | 3, + options?: IntsOnlySendOptionalParams, + ) => Promise; } export function getIntsOnly(context: UnionContext) { return { - get: (options?: IntsOnlyGetOptions) => intsOnlyGet(context, options), - send: (prop: 1 | 2 | 3, options?: IntsOnlySendOptions) => + get: (options?: IntsOnlyGetOptionalParams) => intsOnlyGet(context, options), + send: (prop: 1 | 2 | 3, options?: IntsOnlySendOptionalParams) => intsOnlySend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedLiterals/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedLiterals/index.ts index 4618cdf544..bfa16d3038 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedLiterals/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedLiterals/index.ts @@ -1,33 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { MixedLiteralsCases } from "../../models/models.js"; import { mixedLiteralsGet, mixedLiteralsSend, } from "../../api/mixedLiterals/index.js"; import { - MixedLiteralsGetOptions, - MixedLiteralsSendOptions, + MixedLiteralsGetOptionalParams, + MixedLiteralsSendOptionalParams, } from "../../models/options.js"; export interface MixedLiteralsOperations { get: ( - options?: MixedLiteralsGetOptions, + options?: MixedLiteralsGetOptionalParams, ) => Promise<{ prop: MixedLiteralsCases }>; send: ( prop: MixedLiteralsCases, - options?: MixedLiteralsSendOptions, + options?: MixedLiteralsSendOptionalParams, ) => Promise; } export function getMixedLiterals(context: UnionContext) { return { - get: (options?: MixedLiteralsGetOptions) => + get: (options?: MixedLiteralsGetOptionalParams) => mixedLiteralsGet(context, options), - send: (prop: MixedLiteralsCases, options?: MixedLiteralsSendOptions) => - mixedLiteralsSend(context, prop, options), + send: ( + prop: MixedLiteralsCases, + options?: MixedLiteralsSendOptionalParams, + ) => mixedLiteralsSend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedTypes/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedTypes/index.ts index 164bd95bcc..f61c485e23 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedTypes/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/mixedTypes/index.ts @@ -1,26 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { MixedTypesCases } from "../../models/models.js"; import { mixedTypesGet, mixedTypesSend } from "../../api/mixedTypes/index.js"; import { - MixedTypesGetOptions, - MixedTypesSendOptions, + MixedTypesGetOptionalParams, + MixedTypesSendOptionalParams, } from "../../models/options.js"; export interface MixedTypesOperations { - get: (options?: MixedTypesGetOptions) => Promise<{ prop: MixedTypesCases }>; + get: ( + options?: MixedTypesGetOptionalParams, + ) => Promise<{ prop: MixedTypesCases }>; send: ( prop: MixedTypesCases, - options?: MixedTypesSendOptions, + options?: MixedTypesSendOptionalParams, ) => Promise; } export function getMixedTypes(context: UnionContext) { return { - get: (options?: MixedTypesGetOptions) => mixedTypesGet(context, options), - send: (prop: MixedTypesCases, options?: MixedTypesSendOptions) => + get: (options?: MixedTypesGetOptionalParams) => + mixedTypesGet(context, options), + send: (prop: MixedTypesCases, options?: MixedTypesSendOptionalParams) => mixedTypesSend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/modelsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/modelsOnly/index.ts index 8ccf219e1b..0744599ccc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/modelsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/modelsOnly/index.ts @@ -1,23 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { Cat, Dog } from "../../models/models.js"; import { modelsOnlyGet, modelsOnlySend } from "../../api/modelsOnly/index.js"; import { - ModelsOnlyGetOptions, - ModelsOnlySendOptions, + ModelsOnlyGetOptionalParams, + ModelsOnlySendOptionalParams, } from "../../models/options.js"; export interface ModelsOnlyOperations { - get: (options?: ModelsOnlyGetOptions) => Promise<{ prop: Cat | Dog }>; - send: (prop: Cat | Dog, options?: ModelsOnlySendOptions) => Promise; + get: (options?: ModelsOnlyGetOptionalParams) => Promise<{ prop: Cat | Dog }>; + send: ( + prop: Cat | Dog, + options?: ModelsOnlySendOptionalParams, + ) => Promise; } export function getModelsOnly(context: UnionContext) { return { - get: (options?: ModelsOnlyGetOptions) => modelsOnlyGet(context, options), - send: (prop: Cat | Dog, options?: ModelsOnlySendOptions) => + get: (options?: ModelsOnlyGetOptionalParams) => + modelsOnlyGet(context, options), + send: (prop: Cat | Dog, options?: ModelsOnlySendOptionalParams) => modelsOnlySend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringAndArray/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringAndArray/index.ts index 3bc8235a1d..ca0a02ae77 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringAndArray/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringAndArray/index.ts @@ -1,33 +1,35 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { StringAndArrayCases } from "../../models/models.js"; import { stringAndArrayGet, stringAndArraySend, } from "../../api/stringAndArray/index.js"; import { - StringAndArrayGetOptions, - StringAndArraySendOptions, + StringAndArrayGetOptionalParams, + StringAndArraySendOptionalParams, } from "../../models/options.js"; export interface StringAndArrayOperations { get: ( - options?: StringAndArrayGetOptions, + options?: StringAndArrayGetOptionalParams, ) => Promise<{ prop: StringAndArrayCases }>; send: ( prop: StringAndArrayCases, - options?: StringAndArraySendOptions, + options?: StringAndArraySendOptionalParams, ) => Promise; } export function getStringAndArray(context: UnionContext) { return { - get: (options?: StringAndArrayGetOptions) => + get: (options?: StringAndArrayGetOptionalParams) => stringAndArrayGet(context, options), - send: (prop: StringAndArrayCases, options?: StringAndArraySendOptions) => - stringAndArraySend(context, prop, options), + send: ( + prop: StringAndArrayCases, + options?: StringAndArraySendOptionalParams, + ) => stringAndArraySend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensible/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensible/index.ts index 985c5605e6..5a2b938508 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensible/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensible/index.ts @@ -1,32 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { stringExtensibleGet, stringExtensibleSend, } from "../../api/stringExtensible/index.js"; import { - StringExtensibleGetOptions, - StringExtensibleSendOptions, + StringExtensibleGetOptionalParams, + StringExtensibleSendOptionalParams, } from "../../models/options.js"; export interface StringExtensibleOperations { get: ( - options?: StringExtensibleGetOptions, + options?: StringExtensibleGetOptionalParams, ) => Promise<{ prop: string | "b" | "c" }>; send: ( prop: string | "b" | "c", - options?: StringExtensibleSendOptions, + options?: StringExtensibleSendOptionalParams, ) => Promise; } export function getStringExtensible(context: UnionContext) { return { - get: (options?: StringExtensibleGetOptions) => + get: (options?: StringExtensibleGetOptionalParams) => stringExtensibleGet(context, options), - send: (prop: string | "b" | "c", options?: StringExtensibleSendOptions) => - stringExtensibleSend(context, prop, options), + send: ( + prop: string | "b" | "c", + options?: StringExtensibleSendOptionalParams, + ) => stringExtensibleSend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensibleNamed/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensibleNamed/index.ts index 66af8dbe60..6ba09a7594 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensibleNamed/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringExtensibleNamed/index.ts @@ -1,34 +1,34 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { StringExtensibleNamedUnion } from "../../models/models.js"; import { stringExtensibleNamedGet, stringExtensibleNamedSend, } from "../../api/stringExtensibleNamed/index.js"; import { - StringExtensibleNamedGetOptions, - StringExtensibleNamedSendOptions, + StringExtensibleNamedGetOptionalParams, + StringExtensibleNamedSendOptionalParams, } from "../../models/options.js"; export interface StringExtensibleNamedOperations { get: ( - options?: StringExtensibleNamedGetOptions, + options?: StringExtensibleNamedGetOptionalParams, ) => Promise<{ prop: StringExtensibleNamedUnion }>; send: ( prop: StringExtensibleNamedUnion, - options?: StringExtensibleNamedSendOptions, + options?: StringExtensibleNamedSendOptionalParams, ) => Promise; } export function getStringExtensibleNamed(context: UnionContext) { return { - get: (options?: StringExtensibleNamedGetOptions) => + get: (options?: StringExtensibleNamedGetOptionalParams) => stringExtensibleNamedGet(context, options), send: ( prop: StringExtensibleNamedUnion, - options?: StringExtensibleNamedSendOptions, + options?: StringExtensibleNamedSendOptionalParams, ) => stringExtensibleNamedSend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringsOnly/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringsOnly/index.ts index 6e2eb47157..08c81781e0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringsOnly/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/classic/stringsOnly/index.ts @@ -1,28 +1,31 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { UnionContext } from "../../api/UnionContext.js"; +import { UnionContext } from "../../api/unionContext.js"; import { stringsOnlyGet, stringsOnlySend, } from "../../api/stringsOnly/index.js"; import { - StringsOnlyGetOptions, - StringsOnlySendOptions, + StringsOnlyGetOptionalParams, + StringsOnlySendOptionalParams, } from "../../models/options.js"; export interface StringsOnlyOperations { - get: (options?: StringsOnlyGetOptions) => Promise<{ prop: "a" | "b" | "c" }>; + get: ( + options?: StringsOnlyGetOptionalParams, + ) => Promise<{ prop: "a" | "b" | "c" }>; send: ( prop: "a" | "b" | "c", - options?: StringsOnlySendOptions, + options?: StringsOnlySendOptionalParams, ) => Promise; } export function getStringsOnly(context: UnionContext) { return { - get: (options?: StringsOnlyGetOptions) => stringsOnlyGet(context, options), - send: (prop: "a" | "b" | "c", options?: StringsOnlySendOptions) => + get: (options?: StringsOnlyGetOptionalParams) => + stringsOnlyGet(context, options), + send: (prop: "a" | "b" | "c", options?: StringsOnlySendOptionalParams) => stringsOnlySend(context, prop, options), }; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/index.ts index 5ffc126375..a80f2133f1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/index.ts @@ -1,35 +1,37 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export { UnionClient, UnionClientOptions } from "./UnionClient.js"; +export { UnionClient, UnionClientOptions } from "./unionClient.js"; export { MixedTypesCases, Cat, MixedLiteralsCases, StringAndArrayCases, EnumsOnlyCases, + LR, + UD, Dog, StringExtensibleNamedUnion, - StringsOnlyGetOptions, - StringsOnlySendOptions, - StringExtensibleGetOptions, - StringExtensibleSendOptions, - StringExtensibleNamedGetOptions, - StringExtensibleNamedSendOptions, - IntsOnlyGetOptions, - IntsOnlySendOptions, - FloatsOnlyGetOptions, - FloatsOnlySendOptions, - ModelsOnlyGetOptions, - ModelsOnlySendOptions, - EnumsOnlyGetOptions, - EnumsOnlySendOptions, - StringAndArrayGetOptions, - StringAndArraySendOptions, - MixedLiteralsGetOptions, - MixedLiteralsSendOptions, - MixedTypesGetOptions, - MixedTypesSendOptions, + StringsOnlyGetOptionalParams, + StringsOnlySendOptionalParams, + StringExtensibleGetOptionalParams, + StringExtensibleSendOptionalParams, + StringExtensibleNamedGetOptionalParams, + StringExtensibleNamedSendOptionalParams, + IntsOnlyGetOptionalParams, + IntsOnlySendOptionalParams, + FloatsOnlyGetOptionalParams, + FloatsOnlySendOptionalParams, + ModelsOnlyGetOptionalParams, + ModelsOnlySendOptionalParams, + EnumsOnlyGetOptionalParams, + EnumsOnlySendOptionalParams, + StringAndArrayGetOptionalParams, + StringAndArraySendOptionalParams, + MixedLiteralsGetOptionalParams, + MixedLiteralsSendOptionalParams, + MixedTypesGetOptionalParams, + MixedTypesSendOptionalParams, } from "./models/index.js"; export { EnumsOnlyOperations, diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/index.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/index.ts index 518ee3740c..cc0debfdcc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/index.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/index.ts @@ -7,28 +7,30 @@ export { MixedLiteralsCases, StringAndArrayCases, EnumsOnlyCases, + LR, + UD, Dog, StringExtensibleNamedUnion, } from "./models.js"; export { - StringsOnlyGetOptions, - StringsOnlySendOptions, - StringExtensibleGetOptions, - StringExtensibleSendOptions, - StringExtensibleNamedGetOptions, - StringExtensibleNamedSendOptions, - IntsOnlyGetOptions, - IntsOnlySendOptions, - FloatsOnlyGetOptions, - FloatsOnlySendOptions, - ModelsOnlyGetOptions, - ModelsOnlySendOptions, - EnumsOnlyGetOptions, - EnumsOnlySendOptions, - StringAndArrayGetOptions, - StringAndArraySendOptions, - MixedLiteralsGetOptions, - MixedLiteralsSendOptions, - MixedTypesGetOptions, - MixedTypesSendOptions, + StringsOnlyGetOptionalParams, + StringsOnlySendOptionalParams, + StringExtensibleGetOptionalParams, + StringExtensibleSendOptionalParams, + StringExtensibleNamedGetOptionalParams, + StringExtensibleNamedSendOptionalParams, + IntsOnlyGetOptionalParams, + IntsOnlySendOptionalParams, + FloatsOnlyGetOptionalParams, + FloatsOnlySendOptionalParams, + ModelsOnlyGetOptionalParams, + ModelsOnlySendOptionalParams, + EnumsOnlyGetOptionalParams, + EnumsOnlySendOptionalParams, + StringAndArrayGetOptionalParams, + StringAndArraySendOptionalParams, + MixedLiteralsGetOptionalParams, + MixedLiteralsSendOptionalParams, + MixedTypesGetOptionalParams, + MixedTypesSendOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/models.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/models.ts index 66bdf47da1..67dc067ad0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/models.ts @@ -36,11 +36,16 @@ export interface StringAndArrayCases { export interface EnumsOnlyCases { /** This should be receive/send the left variant */ - lr: string | "left" | "right" | "up" | "down"; + lr: LR | UD; /** This should be receive/send the up variant */ - ud: string | "up" | "down"; + ud: UD | UD; } +/** */ +export type LR = "left" | "right"; +/** */ +export type UD = "up" | "down"; + export interface Dog { bark: string; } diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/options.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/options.ts index aebef5a2a5..edcc28b779 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/options.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/models/options.ts @@ -3,42 +3,44 @@ import { OperationOptions } from "@azure-rest/core-client"; -export interface StringsOnlyGetOptions extends OperationOptions {} +export interface StringsOnlyGetOptionalParams extends OperationOptions {} -export interface StringsOnlySendOptions extends OperationOptions {} +export interface StringsOnlySendOptionalParams extends OperationOptions {} -export interface StringExtensibleGetOptions extends OperationOptions {} +export interface StringExtensibleGetOptionalParams extends OperationOptions {} -export interface StringExtensibleSendOptions extends OperationOptions {} +export interface StringExtensibleSendOptionalParams extends OperationOptions {} -export interface StringExtensibleNamedGetOptions extends OperationOptions {} +export interface StringExtensibleNamedGetOptionalParams + extends OperationOptions {} -export interface StringExtensibleNamedSendOptions extends OperationOptions {} +export interface StringExtensibleNamedSendOptionalParams + extends OperationOptions {} -export interface IntsOnlyGetOptions extends OperationOptions {} +export interface IntsOnlyGetOptionalParams extends OperationOptions {} -export interface IntsOnlySendOptions extends OperationOptions {} +export interface IntsOnlySendOptionalParams extends OperationOptions {} -export interface FloatsOnlyGetOptions extends OperationOptions {} +export interface FloatsOnlyGetOptionalParams extends OperationOptions {} -export interface FloatsOnlySendOptions extends OperationOptions {} +export interface FloatsOnlySendOptionalParams extends OperationOptions {} -export interface ModelsOnlyGetOptions extends OperationOptions {} +export interface ModelsOnlyGetOptionalParams extends OperationOptions {} -export interface ModelsOnlySendOptions extends OperationOptions {} +export interface ModelsOnlySendOptionalParams extends OperationOptions {} -export interface EnumsOnlyGetOptions extends OperationOptions {} +export interface EnumsOnlyGetOptionalParams extends OperationOptions {} -export interface EnumsOnlySendOptions extends OperationOptions {} +export interface EnumsOnlySendOptionalParams extends OperationOptions {} -export interface StringAndArrayGetOptions extends OperationOptions {} +export interface StringAndArrayGetOptionalParams extends OperationOptions {} -export interface StringAndArraySendOptions extends OperationOptions {} +export interface StringAndArraySendOptionalParams extends OperationOptions {} -export interface MixedLiteralsGetOptions extends OperationOptions {} +export interface MixedLiteralsGetOptionalParams extends OperationOptions {} -export interface MixedLiteralsSendOptions extends OperationOptions {} +export interface MixedLiteralsSendOptionalParams extends OperationOptions {} -export interface MixedTypesGetOptions extends OperationOptions {} +export interface MixedTypesGetOptionalParams extends OperationOptions {} -export interface MixedTypesSendOptions extends OperationOptions {} +export interface MixedTypesSendOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/models.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/models.ts index 5d80dba23d..0d793788f7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/models.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/models.ts @@ -11,9 +11,9 @@ export interface Dog { export interface EnumsOnlyCases { /** This should be receive/send the left variant */ - lr: string | string; + lr: LR | UD; /** This should be receive/send the up variant */ - ud: string | string; + ud: UD | UD; } export interface StringAndArrayCases { @@ -47,3 +47,7 @@ export interface MixedTypesCases { /** Alias for StringExtensibleNamedUnion */ export type StringExtensibleNamedUnion = string | "b" | "c"; +/** Alias for LR */ +export type LR = "left" | "right"; +/** Alias for UD */ +export type UD = "up" | "down"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/outputModels.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/outputModels.ts index 940362007c..96a3c89bef 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/outputModels.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/rest/outputModels.ts @@ -11,9 +11,9 @@ export interface DogOutput { export interface EnumsOnlyCasesOutput { /** This should be receive/send the left variant */ - lr: string | string; + lr: LROutput | UDOutput; /** This should be receive/send the up variant */ - ud: string | string; + ud: UDOutput | UDOutput; } export interface StringAndArrayCasesOutput { @@ -47,3 +47,7 @@ export interface MixedTypesCasesOutput { /** Alias for StringExtensibleNamedUnionOutput */ export type StringExtensibleNamedUnionOutput = string | "b" | "c"; +/** Alias for LROutput */ +export type LROutput = "left" | "right"; +/** Alias for UDOutput */ +export type UDOutput = "up" | "down"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/unions/src/UnionClient.ts b/packages/typespec-ts/test/modularIntegration/generated/unions/src/unionClient.ts similarity index 98% rename from packages/typespec-ts/test/modularIntegration/generated/unions/src/UnionClient.ts rename to packages/typespec-ts/test/modularIntegration/generated/unions/src/unionClient.ts index b7d13a9684..bf45d30855 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/unions/src/UnionClient.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/unions/src/unionClient.ts @@ -44,7 +44,7 @@ import { } from "./classic/mixedTypes/index.js"; import { createUnion, UnionClientOptions, UnionContext } from "./api/index.js"; -export { UnionClientOptions } from "./api/UnionContext.js"; +export { UnionClientOptions } from "./api/unionContext.js"; export class UnionClient { private _client: UnionContext; diff --git a/packages/typespec-ts/test/modularIntegration/lroStardard.spec.ts b/packages/typespec-ts/test/modularIntegration/lroStardard.spec.ts index 83d78b0a27..0188926ecf 100644 --- a/packages/typespec-ts/test/modularIntegration/lroStardard.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/lroStardard.spec.ts @@ -204,7 +204,7 @@ describe("LROStandardClient Classical Client", () => { describe("delete", () => { it("should await poller result directly", async () => { try { - const result = await client.deleteOperation("madge"); + const result = await client.delete("madge"); assert.strictEqual(result, undefined); } catch (err) { assert.fail(err as string); @@ -213,7 +213,7 @@ describe("LROStandardClient Classical Client", () => { it("should count polling counts correctly", async () => { try { - const poller = client.deleteOperation("madge"); + const poller = client.delete("madge"); let pollingCounts = 0; const expectedStates = ["running", "succeeded"]; const actualStates: string[] = []; @@ -230,13 +230,9 @@ describe("LROStandardClient Classical Client", () => { }); it("serialize and rehydration", async () => { - const poller = client.deleteOperation("madge"); + const poller = client.delete("madge"); const restoredPoller = await poller.serialize(); - const newPoller = restorePoller( - client, - restoredPoller, - client.deleteOperation - ); + const newPoller = restorePoller(client, restoredPoller, client.delete); const result = await newPoller.pollUntilDone(); assert.strictEqual(result, undefined); }); @@ -245,7 +241,7 @@ describe("LROStandardClient Classical Client", () => { describe("export", () => { it("should await poller result directly", async () => { try { - const result = await client.exportOperation("madge", "json"); + const result = await client.export("madge", "json"); assert.deepEqual(result, { name: "madge", resourceUri: "/users/madge" @@ -257,7 +253,7 @@ describe("LROStandardClient Classical Client", () => { it("should count polling counts correctly", async () => { try { - const poller = client.exportOperation("madge", "json"); + const poller = client.export("madge", "json"); let pollingCounts = 0; const expectedStates = ["running", "succeeded"]; const actualStates: string[] = []; @@ -274,13 +270,9 @@ describe("LROStandardClient Classical Client", () => { }); it("serialize and rehydration", async () => { - const poller = client.exportOperation("madge", "json"); + const poller = client.export("madge", "json"); const restoredPoller = await poller.serialize(); - const newPoller = restorePoller( - client, - restoredPoller, - client.exportOperation - ); + const newPoller = restorePoller(client, restoredPoller, client.export); const result = await newPoller.pollUntilDone(); assert.deepEqual(result, { name: "madge", diff --git a/packages/typespec-ts/test/modularIntegration/modelPropertyType.spec.ts b/packages/typespec-ts/test/modularIntegration/modelPropertyType.spec.ts index d3724a12ed..151c1622bd 100644 --- a/packages/typespec-ts/test/modularIntegration/modelPropertyType.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/modelPropertyType.spec.ts @@ -120,6 +120,10 @@ const testedTypes: TypeDetail[] = [ { type: "union/float/literal", defaultValue: 46.875 + }, + { + type: "union-enum-value", + defaultValue: "value2" } ]; @@ -228,6 +232,9 @@ describe("ModelsPropertyTypesClient Rest Client", () => { case "union/float/literal": result = await client.unionFloatLiteral.get(); break; + case "union-enum-value": + result = await client.unionEnumValue.get(); + break; default: throw new Error(`Unknown type ${item.type}`); } @@ -375,6 +382,11 @@ describe("ModelsPropertyTypesClient Rest Client", () => { property: item.defaultValue }); break; + case "union-enum-value": + result = await client.unionEnumValue.put({ + property: item.defaultValue + }); + break; default: throw new Error(`Unknown type ${item.type}`); } diff --git a/packages/typespec-ts/test/modularIntegration/payloadMediaType.spec.ts b/packages/typespec-ts/test/modularIntegration/payloadMediaType.spec.ts new file mode 100644 index 0000000000..dee42f6311 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/payloadMediaType.spec.ts @@ -0,0 +1,51 @@ +import { MediaTypeClient } from "./generated/payload/media-type/src/index.js"; +import { assert } from "chai"; + +describe("MediaType Client", () => { + let client: MediaTypeClient; + + beforeEach(() => { + client = new MediaTypeClient({ + allowInsecureConnection: true + }); + }); + + it("should getAsText", async () => { + try { + const result = await client.stringBody.getAsText({ + requestOptions: { headers: { accept: "text/plain" } } + }); + assert.strictEqual(result, "{cat}"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should sendAsText", async () => { + try { + const result = await client.stringBody.sendAsText("{cat}"); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should getAsJson", async () => { + try { + const result = await client.stringBody.getAsJson(); + console.log(result); + assert.strictEqual(result, "foo"); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should sendAsJson", async () => { + try { + const result = await client.stringBody.sendAsJson("foo"); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/server.spec.ts b/packages/typespec-ts/test/modularIntegration/server.spec.ts index eb14765fde..8240b142d0 100644 --- a/packages/typespec-ts/test/modularIntegration/server.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/server.spec.ts @@ -145,4 +145,15 @@ describe("Versioned Server Version Client", () => { assert.fail(err as string); } }); + + it("should work with param with old value", async () => { + try { + const result = await client.withQueryOldApiVersion({ + apiVersion: "2021-01-01-preview" + }); + assert.isUndefined(result); + } catch (err) { + assert.fail(err as string); + } + }); }); diff --git a/packages/typespec-ts/test/modularIntegration/specialWords.spec.ts b/packages/typespec-ts/test/modularIntegration/specialWords.spec.ts new file mode 100644 index 0000000000..c286473b57 --- /dev/null +++ b/packages/typespec-ts/test/modularIntegration/specialWords.spec.ts @@ -0,0 +1,988 @@ +import { assert } from "chai"; +import { SpecialWordsClient } from "./generated/specialWords/src/index.js"; + +describe("Special Words Client", () => { + let client: SpecialWordsClient; + + beforeEach(() => { + client = new SpecialWordsClient({ allowInsecureConnection: true }); + }); + + it("should post modelProperties sameAsModel", async () => { + try { + const result = await client.modelProperties.sameAsModel({ + sameAsModel: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations And", async () => { + try { + const result = await client.operations.and(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations As", async () => { + try { + const result = await client.operations.as(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Assert", async () => { + try { + const result = await client.operations.assert(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Async", async () => { + try { + const result = await client.operations.async(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Await", async () => { + try { + const result = await client.operations.await(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Break", async () => { + try { + const result = await client.operations.break(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Class", async () => { + try { + const result = await client.operations.class(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Constructor", async () => { + try { + const result = await client.operations.constructor(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Continue", async () => { + try { + const result = await client.operations.continue(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Def", async () => { + try { + const result = await client.operations.def(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Del", async () => { + try { + const result = await client.operations.del(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Elif", async () => { + try { + const result = await client.operations.elif(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Else", async () => { + try { + const result = await client.operations.else(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Except", async () => { + try { + const result = await client.operations.except(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Exec", async () => { + try { + const result = await client.operations.exec(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Finally", async () => { + try { + const result = await client.operations.finally(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations For", async () => { + try { + const result = await client.operations.for(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations From", async () => { + try { + const result = await client.operations.from(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Global", async () => { + try { + const result = await client.operations.global(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations If", async () => { + try { + const result = await client.operations.if(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Import", async () => { + try { + const result = await client.operations.import(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations In", async () => { + try { + const result = await client.operations.in(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Is", async () => { + try { + const result = await client.operations.is(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Lambda", async () => { + try { + const result = await client.operations.lambda(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Not", async () => { + try { + const result = await client.operations.not(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Or", async () => { + try { + const result = await client.operations.or(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Pass", async () => { + try { + const result = await client.operations.pass(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Raise", async () => { + try { + const result = await client.operations.raise(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Return", async () => { + try { + const result = await client.operations.return(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Try", async () => { + try { + const result = await client.operations.try(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations While", async () => { + try { + const result = await client.operations.while(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations With", async () => { + try { + const result = await client.operations.with(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should get operations Yield", async () => { + try { + const result = await client.operations.yield(); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withAnd", async () => { + try { + const result = await client.parameters.withAnd("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withAs", async () => { + try { + const result = await client.parameters.withAs("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withAssert", async () => { + try { + const result = await client.parameters.withAssert("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withAsync", async () => { + try { + const result = await client.parameters.withAsync("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withAwait", async () => { + try { + const result = await client.parameters.withAwait("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withBreak", async () => { + try { + const result = await client.parameters.withBreak("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withClass", async () => { + try { + const result = await client.parameters.withClass("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withConstructor", async () => { + try { + const result = await client.parameters.withConstructor("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withContinue", async () => { + try { + const result = await client.parameters.withContinue("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withDef", async () => { + try { + const result = await client.parameters.withDef("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withDel", async () => { + try { + const result = await client.parameters.withDel("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withElif", async () => { + try { + const result = await client.parameters.withElif("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withElse", async () => { + try { + const result = await client.parameters.withElse("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withExcept", async () => { + try { + const result = await client.parameters.withExcept("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withExec", async () => { + try { + const result = await client.parameters.withExec("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withFinally", async () => { + try { + const result = await client.parameters.withFinally("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withFor", async () => { + try { + const result = await client.parameters.withFor("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withFrom", async () => { + try { + const result = await client.parameters.withFrom("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withGlobal", async () => { + try { + const result = await client.parameters.withGlobal("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withIf", async () => { + try { + const result = await client.parameters.withIf("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withImport", async () => { + try { + const result = await client.parameters.withImport("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withIn", async () => { + try { + const result = await client.parameters.withIn("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withIs", async () => { + try { + const result = await client.parameters.withIs("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withLambda", async () => { + try { + const result = await client.parameters.withLambda("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withNot", async () => { + try { + const result = await client.parameters.withNot("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withOr", async () => { + try { + const result = await client.parameters.withOr("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withPass", async () => { + try { + const result = await client.parameters.withPass("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withRaise", async () => { + try { + const result = await client.parameters.withRaise("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withReturn", async () => { + try { + const result = await client.parameters.withReturn("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withTry", async () => { + try { + const result = await client.parameters.withTry("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withWhile", async () => { + try { + const result = await client.parameters.withWhile("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withWith", async () => { + try { + const result = await client.parameters.withWith("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post parameters withYield", async () => { + try { + const result = await client.parameters.withYield("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + + it("should post parameters withCancellationToken", async () => { + try { + const result = await client.parameters.withCancellationToken("ok"); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withAnd", async () => { + try { + const result = await client.models.withAnd({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withAs", async () => { + try { + const result = await client.models.withAs({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withAssert", async () => { + try { + const result = await client.models.withAssert({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withAsync", async () => { + try { + const result = await client.models.withAsync({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withAwait", async () => { + try { + const result = await client.models.withAwait({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withBreak", async () => { + try { + const result = await client.models.withBreak({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withClass", async () => { + try { + const result = await client.models.withClass({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withConstructor", async () => { + try { + const result = await client.models.withConstructor({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withContinue", async () => { + try { + const result = await client.models.withContinue({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withDef", async () => { + try { + const result = await client.models.withDef({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withDel", async () => { + try { + const result = await client.models.withDel({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withElif", async () => { + try { + const result = await client.models.withElif({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withElse", async () => { + try { + const result = await client.models.withElse({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withExcept", async () => { + try { + const result = await client.models.withExcept({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withExec", async () => { + try { + const result = await client.models.withExec({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withFinally", async () => { + try { + const result = await client.models.withFinally({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withFor", async () => { + try { + const result = await client.models.withFor({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withFrom", async () => { + try { + const result = await client.models.withFrom({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withGlobal", async () => { + try { + const result = await client.models.withGlobal({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withIf", async () => { + try { + const result = await client.models.withIf({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withImport", async () => { + try { + const result = await client.models.withImport({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withIn", async () => { + try { + const result = await client.models.withIn({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withIs", async () => { + try { + const result = await client.models.withIs({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withLambda", async () => { + try { + const result = await client.models.withLambda({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withNot", async () => { + try { + const result = await client.models.withNot({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withOr", async () => { + try { + const result = await client.models.withOr({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withPass", async () => { + try { + const result = await client.models.withPass({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withRaise", async () => { + try { + const result = await client.models.withRaise({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withReturn", async () => { + try { + const result = await client.models.withReturn({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withTry", async () => { + try { + const result = await client.models.withTry({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withWhile", async () => { + try { + const result = await client.models.withWhile({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withWith", async () => { + try { + const result = await client.models.withWith({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); + + it("should post models withYield", async () => { + try { + const result = await client.models.withYield({ + name: "ok" + }); + assert.equal(result , undefined); + } catch (err) { + assert.fail(err as string); + } + }); +}) diff --git a/packages/typespec-ts/test/modularUnit/anonymousModel.spec.ts b/packages/typespec-ts/test/modularUnit/anonymousModel.spec.ts index 83137c3616..a836d9f344 100644 --- a/packages/typespec-ts/test/modularUnit/anonymousModel.spec.ts +++ b/packages/typespec-ts/test/modularUnit/anonymousModel.spec.ts @@ -33,9 +33,8 @@ describe("anonymous model", () => { prop2: number; }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -57,7 +56,7 @@ describe("anonymous model", () => { prop3: Date, prop4: string, prop5: Bar, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/{pathParam}", pathParam) @@ -88,7 +87,7 @@ describe("anonymous model", () => { prop3: Date, prop4: string, prop5: Bar, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend( context, @@ -140,16 +139,15 @@ describe("anonymous model", () => { await assertEqualContent( optionFile?.getFullText()!, ` - import { OperationOptions } from "@azure-rest/core-client"; + import { OperationOptions } from "@azure-rest/core-client"; - export interface ReadOptions extends OperationOptions { + export interface ReadOptionalParams extends OperationOptions { prop3?: Date; prop5?: Bar; }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -168,7 +166,7 @@ describe("anonymous model", () => { prop1: string, prop2: number, prop4: string, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/{pathParam}", pathParam) @@ -200,7 +198,7 @@ describe("anonymous model", () => { prop1: string, prop2: number, prop4: string, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend( context, @@ -252,16 +250,15 @@ describe("anonymous model", () => { await assertEqualContent( optionFile?.getFullText()!, ` - import { OperationOptions } from "@azure-rest/core-client"; + import { OperationOptions } from "@azure-rest/core-client"; - export interface ReadOptions extends OperationOptions { + export interface ReadOptionalParams extends OperationOptions { prop3?: Date; prop5?: Bar; }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -281,7 +278,7 @@ describe("anonymous model", () => { prop4: string, queryParam: string, prop2: number, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/{pathParam}/{prop1}", pathParam, prop1) @@ -311,7 +308,7 @@ describe("anonymous model", () => { prop4: string, queryParam: string, prop2: number, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend( context, @@ -348,22 +345,21 @@ describe("anonymous model", () => { await assertEqualContent( modelFile?.getFullText()!, ` + export interface Bar { + prop1: string; + prop2: number; + } + export interface Foo { prop1: string; prop2: number; prop3: Date; prop4: string; prop5: Bar; - } - - export interface Bar { - prop1: string; - prop2: number; }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -380,7 +376,7 @@ describe("anonymous model", () => { pathParam: string, queryParam: string, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/{pathParam}", pathParam) @@ -407,7 +403,7 @@ describe("anonymous model", () => { pathParam: string, queryParam: string, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend( context, @@ -428,9 +424,8 @@ describe("anonymous model", () => { `; const modelFile = await emitModularModelsFromTypeSpec(tspContent); assert.isUndefined(modelFile); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -447,7 +442,7 @@ describe("anonymous model", () => { pathParam: string, queryParam: string, body: Record, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/{pathParam}", pathParam) @@ -468,7 +463,7 @@ describe("anonymous model", () => { pathParam: string, queryParam: string, body: Record, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, pathParam, queryParam, body, options); return _readDeserialize(result); @@ -498,9 +493,8 @@ describe("anonymous model", () => { prop2: number; }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -518,7 +512,7 @@ describe("anonymous model", () => { queryParam: string, prop1: string, prop2: Bar, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/{pathParam}", pathParam) @@ -543,7 +537,7 @@ describe("anonymous model", () => { queryParam: string, prop1: string, prop2: Bar, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend( context, @@ -578,9 +572,8 @@ describe("anonymous model", () => { }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -595,7 +588,7 @@ describe("anonymous model", () => { export function _readSend( context: Client, body: Test, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -613,7 +606,7 @@ describe("anonymous model", () => { export async function read( context: Client, body: Test, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -641,9 +634,8 @@ describe("anonymous model", () => { }` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); await assertEqualContent( @@ -658,7 +650,7 @@ describe("anonymous model", () => { export function _readSend( context: Client, body: Test, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -676,7 +668,7 @@ describe("anonymous model", () => { export async function read( context: Client, body: Test, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -704,7 +696,7 @@ describe("anonymous model", () => { } from "@azure-rest/core-client"; export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -718,7 +710,7 @@ describe("anonymous model", () => { } export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise<${returnType}> { const result = await _readSend( context, @@ -735,9 +727,8 @@ describe("anonymous model", () => { `; // No models.ts file generated assert.isUndefined(await emitModularModelsFromTypeSpec(tspContent)); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.equal(operationFiles?.length, 1); // Generate the operations.ts file with empty model await verifyReturnTypeAsEmpty( @@ -759,9 +750,8 @@ describe("anonymous model", () => { export interface PublishResult {} ` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.ok(operationFiles); assert.equal(operationFiles?.length, 1); // Model name referred in operations.ts @@ -777,9 +767,8 @@ describe("anonymous model", () => { `; // No models.ts file generated assert.isUndefined(await emitModularModelsFromTypeSpec(tspContent)); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.equal(operationFiles?.length, 1); // Generate the operations.ts file with empty model await assertEqualContent( @@ -793,7 +782,7 @@ describe("anonymous model", () => { } from "@azure-rest/core-client"; export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -811,7 +800,7 @@ describe("anonymous model", () => { } export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise<{ foo?: { bar: string | null } }> { const result = await _readSend( context, @@ -854,9 +843,8 @@ describe("anonymous model", () => { export interface EmptyModel {} ` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.equal(operationFiles?.length, 1); await assertEqualContent( operationFiles?.[0]?.getFullText()!, @@ -870,7 +858,7 @@ describe("anonymous model", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -896,7 +884,7 @@ describe("anonymous model", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -943,9 +931,8 @@ describe("anonymous model", () => { ` ); - const operationFiles = await emitModularOperationsFromTypeSpec( - tspContent - ); + const operationFiles = + await emitModularOperationsFromTypeSpec(tspContent); assert.equal(operationFiles?.length, 1); await assertEqualContent( operationFiles?.[0]?.getFullText()!, @@ -959,7 +946,7 @@ describe("anonymous model", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -988,7 +975,7 @@ describe("anonymous model", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); diff --git a/packages/typespec-ts/test/modularUnit/apiOperations.spec.ts b/packages/typespec-ts/test/modularUnit/apiOperations.spec.ts index 5262507816..63f269c603 100644 --- a/packages/typespec-ts/test/modularUnit/apiOperations.spec.ts +++ b/packages/typespec-ts/test/modularUnit/apiOperations.spec.ts @@ -31,7 +31,7 @@ describe("api operations in Modular", () => { export function _uploadFileViaBodySend( context: Client, body: Uint8Array, - options: UploadFileViaBodyOptions = { requestOptions: {} } + options: UploadFileViaBodyOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/uploadFileViaBody") @@ -52,7 +52,7 @@ describe("api operations in Modular", () => { export async function uploadFileViaBody( context: Client, body: Uint8Array, - options: UploadFileViaBodyOptions = { requestOptions: {} } + options: UploadFileViaBodyOptionalParams = { requestOptions: {} } ): Promise { const result = await _uploadFileViaBodySend(context, body, options); return _uploadFileViaBodyDeserialize(result); @@ -87,7 +87,7 @@ describe("api operations in Modular", () => { export function _uploadFileViaBodySend( context: Client, body: Uint8Array, - options: UploadFileViaBodyOptions = { requestOptions: {} } + options: UploadFileViaBodyOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/uploadFileViaBody") @@ -108,7 +108,7 @@ describe("api operations in Modular", () => { export async function uploadFileViaBody( context: Client, body: Uint8Array, - options: UploadFileViaBodyOptions = { requestOptions: {} } + options: UploadFileViaBodyOptionalParams = { requestOptions: {} } ): Promise { const result = await _uploadFileViaBodySend(context, body, options); return _uploadFileViaBodyDeserialize(result); @@ -145,7 +145,7 @@ describe("api operations in Modular", () => { context: Client, name: string, file: Uint8Array, - options: UploadFileOptions = { requestOptions: {} } + options: UploadFileOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/uploadFile") @@ -167,7 +167,7 @@ describe("api operations in Modular", () => { context: Client, name: string, file: Uint8Array, - options: UploadFileOptions = { requestOptions: {} } + options: UploadFileOptionalParams = { requestOptions: {} } ): Promise { const result = await _uploadFileSend(context, name, file, options); return _uploadFileDeserialize(result); @@ -204,7 +204,7 @@ describe("api operations in Modular", () => { export function _uploadFilesSend( context: Client, files: Uint8Array[], - options: UploadFilesOptions = { requestOptions: {} } + options: UploadFilesOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/uploadFiles") @@ -225,7 +225,7 @@ describe("api operations in Modular", () => { export async function uploadFiles( context: Client, files: Uint8Array[], - options: UploadFilesOptions = { requestOptions: {} } + options: UploadFilesOptionalParams = { requestOptions: {} } ): Promise { const result = await _uploadFilesSend(context, files, options); return _uploadFilesDeserialize(result); @@ -259,7 +259,7 @@ describe("api operations in Modular", () => { } from "@azure-rest/core-client"; export function _downloadFileSend( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/downloadFile") @@ -275,7 +275,7 @@ describe("api operations in Modular", () => { } export async function downloadFile( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): Promise { const result = await _downloadFileSend(context, options); return _downloadFileDeserialize(result); @@ -310,7 +310,7 @@ describe("api operations in Modular", () => { } from "@azure-rest/core-client"; export function _downloadFileSend( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/downloadFile") @@ -326,7 +326,7 @@ describe("api operations in Modular", () => { } export async function downloadFile( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): Promise { const result = await _downloadFileSend(context, options); return _downloadFileDeserialize(result); @@ -362,7 +362,7 @@ describe("api operations in Modular", () => { import { stringToUint8Array } from "@azure/core-util"; export function _downloadFileSend( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/downloadFile") @@ -384,7 +384,7 @@ describe("api operations in Modular", () => { } export async function downloadFile( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): Promise<{ name: string; file: Uint8Array }> { const result = await _downloadFileSend(context, options); return _downloadFileDeserialize(result); @@ -422,7 +422,7 @@ describe("api operations in Modular", () => { import { stringToUint8Array } from "@azure/core-util"; export function _downloadFileSend( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/downloadFile") @@ -443,7 +443,7 @@ describe("api operations in Modular", () => { } export async function downloadFile( context: Client, - options: DownloadFileOptions = { requestOptions: {} } + options: DownloadFileOptionalParams = { requestOptions: {} } ): Promise<{ name: string; file: Uint8Array[] }> { const result = await _downloadFileSend(context, options); return _downloadFileDeserialize(result); @@ -478,7 +478,7 @@ describe("api operations in Modular", () => { export function _testSend( context: Client, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/") @@ -497,7 +497,7 @@ describe("api operations in Modular", () => { export async function test( context: Client, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _testSend(context, options); return _testDeserialize(result); @@ -510,18 +510,18 @@ describe("api operations in Modular", () => { await assertEqualContent( clientContext?.getFullText()!, ` - import { ClientOptions } from "@azure-rest/core-client"; + import { ClientOptions } from "@azure-rest/core-client"; import { TestingContext } from "../rest/index.js"; import getClient from "../rest/index.js"; - export interface TestingClientOptions extends ClientOptions {} + export interface TestingClientOptions extends ClientOptions {} export { TestingContext } from "../rest/index.js"; export function createTesting( endpoint: string, apiVersion: string, - options: TestingClientOptions = {}, + options: TestingClientOptions = {}, ): TestingContext { const clientContext = getClient(endpoint, apiVersion, options); return clientContext; @@ -535,7 +535,7 @@ describe("api operations in Modular", () => { ` import { Pipeline } from "@azure/core-rest-pipeline"; - export { TestingClientOptions } from "./api/TestingContext.js"; + export { TestingClientOptions } from "./api/testingContext.js"; export class TestingClient { private _client: TestingContext; @@ -545,13 +545,13 @@ describe("api operations in Modular", () => { constructor( endpoint: string, apiVersion: string, - options: TestingClientOptions = {}, + options: TestingClientOptions = {}, ) { this._client = createTesting(endpoint, apiVersion, options); this.pipeline = this._client.pipeline; } - test(options: TestOptions = { requestOptions: {} }): Promise { + test(options: TestOptionalParams = { requestOptions: {} }): Promise { return test(this._client, options); } } @@ -589,7 +589,7 @@ describe("api operations in Modular", () => { export function _testSend( context: Client, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/") @@ -608,7 +608,7 @@ describe("api operations in Modular", () => { export async function test( context: Client, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _testSend(context, options); return _testDeserialize(result); @@ -624,17 +624,19 @@ describe("api operations in Modular", () => { await assertEqualContent( clientContext?.getFullText()!, ` - import { ClientOptions } from "@azure-rest/core-client"; + import { ClientOptions } from "@azure-rest/core-client"; import { TestingContext } from "../rest/index.js"; import getClient from "../rest/index.js"; - export interface TestingClientOptions extends ClientOptions {} + export interface TestingClientOptions extends ClientOptions { + apiVersion?: string; + } export { TestingContext } from "../rest/index.js"; export function createTesting( endpoint: string, - options: TestingClientOptions = {}, + options: TestingClientOptions = {}, ): TestingContext { const clientContext = getClient(endpoint, options); return clientContext; @@ -652,7 +654,7 @@ describe("api operations in Modular", () => { ` import { Pipeline } from "@azure/core-rest-pipeline"; - export { TestingClientOptions } from "./api/TestingContext.js"; + export { TestingClientOptions } from "./api/testingContext.js"; export class TestingClient { private _client: TestingContext; @@ -661,13 +663,13 @@ describe("api operations in Modular", () => { constructor( endpoint: string, - options: TestingClientOptions = {}, + options: TestingClientOptions = {}, ) { this._client = createTesting(endpoint, options); this.pipeline = this._client.pipeline; } - test(options: TestOptions = { requestOptions: {} }): Promise { + test(options: TestOptionalParams = { requestOptions: {} }): Promise { return test(this._client, options); } } @@ -706,7 +708,7 @@ describe("api operations in Modular", () => { export function _testSend( context: Client, apiVersion: string, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/test") @@ -729,7 +731,7 @@ describe("api operations in Modular", () => { export async function test( context: Client, apiVersion: string, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): Promise { const result = await _testSend(context, apiVersion, options); return _testDeserialize(result); @@ -737,7 +739,7 @@ describe("api operations in Modular", () => { export function _test1Send( context: Client, - options: Test1Options = { requestOptions: {} }, + options: Test1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/test1") @@ -756,7 +758,7 @@ describe("api operations in Modular", () => { export async function test1( context: Client, - options: Test1Options = { requestOptions: {} }, + options: Test1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _test1Send(context, options); return _test1Deserialize(result); @@ -770,17 +772,17 @@ describe("api operations in Modular", () => { await assertEqualContent( clientContext?.getFullText()!, ` - import { ClientOptions } from "@azure-rest/core-client"; + import { ClientOptions } from "@azure-rest/core-client"; import { TestingContext } from "../rest/index.js"; import getClient from "../rest/index.js"; - export interface TestingClientOptions extends ClientOptions {} + export interface TestingClientOptions extends ClientOptions {} export { TestingContext } from "../rest/index.js"; export function createTesting( endpoint: string, - options: TestingClientOptions = {}, + options: TestingClientOptions = {}, ): TestingContext { const clientContext = getClient(endpoint, options); return clientContext; @@ -794,7 +796,7 @@ describe("api operations in Modular", () => { ` import { Pipeline } from "@azure/core-rest-pipeline"; - export { TestingClientOptions } from "./api/TestingContext.js"; + export { TestingClientOptions } from "./api/testingContext.js"; export class TestingClient { private _client: TestingContext; @@ -803,7 +805,7 @@ describe("api operations in Modular", () => { constructor( endpoint: string, - options: TestingClientOptions = {}, + options: TestingClientOptions = {}, ) { this._client = createTesting(endpoint, options); this.pipeline = this._client.pipeline; @@ -811,12 +813,12 @@ describe("api operations in Modular", () => { test( apiVersion: string, - options: TestOptions = { requestOptions: {} }, + options: TestOptionalParams = { requestOptions: {} }, ): Promise { return test(this._client, apiVersion, options); } - test1(options: Test1Options = { requestOptions: {} }): Promise { + test1(options: Test1OptionalParams = { requestOptions: {} }): Promise { return test1(this._client, options); } } diff --git a/packages/typespec-ts/test/modularUnit/clientContext.spec.ts b/packages/typespec-ts/test/modularUnit/clientContext.spec.ts index 1d729e9bd8..77f51075be 100644 --- a/packages/typespec-ts/test/modularUnit/clientContext.spec.ts +++ b/packages/typespec-ts/test/modularUnit/clientContext.spec.ts @@ -58,20 +58,20 @@ describe("modular client context type", () => { await assertEqualContent( clientContext?.getFullText()!, ` - import { ClientOptions } from "@azure-rest/core-client"; + import { ClientOptions } from "@azure-rest/core-client"; import { ServiceContext } from "../rest/index.js"; import getClient from "../rest/index.js"; - export interface ServiceClientOptions extends ClientOptions {} + export interface ServiceClientOptions extends ClientOptions {} export { ServiceContext } from "../rest/index.js"; export function createService( - endpoint: string, - client: ClientType, - options: ServiceClientOptions = {} + endpointParam: string, + clientParam: ClientType, + options: ServiceClientOptions = {} ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; }` ); @@ -131,20 +131,20 @@ describe("modular client context type", () => { await assertEqualContent( clientContext?.getFullText()!, ` - import { ClientOptions } from "@azure-rest/core-client"; + import { ClientOptions } from "@azure-rest/core-client"; import { ServiceContext } from "../rest/index.js"; import getClient from "../rest/index.js"; - export interface ServiceClientOptions extends ClientOptions {} + export interface ServiceClientOptions extends ClientOptions {} export { ServiceContext } from "../rest/index.js"; export function createService( - endpoint: string, - client: ClientType, - options: ServiceClientOptions = {} + endpointParam: string, + clientParam: ClientType, + options: ServiceClientOptions = {} ): ServiceContext { - const clientContext = getClient(endpoint, client, options); + const clientContext = getClient(endpointParam, clientParam, options); return clientContext; }` ); diff --git a/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts new file mode 100644 index 0000000000..9144689dfd --- /dev/null +++ b/packages/typespec-ts/test/modularUnit/enumUnion.spec.ts @@ -0,0 +1,890 @@ +import { + emitModularModelsFromTypeSpec, + emitModularOperationsFromTypeSpec +} from "../util/emitUtil.js"; +import { assertEqualContent } from "../util/testUtil.js"; +import { assert } from "chai"; + +describe("header parameters", () => { + describe("named union", async () => { + describe("fixed", async () => { + it("as contentType", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + union SchemaContentTypeValues { + avro: "application/json; serialization=Avro", + json: "application/json; serialization=json", + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + } + + op get( + @header("Content-Type") contentType: SchemaContentTypeValues, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** Type of SchemaContentTypeValues */ + /** */ + export type SchemaContentTypeValues = + | "application/json; serialization=Avro" + | "application/json; serialization=json" + | "text/plain; charset=utf-8" + | "text/vnd.ms.protobuf"; + ` + ); + const paramOutput = await emitModularOperationsFromTypeSpec( + tspDefinition, + false, + false, + false, + true + ); + assert.ok(paramOutput); + assert.strictEqual(paramOutput?.length, 1); + await assertEqualContent( + paramOutput?.[0]?.getFullText()!, + ` + import { DemoServiceContext as Client } from "../rest/index.js"; + import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, + } from "@azure-rest/core-client"; + + export function _getSend( + context: Client, + contentType: SchemaContentTypeValues, + body: string, + options: GetOptionalParams = { requestOptions: {} }, + ): StreamableMethod { + return context + .path("/") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: contentType, + body: body + }); + } + + export async function _getDeserialize(result: Get204Response): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + + return; + } + + export async function get( + context: Client, + contentType: SchemaContentTypeValues, + body: string, + options: GetOptionalParams = { requestOptions: {} }, + ): Promise { + const result = await _getSend(context, contentType, body, options); + return _getDeserialize(result); + } + `, + true + ); + }); + + it("in regular headers", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + union SchemaContentTypeValues { + avro: "application/json; serialization=Avro", + json: "application/json; serialization=json", + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + } + + op get( + @header("test-header") testHeader: SchemaContentTypeValues, + @body body: string, + ): { @header("test-header") testHeader: SchemaContentTypeValues }; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** Type of SchemaContentTypeValues */ + /** */ + export type SchemaContentTypeValues = + | "application/json; serialization=Avro" + | "application/json; serialization=json" + | "text/plain; charset=utf-8" + | "text/vnd.ms.protobuf"; + ` + ); + }); + }); + describe("extensible", async () => { + it("union with string as extensible enum", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + union SchemaContentTypeValues { + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + others: string, + } + + op get( + @header("test-header") testHeader: SchemaContentTypeValues, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** Type of SchemaContentTypeValues */ + /** "text/plain; charset=utf-8", "text/vnd.ms.protobuf" */ + export type SchemaContentTypeValues = string; + ` + ); + }); + it("union contains union with string element", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + union JsonContentType { + avro: "application/json; serialization=Avro", + json: "application/json; serialization=json", + } + + union SchemaContentTypeValues { + JsonContentType, + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + others: string, + } + + op get( + @header("test-header") testHeader: SchemaContentTypeValues, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** Type of JsonContentType */ + /** */ + export type JsonContentType = "application/json; serialization=Avro" | "application/json; serialization=json"; + /** Alias for SchemaContentTypeValues */ + export type SchemaContentTypeValues = JsonContentType | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf" | string; + ` + ); + }); + it("union contains enum with string element", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + enum JsonContentType { + avro: "application/json; serialization=Avro", + json: "application/json; serialization=json", + } + + union SchemaContentTypeValues { + JsonContentType, + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + others: string, + } + + op get( + @header("test-header") testHeader: SchemaContentTypeValues, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** */ + export type JsonContentType = "application/json; serialization=Avro" | "application/json; serialization=json"; + /** Alias for SchemaContentTypeValues */ + export type SchemaContentTypeValues = JsonContentType | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf" | string; + ` + ); + }); + }); + }); + + describe("anonymous union with `|` ", async () => { + describe("fixed", async () => { + it("in regular headers", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + op get( + @header("test-header") testHeader: "A" | "B", + @body body: string, + ): { @header("test-header") testHeader: "A" | "B" }; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.isUndefined(schemaOutput); + + const paramOutput = await emitModularOperationsFromTypeSpec( + tspDefinition, + true, + false, + false, + true + ); + assert.ok(paramOutput); + assert.strictEqual(paramOutput?.length, 1); + const operationContent = paramOutput?.[0]?.getFullText()!; + await assertEqualContent( + operationContent, + ` + import { DemoServiceContext as Client } from "../rest/index.js"; + import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, + } from "@azure-rest/core-client"; + export function _getSend( + context: Client, + testHeader: "A" | "B", + body: string, + options: GetOptionalParams = { requestOptions: {} }, + ): StreamableMethod { + return context + .path("/") + .post({ + ...operationOptionsToRequestParameters(options), + headers: { "test-header": testHeader }, + body: body + }); + } + export async function _getDeserialize(result: Get204Response): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + return; + } + export async function get( + context: Client, + testHeader: "A" | "B", + body: string, + options: GetOptionalParams = { requestOptions: {} }, + ): Promise { + const result = await _getSend(context, testHeader, body, options); + return _getDeserialize(result); + } + `, + true + ); + }); + }); + describe("extensible", async () => { + it("in regular headers", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + + op get( + @header("test-header") testHeader: "A" | "B" | string, + @body body: string, + ): { @header("test-header") testHeader: "A" | "B" | string }; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.isUndefined(schemaOutput); + + const paramOutput = await emitModularOperationsFromTypeSpec( + tspDefinition, + true, + false, + false, + true + ); + assert.ok(paramOutput); + assert.strictEqual(paramOutput?.length, 1); + const operationContent = paramOutput?.[0]?.getFullText()!; + await assertEqualContent( + operationContent, + ` + import { DemoServiceContext as Client } from "../rest/index.js"; + import { + StreamableMethod, + operationOptionsToRequestParameters, + createRestError, + } from "@azure-rest/core-client"; + export function _getSend( + context: Client, + testHeader: string | "A" | "B", + body: string, + options: GetOptionalParams = { requestOptions: {} }, + ): StreamableMethod { + return context + .path("/") + .post({ + ...operationOptionsToRequestParameters(options), + headers: { "test-header": testHeader }, + body: body + }); + } + export async function _getDeserialize(result: Get204Response): Promise { + if (result.status !== "204") { + throw createRestError(result); + } + return; + } + export async function get( + context: Client, + testHeader: string | "A" | "B", + body: string, + options: GetOptionalParams = { requestOptions: {} }, + ): Promise { + const result = await _getSend(context, testHeader, body, options); + return _getDeserialize(result); + } + `, + true + ); + }); + }); + }); + + describe("enum", async () => { + describe("with @fixed", async () => { + it("should be taken as fixed enum", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + import "@azure-tools/typespec-azure-core"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + using Azure.Core; + + @fixed + enum SchemaContentTypeValues { + avro: "application/json; serialization=Avro", + json: "application/json; serialization=json", + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + } + + op get( + @header("test-header") testHeader: SchemaContentTypeValues, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** */ + export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf";` + ); + }); + }); + describe("without @fixed", async () => { + it("should be taken as fixed enum", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + import "@azure-tools/typespec-azure-core"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + using Azure.Core; + + enum SchemaContentTypeValues { + avro: "application/json; serialization=Avro", + json: "application/json; serialization=json", + custom: "text/plain; charset=utf-8", + protobuf: "text/vnd.ms.protobuf", + } + + op get( + @header("test-header") testHeader: SchemaContentTypeValues, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** */ + export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf";` + ); + }); + }); + }); + + describe("number extensible enum + mixed types union", async () => { + it("number extensible enum should be generated correctly", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + import "@azure-tools/typespec-azure-core"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + using Azure.Core; + + union EnumTest { + one: 1, + two: 2, + three: 3, + four: 4, + others: int32 + } + + op get( + @header("test-header") testHeader: EnumTest, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** Type of EnumTest */ + /** 1, 2, 3, 4 */ + export type EnumTest = number; +` + ); + }); + + it("mixed union types should be generated correctly", async () => { + const tspDefinition = ` + import "@typespec/http"; + import "@typespec/rest"; + import "@azure-tools/typespec-azure-core"; + + @service({ + title: "Widget Service", + }) + namespace DemoService; + + using TypeSpec.Http; + using TypeSpec.Rest; + using Azure.Core; + + enum EnumTest { + one: 1, + two: 2, + three: 3, + four: 4, + } + + model Foo {} + + union MixedTypes { + EnumTest, + string, + Foo + } + + op get( + @header("test-header") testHeader: MixedTypes, + @body body: string, + ): NoContentResponse; + `; + const schemaOutput = await emitModularModelsFromTypeSpec( + tspDefinition, + false, + true + ); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.getFullText()!, + ` + /** */ + export type EnumTest = 1 | 2 | 3 | 4; + + export interface Foo { + } + + /** Alias for MixedTypes */ + export type MixedTypes = EnumTest | string | Foo; + ` + ); + }); + }); +}); + +describe("model type", () => { + describe("string | string literal | nullable", () => { + it("string enum", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + model Test { + color: "red" | "blue"; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: "red" | "blue"; + }` + ); + }); + + it("string enum member", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + enum Color { + Red: "red", + Blue: "blue" + } + model Test { + color: Color.Red; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: "red"; + } + + /** */ + export type Color = "red" | "blue"; + ` + ); + }); + + it("nullable string literal", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + model Test { + content: "red" | null; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + content: "red" | null; + }` + ); + }); + + it("nullable string", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + model Test { + content: string | null; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + content: string | null; + }` + ); + }); + }); + + describe("number | numeric literal | nullable", () => { + it("number enum", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + model Test { + color: 1 | 2; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: 1 | 2; + }` + ); + }); + + it("number enum member", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + enum Color { + Color1: 1, + Color2: 2 + } + model Test { + color: Color.Color1; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: 1; + } + + /** */ + export type Color = 1 | 2; + ` + ); + }); + + it("nullable enum without @fixed would be interpreted as non-branded enum which is fixed", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + enum Color { + Color1: 1, + Color2: 2 + } + model Test { + color: Color | null; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: Color | null; + } + + /** Type of Color */ + /** */ + export type Color = 1 | 2; + ` + ); + }); + + it("nullable @fixed enum would be interpreted as azure enum which is fixed", async () => { + const modelFile = await emitModularModelsFromTypeSpec( + ` + @fixed + enum Color { + Color1: 1, + Color2: 2 + } + model Test { + color: Color | null; + } + op read(@body body: Test): void; + `, + undefined, + undefined, + true + ); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: Color | null; + } + + /** Type of Color */ + /** */ + export type Color = 1 | 2; + ` + ); + }); + + it("union of enum", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + enum LR { + left, + right, + } + enum UD { + up, + down, + } + + model Test { + color: LR | UD; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + color: LR | UD; + } + + /** */ + export type LR = "left" | "right"; + /** */ + export type UD = "up" | "down"; + ` + ); + }); + + it("nullable numeric literal", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + model Test { + content: 1 | null; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + content: 1 | null; + }` + ); + }); + + it("nullable number", async () => { + const modelFile = await emitModularModelsFromTypeSpec(` + model Test { + content: int32 | null; + } + op read(@body body: Test): void; + `); + assert.ok(modelFile); + await assertEqualContent( + modelFile!.getFullText()!, + ` + export interface Test { + content: number | null; + }` + ); + }); + }); +}); diff --git a/packages/typespec-ts/test/modularUnit/modelsGenerator.spec.ts b/packages/typespec-ts/test/modularUnit/modelsGenerator.spec.ts index 99449b565a..313d13c786 100644 --- a/packages/typespec-ts/test/modularUnit/modelsGenerator.spec.ts +++ b/packages/typespec-ts/test/modularUnit/modelsGenerator.spec.ts @@ -92,7 +92,12 @@ describe("model property type", () => { const tspType = "TranslationLanguageValues.English"; const typeScriptType = `"English"`; await verifyModularPropertyType(tspType, typeScriptType, { - additionalTypeSpecDefinition: tspTypeDefinition + additionalTypeSpecDefinition: tspTypeDefinition, + additionalInputContent: ` + /** Translation Language Values */ + /** */ + export type TranslationLanguageValues = "English" | "Chinese"; + ` }); }); }); @@ -136,7 +141,7 @@ describe("modular encode test for property type datetime", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -167,7 +172,7 @@ describe("modular encode test for property type datetime", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -196,7 +201,7 @@ describe("modular encode test for property type datetime", () => { export function _readSend( context: Client, prop: Date, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -219,7 +224,7 @@ describe("modular encode test for property type datetime", () => { export async function read( context: Client, prop: Date, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, prop, options); return _readDeserialize(result); @@ -264,7 +269,7 @@ describe("modular encode test for property type datetime", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -291,7 +296,7 @@ describe("modular encode test for property type datetime", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -336,7 +341,7 @@ describe("modular encode test for property type datetime", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -363,7 +368,7 @@ describe("modular encode test for property type datetime", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -405,7 +410,7 @@ describe("modular encode test for property type datetime", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -430,7 +435,7 @@ describe("modular encode test for property type datetime", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -473,7 +478,7 @@ describe("modular encode test for property type duration", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -498,7 +503,7 @@ describe("modular encode test for property type duration", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -540,7 +545,7 @@ describe("modular encode test for property type duration", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -565,7 +570,7 @@ describe("modular encode test for property type duration", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -610,7 +615,7 @@ describe("modular encode test for property type duration", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -637,7 +642,7 @@ describe("modular encode test for property type duration", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -681,7 +686,7 @@ describe("modular encode test for property type bytes", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -709,7 +714,7 @@ describe("modular encode test for property type bytes", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -752,7 +757,7 @@ describe("modular encode test for property type bytes", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -780,7 +785,7 @@ describe("modular encode test for property type bytes", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -823,7 +828,7 @@ describe("modular encode test for property type bytes", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -851,7 +856,7 @@ describe("modular encode test for property type bytes", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -945,7 +950,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -967,7 +972,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1024,7 +1029,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1046,7 +1051,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1113,7 +1118,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1135,7 +1140,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1202,7 +1207,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1219,7 +1224,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1302,7 +1307,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1319,7 +1324,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1371,7 +1376,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1392,7 +1397,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1458,7 +1463,7 @@ describe("inheritance & polymorphism", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1481,7 +1486,7 @@ describe("inheritance & polymorphism", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -1557,7 +1562,7 @@ describe("inheritance & polymorphism", () => { context: Client, contentType: SchemaContentTypeValues, body: string, - options: GetOptions = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -1580,7 +1585,7 @@ describe("inheritance & polymorphism", () => { context: Client, contentType: SchemaContentTypeValues, body: string, - options: GetOptions = { requestOptions: {} } + options: GetOptionalParams = { requestOptions: {} } ): Promise { const result = await _getSend(context, contentType, body, options); return _getDeserialize(result); @@ -1683,7 +1688,7 @@ describe("inheritance & polymorphism", () => { context: Client, testHeader: "A" | "B", body: string, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/") @@ -1703,7 +1708,7 @@ describe("inheritance & polymorphism", () => { context: Client, testHeader: "A" | "B", body: string, - options: GetOptions = { requestOptions: {} }, + options: GetOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getSend(context, testHeader, body, options); return _getDeserialize(result); @@ -1712,246 +1717,6 @@ describe("inheritance & polymorphism", () => { true ); }); - - it.skip("extensible enums with string literals being used in regular headers", async () => { - const tspDefinition = ` - import "@typespec/http"; - import "@typespec/rest"; - - @service({ - title: "Widget Service", - }) - namespace DemoService; - - using TypeSpec.Http; - using TypeSpec.Rest; - - enum SchemaContentTypeValues { - avro: "application/json; serialization=Avro", - json: "application/json; serialization=json", - custom: "text/plain; charset=utf-8", - protobuf: "text/vnd.ms.protobuf", - } - - op get( - @header("test-header") testHeader: SchemaContentTypeValues, - @body body: string, - ): NoContentResponse; - `; - const schemaOutput = await emitModularModelsFromTypeSpec( - tspDefinition, - false, - true - ); - assert.isUndefined(schemaOutput); - }); - - it.skip("fixed enums with string literals being used in regular headers", async () => { - const tspDefinition = ` - import "@typespec/http"; - import "@typespec/rest"; - import "@azure-tools/typespec-azure-core"; - - @service({ - title: "Widget Service", - }) - namespace DemoService; - - using TypeSpec.Http; - using TypeSpec.Rest; - using Azure.Core; - - @fixed - enum SchemaContentTypeValues { - avro: "application/json; serialization=Avro", - json: "application/json; serialization=json", - custom: "text/plain; charset=utf-8", - protobuf: "text/vnd.ms.protobuf", - } - - op get( - @header("test-header") testHeader: SchemaContentTypeValues, - @body body: string, - ): NoContentResponse; - `; - const schemaOutput = await emitModularModelsFromTypeSpec( - tspDefinition, - false, - true - ); - assert.isUndefined(schemaOutput); - const paramOutput = - await emitModularOperationsFromTypeSpec(tspDefinition); - assert.ok(paramOutput); - assert.strictEqual(paramOutput?.length, 1); - await assertEqualContent( - paramOutput?.[0]?.getFullText()!, - ` - import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; - import { RequestParameters } from "@azure-rest/core-client"; - - export interface GetHeaders { - "test-header": - | "application/json; serialization=Avro" - | "application/json; serialization=json" - | "text/plain; charset=utf-8" - | "text/vnd.ms.protobuf"; - } - - export interface GetBodyParam { - body: string; - } - - export interface GetHeaderParam { - headers: RawHttpHeadersInput & GetHeaders; - } - - export type GetParameters = GetHeaderParam & GetBodyParam & RequestParameters; - ` - ); - }); - - it.skip("fixed enums with string literals being used in regular headers", async () => { - const tspDefinition = ` - import "@typespec/http"; - import "@typespec/rest"; - import "@azure-tools/typespec-azure-core"; - - @service({ - title: "Widget Service", - }) - namespace DemoService; - - using TypeSpec.Http; - using TypeSpec.Rest; - using Azure.Core; - - @fixed - enum SchemaContentTypeValues { - avro: "application/json; serialization=Avro", - json: "application/json; serialization=json", - custom: "text/plain; charset=utf-8", - protobuf: "text/vnd.ms.protobuf", - } - - op get( - @header("test-header") testHeader: SchemaContentTypeValues, - @body body: string, - ): NoContentResponse; - `; - const schemaOutput = await emitModularModelsFromTypeSpec( - tspDefinition, - false, - true - ); - assert.ok(schemaOutput); - await assertEqualContent( - schemaOutput?.getFullText()!, - ` - /** */ - export type SchemaContentTypeValues = - | "application/json; serialization=Avro" - | "application/json; serialization=json" - | "text/plain; charset=utf-8" - | "text/vnd.ms.protobuf"; - ` - ); - const paramOutput = - await emitModularOperationsFromTypeSpec(tspDefinition); - assert.ok(paramOutput); - assert.strictEqual(paramOutput?.length, 1); - await assertEqualContent( - paramOutput?.[0]?.getFullText()!, - ` - import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; - import { RequestParameters } from "@azure-rest/core-client"; - - export interface GetHeaders { - "test-header": - | "application/json; serialization=Avro" - | "application/json; serialization=json" - | "text/plain; charset=utf-8" - | "text/vnd.ms.protobuf"; - } - - export interface GetBodyParam { - body: string; - } - - export interface GetHeaderParam { - headers: RawHttpHeadersInput & GetHeaders; - } - - export type GetParameters = GetHeaderParam & GetBodyParam & RequestParameters; - ` - ); - }); - - it.skip("fixed enums with number literals being used in regular headers", async () => { - const tspDefinition = ` - import "@typespec/http"; - import "@typespec/rest"; - import "@azure-tools/typespec-azure-core"; - - @service({ - title: "Widget Service", - }) - namespace DemoService; - - using TypeSpec.Http; - using TypeSpec.Rest; - using Azure.Core; - - @fixed - enum EnumTest { - one: 1, - two: 2, - three: 3, - four: 4, - } - - op get( - @header("test-header") testHeader: EnumTest, - @body body: string, - ): NoContentResponse; - `; - const schemaOutput = await emitModularModelsFromTypeSpec( - tspDefinition, - false, - true - ); - assert.ok(schemaOutput); - assert.isUndefined(schemaOutput); - const paramOutput = await emitModularOperationsFromTypeSpec( - tspDefinition, - false, - false, - false - ); - assert.ok(paramOutput); - assert.strictEqual(paramOutput?.length, 1); - await assertEqualContent( - paramOutput?.[0]?.getFullText()!, - ` - import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; - import { RequestParameters } from "@azure-rest/core-client"; - - export interface GetHeaders { - "test-header": 1 | 2 | 3 | 4; - } - - export interface GetBodyParam { - body: string; - } - - export interface GetHeaderParam { - headers: RawHttpHeadersInput & GetHeaders; - } - - export type GetParameters = GetHeaderParam & GetBodyParam & RequestParameters; - ` - ); - }); }); }); diff --git a/packages/typespec-ts/test/modularUnit/operations.spec.ts b/packages/typespec-ts/test/modularUnit/operations.spec.ts index 96978b0727..933a7fb5f3 100644 --- a/packages/typespec-ts/test/modularUnit/operations.spec.ts +++ b/packages/typespec-ts/test/modularUnit/operations.spec.ts @@ -48,7 +48,7 @@ describe("operations", () => { csvArrayHeader: Uint8Array[], utcDateHeader: Date, body: Bar, - options: ReadOptions = { requestOptions: {} }): StreamableMethod { + options: ReadOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/", ).post({...operationOptionsToRequestParameters(options), headers: { "required-header": requiredHeader, @@ -96,7 +96,7 @@ describe("operations", () => { csvArrayHeader: Uint8Array[], utcDateHeader: Date, body: Bar, - options: ReadOptions = { requestOptions: {} }): Promise { + options: ReadOptionalParams = { requestOptions: {} }): Promise { const result = await _readSend(context, requiredHeader, bytesHeader, value, csvArrayHeader, utcDateHeader, body, options); return _readDeserialize(result); }`, @@ -139,7 +139,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _readSend(context: Client, nullableRequiredHeader: (string | null), options: ReadOptions = { requestOptions: {} }): StreamableMethod { + export function _readSend(context: Client, nullableRequiredHeader: (string | null), options: ReadOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/", ).get({...operationOptionsToRequestParameters(options), headers: {"nullable-required-header": nullableRequiredHeader},}); } @@ -152,7 +152,7 @@ describe("operations", () => { return; } - export async function read(context: Client, nullableRequiredHeader: (string | null), options: ReadOptions = { requestOptions: {} }): Promise { + export async function read(context: Client, nullableRequiredHeader: (string | null), options: ReadOptionalParams = { requestOptions: {} }): Promise { const result = await _readSend(context, nullableRequiredHeader, options); return _readDeserialize(result); } @@ -182,7 +182,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _readSend(context: Client, bars?: Bar[], options: ReadOptions = { requestOptions: {} }): StreamableMethod { + export function _readSend(context: Client, bars?: Bar[], options: ReadOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/").post({ ...operationOptionsToRequestParameters(options), body: (bars ?? []).map((p) => { @@ -202,7 +202,7 @@ describe("operations", () => { return; } - export async function read(context: Client, bars?: Bar[], options: ReadOptions = { requestOptions: {} }): Promise { + export async function read(context: Client, bars?: Bar[], options: ReadOptionalParams = { requestOptions: {} }): Promise { const result = await _readSend(context, bars, options); return _readDeserialize(result); }` @@ -227,7 +227,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _readSend(context: Client, bars: Bar[], options: ReadOptions = { requestOptions: {} }): StreamableMethod { + export function _readSend(context: Client, bars: Bar[], options: ReadOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/").post({ ...operationOptionsToRequestParameters(options), body: bars.map((p) => { @@ -247,7 +247,7 @@ describe("operations", () => { return; } - export async function read(context: Client, bars: Bar[], options: ReadOptions = { requestOptions: {} }): Promise { + export async function read(context: Client, bars: Bar[], options: ReadOptionalParams = { requestOptions: {} }): Promise { const result = await _readSend(context, bars, options); return _readDeserialize(result); }` @@ -272,7 +272,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _readSend(context: Client, bars: Bar[], options: ReadOptions = { requestOptions: {} }): StreamableMethod { + export function _readSend(context: Client, bars: Bar[], options: ReadOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/").post({ ...operationOptionsToRequestParameters(options), body: bars.map((p) => { @@ -292,7 +292,7 @@ describe("operations", () => { return; } - export async function read(context: Client, bars: Bar[], options: ReadOptions = { requestOptions: {} }): Promise { + export async function read(context: Client, bars: Bar[], options: ReadOptionalParams = { requestOptions: {} }): Promise { const result = await _readSend(context, bars, options); return _readDeserialize(result); }` @@ -317,7 +317,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _readSend(context: Client, bars: Bar[], options: ReadOptions = { requestOptions: {} }): StreamableMethod { + export function _readSend(context: Client, bars: Bar[], options: ReadOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/").post({ ...operationOptionsToRequestParameters(options), body: bars.map((p) => { @@ -337,7 +337,7 @@ describe("operations", () => { return; } - export async function read(context: Client, bars: Bar[], options: ReadOptions = { requestOptions: {} }): Promise { + export async function read(context: Client, bars: Bar[], options: ReadOptionalParams = { requestOptions: {} }): Promise { const result = await _readSend(context, bars, options); return _readDeserialize(result); }` @@ -378,7 +378,7 @@ describe("operations", () => { export function _readSend( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -425,7 +425,7 @@ describe("operations", () => { export async function read( context: Client, body: Foo, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, body, options); return _readDeserialize(result); @@ -464,7 +464,7 @@ describe("operations", () => { export function _readSend( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/") @@ -507,7 +507,7 @@ describe("operations", () => { export async function read( context: Client, - options: ReadOptions = { requestOptions: {} } + options: ReadOptionalParams = { requestOptions: {} } ): Promise { const result = await _readSend(context, options); return _readDeserialize(result); @@ -549,7 +549,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _testSend(context: Client, options: TestOptions = { requestOptions: {} }): StreamableMethod { + export function _testSend(context: Client, options: TestOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/", ).post({...operationOptionsToRequestParameters(options), }) ; } @@ -563,7 +563,7 @@ describe("operations", () => { } } - export function test(context: Client, options: TestOptions = { requestOptions: {} }): PagedAsyncIterableIterator { + export function test(context: Client, options: TestOptionalParams = { requestOptions: {} }): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, () => _testSend(context, options), @@ -617,7 +617,7 @@ describe("operations", () => { import { TestingContext as Client } from "../rest/index.js"; import { StreamableMethod, operationOptionsToRequestParameters, createRestError } from "@azure-rest/core-client"; - export function _testSend(context: Client, options: TestOptions = { requestOptions: {} }): StreamableMethod { + export function _testSend(context: Client, options: TestOptionalParams = { requestOptions: {} }): StreamableMethod { return context.path("/", ).post({...operationOptionsToRequestParameters(options), }) ; } @@ -631,7 +631,7 @@ describe("operations", () => { } } - export async function test(context: Client, options: TestOptions = { requestOptions: {} }): Promise { + export async function test(context: Client, options: TestOptionalParams = { requestOptions: {} }): Promise { const result = await _testSend(context, options); return _testDeserialize(result); }`, diff --git a/packages/typespec-ts/test/modularUnit/serializeUtil.spec.ts b/packages/typespec-ts/test/modularUnit/serializeUtil.spec.ts index 775710cda0..c4cbc50f6d 100644 --- a/packages/typespec-ts/test/modularUnit/serializeUtil.spec.ts +++ b/packages/typespec-ts/test/modularUnit/serializeUtil.spec.ts @@ -50,7 +50,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -78,7 +78,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -138,7 +138,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -166,7 +166,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -218,7 +218,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -246,7 +246,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -298,7 +298,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -326,7 +326,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -383,7 +383,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -411,7 +411,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -468,7 +468,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -496,7 +496,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -590,7 +590,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -615,7 +615,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -706,7 +706,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -734,7 +734,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -835,7 +835,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/customGet1") @@ -860,7 +860,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -961,7 +961,7 @@ describe("modular special union serialization", () => { export function _customGet1Send( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/customGet1") @@ -986,7 +986,7 @@ describe("modular special union serialization", () => { export async function customGet1( context: Client, body: Widget1, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _customGet1Send(context, body, options); return _customGet1Deserialize(result); @@ -1040,7 +1040,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1061,7 +1061,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1120,7 +1120,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1141,7 +1141,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1192,7 +1192,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1213,7 +1213,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1264,7 +1264,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1285,7 +1285,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1341,7 +1341,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1362,7 +1362,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1417,7 +1417,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1438,7 +1438,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1527,7 +1527,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1548,7 +1548,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1639,7 +1639,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): StreamableMethod { return context .path("/customGet1") @@ -1660,7 +1660,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} } + options: CustomGet1OptionalParams = { requestOptions: {} } ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1763,7 +1763,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/customGet1") @@ -1784,7 +1784,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); @@ -1893,7 +1893,7 @@ describe("modular special union deserialization", () => { } from "@azure-rest/core-client"; export function _customGet1Send( context: Client, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/customGet1") @@ -1914,7 +1914,7 @@ describe("modular special union deserialization", () => { } export async function customGet1( context: Client, - options: CustomGet1Options = { requestOptions: {} }, + options: CustomGet1OptionalParams = { requestOptions: {} }, ): Promise { const result = await _customGet1Send(context, options); return _customGet1Deserialize(result); diff --git a/packages/typespec-ts/test/modularUnit/type.spec.ts b/packages/typespec-ts/test/modularUnit/type.spec.ts deleted file mode 100644 index 8ddbd03dd6..0000000000 --- a/packages/typespec-ts/test/modularUnit/type.spec.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { assert } from "chai"; -import { emitModularModelsFromTypeSpec } from "../util/emitUtil.js"; -import { assertEqualContent } from "../util/testUtil.js"; - -describe("model type", () => { - describe("string | string literal | nullable", () => { - it("string enum", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - model Test { - color: "red" | "blue"; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: "red" | "blue"; - }` - ); - }); - - it("string enum member", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - enum Color { - Red: "red", - Blue: "blue" - } - model Test { - color: Color.Red; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: "red"; - }` - ); - }); - - it("nullable string literal", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - model Test { - content: "red" | null; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - content: "red" | null; - }` - ); - }); - - it("nullable string", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - model Test { - content: string | null; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - content: string | null; - }` - ); - }); - }); - - describe("number | numeric literal | nullable", () => { - it("number enum", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - model Test { - color: 1 | 2; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: 1 | 2; - }` - ); - }); - - it("number enum member", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - enum Color { - Color1: 1, - Color2: 2 - } - model Test { - color: Color.Color1; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: 1; - }` - ); - }); - - it("nullable enum without @fixed would be interpreted as non-branded enum whichi is extensible", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - enum Color { - Color1: 1, - Color2: 2 - } - model Test { - color: Color | null; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: Color | null; - } - - /** Type of Color */ - /** "1", "2" */ - export type Color = string; - ` - ); - }); - - it("nullable @fixed enum would be intepreted as azure enum which is fixed", async () => { - const modelFile = await emitModularModelsFromTypeSpec( - ` - @fixed - enum Color { - Color1: 1, - Color2: 2 - } - model Test { - color: Color | null; - } - op read(@body body: Test): void; - `, - undefined, - undefined, - true - ); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: Color | null; - } - - /** Type of Color */ - /** */ - export type Color = "1" | "2"; - ` - ); - }); - - it.skip("union of enum", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - enum LR { - left, - right, - } - enum UD { - up, - down, - } - - model Test { - color: LR | UD; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - color: "left" | "right" | "up" | "down"; - } - ` - ); - }); - - it("nullable numeric literal", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - model Test { - content: 1 | null; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - content: 1 | null; - }` - ); - }); - - it("nullable number", async () => { - const modelFile = await emitModularModelsFromTypeSpec(` - model Test { - content: int32 | null; - } - op read(@body body: Test): void; - `); - assert.ok(modelFile); - await assertEqualContent( - modelFile!.getFullText()!, - ` - export interface Test { - content: number | null; - }` - ); - }); - }); -}); diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/index.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/index.ts index c008bfd1eb..58b80f17bd 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/index.ts +++ b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/index.ts @@ -5,4 +5,4 @@ export { createUsage, UsageClientOptions, UsageContext, -} from "./UsageContext.js"; +} from "./usageContext.js"; diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/operations.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/operations.ts index c259ea6090..9a66ff50f2 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/operations.ts +++ b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/operations.ts @@ -17,15 +17,15 @@ import { createRestError, } from "@typespec/ts-http-runtime"; import { - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "../models/options.js"; export function _inputSend( context: Client, inputParameter: InputRecord, - options: InputOptions = { requestOptions: {} }, + options: InputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/usage/input") @@ -48,7 +48,7 @@ export async function _inputDeserialize( export async function input( context: Client, inputParameter: InputRecord, - options: InputOptions = { requestOptions: {} }, + options: InputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _inputSend(context, inputParameter, options); return _inputDeserialize(result); @@ -56,7 +56,7 @@ export async function input( export function _outputSend( context: Client, - options: OutputOptions = { requestOptions: {} }, + options: OutputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/usage/output") @@ -77,7 +77,7 @@ export async function _outputDeserialize( export async function output( context: Client, - options: OutputOptions = { requestOptions: {} }, + options: OutputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _outputSend(context, options); return _outputDeserialize(result); @@ -86,7 +86,7 @@ export async function output( export function _inputAndOutputSend( context: Client, body: InputOutputRecord, - options: InputAndOutputOptions = { requestOptions: {} }, + options: InputAndOutputOptionalParams = { requestOptions: {} }, ): StreamableMethod { return context .path("/type/model/usage/input-output") @@ -111,7 +111,7 @@ export async function _inputAndOutputDeserialize( export async function inputAndOutput( context: Client, body: InputOutputRecord, - options: InputAndOutputOptions = { requestOptions: {} }, + options: InputAndOutputOptionalParams = { requestOptions: {} }, ): Promise { const result = await _inputAndOutputSend(context, body, options); return _inputAndOutputDeserialize(result); diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/UsageContext.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/usageContext.ts similarity index 100% rename from packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/UsageContext.ts rename to packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/api/usageContext.ts diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.ts index 41a6d8f226..2cad1d93e8 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.ts +++ b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.ts @@ -1,11 +1,11 @@ // Licensed under the MIT license. -export { UsageClient, UsageClientOptions } from "./UsageClient.js"; +export { UsageClient, UsageClientOptions } from "./usageClient.js"; export { InputRecord, OutputRecord, InputOutputRecord, - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "./models/index.js"; diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/index.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/index.ts index 6ccd0e51b5..c51f0cb33b 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/index.ts +++ b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/index.ts @@ -2,7 +2,7 @@ export { InputRecord, OutputRecord, InputOutputRecord } from "./models.js"; export { - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "./options.js"; diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/options.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/options.ts index a27869bae9..90e358540d 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/options.ts +++ b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/models/options.ts @@ -2,8 +2,8 @@ import { OperationOptions } from "@typespec/ts-http-runtime"; -export interface InputOptions extends OperationOptions {} +export interface InputOptionalParams extends OperationOptions {} -export interface OutputOptions extends OperationOptions {} +export interface OutputOptionalParams extends OperationOptions {} -export interface InputAndOutputOptions extends OperationOptions {} +export interface InputAndOutputOptionalParams extends OperationOptions {} diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/UsageClient.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/usageClient.ts similarity index 77% rename from packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/UsageClient.ts rename to packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/usageClient.ts index 9faa784709..d08a038cc0 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/UsageClient.ts +++ b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/usageClient.ts @@ -7,9 +7,9 @@ import { InputOutputRecord, } from "./models/models.js"; import { - InputOptions, - OutputOptions, - InputAndOutputOptions, + InputOptionalParams, + OutputOptionalParams, + InputAndOutputOptionalParams, } from "./models/options.js"; import { input, @@ -20,7 +20,7 @@ import { UsageContext, } from "./api/index.js"; -export { UsageClientOptions } from "./api/UsageContext.js"; +export { UsageClientOptions } from "./api/usageContext.js"; export class UsageClient { private _client: UsageContext; @@ -35,20 +35,20 @@ export class UsageClient { input( inputParameter: InputRecord, - options: InputOptions = { requestOptions: {} }, + options: InputOptionalParams = { requestOptions: {} }, ): Promise { return input(this._client, inputParameter, options); } output( - options: OutputOptions = { requestOptions: {} }, + options: OutputOptionalParams = { requestOptions: {} }, ): Promise { return output(this._client, options); } inputAndOutput( body: InputOutputRecord, - options: InputAndOutputOptions = { requestOptions: {} }, + options: InputAndOutputOptionalParams = { requestOptions: {} }, ): Promise { return inputAndOutput(this._client, body, options); } diff --git a/packages/typespec-ts/test/unit/apiVersion.spec.ts b/packages/typespec-ts/test/unit/apiVersion.spec.ts index 63e7125faa..f49f8ad875 100644 --- a/packages/typespec-ts/test/unit/apiVersion.spec.ts +++ b/packages/typespec-ts/test/unit/apiVersion.spec.ts @@ -121,7 +121,9 @@ const buildDefaultReturn = ( hasApiVersionInClient: boolean = false ) => { const defaultDef = !hasDefault - ? (hasApiVersionInClient? `options.apiVersion = options.apiVersion ?? apiVersion;`: "") + ? hasApiVersionInClient + ? `options.apiVersion = options.apiVersion ?? apiVersion;` + : "" : `options.apiVersion = options.apiVersion ?? "2022-05-15-preview";`; const apiVersionDef = !hasQueryDefinition ? `\n client.pipeline.removePolicy({ name: "ApiVersionPolicy" });\n \n` @@ -133,11 +135,17 @@ const buildDefaultReturn = ( /** * Initialize a new instance of \`testClient\` - * @param endpointParam - The endpoint to use.${hasApiVersionInClient && !hasDefault? "\n * @param apiVersion - The parameter apiVersion": ""} + * @param endpointParam - The endpoint to use.${ + hasApiVersionInClient && !hasDefault + ? "\n * @param apiVersion - The parameter apiVersion" + : "" + } * @param options - the parameter for all optional parameters */ export default function createClient( - endpointParam: string,${hasApiVersionInClient && !hasDefault? "\napiVersion: string,": ""} + endpointParam: string,${ + hasApiVersionInClient && !hasDefault ? "\napiVersion: string," : "" + } options: ClientOptions = {} ): testClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? \`\${endpointParam}/language\`; @@ -168,9 +176,10 @@ const buildPathReturn_WithDefault = () => { import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { testClient } from "./clientDefinitions.js"; + import { Versions } from "./models.js"; export interface testClientOptions extends ClientOptions { - apiVersion?: string; + apiVersion?: Versions; } /** @@ -213,16 +222,17 @@ const buildPathReturn_WithoutDefault = () => { import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { testClient } from "./clientDefinitions.js"; + import { Versions } from "./models.js"; /** * Initialize a new instance of \`testClient\` * @param endpointParam - The endpoint to use. - * @param apiVersion - Api Version Possible values: "2022-05-15-preview" + * @param apiVersion - Api Version * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - apiVersion: string, + apiVersion: Versions, options: ClientOptions = {} ): testClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? \`\${endpointParam}/anomalydetector/\${apiVersion}\`; diff --git a/packages/typespec-ts/test/unit/clientFactoryGenerator.spec.ts b/packages/typespec-ts/test/unit/clientFactoryGenerator.spec.ts index 3d3bc43c16..4c0f36730c 100644 --- a/packages/typespec-ts/test/unit/clientFactoryGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/clientFactoryGenerator.spec.ts @@ -112,39 +112,38 @@ describe("Client Factory generation", () => { }); it("should handle two parameters", async () => { - const models = await emitClientFactoryFromTypeSpec( - ` - @server( - "{Endpoint}/language/{Version}", - "Language Service", - { - Endpoint: Endpoint, - Version: Version - } - ) - @service( {title: "PetStoreClient"}) - namespace PetStore; - @doc("The endpoint to use.") - scalar Endpoint extends string; + const tsp = ` + @server( + "{Endpoint}/language/{Version}", + "Language Service", + { + Endpoint: Endpoint, + Version: Version + } + ) + @service( {title: "PetStoreClient"}) + namespace PetStore; + @doc("The endpoint to use.") + scalar Endpoint extends string; - #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" - #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" - @doc("The version to use") - @fixed - enum Version { - V1, - V2 - } - `, - true - ); - assert.ok(models); + #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" + #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" + @doc("The version to use") + @fixed + enum Version { + V1, + V2 + } + `; + const clientFactory = await emitClientFactoryFromTypeSpec(tsp, true); + assert.ok(clientFactory); await assertEqualContent( - models!.content, + clientFactory!.content, ` import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { testClient } from "./clientDefinitions.js"; + import { Version } from "./models.js"; /** * Initialize a new instance of \`testClient\` @@ -154,7 +153,7 @@ describe("Client Factory generation", () => { */ export default function createClient( endpointParam: string, - version: "V1" | "V2", + version: Version, options: ClientOptions = {} ): testClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? \`\${endpointParam}/language/\${version}\`; @@ -214,16 +213,17 @@ describe("Client Factory generation", () => { import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { testClient } from "./clientDefinitions.js"; + import { Versions } from "./models.js"; /** * Initialize a new instance of \`testClient\` * @param endpointParam - The endpoint to use. - * @param version - The version to use. Possible values: "v1.1" + * @param version - The version to use. * @param options - the parameter for all optional parameters */ export default function createClient( endpointParam: string, - version: string, + version: Versions, options: ClientOptions = {} ): testClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? \`\${endpointParam}/language/\${version}\`; @@ -284,6 +284,7 @@ describe("Client Factory generation", () => { import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger.js"; import { testClient } from "./clientDefinitions.js"; + import { Versions } from "./models.js"; export interface testClientOptions extends ClientOptions { endpointParam?: string; @@ -291,11 +292,11 @@ describe("Client Factory generation", () => { /** * Initialize a new instance of \`testClient\` - * @param version - The version to use. Possible values: "v1.1" + * @param version - The version to use. * @param options - the parameter for all optional parameters */ export default function createClient( - version: string, + version: Versions, options: testClientOptions = {} ): testClient { const endpointParam = options.endpointParam ?? "http://localhost:3000"; diff --git a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts index 5495ddc89d..defeee71c1 100644 --- a/packages/typespec-ts/test/unit/modelsGenerator.spec.ts +++ b/packages/typespec-ts/test/unit/modelsGenerator.spec.ts @@ -62,7 +62,6 @@ describe("Input/output model type", () => { ); assert.ok(schemaOutput); const { inputModelFile, outputModelFile } = schemaOutput!; - // console.log(inputModelFile?.content); assert.strictEqual(inputModelFile?.path, "models.ts"); await assertEqualContent( inputModelFile?.content!, @@ -117,6 +116,31 @@ describe("Input/output model type", () => { await verifyPropertyType(tspType, typeScriptType); }); + it("should generate nullable model", async () => { + const tspDefinition = ` + alias NullableFloat = float32 | null; + model SimpleModel { + color: Record[]; + } + `; + const tspType = "SimpleModel"; + const typeScriptType = "SimpleModel"; + await verifyPropertyType(tspType, typeScriptType, { + additionalTypeSpecDefinition: tspDefinition, + outputType: "SimpleModelOutput", + additionalInputContent: ` + export interface SimpleModel { + color: Record[]; + } + `, + additionalOutputContent: ` + export interface SimpleModelOutput { + color: Record[]; + } + ` + }); + }); + it("should generate nullable model", async () => { const tspDefinition = ` model SimpleModel { @@ -165,150 +189,168 @@ describe("Input/output model type", () => { await verifyPropertyType("float64", "number"); }); }); - describe("string generation", () => { - it("should handle extensible_enum as property -> string", async () => { - // When extensible_enum is comsumed as body property it should be string only - const schemaOutput = await emitModelsFromTypeSpec(` - @doc("Extensible enum model description") - enum TranslationLanguageValues { - #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" - English, - #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" - Chinese, - } - model InputOutputModel { - @doc("Property description") - prop: TranslationLanguageValues; - } - @route("/models") - @get - op getModel(@body input: InputOutputModel): InputOutputModel; - `); - assert.ok(schemaOutput); - const { inputModelFile, outputModelFile } = schemaOutput!; - await assertEqualContent( - inputModelFile?.content!, - ` - export interface InputOutputModel { - /** - * Property description - * - * Possible values: "English", "Chinese" - */ - prop: string; - }` - ); - await assertEqualContent( - outputModelFile?.content!, - ` - export interface InputOutputModelOutput { - /** - * Property description - * - * Possible values: "English", "Chinese" - */ - prop: string; - }` - ); - }); - it("should handle extensible_enum as body -> string", async () => { - // When extensible_enum is comsumed as body property it should be string only - const schemaOutput = await emitParameterFromTypeSpec(` - #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" - enum TranslationLanguage { - English, - Chinese, - } - model InputOutputModel { - prop: TranslationLanguage; - } - @route("/models") - @get - op getModel(@body input: TranslationLanguage): InputOutputModel; - `); - assert.ok(schemaOutput); - await assertEqualContent( - schemaOutput?.content!, - ` - import { RequestParameters } from "@azure-rest/core-client"; - - export interface GetModelBodyParam { - /** Possible values: "English", "Chinese" */ - body: string; - } - - export type GetModelParameters = GetModelBodyParam & RequestParameters;` - ); - }); - - describe("fixed enum", () => { - it("should handle enum -> string_literals", async () => { - const tspTypeDefinition = ` - #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" - @fixed - @doc("Translation Language Values") - enum TranslationLanguageValues { - @doc("English descriptions") - English, - @doc("Chinese descriptions") - Chinese, - }`; - const tspType = "TranslationLanguageValues"; - const typeScriptType = `"English" | "Chinese"`; - await verifyPropertyType( - tspType, - typeScriptType, - { - additionalTypeSpecDefinition: tspTypeDefinition - }, - true - ); + describe("string", () => { + describe("enum", () => { + describe("without @fixed", () => { + it("should handle enum as property -> type alias with union", async () => { + const schemaOutput = await emitModelsFromTypeSpec(` + @doc("Extensible enum model description") + enum TranslationLanguageValues { + #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" + English, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" + Chinese, + } + model InputOutputModel { + @doc("Property description") + prop: TranslationLanguageValues; + } + @route("/models") + @get + op getModel(@body input: InputOutputModel): InputOutputModel; + `); + assert.ok(schemaOutput); + const { inputModelFile, outputModelFile } = schemaOutput!; + await assertEqualContent( + inputModelFile?.content!, + ` + export interface InputOutputModel { + /** Property description */ + prop: TranslationLanguageValues; + } + + /** Extensible enum model description */ + export type TranslationLanguageValues = "English" | "Chinese"; + ` + ); + await assertEqualContent( + outputModelFile?.content!, + ` + export interface InputOutputModelOutput { + /** Property description */ + prop: TranslationLanguageValuesOutput; + } + + /** Extensible enum model description */ + export type TranslationLanguageValuesOutput = "English" | "Chinese";` + ); + }); + it("should handle enum as body -> type alias with union", async () => { + const schemaOutput = await emitParameterFromTypeSpec(` + #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" + enum TranslationLanguage { + English, + Chinese, + } + model InputOutputModel { + prop: TranslationLanguage; + } + @route("/models") + @get + op getModel(@body input: TranslationLanguage): InputOutputModel; + `); + assert.ok(schemaOutput); + await assertEqualContent( + schemaOutput?.content!, + ` + import { RequestParameters } from "@azure-rest/core-client"; + import { TranslationLanguage } from "./models.js"; + + export interface GetModelBodyParam { + body: TranslationLanguage; + } + + export type GetModelParameters = GetModelBodyParam & RequestParameters;` + ); + }); }); + describe("with @fixed", () => { + it("should handle enum -> string_literals", async () => { + const tspTypeDefinition = ` + #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" + @fixed + @doc("Translation Language Values") + enum TranslationLanguageValues { + @doc("English descriptions") + English, + @doc("Chinese descriptions") + Chinese, + }`; + const tspType = "TranslationLanguageValues"; + const typeScriptType = `TranslationLanguageValues`; + await verifyPropertyType( + tspType, + typeScriptType, + { + outputType: `TranslationLanguageValuesOutput`, + additionalTypeSpecDefinition: tspTypeDefinition, + additionalInputContent: ` + /** Translation Language Values */ + export type TranslationLanguageValues = "English" | "Chinese"; + `, + additionalOutputContent: ` + /** Translation Language Values */ + export type TranslationLanguageValuesOutput = "English" | "Chinese"; + ` + }, + true + ); + }); - it("with enum value is xx.xx", async () => { - const tspTypeDefinition = ` - #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" - @fixed - @doc("Translation Language Values") - enum TranslationLanguageValues { - @doc("English descriptions") - \`English.Class\`, - @doc("Chinese descriptions") - \`Chinese.Class\`, - }`; - const tspType = "TranslationLanguageValues"; - const typeScriptType = `"English.Class" | "Chinese.Class"`; - await verifyPropertyType( - tspType, - typeScriptType, - { - additionalTypeSpecDefinition: tspTypeDefinition - }, - true - ); - }); + it("with enum value is xx.xx", async () => { + const tspTypeDefinition = ` + #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" + @fixed + @doc("Translation Language Values") + enum TranslationLanguageValues { + @doc("English descriptions") + \`English.Class\`, + @doc("Chinese descriptions") + \`Chinese.Class\`, + }`; + const tspType = "TranslationLanguageValues"; + const typeScriptType = `TranslationLanguageValues`; + await verifyPropertyType( + tspType, + typeScriptType, + { + outputType: `TranslationLanguageValuesOutput`, + additionalTypeSpecDefinition: tspTypeDefinition, + additionalInputContent: ` + /** Translation Language Values */ + export type TranslationLanguageValues = "English.Class" | "Chinese.Class"; + `, + additionalOutputContent: ` + /** Translation Language Values */ + export type TranslationLanguageValuesOutput = "English.Class" | "Chinese.Class"; + ` + }, + true + ); + }); - it("should handle enum member", async () => { - const tspTypeDefinition = ` - #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" - @fixed - @doc("Translation Language Values") - enum TranslationLanguageValues { - @doc("English descriptions") - English, - @doc("Chinese descriptions") - Chinese, - }`; - const tspType = "TranslationLanguageValues.English"; - const typeScriptType = `"English"`; - await verifyPropertyType( - tspType, - typeScriptType, - { - additionalTypeSpecDefinition: tspTypeDefinition - }, - true - ); + it("should handle enum member", async () => { + const tspTypeDefinition = ` + #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" + @fixed + @doc("Translation Language Values") + enum TranslationLanguageValues { + @doc("English descriptions") + English, + @doc("Chinese descriptions") + Chinese, + }`; + const tspType = "TranslationLanguageValues.English"; + const typeScriptType = `"English"`; + await verifyPropertyType( + tspType, + typeScriptType, + { + additionalTypeSpecDefinition: tspTypeDefinition + }, + true + ); + }); }); }); @@ -617,7 +659,7 @@ describe("Input/output model type", () => { }); }); - it("should handle fixed enum array", async () => { + it("should handle enum with @fixed array", async () => { const tspDefinition = ` #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" @@ -628,20 +670,28 @@ describe("Input/output model type", () => { } `; const tspType = "DiskEncryptionTarget[]"; - const typeScriptType = `("osdisk" | "temporarydisk")[]`; + const typeScriptType = `DiskEncryptionTarget[]`; const inputModelName = typeScriptType; await verifyPropertyType( tspType, inputModelName, { additionalTypeSpecDefinition: tspDefinition, - outputType: typeScriptType + outputType: `DiskEncryptionTargetOutput[]`, + additionalInputContent: ` + /** Alias for DiskEncryptionTarget */ + export type DiskEncryptionTarget = "osdisk" | "temporarydisk"; + `, + additionalOutputContent: ` + /** Alias for DiskEncryptionTargetOutput */ + export type DiskEncryptionTargetOutput = "osdisk" | "temporarydisk"; + ` }, true ); }); - it("should handle extensible enum array", async () => { + it("should handle enum without fixed array", async () => { const tspDefinition = ` #suppress "@azure-tools/typespec-azure-core/documentation-required" "for test" enum DiskEncryptionTarget { @@ -650,14 +700,22 @@ describe("Input/output model type", () => { } `; const tspType = "DiskEncryptionTarget[]"; - const typeScriptType = `string[]`; + const typeScriptType = `DiskEncryptionTarget[]`; const inputModelName = typeScriptType; await verifyPropertyType( tspType, inputModelName, { additionalTypeSpecDefinition: tspDefinition, - outputType: typeScriptType + outputType: `DiskEncryptionTargetOutput[]`, + additionalInputContent: ` + /** Alias for DiskEncryptionTarget */ + export type DiskEncryptionTarget = "osdisk" | "temporarydisk"; + `, + additionalOutputContent: ` + /** Alias for DiskEncryptionTargetOutput */ + export type DiskEncryptionTargetOutput = "osdisk" | "temporarydisk"; + ` }, true ); @@ -972,10 +1030,12 @@ describe("Input/output model type", () => { } export interface BOutputParent { - a: string; + a: AOutput; } - export type BOutput = BOutputParent | COutput;` + export type BOutput = BOutputParent | COutput; + /** Alias for AOutput */ + export type AOutput = "AA" | "BB";` ); }); @@ -993,9 +1053,11 @@ describe("Input/output model type", () => { } export interface BOutput { - /** Possible values: "AA", "BB" */ - a: string; - }` + a: AOutput; + } + + /** Alias for AOutput */ + export type AOutput = "AA" | "BB";` ); }); }); @@ -1030,9 +1092,12 @@ describe("Input/output model type", () => { } export interface BOutput { - /** Possible values: 1.1, 2.2 */ - a: string; - }` + a: AOutput; + } + + /** Alias for AOutput */ + export type AOutput = 1.1 | 2.2; + ` ); }); }); @@ -2640,6 +2705,56 @@ describe("Input/output model type", () => { ); }); + it("ErrorResponse model would not be renamed even enabling the namespace name", async () => { + const schemaOutput = await emitModelsFromTypeSpec( + ` + import "@azure-tools/typespec-client-generator-core"; + import "@azure-tools/typespec-azure-core"; + import "@typespec/http"; + import "@typespec/rest"; + import "@typespec/versioning"; + + using Azure.ClientGenerator.Core; + using Azure.Core; + using TypeSpec.Rest; + using TypeSpec.Http; + using TypeSpec.Versioning; + + @service + namespace MyNamespace; + @doc("testing") + model A { + @doc("testing") + errors?: Azure.Core.Foundations.ErrorResponse[]; + } + + interface MyInterface { + @route("/op2") + op1(a: A): void + } + `, + false, + true, + true, + true, + true + ); + assert.ok(schemaOutput); + const { inputModelFile } = schemaOutput!; + await assertEqualContent( + inputModelFile?.content!, + ` + import { ErrorResponse } from "@azure-rest/core-client"; + + /** testing */ + export interface A { + /** testing */ + "errors"?: Array; + } + ` + ); + }); + it("Azure.Core.Foundations.InnerError -> InnerError", async () => { const tspDefinition = ` @doc("testing") @@ -2929,7 +3044,6 @@ describe("Input/output model type", () => { ); assert.ok(schemaOutput); const { inputModelFile, outputModelFile } = schemaOutput!; - // console.log(inputModelFile?.content); assert.strictEqual(inputModelFile?.path, "models.ts"); await assertEqualContent( inputModelFile?.content!, @@ -3120,7 +3234,6 @@ describe("Input/output model type", () => { ); assert.ok(schemaOutput); const { inputModelFile, outputModelFile } = schemaOutput!; - // console.log(inputModelFile?.content); assert.strictEqual(inputModelFile?.path, "models.ts"); await assertEqualContent( inputModelFile?.content!, @@ -3457,7 +3570,7 @@ describe("Input/output model type", () => { ); }); - it("extensible enums with string literals being used in regular headers", async () => { + it("enums with string literals being used in regular headers", async () => { const tspDefinition = ` import "@typespec/http"; import "@typespec/rest"; @@ -3490,11 +3603,17 @@ describe("Input/output model type", () => { ); assert.ok(schemaOutput); const { inputModelFile, outputModelFile } = schemaOutput!; + await assertEqualContent( + inputModelFile?.content!, + ` + /** Alias for SchemaContentTypeValues */ + export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf"; + ` + ); assert.isUndefined(outputModelFile); - assert.isUndefined(inputModelFile); }); - it("fixed enums with string literals being used in regular headers", async () => { + it("enums with @fixed with string literals being used in regular headers", async () => { const tspDefinition = ` import "@typespec/http"; import "@typespec/rest"; @@ -3530,82 +3649,14 @@ describe("Input/output model type", () => { ); assert.ok(schemaOutput); const { inputModelFile, outputModelFile } = schemaOutput!; - assert.isUndefined(outputModelFile); - assert.isUndefined(inputModelFile); - const paramOutput = await emitParameterFromTypeSpec( - tspDefinition, - false, - false, - true, - true - ); - assert.ok(paramOutput); - assert.strictEqual(paramOutput?.path, "parameters.ts"); await assertEqualContent( - paramOutput?.content!, - ` - import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; - import { RequestParameters } from "@azure-rest/core-client"; - - export interface GetHeaders { - "test-header": - | "application/json; serialization=Avro" - | "application/json; serialization=json" - | "text/plain; charset=utf-8" - | "text/vnd.ms.protobuf"; - } - - export interface GetBodyParam { - body: string; - } - - export interface GetHeaderParam { - headers: RawHttpHeadersInput & GetHeaders; - } - - export type GetParameters = GetHeaderParam & GetBodyParam & RequestParameters; + inputModelFile?.content!, ` + /** Alias for SchemaContentTypeValues */ + export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf"; + ` ); - }); - - it("fixed enums with string literals being used in regular headers", async () => { - const tspDefinition = ` - import "@typespec/http"; - import "@typespec/rest"; - import "@azure-tools/typespec-azure-core"; - - @service({ - title: "Widget Service", - }) - namespace DemoService; - - using TypeSpec.Http; - using TypeSpec.Rest; - using Azure.Core; - - @fixed - enum SchemaContentTypeValues { - avro: "application/json; serialization=Avro", - json: "application/json; serialization=json", - custom: "text/plain; charset=utf-8", - protobuf: "text/vnd.ms.protobuf", - } - - op get( - @header("test-header") testHeader: SchemaContentTypeValues, - @body body: string, - ): NoContentResponse; - `; - const schemaOutput = await emitModelsFromTypeSpec( - tspDefinition, - true, - false, - true - ); - assert.ok(schemaOutput); - const { inputModelFile, outputModelFile } = schemaOutput!; assert.isUndefined(outputModelFile); - assert.isUndefined(inputModelFile); const paramOutput = await emitParameterFromTypeSpec( tspDefinition, false, @@ -3620,13 +3671,10 @@ describe("Input/output model type", () => { ` import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; import { RequestParameters } from "@azure-rest/core-client"; + import { SchemaContentTypeValues } from "./models.js"; export interface GetHeaders { - "test-header": - | "application/json; serialization=Avro" - | "application/json; serialization=json" - | "text/plain; charset=utf-8" - | "text/vnd.ms.protobuf"; + "test-header": SchemaContentTypeValues; } export interface GetBodyParam { @@ -3642,7 +3690,7 @@ describe("Input/output model type", () => { ); }); - it("fixed enums with number literals being used in regular headers", async () => { + it("enums with number literals being used in regular headers", async () => { const tspDefinition = ` import "@typespec/http"; import "@typespec/rest"; @@ -3678,8 +3726,14 @@ describe("Input/output model type", () => { ); assert.ok(schemaOutput); const { inputModelFile, outputModelFile } = schemaOutput!; + await assertEqualContent( + inputModelFile?.content!, + ` + /** Alias for EnumTest */ + export type EnumTest = 1 | 2 | 3 | 4; + ` + ); assert.isUndefined(outputModelFile); - assert.isUndefined(inputModelFile); const paramOutput = await emitParameterFromTypeSpec( tspDefinition, false, @@ -3693,9 +3747,10 @@ describe("Input/output model type", () => { ` import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; import { RequestParameters } from "@azure-rest/core-client"; + import { EnumTest } from "./models.js"; export interface GetHeaders { - "test-header": 1 | 2 | 3 | 4; + "test-header": EnumTest; } export interface GetBodyParam { diff --git a/packages/typespec-ts/test/unit/transform/transformSchemas.spec.ts b/packages/typespec-ts/test/unit/transform/transformSchemas.spec.ts index 0187e488da..fa77dc888f 100644 --- a/packages/typespec-ts/test/unit/transform/transformSchemas.spec.ts +++ b/packages/typespec-ts/test/unit/transform/transformSchemas.spec.ts @@ -138,187 +138,271 @@ describe("#transformSchemas", () => { assert.strictEqual(property!.isConstant, true); }); - it("generate literal union", async () => { - const property = await verifyFirstProperty(`true | "test" | 1`); - assert.isNotNull(property); - assert.strictEqual(property!.type, `union`); - assert.strictEqual(property!.typeName, 'true | "test" | 1'); - assert.strictEqual(property!.outputTypeName, 'true | "test" | 1'); - assert.isUndefined(property!.isConstant); - assert.strictEqual(property!.enum!.length, 3); - assert.strictEqual(property!.enum![0].type, "true"); - assert.strictEqual(property!.enum![0].isConstant, true); - }); + describe("union", () => { + describe("named union", () => { + it("should generate a name for union", async () => { + const schemaOutput = await emitSchemasFromTypeSpec( + ` + @doc("Translation Language Values") + union TranslationLanguageValues { + @doc("English descriptions") + English: "English", - it("generate string literal union", async () => { - const property = await verifyFirstProperty(`"a" | "test"`); - assert.isNotNull(property); - assert.deepEqual(property, { - enum: [ - { type: '"a"', isConstant: true }, - { type: '"test"', isConstant: true } - ], - type: "union", - typeName: '"a" | "test"', - outputTypeName: '"a" | "test"', - required: true, - usage: ["input", "output"], - description: undefined - } as any); - }); + @doc("Chinese descriptions") + Chinese: "Chinese", + } + model Test { + prop: TranslationLanguageValues; + } + @route("/models") + @get + op getModel(@body input: Test): Test; + `, + true + ); + assert.isNotNull(schemaOutput); + const first = schemaOutput?.[0] as ObjectSchema; + const property = first.properties![`"prop"`]; + // console.log(first, property, property?.enum); + assert.isNotNull(property); + assert.deepEqual(property, { + name: "TranslationLanguageValues", + type: "object", + typeName: "TranslationLanguageValues", + outputTypeName: "TranslationLanguageValuesOutput", + alias: '"English" | "Chinese"', + outputAlias: '"English" | "Chinese"', + required: true, + usage: ["input", "output"], + description: undefined, + enum: [ + { + isConstant: true, + type: '"English"' + }, + { + isConstant: true, + type: '"Chinese"' + } + ] + } as any); + }); - it("generate primitive union", async () => { - const property = await verifyFirstProperty( - `string | int32 | boolean | utcDateTime` - ); - assert.isNotNull(property); - // console.log(property); - assert.deepEqual(property, { - enum: [ - { - type: "string", - description: "A sequence of textual characters." - }, - { type: "number", format: "int32" }, - { type: "boolean", description: undefined }, - { - type: "string", - format: undefined, + it("union of union should be generated correctly", async () => { + const schemaOutput = await emitSchemasFromTypeSpec( + ` + @doc("Translation Language Values") + union TranslationLanguageValues { + @doc("English descriptions") + English: "English", + + @doc("Chinese descriptions") + Chinese: "Chinese", + + Others: OtherValues + } + + union OtherValues { + "Japanese" + } + model Test { + prop: TranslationLanguageValues; + } + @route("/models") + @get + op getModel(@body input: Test): Test; + `, + true + ); + assert.isNotNull(schemaOutput); + const first = schemaOutput?.[0] as ObjectSchema; + const property = first.properties![`"prop"`]; + // console.log(first, property, property?.enum); + assert.isNotNull(property); + assert.deepEqual(property, { + name: "TranslationLanguageValues", + type: "object", + typeName: "TranslationLanguageValues", + outputTypeName: "TranslationLanguageValuesOutput", + alias: '"English" | "Chinese" | OtherValues', + outputAlias: '"English" | "Chinese" | OtherValuesOutput', + required: true, + usage: ["input", "output"], description: undefined, - typeName: "Date | string", - outputTypeName: "string" - } - ], - type: "union", - typeName: "string | number | boolean | Date | string", - outputTypeName: "string | number | boolean | string", - required: true, - usage: ["input", "output"], - description: undefined - } as any); - }); + enum: [ + { + isConstant: true, + type: '"English"' + }, + { + isConstant: true, + type: '"Chinese"' + }, + { + enum: [ + { + isConstant: true, + type: '"Japanese"' + } + ], + name: "OtherValues", + type: "object", + typeName: "OtherValues", + outputTypeName: "OtherValuesOutput", + alias: '"Japanese"', + outputAlias: '"Japanese"' + } + ] + } as any); + }); + }); + describe("anonymous union", () => { + it("generate literal union", async () => { + const property = await verifyFirstProperty(`true | "test" | 1`); + assert.isNotNull(property); + assert.strictEqual(property!.type, `union`); + assert.strictEqual(property!.typeName, 'true | "test" | 1'); + assert.strictEqual(property!.outputTypeName, 'true | "test" | 1'); + assert.isUndefined(property!.isConstant); + assert.strictEqual(property!.enum!.length, 3); + assert.strictEqual(property!.enum![0].type, "true"); + assert.strictEqual(property!.enum![0].isConstant, true); + }); - it("generate fixed enum", async () => { - const schemaOutput = await emitSchemasFromTypeSpec( - ` - #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" - @fixed - @doc("Translation Language Values") - enum TranslationLanguageValues { - @doc("English descriptions") - English, - @doc("Chinese descriptions") - Chinese, - } - model Test { - prop: TranslationLanguageValues; - } - @route("/models") - @get - op getModel(@body input: Test): Test; - `, - true - ); - assert.isNotNull(schemaOutput); - const first = schemaOutput?.[0] as ObjectSchema; - const property = first.properties![`"prop"`]; - // console.log(first, property, property?.enum); - assert.isNotNull(property); - assert.deepEqual(property, { - type: '"English" | "Chinese"', - description: undefined, - enum: [ - { - "description": "English descriptions", - "isConstant": true, - "type": "\"English\"" - }, - { - "description": "Chinese descriptions", - "isConstant": true, - "type": "\"Chinese\"" - } - ], - required: true, - usage: ["input", "output"] - } as any); + it("generate string literal union", async () => { + const property = await verifyFirstProperty(`"a" | "test"`); + assert.isNotNull(property); + assert.deepEqual(property, { + enum: [ + { type: '"a"', isConstant: true }, + { type: '"test"', isConstant: true } + ], + type: "union", + typeName: '"a" | "test"', + outputTypeName: '"a" | "test"', + required: true, + usage: ["input", "output"], + description: undefined + } as any); + }); + + it("generate primitive union", async () => { + const property = await verifyFirstProperty( + `string | int32 | boolean | utcDateTime` + ); + assert.isNotNull(property); + // console.log(property); + assert.deepEqual(property, { + enum: [ + { + type: "string", + description: "A sequence of textual characters." + }, + { type: "number", format: "int32" }, + { type: "boolean", description: undefined }, + { + type: "string", + format: undefined, + description: undefined, + typeName: "Date | string", + outputTypeName: "string" + } + ], + type: "union", + typeName: "string | number | boolean | Date | string", + outputTypeName: "string | number | boolean | string", + required: true, + usage: ["input", "output"], + description: undefined + } as any); + }); + }); }); - it("generate extensible enum", async () => { - const schemaOutput = await emitSchemasFromTypeSpec( - ` - @doc("Translation Language Values") - enum TranslationLanguageValues { - @doc("English descriptions") - English, - @doc("Chinese descriptions") - Chinese, - } - model Test { - prop: TranslationLanguageValues; - } - @route("/models") - @get - op getModel(@body input: Test): Test; - `, - true - ); - assert.isNotNull(schemaOutput); - const first = schemaOutput?.[0] as ObjectSchema; - const property = first.properties![`"prop"`]; - assert.isNotNull(property); - assert.deepEqual(property, { - type: '"English" | "Chinese"', - name: "string", - typeName: "string", - description: "Possible values: \"English\", \"Chinese\"", - enum: [ - { - "description": "English descriptions", - "isConstant": true, - "type": "\"English\"" - }, - { - "description": "Chinese descriptions", - "isConstant": true, - "type": "\"Chinese\"" + describe("enum", () => { + it("should generate enum name", async () => { + const schemaOutput = await emitSchemasFromTypeSpec( + ` + #suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "for test" + @fixed + @doc("Translation Language Values") + enum TranslationLanguageValues { + @doc("English descriptions") + English, + @doc("Chinese descriptions") + Chinese, } - ], - required: true, - usage: ["input", "output"] - } as any); - }); + model Test { + prop: TranslationLanguageValues; + } + @route("/models") + @get + op getModel(@body input: Test): Test; + `, + true + ); + assert.isNotNull(schemaOutput); + const first = schemaOutput?.[0] as ObjectSchema; + const property = first.properties![`"prop"`]; + // console.log(first, property, property?.enum); + assert.isNotNull(property); + assert.deepEqual(property, { + type: "object", + name: "TranslationLanguageValues", + typeName: "TranslationLanguageValues", + outputTypeName: "TranslationLanguageValuesOutput", + description: undefined, + memberType: "string", + enum: [ + { + description: "English descriptions", + isConstant: true, + type: '"English"' + }, + { + description: "Chinese descriptions", + isConstant: true, + type: '"Chinese"' + } + ], + alias: '"English" | "Chinese"', + outputAlias: '"English" | "Chinese"', + required: true, + usage: ["input", "output"] + } as any); + }); - it("generate enum member", async () => { - const schemaOutput = await emitSchemasFromTypeSpec( - ` - @doc("Translation Language Values") - enum TranslationLanguageValues { - @doc("English descriptions") - English, - @doc("Chinese descriptions") - Chinese, - } - model Test { - prop: TranslationLanguageValues.English; - } - @route("/models") - @get - op getModel(@body input: Test): Test; - `, - true - ); - assert.isNotNull(schemaOutput); - const first = schemaOutput?.[0] as ObjectSchema; - const property = first.properties![`"prop"`]; - assert.isNotNull(property); - assert.deepEqual(property, { - type: '"English"', - description: undefined, - isConstant: true, - required: true, - usage: ["input", "output"] - } as any); + it("generate enum member", async () => { + const schemaOutput = await emitSchemasFromTypeSpec( + ` + @doc("Translation Language Values") + enum TranslationLanguageValues { + @doc("English descriptions") + English, + @doc("Chinese descriptions") + Chinese, + } + model Test { + prop: TranslationLanguageValues.English; + } + @route("/models") + @get + op getModel(@body input: Test): Test; + `, + true + ); + assert.isNotNull(schemaOutput); + const first = schemaOutput?.[0] as ObjectSchema; + const property = first.properties![`"prop"`]; + assert.isNotNull(property); + assert.deepEqual(property, { + type: '"English"', + description: undefined, + isConstant: true, + required: true, + usage: ["input", "output"] + } as any); + }); }); it("generate union model", async () => { @@ -354,6 +438,7 @@ describe("#transformSchemas", () => { name: "A", type: "object", description: "", + fromCore: false, typeName: "A", properties: { '"foo"': { @@ -370,6 +455,7 @@ describe("#transformSchemas", () => { name: "B", type: "object", description: "", + fromCore: false, typeName: "B", properties: { '"bar"': { @@ -417,6 +503,7 @@ describe("#transformSchemas", () => { name: "A", type: "object", description: "", + fromCore: false, typeName: "A", properties: {}, outputTypeName: "AOutput", @@ -458,6 +545,7 @@ describe("#transformSchemas", () => { name: "A", type: "object", description: "", + fromCore: false, typeName: "A", properties: {}, outputTypeName: "AOutput", @@ -502,6 +590,7 @@ describe("#transformSchemas", () => { name: "A", type: "object", description: "", + fromCore: false, typeName: "A", properties: { '"foo"': { @@ -518,6 +607,7 @@ describe("#transformSchemas", () => { name: "B", type: "object", description: "", + fromCore: false, typeName: "B", properties: { '"baz"': { @@ -549,6 +639,7 @@ describe("#transformSchemas", () => { name: "", type: "unknown", description: undefined, + fromCore: false, typeName: "Record", outputTypeName: "Record", properties: {}, @@ -571,6 +662,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: undefined, + fromCore: false, typeName: '{"name": string;"arguments": string;}', outputTypeName: '{"name": string;"arguments": string;}', properties: { @@ -602,6 +694,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: undefined, + fromCore: false, typeName: '{"name": {"foo": {"bar": string;};};}', outputTypeName: '{"name": {"foo": {"bar": string;};};}', properties: { @@ -609,6 +702,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: undefined, + fromCore: false, typeName: '{"foo": {"bar": string;};}', outputTypeName: '{"foo": {"bar": string;};}', required: true, @@ -617,6 +711,7 @@ describe("#transformSchemas", () => { '"foo"': { name: "", type: "object", + fromCore: false, description: undefined, typeName: '{"bar": string;}', outputTypeName: '{"bar": string;}', @@ -649,6 +744,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: undefined, + fromCore: false, typeName: '{"name": Test;}', outputTypeName: '{"name": TestOutput;}', properties: { @@ -656,6 +752,7 @@ describe("#transformSchemas", () => { name: "Test", type: "object", description: undefined, + fromCore: false, typeName: "Test", outputTypeName: "TestOutput", properties: {}, @@ -686,6 +783,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: "", + fromCore: false, typeName: '{"name": string;}', outputTypeName: '{"name": string;}', properties: { @@ -721,6 +819,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: "", + fromCore: false, typeName: '{"name": string;}', outputTypeName: '{"name": string;}', properties: { @@ -755,6 +854,7 @@ describe("#transformSchemas", () => { name: "", type: "object", description: "", + fromCore: false, typeName: '{"name": string;}', outputTypeName: '{"name": string;}', properties: { diff --git a/packages/typespec-ts/test/util/emitUtil.ts b/packages/typespec-ts/test/util/emitUtil.ts index 092aca57c8..cdba7cd677 100644 --- a/packages/typespec-ts/test/util/emitUtil.ts +++ b/packages/typespec-ts/test/util/emitUtil.ts @@ -97,7 +97,8 @@ export async function emitModelsFromTypeSpec( needAzureCore: boolean = false, needTCGC: boolean = false, withRawContent: boolean = false, - mustEmptyDiagnostic: boolean = true + mustEmptyDiagnostic: boolean = true, + enableModelNamespace: boolean = false ) { const context = await rlcEmitterFor( tspContent, @@ -107,7 +108,10 @@ export async function emitModelsFromTypeSpec( withRawContent ); const program = context.program; - const dpgContext = createDpgContextTestHelper(context.program); + const dpgContext = createDpgContextTestHelper( + context.program, + enableModelNamespace + ); const clients = getRLCClients(dpgContext); let rlcSchemas: Schema[] = []; if (clients && clients[0]) { @@ -149,8 +153,13 @@ export async function emitParameterFromTypeSpec( const importSet = initInternalImports(); let parameters; if (clients && clients[0]) { - const urlInfo = transformUrlInfo(clients[0], dpgContext); - parameters = transformToParameterTypes(importSet, clients[0], dpgContext, urlInfo?.apiVersionInfo); + const urlInfo = transformUrlInfo(clients[0], dpgContext, importSet); + parameters = transformToParameterTypes( + importSet, + clients[0], + dpgContext, + urlInfo?.apiVersionInfo + ); } if (mustEmptyDiagnostic && dpgContext.program.diagnostics.length > 0) { throw dpgContext.program.diagnostics; @@ -210,12 +219,13 @@ export async function emitClientFactoryFromTypeSpec( const program = context.program; const dpgContext = createDpgContextTestHelper(context.program); const clients = getRLCClients(dpgContext); - - const creadentialInfo = getCredentialInfo(program, {}); + const importSet = initInternalImports(); + + const credentialInfo = getCredentialInfo(program, {}); let urlInfo; if (clients && clients[0]) { - urlInfo = transformUrlInfo(clients[0], dpgContext); + urlInfo = transformUrlInfo(clients[0], dpgContext, importSet); } if (mustEmptyDiagnostic && dpgContext.program.diagnostics.length > 0) { throw dpgContext.program.diagnostics; @@ -234,10 +244,10 @@ export async function emitClientFactoryFromTypeSpec( version: "1.0.0-beta.1" }, flavor: "azure", - ...creadentialInfo + ...credentialInfo }, importInfo: { - internalImports: initInternalImports(), + internalImports: importSet, runtimeImports: buildRuntimeImports("azure") } }); @@ -529,4 +539,4 @@ export async function emitModularClientFromTypeSpec( } expectDiagnosticEmpty(dpgContext.program.diagnostics); return undefined; -} \ No newline at end of file +} diff --git a/packages/typespec-ts/test/util/testUtil.ts b/packages/typespec-ts/test/util/testUtil.ts index 3a1fe460b6..67199627c8 100644 --- a/packages/typespec-ts/test/util/testUtil.ts +++ b/packages/typespec-ts/test/util/testUtil.ts @@ -29,12 +29,12 @@ export async function rlcEmitterFor( needAzureCore: boolean = false, needTCGC: boolean = false, withRawContent: boolean = false, - withVersionedApiVersion: boolean = false, + withVersionedApiVersion: boolean = false ): Promise { const host: TestHost = await createRLCEmitterTestHost(); const namespace = ` #suppress "@azure-tools/typespec-azure-core/auth-required" "for test" - ${withVersionedApiVersion ? '@versioned(Versions)': ""} + ${withVersionedApiVersion ? "@versioned(Versions)" : ""} @service({ title: "Azure TypeScript Testing" }) @@ -57,7 +57,11 @@ using TypeSpec.Versioning; ${needTCGC ? "using Azure.ClientGenerator.Core;" : ""} ${needAzureCore ? "using Azure.Core;" : ""} ${needNamespaces ? namespace : ""} -${withVersionedApiVersion && needNamespaces ? 'enum Versions { v2022_05_15_preview: "2022-05-15-preview"}' : ""} +${ + withVersionedApiVersion && needNamespaces + ? 'enum Versions { v2022_05_15_preview: "2022-05-15-preview"}' + : "" +} ${code} `; host.addTypeSpecFile("main.tsp", content); @@ -67,10 +71,14 @@ ${code} return host; } -export function createDpgContextTestHelper(program: Program): SdkContext { +export function createDpgContextTestHelper( + program: Program, + enableModelNamespace = false +): SdkContext { const defaultOptions = { generateProtocolMethods: true, generateConvenienceMethods: true, + flattenUnionAsEnum: false, emitters: [ { main: "@azure-tools/typespec-ts", @@ -84,7 +92,7 @@ export function createDpgContextTestHelper(program: Program): SdkContext { program: program, generateProtocolMethods: resolvedOptions.generateProtocolMethods, generateConvenienceMethods: resolvedOptions.generateConvenienceMethods, - rlcOptions: { flavor: "azure" }, + rlcOptions: { flavor: "azure", enableModelNamespace }, generationPathDetail: {}, emitterName: "@azure-tools/typespec-ts" } as SdkContext; diff --git a/rush.json b/rush.json index 17b4fcdceb..76e18ca5fa 100644 --- a/rush.json +++ b/rush.json @@ -14,7 +14,7 @@ * path segment in the "$schema" field for all your Rush config files. This will ensure * correct error-underlining and tab-completion for editors such as VS Code. */ - "rushVersion": "5.97.1", + "rushVersion": "5.120.6", /** * The next field selects which package manager should be installed and determines its version. * Rush installs its own local copy of the package manager to ensure that your build process