From a4b375a6a3fe9352087abb81d37cfa897579f82b Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Wed, 13 Aug 2025 10:44:46 +0800 Subject: [PATCH 1/4] add smoke case for @azure-rest/purview-datamap --- .../generated/typespec-ts/LICENSE | 21 + .../generated/typespec-ts/README.md | 111 + .../generated/typespec-ts/api-extractor.json | 18 + .../generated/typespec-ts/eslint.config.mjs | 14 + .../generated/typespec-ts/package.json | 60 + .../generated/typespec-ts/rollup.config.js | 118 + .../typespec-ts/src/api/dataMapContext.ts | 58 + .../typespec-ts/src/api/discovery/index.ts | 9 + .../src/api/discovery/operations.ts | 181 + .../typespec-ts/src/api/discovery/options.ts | 13 + .../typespec-ts/src/api/entity/index.ts | 77 + .../typespec-ts/src/api/entity/operations.ts | 2075 ++++++++ .../typespec-ts/src/api/entity/options.ts | 258 + .../typespec-ts/src/api/glossary/index.ts | 65 + .../src/api/glossary/operations.ts | 1601 ++++++ .../typespec-ts/src/api/glossary/options.ts | 187 + .../generated/typespec-ts/src/api/index.ts | 8 + .../typespec-ts/src/api/lineage/index.ts | 9 + .../typespec-ts/src/api/lineage/operations.ts | 205 + .../typespec-ts/src/api/lineage/options.ts | 30 + .../typespec-ts/src/api/relationship/index.ts | 10 + .../src/api/relationship/operations.ts | 207 + .../src/api/relationship/options.ts | 19 + .../src/api/typeDefinition/index.ts | 51 + .../src/api/typeDefinition/operations.ts | 1144 +++++ .../src/api/typeDefinition/options.ts | 108 + .../src/classic/discovery/index.ts | 62 + .../typespec-ts/src/classic/entity/index.ts | 604 +++ .../typespec-ts/src/classic/glossary/index.ts | 419 ++ .../typespec-ts/src/classic/index.ts | 9 + .../typespec-ts/src/classic/lineage/index.ts | 82 + .../src/classic/relationship/index.ts | 74 + .../src/classic/typeDefinition/index.ts | 274 + .../typespec-ts/src/dataMapClient.ts | 77 + .../generated/typespec-ts/src/index.ts | 211 + .../generated/typespec-ts/src/logger.ts | 5 + .../generated/typespec-ts/src/models/index.ts | 90 + .../typespec-ts/src/models/models.ts | 4560 +++++++++++++++++ .../src/static-helpers/multipartHelpers.ts | 33 + .../src/static-helpers/urlTemplate.ts | 201 + .../generated/typespec-ts/tsconfig.json | 23 + .../spec/client.tsp | 152 + .../spec/main.tsp | 40 + .../spec/models.tsp | 1997 ++++++++ .../spec/routes.tsp | 2135 ++++++++ .../tspconfig.yaml | 10 + 46 files changed, 17715 insertions(+) create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/LICENSE create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/api-extractor.json create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/eslint.config.mjs create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/rollup.config.js create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/options.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/options.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/options.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/logger.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/models.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/multipartHelpers.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/urlTemplate.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/tsconfig.json create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/client.tsp create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/main.tsp create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/models.tsp create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/routes.tsp create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/tspconfig.yaml diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/LICENSE b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/LICENSE new file mode 100644 index 0000000000..63447fd8bb --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md new file mode 100644 index 0000000000..062956a8a9 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md @@ -0,0 +1,111 @@ +# Azure DataMap client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure DataMap client. + +Purview Data Map Service is a fully managed cloud service whose users can +discover the data sources they need and understand the data sources they find. +At the same time, Data Map helps organizations get more value from their +existing investments. This spec defines REST API of Purview Data Map Service. + +Key links: + +- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/purview-datamap) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure-rest/purview-datamap?view=azure-node-preview) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure-rest/purview-datamap` package + +Install the Azure DataMap client library for JavaScript with `npm`: + +```bash +npm install @azure-rest/purview-datamap +``` + +### Create and authenticate a `DataMapClient` + +To create a client object to access the Azure DataMap API, you will need the `endpoint` of your Azure DataMap resource and a `credential`. The Azure DataMap client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure DataMap resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure DataMap** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). + +For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. + +```ts +import { DataMapClient } from "@azure-rest/purview-datamap"; +import { DefaultAzureCredential } from "@azure/identity"; + +const client = new DataMapClient("", new DefaultAzureCredential()); +``` + +For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. + +```ts +import { InteractiveBrowserCredential } from "@azure/identity"; +import { DataMapClient } from "@azure-rest/purview-datamap"; + +const credential = new InteractiveBrowserCredential({ + tenantId: "", + clientId: "" + }); +const client = new DataMapClient("", credential); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### DataMapClient + +`DataMapClient` is the primary interface for developers using the Azure DataMap client library. Explore the methods on this client object to understand the different features of the Azure DataMap service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```ts +import { setLogLevel } from "@azure/logger"; + +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/api-extractor.json b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/api-extractor.json new file mode 100644 index 0000000000..cf44569695 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "dist/esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "dist/purview-datamap.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/eslint.config.mjs b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/eslint.config.mjs new file mode 100644 index 0000000000..9396819633 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn" + } + } +]); diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json new file mode 100644 index 0000000000..2b1a9c143c --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json @@ -0,0 +1,60 @@ +{ + "name": "@azure-rest/purview-datamap", + "version": "1.0.0-beta.1", + "description": "Purview DataMap Service", + "engines": { + "node": ">=20.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/typeDefinition": "src/api/typeDefinition/index.ts", + "./api/relationship": "src/api/relationship/index.ts", + "./api/lineage": "src/api/lineage/index.ts", + "./api/discovery": "src/api/discovery/index.ts", + "./api/glossary": "src/api/glossary/index.ts", + "./api/entity": "src/api/entity/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], + "selfLink": false + }, + "type": "module", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "author": "Microsoft Corporation", + "license": "MIT", + "files": ["dist/", "!dist/**/*.d.*ts.map", "README.md", "LICENSE"], + "dependencies": { + "@azure/core-util": "^1.9.2", + "@azure-rest/core-client": "^2.3.1", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "dotenv": "^16.0.0", + "@types/node": "^20.0.0", + "eslint": "^9.9.0", + "typescript": "~5.8.2", + "tshy": "^2.0.0", + "@microsoft/api-extractor": "^7.40.3", + "rimraf": "^5.0.5", + "mkdirp": "^3.0.1" + }, + "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src", + "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", + "build": "npm run clean && tshy && npm run extract-api" + } +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/rollup.config.js b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/rollup.config.js new file mode 100644 index 0000000000..843de501bf --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/rollup.config.js @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && + warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"], + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true, + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"], + }), + cjs(), + json(), + sourcemaps(), + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false, + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false, +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}), + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies), + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()], + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts new file mode 100644 index 0000000000..0b3430e996 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownApiVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +export interface DataMapContext extends Client {} + +/** Optional parameters for the client. */ +export interface DataMapClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownApiVersions} that the service accepts. */ + apiVersion?: string; +} + +export function createDataMap( + endpointParam: string, + credential: TokenCredential, + options: DataMapClientOptionalParams = {}, +): DataMapContext { + const endpointUrl = options.endpoint ?? `${endpointParam}/datamap/api`; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-purview-datamap/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [ + "https://purview.azure.net/.default", + ], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2023-09-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return clientContext; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/index.ts new file mode 100644 index 0000000000..73dd6181ca --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { autoComplete, suggest, query } from "./operations.js"; +export { + DiscoveryAutoCompleteOptionalParams, + DiscoverySuggestOptionalParams, + DiscoveryQueryOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts new file mode 100644 index 0000000000..b266413ac7 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext as Client } from "../index.js"; +import { + atlasErrorResponseDeserializer, + QueryOptions, + queryOptionsSerializer, + QueryResult, + queryResultDeserializer, + SuggestOptions, + suggestOptionsSerializer, + SuggestResult, + suggestResultDeserializer, + AutoCompleteOptions, + autoCompleteOptionsSerializer, + AutoCompleteResult, + autoCompleteResultDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + DiscoveryAutoCompleteOptionalParams, + DiscoverySuggestOptionalParams, + DiscoveryQueryOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _autoCompleteSend( + context: Client, + body: AutoCompleteOptions, + options: DiscoveryAutoCompleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/search/autocomplete{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: autoCompleteOptionsSerializer(body), + }); +} + +export async function _autoCompleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return autoCompleteResultDeserializer(result.body); +} + +/** Get auto complete options. */ +export async function autoComplete( + context: Client, + body: AutoCompleteOptions, + options: DiscoveryAutoCompleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _autoCompleteSend(context, body, options); + return _autoCompleteDeserialize(result); +} + +export function _suggestSend( + context: Client, + body: SuggestOptions, + options: DiscoverySuggestOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/search/suggest{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: suggestOptionsSerializer(body), + }); +} + +export async function _suggestDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return suggestResultDeserializer(result.body); +} + +/** Get search suggestions by query criteria. */ +export async function suggest( + context: Client, + body: SuggestOptions, + options: DiscoverySuggestOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _suggestSend(context, body, options); + return _suggestDeserialize(result); +} + +export function _querySend( + context: Client, + body: QueryOptions, + options: DiscoveryQueryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/search/query{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: queryOptionsSerializer(body), + }); +} + +export async function _queryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return queryResultDeserializer(result.body); +} + +/** Get data using search. */ +export async function query( + context: Client, + body: QueryOptions, + options: DiscoveryQueryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _querySend(context, body, options); + return _queryDeserialize(result); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/options.ts new file mode 100644 index 0000000000..41b1bc9f9c --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/options.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DiscoveryAutoCompleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoverySuggestOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveryQueryOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts new file mode 100644 index 0000000000..249febd8c5 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + moveEntitiesToCollection, + addLabelsByUniqueAttribute, + setLabelsByUniqueAttribute, + removeLabelsByUniqueAttribute, + addLabel, + setLabels, + removeLabels, + importBusinessMetadata, + getBusinessMetadataTemplate, + addOrUpdateBusinessMetadataAttributes, + removeBusinessMetadataAttributes, + addOrUpdateBusinessMetadata, + removeBusinessMetadata, + getHeader, + batchGetByUniqueAttributes, + batchSetClassifications, + updateClassificationsUniqueByAttribute, + addClassificationsByUniqueAttribute, + removeClassificationByUniqueAttribute, + deleteByUniqueAttribute, + updateByUniqueAttribute, + getByUniqueAttribute, + updateClassifications, + addClassifications, + getClassifications, + removeClassification, + getClassification, + $delete, + updateAttributeById, + get, + addClassification, + batchDelete, + batchCreateOrUpdate, + getByIds, + createOrUpdate, +} from "./operations.js"; +export { + EntityMoveEntitiesToCollectionOptionalParams, + EntityAddLabelsByUniqueAttributeOptionalParams, + EntitySetLabelsByUniqueAttributeOptionalParams, + EntityRemoveLabelsByUniqueAttributeOptionalParams, + EntityAddLabelOptionalParams, + EntitySetLabelsOptionalParams, + EntityRemoveLabelsOptionalParams, + EntityImportBusinessMetadataOptionalParams, + EntityGetBusinessMetadataTemplateOptionalParams, + EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, + EntityRemoveBusinessMetadataAttributesOptionalParams, + EntityAddOrUpdateBusinessMetadataOptionalParams, + EntityRemoveBusinessMetadataOptionalParams, + EntityGetHeaderOptionalParams, + EntityBatchGetByUniqueAttributesOptionalParams, + EntityBatchSetClassificationsOptionalParams, + EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityAddClassificationsByUniqueAttributeOptionalParams, + EntityRemoveClassificationByUniqueAttributeOptionalParams, + EntityDeleteByUniqueAttributeOptionalParams, + EntityUpdateByUniqueAttributeOptionalParams, + EntityGetByUniqueAttributeOptionalParams, + EntityUpdateClassificationsOptionalParams, + EntityAddClassificationsOptionalParams, + EntityGetClassificationsOptionalParams, + EntityRemoveClassificationOptionalParams, + EntityGetClassificationOptionalParams, + EntityDeleteOptionalParams, + EntityUpdateAttributeByIdOptionalParams, + EntityGetOptionalParams, + EntityAddClassificationOptionalParams, + EntityBatchDeleteOptionalParams, + EntityBatchCreateOrUpdateOptionalParams, + EntityGetByIdsOptionalParams, + EntityCreateOrUpdateOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts new file mode 100644 index 0000000000..09c234b719 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts @@ -0,0 +1,2075 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext as Client } from "../index.js"; +import { + AtlasEntityWithExtInfo, + atlasEntityWithExtInfoSerializer, + atlasEntityWithExtInfoDeserializer, + atlasClassificationArraySerializer, + AtlasClassification, + atlasClassificationDeserializer, + EntityMutationResult, + entityMutationResultDeserializer, + AtlasEntityHeader, + atlasEntityHeaderDeserializer, + atlasErrorResponseDeserializer, + AtlasEntitiesWithExtInfo, + atlasEntitiesWithExtInfoSerializer, + atlasEntitiesWithExtInfoDeserializer, + ClassificationAssociateOptions, + classificationAssociateOptionsSerializer, + AtlasClassifications, + atlasClassificationsDeserializer, + AtlasEntityHeaders, + atlasEntityHeadersSerializer, + BusinessMetadataOptions, + businessMetadataOptionsSerializer, + BulkImportResult, + bulkImportResultDeserializer, + MoveEntitiesOptions, + moveEntitiesOptionsSerializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + EntityMoveEntitiesToCollectionOptionalParams, + EntityAddLabelsByUniqueAttributeOptionalParams, + EntitySetLabelsByUniqueAttributeOptionalParams, + EntityRemoveLabelsByUniqueAttributeOptionalParams, + EntityAddLabelOptionalParams, + EntitySetLabelsOptionalParams, + EntityRemoveLabelsOptionalParams, + EntityImportBusinessMetadataOptionalParams, + EntityGetBusinessMetadataTemplateOptionalParams, + EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, + EntityRemoveBusinessMetadataAttributesOptionalParams, + EntityAddOrUpdateBusinessMetadataOptionalParams, + EntityRemoveBusinessMetadataOptionalParams, + EntityGetHeaderOptionalParams, + EntityBatchGetByUniqueAttributesOptionalParams, + EntityBatchSetClassificationsOptionalParams, + EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityAddClassificationsByUniqueAttributeOptionalParams, + EntityRemoveClassificationByUniqueAttributeOptionalParams, + EntityDeleteByUniqueAttributeOptionalParams, + EntityUpdateByUniqueAttributeOptionalParams, + EntityGetByUniqueAttributeOptionalParams, + EntityUpdateClassificationsOptionalParams, + EntityAddClassificationsOptionalParams, + EntityGetClassificationsOptionalParams, + EntityRemoveClassificationOptionalParams, + EntityGetClassificationOptionalParams, + EntityDeleteOptionalParams, + EntityUpdateAttributeByIdOptionalParams, + EntityGetOptionalParams, + EntityAddClassificationOptionalParams, + EntityBatchDeleteOptionalParams, + EntityBatchCreateOrUpdateOptionalParams, + EntityGetByIdsOptionalParams, + EntityCreateOrUpdateOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _moveEntitiesToCollectionSend( + context: Client, + collectionId: string, + body: MoveEntitiesOptions, + options: EntityMoveEntitiesToCollectionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/entity/moveTo{?api%2Dversion,collectionId}", + { + "api%2Dversion": context.apiVersion, + collectionId: collectionId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: moveEntitiesOptionsSerializer(body), + }); +} + +export async function _moveEntitiesToCollectionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** Move existing entities to the target collection. */ +export async function moveEntitiesToCollection( + context: Client, + collectionId: string, + body: MoveEntitiesOptions, + options: EntityMoveEntitiesToCollectionOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _moveEntitiesToCollectionSend( + context, + collectionId, + body, + options, + ); + return _moveEntitiesToCollectionDeserialize(result); +} + +export function _addLabelsByUniqueAttributeSend( + context: Client, + typeName: string, + options: EntityAddLabelsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["body"] + ? options["body"] + : options["body"].map((p: any) => { + return p; + }), + }); +} + +export async function _addLabelsByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** + * Add given labels to a given entity identified by its type and unique + * attributes. + * + * If labels is null/empty, no labels will be added. + * + * In addition to + * the typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: attr:=. + * + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: PUT + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function addLabelsByUniqueAttribute( + context: Client, + typeName: string, + options: EntityAddLabelsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _addLabelsByUniqueAttributeSend( + context, + typeName, + options, + ); + return _addLabelsByUniqueAttributeDeserialize(result); +} + +export function _setLabelsByUniqueAttributeSend( + context: Client, + typeName: string, + options: EntitySetLabelsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["body"] + ? options["body"] + : options["body"].map((p: any) => { + return p; + }), + }); +} + +export async function _setLabelsByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** + * Set labels to a given entity identified by its type and unique attributes. + * + * If + * labels is null/empty, existing labels will all be removed. + * + * In addition to the + * typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: attr:=. + * + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: POST + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function setLabelsByUniqueAttribute( + context: Client, + typeName: string, + options: EntitySetLabelsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _setLabelsByUniqueAttributeSend( + context, + typeName, + options, + ); + return _setLabelsByUniqueAttributeDeserialize(result); +} + +export function _removeLabelsByUniqueAttributeSend( + context: Client, + typeName: string, + options: EntityRemoveLabelsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["body"] + ? options["body"] + : options["body"].map((p: any) => { + return p; + }), + }); +} + +export async function _removeLabelsByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** + * Delete given labels to a given entity identified by its type and unique + * attribute. + * + * If labels is null/empty, no labels will be removed. + * + * If any labels + * in labels set are non-existing labels, they will be ignored, only existing + * labels will be removed. In addition to the typeName path parameter, attribute + * key-value pair(s) can be provided in the following format: + * attr:=. NOTE: The attrName and attrValue should be unique + * across entities, eg. qualifiedName. The REST request would look something like + * this: DELETE + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function removeLabelsByUniqueAttribute( + context: Client, + typeName: string, + options: EntityRemoveLabelsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _removeLabelsByUniqueAttributeSend( + context, + typeName, + options, + ); + return _removeLabelsByUniqueAttributeDeserialize(result); +} + +export function _addLabelSend( + context: Client, + guid: string, + options: EntityAddLabelOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/labels", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["body"] + ? options["body"] + : options["body"].map((p: any) => { + return p; + }), + }); +} + +export async function _addLabelDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Add given labels to a given entity. */ +export async function addLabel( + context: Client, + guid: string, + options: EntityAddLabelOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _addLabelSend(context, guid, options); + return _addLabelDeserialize(result); +} + +export function _setLabelsSend( + context: Client, + guid: string, + options: EntitySetLabelsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/labels", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["body"] + ? options["body"] + : options["body"].map((p: any) => { + return p; + }), + }); +} + +export async function _setLabelsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Set labels to a given entity. */ +export async function setLabels( + context: Client, + guid: string, + options: EntitySetLabelsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _setLabelsSend(context, guid, options); + return _setLabelsDeserialize(result); +} + +export function _removeLabelsSend( + context: Client, + guid: string, + options: EntityRemoveLabelsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/labels", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: !options["body"] + ? options["body"] + : options["body"].map((p: any) => { + return p; + }), + }); +} + +export async function _removeLabelsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete given labels to a given entity. */ +export async function removeLabels( + context: Client, + guid: string, + options: EntityRemoveLabelsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _removeLabelsSend(context, guid, options); + return _removeLabelsDeserialize(result); +} + +export function _importBusinessMetadataSend( + context: Client, + body: BusinessMetadataOptions, + options: EntityImportBusinessMetadataOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/entity/businessmetadata/import") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "multipart/form-data", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: businessMetadataOptionsSerializer(body), + }); +} + +export async function _importBusinessMetadataDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return bulkImportResultDeserializer(result.body); +} + +/** Upload the file for creating Business Metadata in BULK */ +export async function importBusinessMetadata( + context: Client, + body: BusinessMetadataOptions, + options: EntityImportBusinessMetadataOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _importBusinessMetadataSend(context, body, options); + return _importBusinessMetadataDeserialize(result); +} + +export function _getBusinessMetadataTemplateSend( + context: Client, + options: EntityGetBusinessMetadataTemplateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/entity/businessmetadata/import/template") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/octet-stream", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getBusinessMetadataTemplateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return result.body; +} + +/** Get the sample Template for uploading/creating bulk BusinessMetaData */ +export async function getBusinessMetadataTemplate( + context: Client, + options: EntityGetBusinessMetadataTemplateOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getBusinessMetadataTemplateSend(context, options); + return _getBusinessMetadataTemplateDeserialize(result); +} + +export function _addOrUpdateBusinessMetadataAttributesSend( + context: Client, + businessMetadataName: string, + guid: string, + body: Record, + options: EntityAddOrUpdateBusinessMetadataAttributesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/businessmetadata/{businessMetadataName}", + { + businessMetadataName: businessMetadataName, + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: body, + }); +} + +export async function _addOrUpdateBusinessMetadataAttributesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Add or update business metadata attributes. */ +export async function addOrUpdateBusinessMetadataAttributes( + context: Client, + businessMetadataName: string, + guid: string, + body: Record, + options: EntityAddOrUpdateBusinessMetadataAttributesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _addOrUpdateBusinessMetadataAttributesSend( + context, + businessMetadataName, + guid, + body, + options, + ); + return _addOrUpdateBusinessMetadataAttributesDeserialize(result); +} + +export function _removeBusinessMetadataAttributesSend( + context: Client, + businessMetadataName: string, + guid: string, + body: Record, + options: EntityRemoveBusinessMetadataAttributesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/businessmetadata/{businessMetadataName}", + { + businessMetadataName: businessMetadataName, + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: body, + }); +} + +export async function _removeBusinessMetadataAttributesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete business metadata attributes from an entity. */ +export async function removeBusinessMetadataAttributes( + context: Client, + businessMetadataName: string, + guid: string, + body: Record, + options: EntityRemoveBusinessMetadataAttributesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _removeBusinessMetadataAttributesSend( + context, + businessMetadataName, + guid, + body, + options, + ); + return _removeBusinessMetadataAttributesDeserialize(result); +} + +export function _addOrUpdateBusinessMetadataSend( + context: Client, + guid: string, + body: Record>, + options: EntityAddOrUpdateBusinessMetadataOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/businessmetadata{?isOverwrite}", + { + guid: guid, + isOverwrite: options?.overwrite, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: body, + }); +} + +export async function _addOrUpdateBusinessMetadataDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Add business metadata to an entity. */ +export async function addOrUpdateBusinessMetadata( + context: Client, + guid: string, + body: Record>, + options: EntityAddOrUpdateBusinessMetadataOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _addOrUpdateBusinessMetadataSend( + context, + guid, + body, + options, + ); + return _addOrUpdateBusinessMetadataDeserialize(result); +} + +export function _removeBusinessMetadataSend( + context: Client, + guid: string, + body: Record>, + options: EntityRemoveBusinessMetadataOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/businessmetadata", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: body, + }); +} + +export async function _removeBusinessMetadataDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Remove business metadata from an entity. */ +export async function removeBusinessMetadata( + context: Client, + guid: string, + body: Record>, + options: EntityRemoveBusinessMetadataOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _removeBusinessMetadataSend( + context, + guid, + body, + options, + ); + return _removeBusinessMetadataDeserialize(result); +} + +export function _getHeaderSend( + context: Client, + guid: string, + options: EntityGetHeaderOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/header", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getHeaderDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntityHeaderDeserializer(result.body); +} + +/** Get entity header given its GUID. */ +export async function getHeader( + context: Client, + guid: string, + options: EntityGetHeaderOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getHeaderSend(context, guid, options); + return _getHeaderDeserialize(result); +} + +export function _batchGetByUniqueAttributesSend( + context: Client, + typeName: string, + options: EntityBatchGetByUniqueAttributesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/bulk/uniqueAttribute/type/{typeName}{?minExtInfo,ignoreRelationships,attr_N%3AqualifiedName}", + { + typeName: typeName, + minExtInfo: options?.minExtInfo, + ignoreRelationships: options?.ignoreRelationships, + "attr_N%3AqualifiedName": options?.attrNQualifiedName, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _batchGetByUniqueAttributesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntitiesWithExtInfoDeserializer(result.body); +} + +/** + * Bulk API to retrieve list of entities identified by its unique attributes. + * In + * addition to the typeName path parameter, attribute key-value pair(s) can be + * provided in the following + * format + * + * typeName=\&attr_1:\=\&attr_2:\=\&attr_3:\=\ + * + * NOTE: + * The attrName should be an unique attribute for the given entity-type. + * The REST + * request would look something like this + * + * GET + * /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_1:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 + * + * Note: + * at least one unique attribute must be provided. + */ +export async function batchGetByUniqueAttributes( + context: Client, + typeName: string, + options: EntityBatchGetByUniqueAttributesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _batchGetByUniqueAttributesSend( + context, + typeName, + options, + ); + return _batchGetByUniqueAttributesDeserialize(result); +} + +export function _batchSetClassificationsSend( + context: Client, + body: AtlasEntityHeaders, + options: EntityBatchSetClassificationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/entity/bulk/setClassifications") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasEntityHeadersSerializer(body), + }); +} + +export async function _batchSetClassificationsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return result.body.map((p: any) => { + return p; + }); +} + +/** Set classifications on entities in bulk. */ +export async function batchSetClassifications( + context: Client, + body: AtlasEntityHeaders, + options: EntityBatchSetClassificationsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchSetClassificationsSend(context, body, options); + return _batchSetClassificationsDeserialize(result); +} + +export function _updateClassificationsUniqueByAttributeSend( + context: Client, + typeName: string, + body: AtlasClassification[], + options: EntityUpdateClassificationsUniqueByAttributeOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}/classifications{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasClassificationArraySerializer(body), + }); +} + +export async function _updateClassificationsUniqueByAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Update classification on an entity identified by its type and unique attributes. */ +export async function updateClassificationsUniqueByAttribute( + context: Client, + typeName: string, + body: AtlasClassification[], + options: EntityUpdateClassificationsUniqueByAttributeOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _updateClassificationsUniqueByAttributeSend( + context, + typeName, + body, + options, + ); + return _updateClassificationsUniqueByAttributeDeserialize(result); +} + +export function _addClassificationsByUniqueAttributeSend( + context: Client, + typeName: string, + body: AtlasClassification[], + options: EntityAddClassificationsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}/classifications{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasClassificationArraySerializer(body), + }); +} + +export async function _addClassificationsByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Add classification to the entity identified by its type and unique attributes. */ +export async function addClassificationsByUniqueAttribute( + context: Client, + typeName: string, + body: AtlasClassification[], + options: EntityAddClassificationsByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _addClassificationsByUniqueAttributeSend( + context, + typeName, + body, + options, + ); + return _addClassificationsByUniqueAttributeDeserialize(result); +} + +export function _removeClassificationByUniqueAttributeSend( + context: Client, + typeName: string, + classificationName: string, + options: EntityRemoveClassificationByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}/classification/{classificationName}{?attr%3AqualifiedName}", + { + typeName: typeName, + classificationName: classificationName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _removeClassificationByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** + * Delete a given classification from an entity identified by its type and unique + * attributes. + */ +export async function removeClassificationByUniqueAttribute( + context: Client, + typeName: string, + classificationName: string, + options: EntityRemoveClassificationByUniqueAttributeOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _removeClassificationByUniqueAttributeSend( + context, + typeName, + classificationName, + options, + ); + return _removeClassificationByUniqueAttributeDeserialize(result); +} + +export function _deleteByUniqueAttributeSend( + context: Client, + typeName: string, + options: EntityDeleteByUniqueAttributeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _deleteByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** + * Delete an entity identified by its type and unique attributes. + * In addition to + * the typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: + * attr:\=\. + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: + * DELETE + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function deleteByUniqueAttribute( + context: Client, + typeName: string, + options: EntityDeleteByUniqueAttributeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteByUniqueAttributeSend(context, typeName, options); + return _deleteByUniqueAttributeDeserialize(result); +} + +export function _updateByUniqueAttributeSend( + context: Client, + typeName: string, + body: AtlasEntityWithExtInfo, + options: EntityUpdateByUniqueAttributeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}{?attr%3AqualifiedName}", + { + typeName: typeName, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasEntityWithExtInfoSerializer(body), + }); +} + +export async function _updateByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** + * Update entity partially - Allow a subset of attributes to be updated on an + * entity which is identified by its type and unique attribute eg: + * Referenceable.qualifiedName. Null updates are not possible. + * + * In addition to the + * typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: + * + * attr:=. + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: + * PUT + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function updateByUniqueAttribute( + context: Client, + typeName: string, + body: AtlasEntityWithExtInfo, + options: EntityUpdateByUniqueAttributeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateByUniqueAttributeSend( + context, + typeName, + body, + options, + ); + return _updateByUniqueAttributeDeserialize(result); +} + +export function _getByUniqueAttributeSend( + context: Client, + typeName: string, + options: EntityGetByUniqueAttributeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/uniqueAttribute/type/{typeName}{?minExtInfo,ignoreRelationships,attr%3AqualifiedName}", + { + typeName: typeName, + minExtInfo: options?.minExtInfo, + ignoreRelationships: options?.ignoreRelationships, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntityWithExtInfoDeserializer(result.body); +} + +/** + * Get complete definition of an entity given its type and unique attribute. + * + * In + * addition to the typeName path parameter, attribute key-value pair(s) can be + * provided in the following format: + * attr:\=. + * + * NOTE: The + * attrName and attrValue should be unique across entities, eg. + * qualifiedName. + * + * The REST request would look something like this: + * GET + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function getByUniqueAttribute( + context: Client, + typeName: string, + options: EntityGetByUniqueAttributeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByUniqueAttributeSend(context, typeName, options); + return _getByUniqueAttributeDeserialize(result); +} + +export function _updateClassificationsSend( + context: Client, + guid: string, + body: AtlasClassification[], + options: EntityUpdateClassificationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/classifications", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasClassificationArraySerializer(body), + }); +} + +export async function _updateClassificationsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Update classifications to an existing entity represented by a guid. */ +export async function updateClassifications( + context: Client, + guid: string, + body: AtlasClassification[], + options: EntityUpdateClassificationsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateClassificationsSend(context, guid, body, options); + return _updateClassificationsDeserialize(result); +} + +export function _addClassificationsSend( + context: Client, + guid: string, + body: AtlasClassification[], + options: EntityAddClassificationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/classifications", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasClassificationArraySerializer(body), + }); +} + +export async function _addClassificationsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Add classifications to an existing entity represented by a GUID. */ +export async function addClassifications( + context: Client, + guid: string, + body: AtlasClassification[], + options: EntityAddClassificationsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _addClassificationsSend(context, guid, body, options); + return _addClassificationsDeserialize(result); +} + +export function _getClassificationsSend( + context: Client, + guid: string, + options: EntityGetClassificationsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/classifications", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getClassificationsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasClassificationsDeserializer(result.body); +} + +/** List classifications for a given entity represented by a GUID. */ +export async function getClassifications( + context: Client, + guid: string, + options: EntityGetClassificationsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getClassificationsSend(context, guid, options); + return _getClassificationsDeserialize(result); +} + +export function _removeClassificationSend( + context: Client, + guid: string, + classificationName: string, + options: EntityRemoveClassificationOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/classification/{classificationName}", + { + guid: guid, + classificationName: classificationName, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _removeClassificationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a given classification from an existing entity represented by a GUID. */ +export async function removeClassification( + context: Client, + guid: string, + classificationName: string, + options: EntityRemoveClassificationOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _removeClassificationSend( + context, + guid, + classificationName, + options, + ); + return _removeClassificationDeserialize(result); +} + +export function _getClassificationSend( + context: Client, + guid: string, + classificationName: string, + options: EntityGetClassificationOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}/classification/{classificationName}", + { + guid: guid, + classificationName: classificationName, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getClassificationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasClassificationDeserializer(result.body); +} + +/** Get classification for a given entity represented by a GUID. */ +export async function getClassification( + context: Client, + guid: string, + classificationName: string, + options: EntityGetClassificationOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getClassificationSend( + context, + guid, + classificationName, + options, + ); + return _getClassificationDeserialize(result); +} + +export function _$deleteSend( + context: Client, + guid: string, + options: EntityDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** Delete an entity identified by its GUID. */ +/** + * @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, + guid: string, + options: EntityDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, guid, options); + return _$deleteDeserialize(result); +} + +export function _updateAttributeByIdSend( + context: Client, + guid: string, + name: string, + body: any, + options: EntityUpdateAttributeByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}{?name}", + { + guid: guid, + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: body, + }); +} + +export async function _updateAttributeByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** + * Update entity partially - create or update entity attribute identified by its + * GUID. + * Supports only primitive attribute type and entity references. + * It does not support updating complex types like arrays, and maps. + * Null updates are not possible. + */ +export async function updateAttributeById( + context: Client, + guid: string, + name: string, + body: any, + options: EntityUpdateAttributeByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateAttributeByIdSend( + context, + guid, + name, + body, + options, + ); + return _updateAttributeByIdDeserialize(result); +} + +export function _getSend( + context: Client, + guid: string, + options: EntityGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/guid/{guid}{?minExtInfo,ignoreRelationships}", + { + guid: guid, + minExtInfo: options?.minExtInfo, + ignoreRelationships: options?.ignoreRelationships, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntityWithExtInfoDeserializer(result.body); +} + +/** Get complete definition of an entity given its GUID. */ +export async function get( + context: Client, + guid: string, + options: EntityGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, guid, options); + return _getDeserialize(result); +} + +export function _addClassificationSend( + context: Client, + body: ClassificationAssociateOptions, + options: EntityAddClassificationOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/entity/bulk/classification") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: classificationAssociateOptionsSerializer(body), + }); +} + +export async function _addClassificationDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Associate a classification to multiple entities in bulk. */ +export async function addClassification( + context: Client, + body: ClassificationAssociateOptions, + options: EntityAddClassificationOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _addClassificationSend(context, body, options); + return _addClassificationDeserialize(result); +} + +export function _batchDeleteSend( + context: Client, + guid: string[], + options: EntityBatchDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/bulk{?guid*}", + { + guid: guid.map((p: any) => { + return p; + }), + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _batchDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** + * Delete a list of entities in bulk identified by their GUIDs or unique + * attributes. + */ +export async function batchDelete( + context: Client, + guid: string[], + options: EntityBatchDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchDeleteSend(context, guid, options); + return _batchDeleteDeserialize(result); +} + +export function _batchCreateOrUpdateSend( + context: Client, + body: AtlasEntitiesWithExtInfo, + options: EntityBatchCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/bulk{?api%2Dversion,collectionId,businessAttributeUpdateBehavior}", + { + "api%2Dversion": context.apiVersion, + collectionId: options?.collectionId, + businessAttributeUpdateBehavior: options?.businessAttributeUpdateBehavior, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasEntitiesWithExtInfoSerializer(body), + }); +} + +export async function _batchCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** + * Create or update entities in bulk. + * Existing entity is matched using its unique + * guid if supplied or by its unique attributes eg: qualifiedName. + * Map and array + * of collections are not well supported. E.g., array>, + * array>. + * For each contact type, the maximum number of contacts + * is 20. + */ +export async function batchCreateOrUpdate( + context: Client, + body: AtlasEntitiesWithExtInfo, + options: EntityBatchCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchCreateOrUpdateSend(context, body, options); + return _batchCreateOrUpdateDeserialize(result); +} + +export function _getByIdsSend( + context: Client, + guid: string[], + options: EntityGetByIdsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity/bulk{?api%2Dversion,guid*,minExtInfo,ignoreRelationships}", + { + "api%2Dversion": context.apiVersion, + guid: guid.map((p: any) => { + return p; + }), + minExtInfo: options?.minExtInfo, + ignoreRelationships: options?.ignoreRelationships, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getByIdsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntitiesWithExtInfoDeserializer(result.body); +} + +/** List entities in bulk identified by its GUIDs. */ +export async function getByIds( + context: Client, + guid: string[], + options: EntityGetByIdsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByIdsSend(context, guid, options); + return _getByIdsDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + body: AtlasEntityWithExtInfo, + options: EntityCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/entity{?api%2Dversion,businessAttributeUpdateBehavior,collectionId}", + { + "api%2Dversion": context.apiVersion, + businessAttributeUpdateBehavior: options?.businessAttributeUpdateBehavior, + collectionId: options?.collectionId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasEntityWithExtInfoSerializer(body), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return entityMutationResultDeserializer(result.body); +} + +/** + * Create or update an entity. + * Existing entity is matched using its unique guid if + * supplied or by its unique attributes eg: qualifiedName. + * Map and array of + * collections are not well supported. E.g., array>, array>. + * For each contact type, the maximum number of contacts is 20. + */ +export async function createOrUpdate( + context: Client, + body: AtlasEntityWithExtInfo, + options: EntityCreateOrUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createOrUpdateSend(context, body, options); + return _createOrUpdateDeserialize(result); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts new file mode 100644 index 0000000000..7e29545543 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { BusinessAttributeUpdateBehavior } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface EntityMoveEntitiesToCollectionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityAddLabelsByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; + /** set of labels to be added */ + body?: string[]; +} + +/** Optional parameters. */ +export interface EntitySetLabelsByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; + /** set of labels to be set */ + body?: string[]; +} + +/** Optional parameters. */ +export interface EntityRemoveLabelsByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; + /** set of labels to be deleted */ + body?: string[]; +} + +/** Optional parameters. */ +export interface EntityAddLabelOptionalParams extends OperationOptions { + /** set of labels to be added */ + body?: string[]; +} + +/** Optional parameters. */ +export interface EntitySetLabelsOptionalParams extends OperationOptions { + /** set of labels to be set to the entity */ + body?: string[]; +} + +/** Optional parameters. */ +export interface EntityRemoveLabelsOptionalParams extends OperationOptions { + /** set of labels to be deleted */ + body?: string[]; +} + +/** Optional parameters. */ +export interface EntityImportBusinessMetadataOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityGetBusinessMetadataTemplateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityAddOrUpdateBusinessMetadataAttributesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityRemoveBusinessMetadataAttributesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityAddOrUpdateBusinessMetadataOptionalParams + extends OperationOptions { + /** + * Whether to overwrite the existing business metadata on the entity or not, + * default is false. + */ + overwrite?: boolean; +} + +/** Optional parameters. */ +export interface EntityRemoveBusinessMetadataOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityGetHeaderOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityBatchGetByUniqueAttributesOptionalParams + extends OperationOptions { + /** Whether to return minimal information for referred entities. */ + minExtInfo?: boolean; + /** Whether to ignore relationship attributes. */ + ignoreRelationships?: boolean; + /** + * Qualified name of an entity. E.g. to find 2 entities you can set + * attrs_1:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. (This is only an + * example. qualifiedName can be changed to other unique attributes) + */ + attrNQualifiedName?: string; +} + +/** Optional parameters. */ +export interface EntityBatchSetClassificationsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityUpdateClassificationsUniqueByAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface EntityAddClassificationsByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface EntityRemoveClassificationByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface EntityDeleteByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface EntityUpdateByUniqueAttributeOptionalParams + extends OperationOptions { + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface EntityGetByUniqueAttributeOptionalParams + extends OperationOptions { + /** Whether to return minimal information for referred entities. */ + minExtInfo?: boolean; + /** Whether to ignore relationship attributes. */ + ignoreRelationships?: boolean; + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface EntityUpdateClassificationsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityAddClassificationsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityGetClassificationsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityRemoveClassificationOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityGetClassificationOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityUpdateAttributeByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityGetOptionalParams extends OperationOptions { + /** Whether to return minimal information for referred entities. */ + minExtInfo?: boolean; + /** Whether to ignore relationship attributes. */ + ignoreRelationships?: boolean; +} + +/** Optional parameters. */ +export interface EntityAddClassificationOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityBatchDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface EntityBatchCreateOrUpdateOptionalParams + extends OperationOptions { + /** + * The collection where entities will be moved to. Only specify a value if you + * need to move an entity to another collection. + */ + collectionId?: string; + /** + * Used to define the update behavior for business attributes when updating + * entities. + */ + businessAttributeUpdateBehavior?: BusinessAttributeUpdateBehavior; +} + +/** Optional parameters. */ +export interface EntityGetByIdsOptionalParams extends OperationOptions { + /** Whether to return minimal information for referred entities. */ + minExtInfo?: boolean; + /** Whether to ignore relationship attributes. */ + ignoreRelationships?: boolean; +} + +/** Optional parameters. */ +export interface EntityCreateOrUpdateOptionalParams extends OperationOptions { + /** + * Used to define the update behavior for business attributes when updating + * entities. + */ + businessAttributeUpdateBehavior?: BusinessAttributeUpdateBehavior; + /** + * The collection where entities will be moved to. Only specify a value if you + * need to move an entity to another collection. + */ + collectionId?: string; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts new file mode 100644 index 0000000000..1307b39061 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + getTermHeaders, + getTerms, + partialUpdate, + getDetailed, + getCategoriesHeaders, + getCategories, + $delete, + update, + get, + getRelatedTerms, + deleteTermAssignmentFromEntities, + assignTermToEntities, + getEntitiesAssignedWithTerm, + createTerms, + partialUpdateTerm, + deleteTerm, + updateTerm, + getTerm, + createTerm, + getCategoryTerms, + getRelatedCategories, + partialUpdateCategory, + deleteCategory, + updateCategory, + getCategory, + createCategory, + createCategories, + create, + batchGet, +} from "./operations.js"; +export { + GlossaryGetTermHeadersOptionalParams, + GlossaryGetTermsOptionalParams, + GlossaryPartialUpdateOptionalParams, + GlossaryGetDetailedOptionalParams, + GlossaryGetCategoriesHeadersOptionalParams, + GlossaryGetCategoriesOptionalParams, + GlossaryDeleteOptionalParams, + GlossaryUpdateOptionalParams, + GlossaryGetOptionalParams, + GlossaryGetRelatedTermsOptionalParams, + GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, + GlossaryAssignTermToEntitiesOptionalParams, + GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryCreateTermsOptionalParams, + GlossaryPartialUpdateTermOptionalParams, + GlossaryDeleteTermOptionalParams, + GlossaryUpdateTermOptionalParams, + GlossaryGetTermOptionalParams, + GlossaryCreateTermOptionalParams, + GlossaryGetCategoryTermsOptionalParams, + GlossaryGetRelatedCategoriesOptionalParams, + GlossaryPartialUpdateCategoryOptionalParams, + GlossaryDeleteCategoryOptionalParams, + GlossaryUpdateCategoryOptionalParams, + GlossaryGetCategoryOptionalParams, + GlossaryCreateCategoryOptionalParams, + GlossaryCreateCategoriesOptionalParams, + GlossaryCreateOptionalParams, + GlossaryBatchGetOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts new file mode 100644 index 0000000000..ccdb0c3b24 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts @@ -0,0 +1,1601 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext as Client } from "../index.js"; +import { + atlasErrorResponseDeserializer, + AtlasGlossary, + atlasGlossarySerializer, + atlasGlossaryDeserializer, + atlasRelatedCategoryHeaderArrayDeserializer, + AtlasRelatedCategoryHeader, + atlasRelatedTermHeaderArrayDeserializer, + AtlasRelatedTermHeader, + AtlasGlossaryCategory, + atlasGlossaryCategorySerializer, + atlasGlossaryCategoryDeserializer, + AtlasGlossaryTerm, + atlasGlossaryTermSerializer, + atlasGlossaryTermDeserializer, + atlasRelatedObjectIdArraySerializer, + atlasRelatedObjectIdArrayDeserializer, + AtlasRelatedObjectId, + AtlasGlossaryExtInfo, + atlasGlossaryExtInfoDeserializer, + atlasGlossaryArrayDeserializer, + atlasGlossaryCategoryArraySerializer, + atlasGlossaryCategoryArrayDeserializer, + atlasRelatedCategoryHeaderArrayRecordDeserializer, + atlasGlossaryTermArraySerializer, + atlasGlossaryTermArrayDeserializer, + atlasRelatedTermHeaderArrayRecordDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + GlossaryGetTermHeadersOptionalParams, + GlossaryGetTermsOptionalParams, + GlossaryPartialUpdateOptionalParams, + GlossaryGetDetailedOptionalParams, + GlossaryGetCategoriesHeadersOptionalParams, + GlossaryGetCategoriesOptionalParams, + GlossaryDeleteOptionalParams, + GlossaryUpdateOptionalParams, + GlossaryGetOptionalParams, + GlossaryGetRelatedTermsOptionalParams, + GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, + GlossaryAssignTermToEntitiesOptionalParams, + GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryCreateTermsOptionalParams, + GlossaryPartialUpdateTermOptionalParams, + GlossaryDeleteTermOptionalParams, + GlossaryUpdateTermOptionalParams, + GlossaryGetTermOptionalParams, + GlossaryCreateTermOptionalParams, + GlossaryGetCategoryTermsOptionalParams, + GlossaryGetRelatedCategoriesOptionalParams, + GlossaryPartialUpdateCategoryOptionalParams, + GlossaryDeleteCategoryOptionalParams, + GlossaryUpdateCategoryOptionalParams, + GlossaryGetCategoryOptionalParams, + GlossaryCreateCategoryOptionalParams, + GlossaryCreateCategoriesOptionalParams, + GlossaryCreateOptionalParams, + GlossaryBatchGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _getTermHeadersSend( + context: Client, + glossaryId: string, + options: GlossaryGetTermHeadersOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}/terms/headers{?limit,offset,sort}", + { + glossaryId: glossaryId, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getTermHeadersDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelatedTermHeaderArrayDeserializer(result.body); +} + +/** + * Get term headers belonging to a specific glossary. Recommend using limit/offset + * to get pagination result. + */ +export async function getTermHeaders( + context: Client, + glossaryId: string, + options: GlossaryGetTermHeadersOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTermHeadersSend(context, glossaryId, options); + return _getTermHeadersDeserialize(result); +} + +export function _getTermsSend( + context: Client, + glossaryId: string, + options: GlossaryGetTermsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}/terms{?api%2Dversion,limit,offset,sort}", + { + glossaryId: glossaryId, + "api%2Dversion": context.apiVersion, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getTermsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryTermArrayDeserializer(result.body); +} + +/** + * Get terms belonging to a specific glossary. Recommend using limit/offset to get + * pagination result. + */ +export async function getTerms( + context: Client, + glossaryId: string, + options: GlossaryGetTermsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTermsSend(context, glossaryId, options); + return _getTermsDeserialize(result); +} + +export function _partialUpdateSend( + context: Client, + glossaryId: string, + body: Record, + options: GlossaryPartialUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}/partial{?api%2Dversion,ignoreTermsAndCategories}", + { + glossaryId: glossaryId, + "api%2Dversion": context.apiVersion, + ignoreTermsAndCategories: options?.ignoreTermsAndCategories, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: body, + }); +} + +export async function _partialUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryDeserializer(result.body); +} + +/** + * Update the glossary partially. Some properties such as qualifiedName are not + * allowed to be updated. + * + * So far we only supports partial updating + * shortDescription, longDescription, language and usage for glossary. + * + * Recommend + * using 'ignoreTermsAndCategories=true' to reduce response body size. + */ +export async function partialUpdate( + context: Client, + glossaryId: string, + body: Record, + options: GlossaryPartialUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _partialUpdateSend(context, glossaryId, body, options); + return _partialUpdateDeserialize(result); +} + +export function _getDetailedSend( + context: Client, + glossaryId: string, + options: GlossaryGetDetailedOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}/detailed{?api%2Dversion}", + { + glossaryId: glossaryId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDetailedDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryExtInfoDeserializer(result.body); +} + +/** + * Get a specific glossary with detailed information. This API is not + * recommend. + * + * Recommend to fetch terms/categories details separately using + * + * GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms and + * + * GET /datamap/api/atlas/v2/glossary/{glossaryId}/categories. + */ +export async function getDetailed( + context: Client, + glossaryId: string, + options: GlossaryGetDetailedOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getDetailedSend(context, glossaryId, options); + return _getDetailedDeserialize(result); +} + +export function _getCategoriesHeadersSend( + context: Client, + glossaryId: string, + options: GlossaryGetCategoriesHeadersOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}/categories/headers{?limit,offset,sort}", + { + glossaryId: glossaryId, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getCategoriesHeadersDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelatedCategoryHeaderArrayDeserializer(result.body); +} + +/** + * Get the category headers belonging to a specific glossary. Recommend using + * limit/offset to get pagination result. + */ +export async function getCategoriesHeaders( + context: Client, + glossaryId: string, + options: GlossaryGetCategoriesHeadersOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getCategoriesHeadersSend(context, glossaryId, options); + return _getCategoriesHeadersDeserialize(result); +} + +export function _getCategoriesSend( + context: Client, + glossaryId: string, + options: GlossaryGetCategoriesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}/categories{?limit,offset,sort}", + { + glossaryId: glossaryId, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getCategoriesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryCategoryArrayDeserializer(result.body); +} + +/** + * Get the categories belonging to a specific glossary. Recommend using + * limit/offset to get pagination result. + */ +export async function getCategories( + context: Client, + glossaryId: string, + options: GlossaryGetCategoriesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getCategoriesSend(context, glossaryId, options); + return _getCategoriesDeserialize(result); +} + +export function _$deleteSend( + context: Client, + glossaryId: string, + options: GlossaryDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}", + { + glossaryId: glossaryId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** + * Delete a glossary. Will delete underlying terms/categories together. Recommend + * separate delete terms and categories. + */ +/** + * @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, + glossaryId: string, + options: GlossaryDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, glossaryId, options); + return _$deleteDeserialize(result); +} + +export function _updateSend( + context: Client, + glossaryId: string, + body: AtlasGlossary, + options: GlossaryUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}{?api%2Dversion,ignoreTermsAndCategories}", + { + glossaryId: glossaryId, + "api%2Dversion": context.apiVersion, + ignoreTermsAndCategories: options?.ignoreTermsAndCategories, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossarySerializer(body), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryDeserializer(result.body); +} + +/** Update the given glossary. */ +export async function update( + context: Client, + glossaryId: string, + body: AtlasGlossary, + options: GlossaryUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend(context, glossaryId, body, options); + return _updateDeserialize(result); +} + +export function _getSend( + context: Client, + glossaryId: string, + options: GlossaryGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/{glossaryId}", + { + glossaryId: glossaryId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryDeserializer(result.body); +} + +/** Get a specific Glossary by its GUID. */ +export async function get( + context: Client, + glossaryId: string, + options: GlossaryGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, glossaryId, options); + return _getDeserialize(result); +} + +export function _getRelatedTermsSend( + context: Client, + termId: string, + options: GlossaryGetRelatedTermsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/terms/{termId}/related{?api%2Dversion,limit,offset,sort}", + { + termId: termId, + "api%2Dversion": context.apiVersion, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getRelatedTermsDeserialize( + result: PathUncheckedResponse, +): Promise> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelatedTermHeaderArrayRecordDeserializer(result.body); +} + +/** + * Get all related terms for a specific term by its GUID. Limit, offset, and sort + * parameters are currently not being enabled and won't work even they are passed. + */ +export async function getRelatedTerms( + context: Client, + termId: string, + options: GlossaryGetRelatedTermsOptionalParams = { requestOptions: {} }, +): Promise> { + const result = await _getRelatedTermsSend(context, termId, options); + return _getRelatedTermsDeserialize(result); +} + +export function _deleteTermAssignmentFromEntitiesSend( + context: Client, + termId: string, + body: AtlasRelatedObjectId[], + options: GlossaryDeleteTermAssignmentFromEntitiesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/terms/{termId}/assignedEntities", + { + termId: termId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasRelatedObjectIdArraySerializer(body), + }); +} + +export async function _deleteTermAssignmentFromEntitiesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete the term assignment for the given list of related objects. */ +export async function deleteTermAssignmentFromEntities( + context: Client, + termId: string, + body: AtlasRelatedObjectId[], + options: GlossaryDeleteTermAssignmentFromEntitiesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _deleteTermAssignmentFromEntitiesSend( + context, + termId, + body, + options, + ); + return _deleteTermAssignmentFromEntitiesDeserialize(result); +} + +export function _assignTermToEntitiesSend( + context: Client, + termId: string, + body: AtlasRelatedObjectId[], + options: GlossaryAssignTermToEntitiesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/terms/{termId}/assignedEntities", + { + termId: termId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasRelatedObjectIdArraySerializer(body), + }); +} + +export async function _assignTermToEntitiesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** + * Assign the given term to the provided list of related objects. Recommend using + * small batches with multiple API calls. + * + * [Entities Create Or Update + * operation](https://learn.microsoft.com/en-us/rest/api/purview/datamapdataplane/entity/bulk-create-or-update?tabs=HTTP) + * is an alternative to assign a term to multiple entities. + */ +export async function assignTermToEntities( + context: Client, + termId: string, + body: AtlasRelatedObjectId[], + options: GlossaryAssignTermToEntitiesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _assignTermToEntitiesSend( + context, + termId, + body, + options, + ); + return _assignTermToEntitiesDeserialize(result); +} + +export function _getEntitiesAssignedWithTermSend( + context: Client, + termId: string, + options: GlossaryGetEntitiesAssignedWithTermOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/terms/{termId}/assignedEntities{?limit,offset,sort}", + { + termId: termId, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getEntitiesAssignedWithTermDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelatedObjectIdArrayDeserializer(result.body); +} + +/** + * List all related objects assigned with the specified term. Recommend using + * limit/offset to get pagination result. + */ +export async function getEntitiesAssignedWithTerm( + context: Client, + termId: string, + options: GlossaryGetEntitiesAssignedWithTermOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getEntitiesAssignedWithTermSend( + context, + termId, + options, + ); + return _getEntitiesAssignedWithTermDeserialize(result); +} + +export function _createTermsSend( + context: Client, + body: AtlasGlossaryTerm[], + options: GlossaryCreateTermsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/terms{?api%2Dversion,includeTermHierarchy}", + { + "api%2Dversion": context.apiVersion, + includeTermHierarchy: options?.includeTermHierarchy, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossaryTermArraySerializer(body), + }); +} + +export async function _createTermsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryTermArrayDeserializer(result.body); +} + +/** Create glossary terms in bulk. */ +export async function createTerms( + context: Client, + body: AtlasGlossaryTerm[], + options: GlossaryCreateTermsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createTermsSend(context, body, options); + return _createTermsDeserialize(result); +} + +export function _partialUpdateTermSend( + context: Client, + termId: string, + body: Record, + options: GlossaryPartialUpdateTermOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/term/{termId}/partial{?api%2Dversion,includeTermHierarchy}", + { + termId: termId, + "api%2Dversion": context.apiVersion, + includeTermHierarchy: options?.includeTermHierarchy, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: body, + }); +} + +export async function _partialUpdateTermDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryTermDeserializer(result.body); +} + +/** + * Update the glossary term partially. So far we only supports partial updating + * shortDescription, longDescription, abbreviation, usage and status for term. + */ +export async function partialUpdateTerm( + context: Client, + termId: string, + body: Record, + options: GlossaryPartialUpdateTermOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _partialUpdateTermSend(context, termId, body, options); + return _partialUpdateTermDeserialize(result); +} + +export function _deleteTermSend( + context: Client, + termId: string, + options: GlossaryDeleteTermOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/term/{termId}", + { + termId: termId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteTermDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a glossary term. */ +export async function deleteTerm( + context: Client, + termId: string, + options: GlossaryDeleteTermOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteTermSend(context, termId, options); + return _deleteTermDeserialize(result); +} + +export function _updateTermSend( + context: Client, + termId: string, + body: AtlasGlossaryTerm, + options: GlossaryUpdateTermOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/term/{termId}{?api%2Dversion,includeTermHierarchy}", + { + termId: termId, + "api%2Dversion": context.apiVersion, + includeTermHierarchy: options?.includeTermHierarchy, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossaryTermSerializer(body), + }); +} + +export async function _updateTermDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryTermDeserializer(result.body); +} + +/** Update the given glossary term by its GUID. */ +export async function updateTerm( + context: Client, + termId: string, + body: AtlasGlossaryTerm, + options: GlossaryUpdateTermOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateTermSend(context, termId, body, options); + return _updateTermDeserialize(result); +} + +export function _getTermSend( + context: Client, + termId: string, + options: GlossaryGetTermOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/term/{termId}{?api%2Dversion}", + { + termId: termId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getTermDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryTermDeserializer(result.body); +} + +/** Get a specific glossary term by its GUID. */ +export async function getTerm( + context: Client, + termId: string, + options: GlossaryGetTermOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getTermSend(context, termId, options); + return _getTermDeserialize(result); +} + +export function _createTermSend( + context: Client, + body: AtlasGlossaryTerm, + options: GlossaryCreateTermOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/term{?includeTermHierarchy}", + { + includeTermHierarchy: options?.includeTermHierarchy, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossaryTermSerializer(body), + }); +} + +export async function _createTermDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryTermDeserializer(result.body); +} + +/** Create a glossary term. */ +export async function createTerm( + context: Client, + body: AtlasGlossaryTerm, + options: GlossaryCreateTermOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createTermSend(context, body, options); + return _createTermDeserialize(result); +} + +export function _getCategoryTermsSend( + context: Client, + categoryId: string, + options: GlossaryGetCategoryTermsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/category/{categoryId}/terms{?limit,offset,sort}", + { + categoryId: categoryId, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getCategoryTermsDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelatedTermHeaderArrayDeserializer(result.body); +} + +/** Get all terms associated with the specific category. */ +export async function getCategoryTerms( + context: Client, + categoryId: string, + options: GlossaryGetCategoryTermsOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getCategoryTermsSend(context, categoryId, options); + return _getCategoryTermsDeserialize(result); +} + +export function _getRelatedCategoriesSend( + context: Client, + categoryId: string, + options: GlossaryGetRelatedCategoriesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/category/{categoryId}/related{?limit,offset,sort}", + { + categoryId: categoryId, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getRelatedCategoriesDeserialize( + result: PathUncheckedResponse, +): Promise> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelatedCategoryHeaderArrayRecordDeserializer(result.body); +} + +/** + * Get all related categories (parent and children). Limit, offset, and sort + * parameters are currently not being enabled and won't work even they are passed. + */ +export async function getRelatedCategories( + context: Client, + categoryId: string, + options: GlossaryGetRelatedCategoriesOptionalParams = { requestOptions: {} }, +): Promise> { + const result = await _getRelatedCategoriesSend(context, categoryId, options); + return _getRelatedCategoriesDeserialize(result); +} + +export function _partialUpdateCategorySend( + context: Client, + categoryId: string, + body: Record, + options: GlossaryPartialUpdateCategoryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/category/{categoryId}/partial", + { + categoryId: categoryId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: body, + }); +} + +export async function _partialUpdateCategoryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryCategoryDeserializer(result.body); +} + +/** + * Update the glossary category partially. So far we only supports partial + * updating shortDescription and longDescription for category. + */ +export async function partialUpdateCategory( + context: Client, + categoryId: string, + body: Record, + options: GlossaryPartialUpdateCategoryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _partialUpdateCategorySend( + context, + categoryId, + body, + options, + ); + return _partialUpdateCategoryDeserialize(result); +} + +export function _deleteCategorySend( + context: Client, + categoryId: string, + options: GlossaryDeleteCategoryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/category/{categoryId}", + { + categoryId: categoryId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteCategoryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a glossary category. */ +export async function deleteCategory( + context: Client, + categoryId: string, + options: GlossaryDeleteCategoryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _deleteCategorySend(context, categoryId, options); + return _deleteCategoryDeserialize(result); +} + +export function _updateCategorySend( + context: Client, + categoryId: string, + body: AtlasGlossaryCategory, + options: GlossaryUpdateCategoryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/category/{categoryId}", + { + categoryId: categoryId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossaryCategorySerializer(body), + }); +} + +export async function _updateCategoryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryCategoryDeserializer(result.body); +} + +/** Update the given glossary category by its GUID. */ +export async function updateCategory( + context: Client, + categoryId: string, + body: AtlasGlossaryCategory, + options: GlossaryUpdateCategoryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateCategorySend(context, categoryId, body, options); + return _updateCategoryDeserialize(result); +} + +export function _getCategorySend( + context: Client, + categoryId: string, + options: GlossaryGetCategoryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary/category/{categoryId}", + { + categoryId: categoryId, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getCategoryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryCategoryDeserializer(result.body); +} + +/** Get specific glossary category by its GUID. */ +export async function getCategory( + context: Client, + categoryId: string, + options: GlossaryGetCategoryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getCategorySend(context, categoryId, options); + return _getCategoryDeserialize(result); +} + +export function _createCategorySend( + context: Client, + body: AtlasGlossaryCategory, + options: GlossaryCreateCategoryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/glossary/category") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossaryCategorySerializer(body), + }); +} + +export async function _createCategoryDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryCategoryDeserializer(result.body); +} + +/** Create a glossary category. */ +export async function createCategory( + context: Client, + body: AtlasGlossaryCategory, + options: GlossaryCreateCategoryOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createCategorySend(context, body, options); + return _createCategoryDeserialize(result); +} + +export function _createCategoriesSend( + context: Client, + body: AtlasGlossaryCategory[], + options: GlossaryCreateCategoriesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/glossary/categories") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossaryCategoryArraySerializer(body), + }); +} + +export async function _createCategoriesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryCategoryArrayDeserializer(result.body); +} + +/** Create glossary category in bulk. */ +export async function createCategories( + context: Client, + body: AtlasGlossaryCategory[], + options: GlossaryCreateCategoriesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createCategoriesSend(context, body, options); + return _createCategoriesDeserialize(result); +} + +export function _createSend( + context: Client, + body: AtlasGlossary, + options: GlossaryCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/glossary") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasGlossarySerializer(body), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryDeserializer(result.body); +} + +/** Create a glossary. */ +export async function create( + context: Client, + body: AtlasGlossary, + options: GlossaryCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, body, options); + return _createDeserialize(result); +} + +export function _batchGetSend( + context: Client, + options: GlossaryBatchGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/glossary{?api%2Dversion,limit,offset,sort,ignoreTermsAndCategories}", + { + "api%2Dversion": context.apiVersion, + limit: options?.limit, + offset: options?.offset, + sort: options?.sort, + ignoreTermsAndCategories: options?.ignoreTermsAndCategories, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _batchGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasGlossaryArrayDeserializer(result.body); +} + +/** + * Get all glossaries. Recommend using limit/offset to get pagination result. + * Recommend using 'ignoreTermsAndCategories=true' and fetch terms/categories + * separately using 'GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms' + * and 'GET '/datamap/api/atlas/v2/glossary/{glossaryId}/categories'. + */ +export async function batchGet( + context: Client, + options: GlossaryBatchGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchGetSend(context, options); + return _batchGetDeserialize(result); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts new file mode 100644 index 0000000000..f51a788019 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface GlossaryGetTermHeadersOptionalParams extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryGetTermsOptionalParams extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryPartialUpdateOptionalParams extends OperationOptions { + /** Whether ignore terms and categories */ + ignoreTermsAndCategories?: boolean; +} + +/** Optional parameters. */ +export interface GlossaryGetDetailedOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryGetCategoriesHeadersOptionalParams + extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryGetCategoriesOptionalParams extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryUpdateOptionalParams extends OperationOptions { + /** Whether ignore terms and categories */ + ignoreTermsAndCategories?: boolean; +} + +/** Optional parameters. */ +export interface GlossaryGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryGetRelatedTermsOptionalParams + extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryDeleteTermAssignmentFromEntitiesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryAssignTermToEntitiesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryGetEntitiesAssignedWithTermOptionalParams + extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryCreateTermsOptionalParams extends OperationOptions { + /** Whether include term hierarchy */ + includeTermHierarchy?: boolean; +} + +/** Optional parameters. */ +export interface GlossaryPartialUpdateTermOptionalParams + extends OperationOptions { + /** Whether include term hierarchy */ + includeTermHierarchy?: boolean; +} + +/** Optional parameters. */ +export interface GlossaryDeleteTermOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryUpdateTermOptionalParams extends OperationOptions { + /** Whether include term hierarchy */ + includeTermHierarchy?: boolean; +} + +/** Optional parameters. */ +export interface GlossaryGetTermOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryCreateTermOptionalParams extends OperationOptions { + /** Whether include term hierarchy */ + includeTermHierarchy?: boolean; +} + +/** Optional parameters. */ +export interface GlossaryGetCategoryTermsOptionalParams + extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryGetRelatedCategoriesOptionalParams + extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; +} + +/** Optional parameters. */ +export interface GlossaryPartialUpdateCategoryOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryDeleteCategoryOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryUpdateCategoryOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryGetCategoryOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryCreateCategoryOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryCreateCategoriesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryCreateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface GlossaryBatchGetOptionalParams extends OperationOptions { + /** The page size - by default there is no paging. */ + limit?: number; + /** The offset for pagination purpose. */ + offset?: number; + /** The sort order, ASC (default) or DESC. */ + sort?: string; + /** Whether ignore terms and categories */ + ignoreTermsAndCategories?: boolean; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts new file mode 100644 index 0000000000..5374155e74 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createDataMap, + DataMapContext, + DataMapClientOptionalParams, +} from "./dataMapContext.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/index.ts new file mode 100644 index 0000000000..65bbb1f4af --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { getByUniqueAttribute, getNextPage, get } from "./operations.js"; +export { + LineageGetByUniqueAttributeOptionalParams, + LineageGetNextPageOptionalParams, + LineageGetOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts new file mode 100644 index 0000000000..9d15873130 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext as Client } from "../index.js"; +import { + atlasErrorResponseDeserializer, + AtlasLineageInfo, + atlasLineageInfoDeserializer, + LineageDirection, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + LineageGetByUniqueAttributeOptionalParams, + LineageGetNextPageOptionalParams, + LineageGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _getByUniqueAttributeSend( + context: Client, + typeName: string, + direction: LineageDirection, + options: LineageGetByUniqueAttributeOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/lineage/uniqueAttribute/type/{typeName}{?depth,direction,attr%3AqualifiedName}", + { + typeName: typeName, + depth: options?.depth, + direction: direction, + "attr%3AqualifiedName": options?.attribute, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getByUniqueAttributeDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasLineageInfoDeserializer(result.body); +} + +/** + * Return lineage info about entity. + * + * In addition to the typeName path parameter, + * attribute key-value pair(s) can be provided in the following + * format + * + * attr:[attrName]=[attrValue] + * + * NOTE: The attrName and attrValue should be + * unique across entities, eg. qualifiedName. + * + * The REST request would look + * something like this: + * + * GET + * /v2/lineage/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ +export async function getByUniqueAttribute( + context: Client, + typeName: string, + direction: LineageDirection, + options: LineageGetByUniqueAttributeOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByUniqueAttributeSend( + context, + typeName, + direction, + options, + ); + return _getByUniqueAttributeDeserialize(result); +} + +export function _getNextPageSend( + context: Client, + guid: string, + direction: LineageDirection, + options: LineageGetNextPageOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/lineage/{guid}/next{?api%2Dversion,direction,offset,limit}", + { + guid: guid, + "api%2Dversion": context.apiVersion, + direction: direction, + offset: options?.offset, + limit: options?.limit, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getNextPageDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasLineageInfoDeserializer(result.body); +} + +/** Return immediate next page lineage info about entity with pagination */ +export async function getNextPage( + context: Client, + guid: string, + direction: LineageDirection, + options: LineageGetNextPageOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getNextPageSend(context, guid, direction, options); + return _getNextPageDeserialize(result); +} + +export function _getSend( + context: Client, + guid: string, + direction: LineageDirection, + options: LineageGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/lineage/{guid}{?depth,direction}", + { + guid: guid, + depth: options?.depth, + direction: direction, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasLineageInfoDeserializer(result.body); +} + +/** Get lineage info of the entity specified by GUID. */ +export async function get( + context: Client, + guid: string, + direction: LineageDirection, + options: LineageGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, guid, direction, options); + return _getDeserialize(result); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/options.ts new file mode 100644 index 0000000000..ba71f23b8d --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/options.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface LineageGetByUniqueAttributeOptionalParams + extends OperationOptions { + /** The number of hops for lineage. */ + depth?: number; + /** + * The qualified name of the entity. (This is only an example. qualifiedName can + * be changed to other unique attributes) + */ + attribute?: string; +} + +/** Optional parameters. */ +export interface LineageGetNextPageOptionalParams extends OperationOptions { + /** The offset for pagination purpose. */ + offset?: number; + /** The page size - by default there is no paging. */ + limit?: number; +} + +/** Optional parameters. */ +export interface LineageGetOptionalParams extends OperationOptions { + /** The number of hops for lineage. */ + depth?: number; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/index.ts new file mode 100644 index 0000000000..39a34dfb25 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { $delete, get, update, create } from "./operations.js"; +export { + RelationshipDeleteOptionalParams, + RelationshipGetOptionalParams, + RelationshipUpdateOptionalParams, + RelationshipCreateOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts new file mode 100644 index 0000000000..d3e0682ed4 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext as Client } from "../index.js"; +import { + atlasErrorResponseDeserializer, + AtlasRelationship, + atlasRelationshipSerializer, + atlasRelationshipDeserializer, + AtlasRelationshipWithExtInfo, + atlasRelationshipWithExtInfoDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + RelationshipDeleteOptionalParams, + RelationshipGetOptionalParams, + RelationshipUpdateOptionalParams, + RelationshipCreateOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _$deleteSend( + context: Client, + guid: string, + options: RelationshipDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/relationship/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a relationship between entities by its GUID. */ +/** + * @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, + guid: string, + options: RelationshipDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, guid, options); + return _$deleteDeserialize(result); +} + +export function _getSend( + context: Client, + guid: string, + options: RelationshipGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/relationship/guid/{guid}{?extendedInfo}", + { + guid: guid, + extendedInfo: options?.extendedInfo, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelationshipWithExtInfoDeserializer(result.body); +} + +/** Get relationship information between entities by its GUID. */ +export async function get( + context: Client, + guid: string, + options: RelationshipGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, guid, options); + return _getDeserialize(result); +} + +export function _updateSend( + context: Client, + body: AtlasRelationship, + options: RelationshipUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/relationship") + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasRelationshipSerializer(body), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelationshipDeserializer(result.body); +} + +/** Update an existing relationship between entities. */ +export async function update( + context: Client, + body: AtlasRelationship, + options: RelationshipUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend(context, body, options); + return _updateDeserialize(result); +} + +export function _createSend( + context: Client, + body: AtlasRelationship, + options: RelationshipCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/relationship") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasRelationshipSerializer(body), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelationshipDeserializer(result.body); +} + +/** Create a new relationship between entities. */ +export async function create( + context: Client, + body: AtlasRelationship, + options: RelationshipCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _createSend(context, body, options); + return _createDeserialize(result); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/options.ts new file mode 100644 index 0000000000..afeb5d98c1 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/options.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface RelationshipDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface RelationshipGetOptionalParams extends OperationOptions { + /** Limits whether includes extended information. */ + extendedInfo?: boolean; +} + +/** Optional parameters. */ +export interface RelationshipUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface RelationshipCreateOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts new file mode 100644 index 0000000000..b888c84788 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + getTermTemplateByName, + getTermTemplateById, + getHeaders, + batchDelete, + batchUpdate, + batchCreate, + get, + $delete, + getByName, + getById, + getStructByName, + getStructById, + getRelationshipByName, + getRelationshipById, + getEnumByName, + getEnumById, + getEntityByName, + getEntityById, + getClassificationByName, + getClassificationById, + getBusinessMetadataByName, + getBusinessMetadataById, +} from "./operations.js"; +export { + TypeDefinitionGetTermTemplateByNameOptionalParams, + TypeDefinitionGetTermTemplateByIdOptionalParams, + TypeDefinitionGetHeadersOptionalParams, + TypeDefinitionBatchDeleteOptionalParams, + TypeDefinitionBatchUpdateOptionalParams, + TypeDefinitionBatchCreateOptionalParams, + TypeDefinitionGetOptionalParams, + TypeDefinitionDeleteOptionalParams, + TypeDefinitionGetByNameOptionalParams, + TypeDefinitionGetByIdOptionalParams, + TypeDefinitionGetStructByNameOptionalParams, + TypeDefinitionGetStructByIdOptionalParams, + TypeDefinitionGetRelationshipByNameOptionalParams, + TypeDefinitionGetRelationshipByIdOptionalParams, + TypeDefinitionGetEnumByNameOptionalParams, + TypeDefinitionGetEnumByIdOptionalParams, + TypeDefinitionGetEntityByNameOptionalParams, + TypeDefinitionGetEntityByIdOptionalParams, + TypeDefinitionGetClassificationByNameOptionalParams, + TypeDefinitionGetClassificationByIdOptionalParams, + TypeDefinitionGetBusinessMetadataByNameOptionalParams, + TypeDefinitionGetBusinessMetadataByIdOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts new file mode 100644 index 0000000000..03988cf7bc --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts @@ -0,0 +1,1144 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext as Client } from "../index.js"; +import { + atlasErrorResponseDeserializer, + AtlasBusinessMetadataDef, + atlasBusinessMetadataDefDeserializer, + AtlasClassificationDef, + atlasClassificationDefDeserializer, + AtlasEntityDef, + atlasEntityDefDeserializer, + AtlasEnumDef, + atlasEnumDefDeserializer, + AtlasRelationshipDef, + atlasRelationshipDefDeserializer, + AtlasStructDef, + atlasStructDefDeserializer, + AtlasTypeDef, + atlasTypeDefDeserializer, + AtlasTypesDef, + atlasTypesDefSerializer, + atlasTypesDefDeserializer, + TermTemplateDef, + termTemplateDefDeserializer, + AtlasTypeDefHeader, + atlasTypeDefHeaderArrayDeserializer, +} from "../../models/models.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + TypeDefinitionGetTermTemplateByNameOptionalParams, + TypeDefinitionGetTermTemplateByIdOptionalParams, + TypeDefinitionGetHeadersOptionalParams, + TypeDefinitionBatchDeleteOptionalParams, + TypeDefinitionBatchUpdateOptionalParams, + TypeDefinitionBatchCreateOptionalParams, + TypeDefinitionGetOptionalParams, + TypeDefinitionDeleteOptionalParams, + TypeDefinitionGetByNameOptionalParams, + TypeDefinitionGetByIdOptionalParams, + TypeDefinitionGetStructByNameOptionalParams, + TypeDefinitionGetStructByIdOptionalParams, + TypeDefinitionGetRelationshipByNameOptionalParams, + TypeDefinitionGetRelationshipByIdOptionalParams, + TypeDefinitionGetEnumByNameOptionalParams, + TypeDefinitionGetEnumByIdOptionalParams, + TypeDefinitionGetEntityByNameOptionalParams, + TypeDefinitionGetEntityByIdOptionalParams, + TypeDefinitionGetClassificationByNameOptionalParams, + TypeDefinitionGetClassificationByIdOptionalParams, + TypeDefinitionGetBusinessMetadataByNameOptionalParams, + TypeDefinitionGetBusinessMetadataByIdOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _getTermTemplateByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetTermTemplateByNameOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/types/termtemplatedef/name/{name}{?api%2Dversion}", + { + name: name, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getTermTemplateByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return termTemplateDefDeserializer(result.body); +} + +/** Get the term template definition by its name (unique). */ +export async function getTermTemplateByName( + context: Client, + name: string, + options: TypeDefinitionGetTermTemplateByNameOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getTermTemplateByNameSend(context, name, options); + return _getTermTemplateByNameDeserialize(result); +} + +export function _getTermTemplateByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetTermTemplateByIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/types/termtemplatedef/guid/{guid}{?api%2Dversion}", + { + guid: guid, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getTermTemplateByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return termTemplateDefDeserializer(result.body); +} + +/** Get the term template definition for the given GUID. */ +export async function getTermTemplateById( + context: Client, + guid: string, + options: TypeDefinitionGetTermTemplateByIdOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getTermTemplateByIdSend(context, guid, options); + return _getTermTemplateByIdDeserialize(result); +} + +export function _getHeadersSend( + context: Client, + options: TypeDefinitionGetHeadersOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/typedefs/headers{?api%2Dversion,includeTermTemplate,type}", + { + "api%2Dversion": context.apiVersion, + includeTermTemplate: options?.includeTermTemplate, + type: options?.typeParam, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getHeadersDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasTypeDefHeaderArrayDeserializer(result.body); +} + +/** List all type definitions returned as a list of minimal information header. */ +export async function getHeaders( + context: Client, + options: TypeDefinitionGetHeadersOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getHeadersSend(context, options); + return _getHeadersDeserialize(result); +} + +export function _batchDeleteSend( + context: Client, + body: AtlasTypesDef, + options: TypeDefinitionBatchDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/types/typedefs") + .delete({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: atlasTypesDefSerializer(body), + }); +} + +export async function _batchDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete API for all types in bulk. */ +export async function batchDelete( + context: Client, + body: AtlasTypesDef, + options: TypeDefinitionBatchDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchDeleteSend(context, body, options); + return _batchDeleteDeserialize(result); +} + +export function _batchUpdateSend( + context: Client, + body: AtlasTypesDef, + options: TypeDefinitionBatchUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/types/typedefs") + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasTypesDefSerializer(body), + }); +} + +export async function _batchUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasTypesDefDeserializer(result.body); +} + +/** + * Update all types in bulk, changes detected in the type definitions would be + * persisted. + */ +export async function batchUpdate( + context: Client, + body: AtlasTypesDef, + options: TypeDefinitionBatchUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchUpdateSend(context, body, options); + return _batchUpdateDeserialize(result); +} + +export function _batchCreateSend( + context: Client, + body: AtlasTypesDef, + options: TypeDefinitionBatchCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path("/atlas/v2/types/typedefs") + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: atlasTypesDefSerializer(body), + }); +} + +export async function _batchCreateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasTypesDefDeserializer(result.body); +} + +/** Create all atlas type definitions in bulk. Please avoid recreating existing types. */ +export async function batchCreate( + context: Client, + body: AtlasTypesDef, + options: TypeDefinitionBatchCreateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _batchCreateSend(context, body, options); + return _batchCreateDeserialize(result); +} + +export function _getSend( + context: Client, + options: TypeDefinitionGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/typedefs{?api%2Dversion,includeTermTemplate,type}", + { + "api%2Dversion": context.apiVersion, + includeTermTemplate: options?.includeTermTemplate, + type: options?.typeParam, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasTypesDefDeserializer(result.body); +} + +/** List all type definitions in bulk. */ +export async function get( + context: Client, + options: TypeDefinitionGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, options); + return _getDeserialize(result); +} + +export function _$deleteSend( + context: Client, + name: string, + options: TypeDefinitionDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/typedef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete API for type identified by its name. */ +/** + * @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, + name: string, + options: TypeDefinitionDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _$deleteSend(context, name, options); + return _$deleteDeserialize(result); +} + +export function _getByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetByNameOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/typedef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasTypeDefDeserializer(result.body); +} + +/** Get the type definition by its name (unique). */ +export async function getByName( + context: Client, + name: string, + options: TypeDefinitionGetByNameOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByNameSend(context, name, options); + return _getByNameDeserialize(result); +} + +export function _getByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/typedef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasTypeDefDeserializer(result.body); +} + +/** Get the type definition for the given GUID. */ +export async function getById( + context: Client, + guid: string, + options: TypeDefinitionGetByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getByIdSend(context, guid, options); + return _getByIdDeserialize(result); +} + +export function _getStructByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetStructByNameOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/structdef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getStructByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasStructDefDeserializer(result.body); +} + +/** Get the struct definition by its name (unique). */ +export async function getStructByName( + context: Client, + name: string, + options: TypeDefinitionGetStructByNameOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getStructByNameSend(context, name, options); + return _getStructByNameDeserialize(result); +} + +export function _getStructByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetStructByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/structdef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getStructByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasStructDefDeserializer(result.body); +} + +/** Get the struct definition for the given GUID. */ +export async function getStructById( + context: Client, + guid: string, + options: TypeDefinitionGetStructByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getStructByIdSend(context, guid, options); + return _getStructByIdDeserialize(result); +} + +export function _getRelationshipByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetRelationshipByNameOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/relationshipdef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getRelationshipByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelationshipDefDeserializer(result.body); +} + +/** Get the relationship definition by its name (unique). */ +export async function getRelationshipByName( + context: Client, + name: string, + options: TypeDefinitionGetRelationshipByNameOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getRelationshipByNameSend(context, name, options); + return _getRelationshipByNameDeserialize(result); +} + +export function _getRelationshipByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetRelationshipByIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/relationshipdef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getRelationshipByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasRelationshipDefDeserializer(result.body); +} + +/** Get the relationship definition for the given GUID. */ +export async function getRelationshipById( + context: Client, + guid: string, + options: TypeDefinitionGetRelationshipByIdOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getRelationshipByIdSend(context, guid, options); + return _getRelationshipByIdDeserialize(result); +} + +export function _getEnumByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetEnumByNameOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/enumdef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getEnumByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEnumDefDeserializer(result.body); +} + +/** Get the enum definition by its name (unique). */ +export async function getEnumByName( + context: Client, + name: string, + options: TypeDefinitionGetEnumByNameOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getEnumByNameSend(context, name, options); + return _getEnumByNameDeserialize(result); +} + +export function _getEnumByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetEnumByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/enumdef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getEnumByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEnumDefDeserializer(result.body); +} + +/** Get the enum definition for the given GUID. */ +export async function getEnumById( + context: Client, + guid: string, + options: TypeDefinitionGetEnumByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getEnumByIdSend(context, guid, options); + return _getEnumByIdDeserialize(result); +} + +export function _getEntityByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetEntityByNameOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/entitydef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getEntityByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntityDefDeserializer(result.body); +} + +/** Get the entity definition by its name (unique). */ +export async function getEntityByName( + context: Client, + name: string, + options: TypeDefinitionGetEntityByNameOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getEntityByNameSend(context, name, options); + return _getEntityByNameDeserialize(result); +} + +export function _getEntityByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetEntityByIdOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/entitydef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getEntityByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasEntityDefDeserializer(result.body); +} + +/** Get the Entity definition for the given GUID. */ +export async function getEntityById( + context: Client, + guid: string, + options: TypeDefinitionGetEntityByIdOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getEntityByIdSend(context, guid, options); + return _getEntityByIdDeserialize(result); +} + +export function _getClassificationByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetClassificationByNameOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/classificationdef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getClassificationByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasClassificationDefDeserializer(result.body); +} + +/** Get the classification definition by its name (unique). */ +export async function getClassificationByName( + context: Client, + name: string, + options: TypeDefinitionGetClassificationByNameOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getClassificationByNameSend(context, name, options); + return _getClassificationByNameDeserialize(result); +} + +export function _getClassificationByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetClassificationByIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/classificationdef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getClassificationByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasClassificationDefDeserializer(result.body); +} + +/** Get the classification definition for the given GUID. */ +export async function getClassificationById( + context: Client, + guid: string, + options: TypeDefinitionGetClassificationByIdOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getClassificationByIdSend(context, guid, options); + return _getClassificationByIdDeserialize(result); +} + +export function _getBusinessMetadataByNameSend( + context: Client, + name: string, + options: TypeDefinitionGetBusinessMetadataByNameOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/businessmetadatadef/name/{name}", + { + name: name, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getBusinessMetadataByNameDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasBusinessMetadataDefDeserializer(result.body); +} + +/** Get the businessMetadata definition by it's name (unique). */ +export async function getBusinessMetadataByName( + context: Client, + name: string, + options: TypeDefinitionGetBusinessMetadataByNameOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getBusinessMetadataByNameSend(context, name, options); + return _getBusinessMetadataByNameDeserialize(result); +} + +export function _getBusinessMetadataByIdSend( + context: Client, + guid: string, + options: TypeDefinitionGetBusinessMetadataByIdOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/atlas/v2/types/businessmetadatadef/guid/{guid}", + { + guid: guid, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getBusinessMetadataByIdDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = atlasErrorResponseDeserializer(result.body); + throw error; + } + + return atlasBusinessMetadataDefDeserializer(result.body); +} + +/** Get the businessMetadata definition for the given guid. */ +export async function getBusinessMetadataById( + context: Client, + guid: string, + options: TypeDefinitionGetBusinessMetadataByIdOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getBusinessMetadataByIdSend(context, guid, options); + return _getBusinessMetadataByIdDeserialize(result); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts new file mode 100644 index 0000000000..a5bfcefebc --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { TypeCategory } from "../../models/models.js"; +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface TypeDefinitionGetTermTemplateByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetTermTemplateByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetHeadersOptionalParams + extends OperationOptions { + /** + * Whether include termtemplatedef when return all typedefs. + * This is always true + * when search filter type=term_template + */ + includeTermTemplate?: boolean; + /** Typedef name as search filter when get typedefs. */ + typeParam?: TypeCategory; +} + +/** Optional parameters. */ +export interface TypeDefinitionBatchDeleteOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionBatchUpdateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionBatchCreateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetOptionalParams extends OperationOptions { + /** + * Whether include termtemplatedef when return all typedefs. + * This is always true + * when search filter type=term_template + */ + includeTermTemplate?: boolean; + /** Typedef name as search filter when get typedefs. */ + typeParam?: TypeCategory; +} + +/** Optional parameters. */ +export interface TypeDefinitionDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetByIdOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetStructByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetStructByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetRelationshipByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetRelationshipByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetEnumByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetEnumByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetEntityByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetEntityByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetClassificationByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetClassificationByIdOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetBusinessMetadataByNameOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TypeDefinitionGetBusinessMetadataByIdOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts new file mode 100644 index 0000000000..1980880c4d --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext } from "../../api/dataMapContext.js"; +import { + autoComplete, + suggest, + query, +} from "../../api/discovery/operations.js"; +import { + DiscoveryAutoCompleteOptionalParams, + DiscoverySuggestOptionalParams, + DiscoveryQueryOptionalParams, +} from "../../api/discovery/options.js"; +import { + QueryOptions, + QueryResult, + SuggestOptions, + SuggestResult, + AutoCompleteOptions, + AutoCompleteResult, +} from "../../models/models.js"; + +/** Interface representing a Discovery operations. */ +export interface DiscoveryOperations { + /** Get auto complete options. */ + autoComplete: ( + body: AutoCompleteOptions, + options?: DiscoveryAutoCompleteOptionalParams, + ) => Promise; + /** Get search suggestions by query criteria. */ + suggest: ( + body: SuggestOptions, + options?: DiscoverySuggestOptionalParams, + ) => Promise; + /** Get data using search. */ + query: ( + body: QueryOptions, + options?: DiscoveryQueryOptionalParams, + ) => Promise; +} + +function _getDiscovery(context: DataMapContext) { + return { + autoComplete: ( + body: AutoCompleteOptions, + options?: DiscoveryAutoCompleteOptionalParams, + ) => autoComplete(context, body, options), + suggest: (body: SuggestOptions, options?: DiscoverySuggestOptionalParams) => + suggest(context, body, options), + query: (body: QueryOptions, options?: DiscoveryQueryOptionalParams) => + query(context, body, options), + }; +} + +export function _getDiscoveryOperations( + context: DataMapContext, +): DiscoveryOperations { + return { + ..._getDiscovery(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts new file mode 100644 index 0000000000..e401cc9e45 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts @@ -0,0 +1,604 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext } from "../../api/dataMapContext.js"; +import { + moveEntitiesToCollection, + addLabelsByUniqueAttribute, + setLabelsByUniqueAttribute, + removeLabelsByUniqueAttribute, + addLabel, + setLabels, + removeLabels, + importBusinessMetadata, + getBusinessMetadataTemplate, + addOrUpdateBusinessMetadataAttributes, + removeBusinessMetadataAttributes, + addOrUpdateBusinessMetadata, + removeBusinessMetadata, + getHeader, + batchGetByUniqueAttributes, + batchSetClassifications, + updateClassificationsUniqueByAttribute, + addClassificationsByUniqueAttribute, + removeClassificationByUniqueAttribute, + deleteByUniqueAttribute, + updateByUniqueAttribute, + getByUniqueAttribute, + updateClassifications, + addClassifications, + getClassifications, + removeClassification, + getClassification, + $delete, + updateAttributeById, + get, + addClassification, + batchDelete, + batchCreateOrUpdate, + getByIds, + createOrUpdate, +} from "../../api/entity/operations.js"; +import { + EntityMoveEntitiesToCollectionOptionalParams, + EntityAddLabelsByUniqueAttributeOptionalParams, + EntitySetLabelsByUniqueAttributeOptionalParams, + EntityRemoveLabelsByUniqueAttributeOptionalParams, + EntityAddLabelOptionalParams, + EntitySetLabelsOptionalParams, + EntityRemoveLabelsOptionalParams, + EntityImportBusinessMetadataOptionalParams, + EntityGetBusinessMetadataTemplateOptionalParams, + EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, + EntityRemoveBusinessMetadataAttributesOptionalParams, + EntityAddOrUpdateBusinessMetadataOptionalParams, + EntityRemoveBusinessMetadataOptionalParams, + EntityGetHeaderOptionalParams, + EntityBatchGetByUniqueAttributesOptionalParams, + EntityBatchSetClassificationsOptionalParams, + EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityAddClassificationsByUniqueAttributeOptionalParams, + EntityRemoveClassificationByUniqueAttributeOptionalParams, + EntityDeleteByUniqueAttributeOptionalParams, + EntityUpdateByUniqueAttributeOptionalParams, + EntityGetByUniqueAttributeOptionalParams, + EntityUpdateClassificationsOptionalParams, + EntityAddClassificationsOptionalParams, + EntityGetClassificationsOptionalParams, + EntityRemoveClassificationOptionalParams, + EntityGetClassificationOptionalParams, + EntityDeleteOptionalParams, + EntityUpdateAttributeByIdOptionalParams, + EntityGetOptionalParams, + EntityAddClassificationOptionalParams, + EntityBatchDeleteOptionalParams, + EntityBatchCreateOrUpdateOptionalParams, + EntityGetByIdsOptionalParams, + EntityCreateOrUpdateOptionalParams, +} from "../../api/entity/options.js"; +import { + AtlasEntityWithExtInfo, + AtlasClassification, + EntityMutationResult, + AtlasEntityHeader, + AtlasEntitiesWithExtInfo, + ClassificationAssociateOptions, + AtlasClassifications, + AtlasEntityHeaders, + BusinessMetadataOptions, + BulkImportResult, + MoveEntitiesOptions, +} from "../../models/models.js"; + +/** Interface representing a Entity operations. */ +export interface EntityOperations { + /** Move existing entities to the target collection. */ + moveEntitiesToCollection: ( + collectionId: string, + body: MoveEntitiesOptions, + options?: EntityMoveEntitiesToCollectionOptionalParams, + ) => Promise; + /** + * Add given labels to a given entity identified by its type and unique + * attributes. + * + * If labels is null/empty, no labels will be added. + * + * In addition to + * the typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: attr:=. + * + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: PUT + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + addLabelsByUniqueAttribute: ( + typeName: string, + options?: EntityAddLabelsByUniqueAttributeOptionalParams, + ) => Promise; + /** + * Set labels to a given entity identified by its type and unique attributes. + * + * If + * labels is null/empty, existing labels will all be removed. + * + * In addition to the + * typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: attr:=. + * + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: POST + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + setLabelsByUniqueAttribute: ( + typeName: string, + options?: EntitySetLabelsByUniqueAttributeOptionalParams, + ) => Promise; + /** + * Delete given labels to a given entity identified by its type and unique + * attribute. + * + * If labels is null/empty, no labels will be removed. + * + * If any labels + * in labels set are non-existing labels, they will be ignored, only existing + * labels will be removed. In addition to the typeName path parameter, attribute + * key-value pair(s) can be provided in the following format: + * attr:=. NOTE: The attrName and attrValue should be unique + * across entities, eg. qualifiedName. The REST request would look something like + * this: DELETE + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + removeLabelsByUniqueAttribute: ( + typeName: string, + options?: EntityRemoveLabelsByUniqueAttributeOptionalParams, + ) => Promise; + /** Add given labels to a given entity. */ + addLabel: ( + guid: string, + options?: EntityAddLabelOptionalParams, + ) => Promise; + /** Set labels to a given entity. */ + setLabels: ( + guid: string, + options?: EntitySetLabelsOptionalParams, + ) => Promise; + /** Delete given labels to a given entity. */ + removeLabels: ( + guid: string, + options?: EntityRemoveLabelsOptionalParams, + ) => Promise; + /** Upload the file for creating Business Metadata in BULK */ + importBusinessMetadata: ( + body: BusinessMetadataOptions, + options?: EntityImportBusinessMetadataOptionalParams, + ) => Promise; + /** Get the sample Template for uploading/creating bulk BusinessMetaData */ + getBusinessMetadataTemplate: ( + options?: EntityGetBusinessMetadataTemplateOptionalParams, + ) => Promise; + /** Add or update business metadata attributes. */ + addOrUpdateBusinessMetadataAttributes: ( + businessMetadataName: string, + guid: string, + body: Record, + options?: EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, + ) => Promise; + /** Delete business metadata attributes from an entity. */ + removeBusinessMetadataAttributes: ( + businessMetadataName: string, + guid: string, + body: Record, + options?: EntityRemoveBusinessMetadataAttributesOptionalParams, + ) => Promise; + /** Add business metadata to an entity. */ + addOrUpdateBusinessMetadata: ( + guid: string, + body: Record>, + options?: EntityAddOrUpdateBusinessMetadataOptionalParams, + ) => Promise; + /** Remove business metadata from an entity. */ + removeBusinessMetadata: ( + guid: string, + body: Record>, + options?: EntityRemoveBusinessMetadataOptionalParams, + ) => Promise; + /** Get entity header given its GUID. */ + getHeader: ( + guid: string, + options?: EntityGetHeaderOptionalParams, + ) => Promise; + /** + * Bulk API to retrieve list of entities identified by its unique attributes. + * In + * addition to the typeName path parameter, attribute key-value pair(s) can be + * provided in the following + * format + * + * typeName=\&attr_1:\=\&attr_2:\=\&attr_3:\=\ + * + * NOTE: + * The attrName should be an unique attribute for the given entity-type. + * The REST + * request would look something like this + * + * GET + * /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_1:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 + * + * Note: + * at least one unique attribute must be provided. + */ + batchGetByUniqueAttributes: ( + typeName: string, + options?: EntityBatchGetByUniqueAttributesOptionalParams, + ) => Promise; + /** Set classifications on entities in bulk. */ + batchSetClassifications: ( + body: AtlasEntityHeaders, + options?: EntityBatchSetClassificationsOptionalParams, + ) => Promise; + /** Update classification on an entity identified by its type and unique attributes. */ + updateClassificationsUniqueByAttribute: ( + typeName: string, + body: AtlasClassification[], + options?: EntityUpdateClassificationsUniqueByAttributeOptionalParams, + ) => Promise; + /** Add classification to the entity identified by its type and unique attributes. */ + addClassificationsByUniqueAttribute: ( + typeName: string, + body: AtlasClassification[], + options?: EntityAddClassificationsByUniqueAttributeOptionalParams, + ) => Promise; + /** + * Delete a given classification from an entity identified by its type and unique + * attributes. + */ + removeClassificationByUniqueAttribute: ( + typeName: string, + classificationName: string, + options?: EntityRemoveClassificationByUniqueAttributeOptionalParams, + ) => Promise; + /** + * Delete an entity identified by its type and unique attributes. + * In addition to + * the typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: + * attr:\=\. + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: + * DELETE + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + deleteByUniqueAttribute: ( + typeName: string, + options?: EntityDeleteByUniqueAttributeOptionalParams, + ) => Promise; + /** + * Update entity partially - Allow a subset of attributes to be updated on an + * entity which is identified by its type and unique attribute eg: + * Referenceable.qualifiedName. Null updates are not possible. + * + * In addition to the + * typeName path parameter, attribute key-value pair(s) can be provided in the + * following format: + * + * attr:=. + * NOTE: The attrName and + * attrValue should be unique across entities, eg. qualifiedName. + * + * The REST + * request would look something like this: + * PUT + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + updateByUniqueAttribute: ( + typeName: string, + body: AtlasEntityWithExtInfo, + options?: EntityUpdateByUniqueAttributeOptionalParams, + ) => Promise; + /** + * Get complete definition of an entity given its type and unique attribute. + * + * In + * addition to the typeName path parameter, attribute key-value pair(s) can be + * provided in the following format: + * attr:\=. + * + * NOTE: The + * attrName and attrValue should be unique across entities, eg. + * qualifiedName. + * + * The REST request would look something like this: + * GET + * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + getByUniqueAttribute: ( + typeName: string, + options?: EntityGetByUniqueAttributeOptionalParams, + ) => Promise; + /** Update classifications to an existing entity represented by a guid. */ + updateClassifications: ( + guid: string, + body: AtlasClassification[], + options?: EntityUpdateClassificationsOptionalParams, + ) => Promise; + /** Add classifications to an existing entity represented by a GUID. */ + addClassifications: ( + guid: string, + body: AtlasClassification[], + options?: EntityAddClassificationsOptionalParams, + ) => Promise; + /** List classifications for a given entity represented by a GUID. */ + getClassifications: ( + guid: string, + options?: EntityGetClassificationsOptionalParams, + ) => Promise; + /** Delete a given classification from an existing entity represented by a GUID. */ + removeClassification: ( + guid: string, + classificationName: string, + options?: EntityRemoveClassificationOptionalParams, + ) => Promise; + /** Get classification for a given entity represented by a GUID. */ + getClassification: ( + guid: string, + classificationName: string, + options?: EntityGetClassificationOptionalParams, + ) => Promise; + /** Delete an entity identified by its GUID. */ + /** + * @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: ( + guid: string, + options?: EntityDeleteOptionalParams, + ) => Promise; + /** + * Update entity partially - create or update entity attribute identified by its + * GUID. + * Supports only primitive attribute type and entity references. + * It does not support updating complex types like arrays, and maps. + * Null updates are not possible. + */ + updateAttributeById: ( + guid: string, + name: string, + body: any, + options?: EntityUpdateAttributeByIdOptionalParams, + ) => Promise; + /** Get complete definition of an entity given its GUID. */ + get: ( + guid: string, + options?: EntityGetOptionalParams, + ) => Promise; + /** Associate a classification to multiple entities in bulk. */ + addClassification: ( + body: ClassificationAssociateOptions, + options?: EntityAddClassificationOptionalParams, + ) => Promise; + /** + * Delete a list of entities in bulk identified by their GUIDs or unique + * attributes. + */ + batchDelete: ( + guid: string[], + options?: EntityBatchDeleteOptionalParams, + ) => Promise; + /** + * Create or update entities in bulk. + * Existing entity is matched using its unique + * guid if supplied or by its unique attributes eg: qualifiedName. + * Map and array + * of collections are not well supported. E.g., array>, + * array>. + * For each contact type, the maximum number of contacts + * is 20. + */ + batchCreateOrUpdate: ( + body: AtlasEntitiesWithExtInfo, + options?: EntityBatchCreateOrUpdateOptionalParams, + ) => Promise; + /** List entities in bulk identified by its GUIDs. */ + getByIds: ( + guid: string[], + options?: EntityGetByIdsOptionalParams, + ) => Promise; + /** + * Create or update an entity. + * Existing entity is matched using its unique guid if + * supplied or by its unique attributes eg: qualifiedName. + * Map and array of + * collections are not well supported. E.g., array>, array>. + * For each contact type, the maximum number of contacts is 20. + */ + createOrUpdate: ( + body: AtlasEntityWithExtInfo, + options?: EntityCreateOrUpdateOptionalParams, + ) => Promise; +} + +function _getEntity(context: DataMapContext) { + return { + moveEntitiesToCollection: ( + collectionId: string, + body: MoveEntitiesOptions, + options?: EntityMoveEntitiesToCollectionOptionalParams, + ) => moveEntitiesToCollection(context, collectionId, body, options), + addLabelsByUniqueAttribute: ( + typeName: string, + options?: EntityAddLabelsByUniqueAttributeOptionalParams, + ) => addLabelsByUniqueAttribute(context, typeName, options), + setLabelsByUniqueAttribute: ( + typeName: string, + options?: EntitySetLabelsByUniqueAttributeOptionalParams, + ) => setLabelsByUniqueAttribute(context, typeName, options), + removeLabelsByUniqueAttribute: ( + typeName: string, + options?: EntityRemoveLabelsByUniqueAttributeOptionalParams, + ) => removeLabelsByUniqueAttribute(context, typeName, options), + addLabel: (guid: string, options?: EntityAddLabelOptionalParams) => + addLabel(context, guid, options), + setLabels: (guid: string, options?: EntitySetLabelsOptionalParams) => + setLabels(context, guid, options), + removeLabels: (guid: string, options?: EntityRemoveLabelsOptionalParams) => + removeLabels(context, guid, options), + importBusinessMetadata: ( + body: BusinessMetadataOptions, + options?: EntityImportBusinessMetadataOptionalParams, + ) => importBusinessMetadata(context, body, options), + getBusinessMetadataTemplate: ( + options?: EntityGetBusinessMetadataTemplateOptionalParams, + ) => getBusinessMetadataTemplate(context, options), + addOrUpdateBusinessMetadataAttributes: ( + businessMetadataName: string, + guid: string, + body: Record, + options?: EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, + ) => + addOrUpdateBusinessMetadataAttributes( + context, + businessMetadataName, + guid, + body, + options, + ), + removeBusinessMetadataAttributes: ( + businessMetadataName: string, + guid: string, + body: Record, + options?: EntityRemoveBusinessMetadataAttributesOptionalParams, + ) => + removeBusinessMetadataAttributes( + context, + businessMetadataName, + guid, + body, + options, + ), + addOrUpdateBusinessMetadata: ( + guid: string, + body: Record>, + options?: EntityAddOrUpdateBusinessMetadataOptionalParams, + ) => addOrUpdateBusinessMetadata(context, guid, body, options), + removeBusinessMetadata: ( + guid: string, + body: Record>, + options?: EntityRemoveBusinessMetadataOptionalParams, + ) => removeBusinessMetadata(context, guid, body, options), + getHeader: (guid: string, options?: EntityGetHeaderOptionalParams) => + getHeader(context, guid, options), + batchGetByUniqueAttributes: ( + typeName: string, + options?: EntityBatchGetByUniqueAttributesOptionalParams, + ) => batchGetByUniqueAttributes(context, typeName, options), + batchSetClassifications: ( + body: AtlasEntityHeaders, + options?: EntityBatchSetClassificationsOptionalParams, + ) => batchSetClassifications(context, body, options), + updateClassificationsUniqueByAttribute: ( + typeName: string, + body: AtlasClassification[], + options?: EntityUpdateClassificationsUniqueByAttributeOptionalParams, + ) => + updateClassificationsUniqueByAttribute(context, typeName, body, options), + addClassificationsByUniqueAttribute: ( + typeName: string, + body: AtlasClassification[], + options?: EntityAddClassificationsByUniqueAttributeOptionalParams, + ) => addClassificationsByUniqueAttribute(context, typeName, body, options), + removeClassificationByUniqueAttribute: ( + typeName: string, + classificationName: string, + options?: EntityRemoveClassificationByUniqueAttributeOptionalParams, + ) => + removeClassificationByUniqueAttribute( + context, + typeName, + classificationName, + options, + ), + deleteByUniqueAttribute: ( + typeName: string, + options?: EntityDeleteByUniqueAttributeOptionalParams, + ) => deleteByUniqueAttribute(context, typeName, options), + updateByUniqueAttribute: ( + typeName: string, + body: AtlasEntityWithExtInfo, + options?: EntityUpdateByUniqueAttributeOptionalParams, + ) => updateByUniqueAttribute(context, typeName, body, options), + getByUniqueAttribute: ( + typeName: string, + options?: EntityGetByUniqueAttributeOptionalParams, + ) => getByUniqueAttribute(context, typeName, options), + updateClassifications: ( + guid: string, + body: AtlasClassification[], + options?: EntityUpdateClassificationsOptionalParams, + ) => updateClassifications(context, guid, body, options), + addClassifications: ( + guid: string, + body: AtlasClassification[], + options?: EntityAddClassificationsOptionalParams, + ) => addClassifications(context, guid, body, options), + getClassifications: ( + guid: string, + options?: EntityGetClassificationsOptionalParams, + ) => getClassifications(context, guid, options), + removeClassification: ( + guid: string, + classificationName: string, + options?: EntityRemoveClassificationOptionalParams, + ) => removeClassification(context, guid, classificationName, options), + getClassification: ( + guid: string, + classificationName: string, + options?: EntityGetClassificationOptionalParams, + ) => getClassification(context, guid, classificationName, options), + delete: (guid: string, options?: EntityDeleteOptionalParams) => + $delete(context, guid, options), + updateAttributeById: ( + guid: string, + name: string, + body: any, + options?: EntityUpdateAttributeByIdOptionalParams, + ) => updateAttributeById(context, guid, name, body, options), + get: (guid: string, options?: EntityGetOptionalParams) => + get(context, guid, options), + addClassification: ( + body: ClassificationAssociateOptions, + options?: EntityAddClassificationOptionalParams, + ) => addClassification(context, body, options), + batchDelete: (guid: string[], options?: EntityBatchDeleteOptionalParams) => + batchDelete(context, guid, options), + batchCreateOrUpdate: ( + body: AtlasEntitiesWithExtInfo, + options?: EntityBatchCreateOrUpdateOptionalParams, + ) => batchCreateOrUpdate(context, body, options), + getByIds: (guid: string[], options?: EntityGetByIdsOptionalParams) => + getByIds(context, guid, options), + createOrUpdate: ( + body: AtlasEntityWithExtInfo, + options?: EntityCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, body, options), + }; +} + +export function _getEntityOperations( + context: DataMapContext, +): EntityOperations { + return { + ..._getEntity(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts new file mode 100644 index 0000000000..12edbd917a --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext } from "../../api/dataMapContext.js"; +import { + getTermHeaders, + getTerms, + partialUpdate, + getDetailed, + getCategoriesHeaders, + getCategories, + $delete, + update, + get, + getRelatedTerms, + deleteTermAssignmentFromEntities, + assignTermToEntities, + getEntitiesAssignedWithTerm, + createTerms, + partialUpdateTerm, + deleteTerm, + updateTerm, + getTerm, + createTerm, + getCategoryTerms, + getRelatedCategories, + partialUpdateCategory, + deleteCategory, + updateCategory, + getCategory, + createCategory, + createCategories, + create, + batchGet, +} from "../../api/glossary/operations.js"; +import { + GlossaryGetTermHeadersOptionalParams, + GlossaryGetTermsOptionalParams, + GlossaryPartialUpdateOptionalParams, + GlossaryGetDetailedOptionalParams, + GlossaryGetCategoriesHeadersOptionalParams, + GlossaryGetCategoriesOptionalParams, + GlossaryDeleteOptionalParams, + GlossaryUpdateOptionalParams, + GlossaryGetOptionalParams, + GlossaryGetRelatedTermsOptionalParams, + GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, + GlossaryAssignTermToEntitiesOptionalParams, + GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryCreateTermsOptionalParams, + GlossaryPartialUpdateTermOptionalParams, + GlossaryDeleteTermOptionalParams, + GlossaryUpdateTermOptionalParams, + GlossaryGetTermOptionalParams, + GlossaryCreateTermOptionalParams, + GlossaryGetCategoryTermsOptionalParams, + GlossaryGetRelatedCategoriesOptionalParams, + GlossaryPartialUpdateCategoryOptionalParams, + GlossaryDeleteCategoryOptionalParams, + GlossaryUpdateCategoryOptionalParams, + GlossaryGetCategoryOptionalParams, + GlossaryCreateCategoryOptionalParams, + GlossaryCreateCategoriesOptionalParams, + GlossaryCreateOptionalParams, + GlossaryBatchGetOptionalParams, +} from "../../api/glossary/options.js"; +import { + AtlasGlossary, + AtlasRelatedCategoryHeader, + AtlasRelatedTermHeader, + AtlasGlossaryCategory, + AtlasGlossaryTerm, + AtlasRelatedObjectId, + AtlasGlossaryExtInfo, +} from "../../models/models.js"; + +/** Interface representing a Glossary operations. */ +export interface GlossaryOperations { + /** + * Get term headers belonging to a specific glossary. Recommend using limit/offset + * to get pagination result. + */ + getTermHeaders: ( + glossaryId: string, + options?: GlossaryGetTermHeadersOptionalParams, + ) => Promise; + /** + * Get terms belonging to a specific glossary. Recommend using limit/offset to get + * pagination result. + */ + getTerms: ( + glossaryId: string, + options?: GlossaryGetTermsOptionalParams, + ) => Promise; + /** + * Update the glossary partially. Some properties such as qualifiedName are not + * allowed to be updated. + * + * So far we only supports partial updating + * shortDescription, longDescription, language and usage for glossary. + * + * Recommend + * using 'ignoreTermsAndCategories=true' to reduce response body size. + */ + partialUpdate: ( + glossaryId: string, + body: Record, + options?: GlossaryPartialUpdateOptionalParams, + ) => Promise; + /** + * Get a specific glossary with detailed information. This API is not + * recommend. + * + * Recommend to fetch terms/categories details separately using + * + * GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms and + * + * GET /datamap/api/atlas/v2/glossary/{glossaryId}/categories. + */ + getDetailed: ( + glossaryId: string, + options?: GlossaryGetDetailedOptionalParams, + ) => Promise; + /** + * Get the category headers belonging to a specific glossary. Recommend using + * limit/offset to get pagination result. + */ + getCategoriesHeaders: ( + glossaryId: string, + options?: GlossaryGetCategoriesHeadersOptionalParams, + ) => Promise; + /** + * Get the categories belonging to a specific glossary. Recommend using + * limit/offset to get pagination result. + */ + getCategories: ( + glossaryId: string, + options?: GlossaryGetCategoriesOptionalParams, + ) => Promise; + /** + * Delete a glossary. Will delete underlying terms/categories together. Recommend + * separate delete terms and categories. + */ + /** + * @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: ( + glossaryId: string, + options?: GlossaryDeleteOptionalParams, + ) => Promise; + /** Update the given glossary. */ + update: ( + glossaryId: string, + body: AtlasGlossary, + options?: GlossaryUpdateOptionalParams, + ) => Promise; + /** Get a specific Glossary by its GUID. */ + get: ( + glossaryId: string, + options?: GlossaryGetOptionalParams, + ) => Promise; + /** + * Get all related terms for a specific term by its GUID. Limit, offset, and sort + * parameters are currently not being enabled and won't work even they are passed. + */ + getRelatedTerms: ( + termId: string, + options?: GlossaryGetRelatedTermsOptionalParams, + ) => Promise>; + /** Delete the term assignment for the given list of related objects. */ + deleteTermAssignmentFromEntities: ( + termId: string, + body: AtlasRelatedObjectId[], + options?: GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, + ) => Promise; + /** + * Assign the given term to the provided list of related objects. Recommend using + * small batches with multiple API calls. + * + * [Entities Create Or Update + * operation](https://learn.microsoft.com/en-us/rest/api/purview/datamapdataplane/entity/bulk-create-or-update?tabs=HTTP) + * is an alternative to assign a term to multiple entities. + */ + assignTermToEntities: ( + termId: string, + body: AtlasRelatedObjectId[], + options?: GlossaryAssignTermToEntitiesOptionalParams, + ) => Promise; + /** + * List all related objects assigned with the specified term. Recommend using + * limit/offset to get pagination result. + */ + getEntitiesAssignedWithTerm: ( + termId: string, + options?: GlossaryGetEntitiesAssignedWithTermOptionalParams, + ) => Promise; + /** Create glossary terms in bulk. */ + createTerms: ( + body: AtlasGlossaryTerm[], + options?: GlossaryCreateTermsOptionalParams, + ) => Promise; + /** + * Update the glossary term partially. So far we only supports partial updating + * shortDescription, longDescription, abbreviation, usage and status for term. + */ + partialUpdateTerm: ( + termId: string, + body: Record, + options?: GlossaryPartialUpdateTermOptionalParams, + ) => Promise; + /** Delete a glossary term. */ + deleteTerm: ( + termId: string, + options?: GlossaryDeleteTermOptionalParams, + ) => Promise; + /** Update the given glossary term by its GUID. */ + updateTerm: ( + termId: string, + body: AtlasGlossaryTerm, + options?: GlossaryUpdateTermOptionalParams, + ) => Promise; + /** Get a specific glossary term by its GUID. */ + getTerm: ( + termId: string, + options?: GlossaryGetTermOptionalParams, + ) => Promise; + /** Create a glossary term. */ + createTerm: ( + body: AtlasGlossaryTerm, + options?: GlossaryCreateTermOptionalParams, + ) => Promise; + /** Get all terms associated with the specific category. */ + getCategoryTerms: ( + categoryId: string, + options?: GlossaryGetCategoryTermsOptionalParams, + ) => Promise; + /** + * Get all related categories (parent and children). Limit, offset, and sort + * parameters are currently not being enabled and won't work even they are passed. + */ + getRelatedCategories: ( + categoryId: string, + options?: GlossaryGetRelatedCategoriesOptionalParams, + ) => Promise>; + /** + * Update the glossary category partially. So far we only supports partial + * updating shortDescription and longDescription for category. + */ + partialUpdateCategory: ( + categoryId: string, + body: Record, + options?: GlossaryPartialUpdateCategoryOptionalParams, + ) => Promise; + /** Delete a glossary category. */ + deleteCategory: ( + categoryId: string, + options?: GlossaryDeleteCategoryOptionalParams, + ) => Promise; + /** Update the given glossary category by its GUID. */ + updateCategory: ( + categoryId: string, + body: AtlasGlossaryCategory, + options?: GlossaryUpdateCategoryOptionalParams, + ) => Promise; + /** Get specific glossary category by its GUID. */ + getCategory: ( + categoryId: string, + options?: GlossaryGetCategoryOptionalParams, + ) => Promise; + /** Create a glossary category. */ + createCategory: ( + body: AtlasGlossaryCategory, + options?: GlossaryCreateCategoryOptionalParams, + ) => Promise; + /** Create glossary category in bulk. */ + createCategories: ( + body: AtlasGlossaryCategory[], + options?: GlossaryCreateCategoriesOptionalParams, + ) => Promise; + /** Create a glossary. */ + create: ( + body: AtlasGlossary, + options?: GlossaryCreateOptionalParams, + ) => Promise; + /** + * Get all glossaries. Recommend using limit/offset to get pagination result. + * Recommend using 'ignoreTermsAndCategories=true' and fetch terms/categories + * separately using 'GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms' + * and 'GET '/datamap/api/atlas/v2/glossary/{glossaryId}/categories'. + */ + batchGet: ( + options?: GlossaryBatchGetOptionalParams, + ) => Promise; +} + +function _getGlossary(context: DataMapContext) { + return { + getTermHeaders: ( + glossaryId: string, + options?: GlossaryGetTermHeadersOptionalParams, + ) => getTermHeaders(context, glossaryId, options), + getTerms: (glossaryId: string, options?: GlossaryGetTermsOptionalParams) => + getTerms(context, glossaryId, options), + partialUpdate: ( + glossaryId: string, + body: Record, + options?: GlossaryPartialUpdateOptionalParams, + ) => partialUpdate(context, glossaryId, body, options), + getDetailed: ( + glossaryId: string, + options?: GlossaryGetDetailedOptionalParams, + ) => getDetailed(context, glossaryId, options), + getCategoriesHeaders: ( + glossaryId: string, + options?: GlossaryGetCategoriesHeadersOptionalParams, + ) => getCategoriesHeaders(context, glossaryId, options), + getCategories: ( + glossaryId: string, + options?: GlossaryGetCategoriesOptionalParams, + ) => getCategories(context, glossaryId, options), + delete: (glossaryId: string, options?: GlossaryDeleteOptionalParams) => + $delete(context, glossaryId, options), + update: ( + glossaryId: string, + body: AtlasGlossary, + options?: GlossaryUpdateOptionalParams, + ) => update(context, glossaryId, body, options), + get: (glossaryId: string, options?: GlossaryGetOptionalParams) => + get(context, glossaryId, options), + getRelatedTerms: ( + termId: string, + options?: GlossaryGetRelatedTermsOptionalParams, + ) => getRelatedTerms(context, termId, options), + deleteTermAssignmentFromEntities: ( + termId: string, + body: AtlasRelatedObjectId[], + options?: GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, + ) => deleteTermAssignmentFromEntities(context, termId, body, options), + assignTermToEntities: ( + termId: string, + body: AtlasRelatedObjectId[], + options?: GlossaryAssignTermToEntitiesOptionalParams, + ) => assignTermToEntities(context, termId, body, options), + getEntitiesAssignedWithTerm: ( + termId: string, + options?: GlossaryGetEntitiesAssignedWithTermOptionalParams, + ) => getEntitiesAssignedWithTerm(context, termId, options), + createTerms: ( + body: AtlasGlossaryTerm[], + options?: GlossaryCreateTermsOptionalParams, + ) => createTerms(context, body, options), + partialUpdateTerm: ( + termId: string, + body: Record, + options?: GlossaryPartialUpdateTermOptionalParams, + ) => partialUpdateTerm(context, termId, body, options), + deleteTerm: (termId: string, options?: GlossaryDeleteTermOptionalParams) => + deleteTerm(context, termId, options), + updateTerm: ( + termId: string, + body: AtlasGlossaryTerm, + options?: GlossaryUpdateTermOptionalParams, + ) => updateTerm(context, termId, body, options), + getTerm: (termId: string, options?: GlossaryGetTermOptionalParams) => + getTerm(context, termId, options), + createTerm: ( + body: AtlasGlossaryTerm, + options?: GlossaryCreateTermOptionalParams, + ) => createTerm(context, body, options), + getCategoryTerms: ( + categoryId: string, + options?: GlossaryGetCategoryTermsOptionalParams, + ) => getCategoryTerms(context, categoryId, options), + getRelatedCategories: ( + categoryId: string, + options?: GlossaryGetRelatedCategoriesOptionalParams, + ) => getRelatedCategories(context, categoryId, options), + partialUpdateCategory: ( + categoryId: string, + body: Record, + options?: GlossaryPartialUpdateCategoryOptionalParams, + ) => partialUpdateCategory(context, categoryId, body, options), + deleteCategory: ( + categoryId: string, + options?: GlossaryDeleteCategoryOptionalParams, + ) => deleteCategory(context, categoryId, options), + updateCategory: ( + categoryId: string, + body: AtlasGlossaryCategory, + options?: GlossaryUpdateCategoryOptionalParams, + ) => updateCategory(context, categoryId, body, options), + getCategory: ( + categoryId: string, + options?: GlossaryGetCategoryOptionalParams, + ) => getCategory(context, categoryId, options), + createCategory: ( + body: AtlasGlossaryCategory, + options?: GlossaryCreateCategoryOptionalParams, + ) => createCategory(context, body, options), + createCategories: ( + body: AtlasGlossaryCategory[], + options?: GlossaryCreateCategoriesOptionalParams, + ) => createCategories(context, body, options), + create: (body: AtlasGlossary, options?: GlossaryCreateOptionalParams) => + create(context, body, options), + batchGet: (options?: GlossaryBatchGetOptionalParams) => + batchGet(context, options), + }; +} + +export function _getGlossaryOperations( + context: DataMapContext, +): GlossaryOperations { + return { + ..._getGlossary(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts new file mode 100644 index 0000000000..b392fcb3e7 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { DiscoveryOperations } from "./discovery/index.js"; +export { EntityOperations } from "./entity/index.js"; +export { GlossaryOperations } from "./glossary/index.js"; +export { LineageOperations } from "./lineage/index.js"; +export { RelationshipOperations } from "./relationship/index.js"; +export { TypeDefinitionOperations } from "./typeDefinition/index.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts new file mode 100644 index 0000000000..b51f383cd0 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext } from "../../api/dataMapContext.js"; +import { + getByUniqueAttribute, + getNextPage, + get, +} from "../../api/lineage/operations.js"; +import { + LineageGetByUniqueAttributeOptionalParams, + LineageGetNextPageOptionalParams, + LineageGetOptionalParams, +} from "../../api/lineage/options.js"; +import { AtlasLineageInfo, LineageDirection } from "../../models/models.js"; + +/** Interface representing a Lineage operations. */ +export interface LineageOperations { + /** + * Return lineage info about entity. + * + * In addition to the typeName path parameter, + * attribute key-value pair(s) can be provided in the following + * format + * + * attr:[attrName]=[attrValue] + * + * NOTE: The attrName and attrValue should be + * unique across entities, eg. qualifiedName. + * + * The REST request would look + * something like this: + * + * GET + * /v2/lineage/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + */ + getByUniqueAttribute: ( + typeName: string, + direction: LineageDirection, + options?: LineageGetByUniqueAttributeOptionalParams, + ) => Promise; + /** Return immediate next page lineage info about entity with pagination */ + getNextPage: ( + guid: string, + direction: LineageDirection, + options?: LineageGetNextPageOptionalParams, + ) => Promise; + /** Get lineage info of the entity specified by GUID. */ + get: ( + guid: string, + direction: LineageDirection, + options?: LineageGetOptionalParams, + ) => Promise; +} + +function _getLineage(context: DataMapContext) { + return { + getByUniqueAttribute: ( + typeName: string, + direction: LineageDirection, + options?: LineageGetByUniqueAttributeOptionalParams, + ) => getByUniqueAttribute(context, typeName, direction, options), + getNextPage: ( + guid: string, + direction: LineageDirection, + options?: LineageGetNextPageOptionalParams, + ) => getNextPage(context, guid, direction, options), + get: ( + guid: string, + direction: LineageDirection, + options?: LineageGetOptionalParams, + ) => get(context, guid, direction, options), + }; +} + +export function _getLineageOperations( + context: DataMapContext, +): LineageOperations { + return { + ..._getLineage(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts new file mode 100644 index 0000000000..1f51a057a4 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext } from "../../api/dataMapContext.js"; +import { + $delete, + get, + update, + create, +} from "../../api/relationship/operations.js"; +import { + RelationshipDeleteOptionalParams, + RelationshipGetOptionalParams, + RelationshipUpdateOptionalParams, + RelationshipCreateOptionalParams, +} from "../../api/relationship/options.js"; +import { + AtlasRelationship, + AtlasRelationshipWithExtInfo, +} from "../../models/models.js"; + +/** Interface representing a Relationship operations. */ +export interface RelationshipOperations { + /** Delete a relationship between entities by its GUID. */ + /** + * @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: ( + guid: string, + options?: RelationshipDeleteOptionalParams, + ) => Promise; + /** Get relationship information between entities by its GUID. */ + get: ( + guid: string, + options?: RelationshipGetOptionalParams, + ) => Promise; + /** Update an existing relationship between entities. */ + update: ( + body: AtlasRelationship, + options?: RelationshipUpdateOptionalParams, + ) => Promise; + /** Create a new relationship between entities. */ + create: ( + body: AtlasRelationship, + options?: RelationshipCreateOptionalParams, + ) => Promise; +} + +function _getRelationship(context: DataMapContext) { + return { + delete: (guid: string, options?: RelationshipDeleteOptionalParams) => + $delete(context, guid, options), + get: (guid: string, options?: RelationshipGetOptionalParams) => + get(context, guid, options), + update: ( + body: AtlasRelationship, + options?: RelationshipUpdateOptionalParams, + ) => update(context, body, options), + create: ( + body: AtlasRelationship, + options?: RelationshipCreateOptionalParams, + ) => create(context, body, options), + }; +} + +export function _getRelationshipOperations( + context: DataMapContext, +): RelationshipOperations { + return { + ..._getRelationship(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts new file mode 100644 index 0000000000..bc5f6155dd --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DataMapContext } from "../../api/dataMapContext.js"; +import { + getTermTemplateByName, + getTermTemplateById, + getHeaders, + batchDelete, + batchUpdate, + batchCreate, + get, + $delete, + getByName, + getById, + getStructByName, + getStructById, + getRelationshipByName, + getRelationshipById, + getEnumByName, + getEnumById, + getEntityByName, + getEntityById, + getClassificationByName, + getClassificationById, + getBusinessMetadataByName, + getBusinessMetadataById, +} from "../../api/typeDefinition/operations.js"; +import { + TypeDefinitionGetTermTemplateByNameOptionalParams, + TypeDefinitionGetTermTemplateByIdOptionalParams, + TypeDefinitionGetHeadersOptionalParams, + TypeDefinitionBatchDeleteOptionalParams, + TypeDefinitionBatchUpdateOptionalParams, + TypeDefinitionBatchCreateOptionalParams, + TypeDefinitionGetOptionalParams, + TypeDefinitionDeleteOptionalParams, + TypeDefinitionGetByNameOptionalParams, + TypeDefinitionGetByIdOptionalParams, + TypeDefinitionGetStructByNameOptionalParams, + TypeDefinitionGetStructByIdOptionalParams, + TypeDefinitionGetRelationshipByNameOptionalParams, + TypeDefinitionGetRelationshipByIdOptionalParams, + TypeDefinitionGetEnumByNameOptionalParams, + TypeDefinitionGetEnumByIdOptionalParams, + TypeDefinitionGetEntityByNameOptionalParams, + TypeDefinitionGetEntityByIdOptionalParams, + TypeDefinitionGetClassificationByNameOptionalParams, + TypeDefinitionGetClassificationByIdOptionalParams, + TypeDefinitionGetBusinessMetadataByNameOptionalParams, + TypeDefinitionGetBusinessMetadataByIdOptionalParams, +} from "../../api/typeDefinition/options.js"; +import { + AtlasBusinessMetadataDef, + AtlasClassificationDef, + AtlasEntityDef, + AtlasEnumDef, + AtlasRelationshipDef, + AtlasStructDef, + AtlasTypeDef, + AtlasTypesDef, + TermTemplateDef, + AtlasTypeDefHeader, +} from "../../models/models.js"; + +/** Interface representing a TypeDefinition operations. */ +export interface TypeDefinitionOperations { + /** Get the term template definition by its name (unique). */ + getTermTemplateByName: ( + name: string, + options?: TypeDefinitionGetTermTemplateByNameOptionalParams, + ) => Promise; + /** Get the term template definition for the given GUID. */ + getTermTemplateById: ( + guid: string, + options?: TypeDefinitionGetTermTemplateByIdOptionalParams, + ) => Promise; + /** List all type definitions returned as a list of minimal information header. */ + getHeaders: ( + options?: TypeDefinitionGetHeadersOptionalParams, + ) => Promise; + /** Delete API for all types in bulk. */ + batchDelete: ( + body: AtlasTypesDef, + options?: TypeDefinitionBatchDeleteOptionalParams, + ) => Promise; + /** + * Update all types in bulk, changes detected in the type definitions would be + * persisted. + */ + batchUpdate: ( + body: AtlasTypesDef, + options?: TypeDefinitionBatchUpdateOptionalParams, + ) => Promise; + /** Create all atlas type definitions in bulk. Please avoid recreating existing types. */ + batchCreate: ( + body: AtlasTypesDef, + options?: TypeDefinitionBatchCreateOptionalParams, + ) => Promise; + /** List all type definitions in bulk. */ + get: (options?: TypeDefinitionGetOptionalParams) => Promise; + /** Delete API for type identified by its name. */ + /** + * @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?: TypeDefinitionDeleteOptionalParams, + ) => Promise; + /** Get the type definition by its name (unique). */ + getByName: ( + name: string, + options?: TypeDefinitionGetByNameOptionalParams, + ) => Promise; + /** Get the type definition for the given GUID. */ + getById: ( + guid: string, + options?: TypeDefinitionGetByIdOptionalParams, + ) => Promise; + /** Get the struct definition by its name (unique). */ + getStructByName: ( + name: string, + options?: TypeDefinitionGetStructByNameOptionalParams, + ) => Promise; + /** Get the struct definition for the given GUID. */ + getStructById: ( + guid: string, + options?: TypeDefinitionGetStructByIdOptionalParams, + ) => Promise; + /** Get the relationship definition by its name (unique). */ + getRelationshipByName: ( + name: string, + options?: TypeDefinitionGetRelationshipByNameOptionalParams, + ) => Promise; + /** Get the relationship definition for the given GUID. */ + getRelationshipById: ( + guid: string, + options?: TypeDefinitionGetRelationshipByIdOptionalParams, + ) => Promise; + /** Get the enum definition by its name (unique). */ + getEnumByName: ( + name: string, + options?: TypeDefinitionGetEnumByNameOptionalParams, + ) => Promise; + /** Get the enum definition for the given GUID. */ + getEnumById: ( + guid: string, + options?: TypeDefinitionGetEnumByIdOptionalParams, + ) => Promise; + /** Get the entity definition by its name (unique). */ + getEntityByName: ( + name: string, + options?: TypeDefinitionGetEntityByNameOptionalParams, + ) => Promise; + /** Get the Entity definition for the given GUID. */ + getEntityById: ( + guid: string, + options?: TypeDefinitionGetEntityByIdOptionalParams, + ) => Promise; + /** Get the classification definition by its name (unique). */ + getClassificationByName: ( + name: string, + options?: TypeDefinitionGetClassificationByNameOptionalParams, + ) => Promise; + /** Get the classification definition for the given GUID. */ + getClassificationById: ( + guid: string, + options?: TypeDefinitionGetClassificationByIdOptionalParams, + ) => Promise; + /** Get the businessMetadata definition by it's name (unique). */ + getBusinessMetadataByName: ( + name: string, + options?: TypeDefinitionGetBusinessMetadataByNameOptionalParams, + ) => Promise; + /** Get the businessMetadata definition for the given guid. */ + getBusinessMetadataById: ( + guid: string, + options?: TypeDefinitionGetBusinessMetadataByIdOptionalParams, + ) => Promise; +} + +function _getTypeDefinition(context: DataMapContext) { + return { + getTermTemplateByName: ( + name: string, + options?: TypeDefinitionGetTermTemplateByNameOptionalParams, + ) => getTermTemplateByName(context, name, options), + getTermTemplateById: ( + guid: string, + options?: TypeDefinitionGetTermTemplateByIdOptionalParams, + ) => getTermTemplateById(context, guid, options), + getHeaders: (options?: TypeDefinitionGetHeadersOptionalParams) => + getHeaders(context, options), + batchDelete: ( + body: AtlasTypesDef, + options?: TypeDefinitionBatchDeleteOptionalParams, + ) => batchDelete(context, body, options), + batchUpdate: ( + body: AtlasTypesDef, + options?: TypeDefinitionBatchUpdateOptionalParams, + ) => batchUpdate(context, body, options), + batchCreate: ( + body: AtlasTypesDef, + options?: TypeDefinitionBatchCreateOptionalParams, + ) => batchCreate(context, body, options), + get: (options?: TypeDefinitionGetOptionalParams) => get(context, options), + delete: (name: string, options?: TypeDefinitionDeleteOptionalParams) => + $delete(context, name, options), + getByName: ( + name: string, + options?: TypeDefinitionGetByNameOptionalParams, + ) => getByName(context, name, options), + getById: (guid: string, options?: TypeDefinitionGetByIdOptionalParams) => + getById(context, guid, options), + getStructByName: ( + name: string, + options?: TypeDefinitionGetStructByNameOptionalParams, + ) => getStructByName(context, name, options), + getStructById: ( + guid: string, + options?: TypeDefinitionGetStructByIdOptionalParams, + ) => getStructById(context, guid, options), + getRelationshipByName: ( + name: string, + options?: TypeDefinitionGetRelationshipByNameOptionalParams, + ) => getRelationshipByName(context, name, options), + getRelationshipById: ( + guid: string, + options?: TypeDefinitionGetRelationshipByIdOptionalParams, + ) => getRelationshipById(context, guid, options), + getEnumByName: ( + name: string, + options?: TypeDefinitionGetEnumByNameOptionalParams, + ) => getEnumByName(context, name, options), + getEnumById: ( + guid: string, + options?: TypeDefinitionGetEnumByIdOptionalParams, + ) => getEnumById(context, guid, options), + getEntityByName: ( + name: string, + options?: TypeDefinitionGetEntityByNameOptionalParams, + ) => getEntityByName(context, name, options), + getEntityById: ( + guid: string, + options?: TypeDefinitionGetEntityByIdOptionalParams, + ) => getEntityById(context, guid, options), + getClassificationByName: ( + name: string, + options?: TypeDefinitionGetClassificationByNameOptionalParams, + ) => getClassificationByName(context, name, options), + getClassificationById: ( + guid: string, + options?: TypeDefinitionGetClassificationByIdOptionalParams, + ) => getClassificationById(context, guid, options), + getBusinessMetadataByName: ( + name: string, + options?: TypeDefinitionGetBusinessMetadataByNameOptionalParams, + ) => getBusinessMetadataByName(context, name, options), + getBusinessMetadataById: ( + guid: string, + options?: TypeDefinitionGetBusinessMetadataByIdOptionalParams, + ) => getBusinessMetadataById(context, guid, options), + }; +} + +export function _getTypeDefinitionOperations( + context: DataMapContext, +): TypeDefinitionOperations { + return { + ..._getTypeDefinition(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts new file mode 100644 index 0000000000..5bf327486b --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + createDataMap, + DataMapContext, + DataMapClientOptionalParams, +} from "./api/index.js"; +import { + DiscoveryOperations, + _getDiscoveryOperations, +} from "./classic/discovery/index.js"; +import { + EntityOperations, + _getEntityOperations, +} from "./classic/entity/index.js"; +import { + GlossaryOperations, + _getGlossaryOperations, +} from "./classic/glossary/index.js"; +import { + LineageOperations, + _getLineageOperations, +} from "./classic/lineage/index.js"; +import { + RelationshipOperations, + _getRelationshipOperations, +} from "./classic/relationship/index.js"; +import { + TypeDefinitionOperations, + _getTypeDefinitionOperations, +} from "./classic/typeDefinition/index.js"; +import { TokenCredential } from "@azure/core-auth"; +import { Pipeline } from "@azure/core-rest-pipeline"; + +export { DataMapClientOptionalParams } from "./api/dataMapContext.js"; + +export class DataMapClient { + private _client: DataMapContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + constructor( + endpointParam: string, + credential: TokenCredential, + options: DataMapClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createDataMap(endpointParam, credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.typeDefinition = _getTypeDefinitionOperations(this._client); + this.relationship = _getRelationshipOperations(this._client); + this.lineage = _getLineageOperations(this._client); + this.discovery = _getDiscoveryOperations(this._client); + this.glossary = _getGlossaryOperations(this._client); + this.entity = _getEntityOperations(this._client); + } + + /** The operation groups for typeDefinition */ + public readonly typeDefinition: TypeDefinitionOperations; + /** The operation groups for relationship */ + public readonly relationship: RelationshipOperations; + /** The operation groups for lineage */ + public readonly lineage: LineageOperations; + /** The operation groups for discovery */ + public readonly discovery: DiscoveryOperations; + /** The operation groups for glossary */ + public readonly glossary: GlossaryOperations; + /** The operation groups for entity */ + public readonly entity: EntityOperations; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts new file mode 100644 index 0000000000..c3243629e0 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { FileContents } from "./static-helpers/multipartHelpers.js"; + +export { DataMapClient } from "./dataMapClient.js"; +export { + AtlasEntityWithExtInfo, + AtlasEntity, + AtlasClassification, + EntityStatus, + TimeBoundary, + AtlasTermAssignmentHeader, + AtlasTermAssignmentStatus, + ContactInfo, + EntityMutationResult, + AtlasEntityHeader, + AtlasErrorResponse, + AtlasEntitiesWithExtInfo, + ClassificationAssociateOptions, + AtlasClassifications, + SortType, + AtlasEntityHeaders, + BusinessMetadataOptions, + BulkImportResult, + ImportInfo, + ImportStatus, + MoveEntitiesOptions, + AtlasGlossary, + AtlasRelatedCategoryHeader, + AtlasRelatedTermHeader, + AtlasTermRelationshipStatus, + AtlasGlossaryCategory, + AtlasGlossaryHeader, + AtlasGlossaryTerm, + TermStatus, + PurviewObjectId, + ResourceLink, + AtlasRelatedObjectId, + AtlasStruct, + StatusAtlasRelationship, + AtlasTermCategorizationHeader, + AtlasGlossaryExtInfo, + QueryOptions, + SearchFacetItem, + SearchFacetSort, + SearchSortOrder, + SearchTaxonomySetting, + QueryResult, + SearchFacetResultValue, + SearchFacetItemValue, + SearchResultValue, + SearchHighlights, + TermSearchResultValue, + ContactSearchResultValue, + SuggestOptions, + SuggestResult, + SuggestResultValue, + AutoCompleteOptions, + AutoCompleteResult, + AutoCompleteResultValue, + AtlasLineageInfo, + LineageDirection, + ParentRelation, + LineageRelation, + AtlasRelationship, + AtlasObjectId, + AtlasRelationshipWithExtInfo, + AtlasBusinessMetadataDef, + TypeCategory, + DateFormat, + NumberFormat, + RoundingMode, + TimeZone, + AtlasAttributeDef, + CardinalityValue, + AtlasConstraintDef, + AtlasClassificationDef, + AtlasEntityDef, + AtlasRelationshipAttributeDef, + AtlasEnumDef, + AtlasEnumElementDef, + AtlasRelationshipDef, + AtlasRelationshipEndDef, + RelationshipCategory, + AtlasStructDef, + AtlasTypeDef, + AtlasTypesDef, + TermTemplateDef, + AtlasTypeDefHeader, + BusinessAttributeUpdateBehavior, + KnownApiVersions, +} from "./models/index.js"; +export { DataMapClientOptionalParams } from "./api/index.js"; +export { + DiscoveryAutoCompleteOptionalParams, + DiscoverySuggestOptionalParams, + DiscoveryQueryOptionalParams, +} from "./api/discovery/index.js"; +export { + EntityMoveEntitiesToCollectionOptionalParams, + EntityAddLabelsByUniqueAttributeOptionalParams, + EntitySetLabelsByUniqueAttributeOptionalParams, + EntityRemoveLabelsByUniqueAttributeOptionalParams, + EntityAddLabelOptionalParams, + EntitySetLabelsOptionalParams, + EntityRemoveLabelsOptionalParams, + EntityImportBusinessMetadataOptionalParams, + EntityGetBusinessMetadataTemplateOptionalParams, + EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, + EntityRemoveBusinessMetadataAttributesOptionalParams, + EntityAddOrUpdateBusinessMetadataOptionalParams, + EntityRemoveBusinessMetadataOptionalParams, + EntityGetHeaderOptionalParams, + EntityBatchGetByUniqueAttributesOptionalParams, + EntityBatchSetClassificationsOptionalParams, + EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityAddClassificationsByUniqueAttributeOptionalParams, + EntityRemoveClassificationByUniqueAttributeOptionalParams, + EntityDeleteByUniqueAttributeOptionalParams, + EntityUpdateByUniqueAttributeOptionalParams, + EntityGetByUniqueAttributeOptionalParams, + EntityUpdateClassificationsOptionalParams, + EntityAddClassificationsOptionalParams, + EntityGetClassificationsOptionalParams, + EntityRemoveClassificationOptionalParams, + EntityGetClassificationOptionalParams, + EntityDeleteOptionalParams, + EntityUpdateAttributeByIdOptionalParams, + EntityGetOptionalParams, + EntityAddClassificationOptionalParams, + EntityBatchDeleteOptionalParams, + EntityBatchCreateOrUpdateOptionalParams, + EntityGetByIdsOptionalParams, + EntityCreateOrUpdateOptionalParams, +} from "./api/entity/index.js"; +export { + GlossaryGetTermHeadersOptionalParams, + GlossaryGetTermsOptionalParams, + GlossaryPartialUpdateOptionalParams, + GlossaryGetDetailedOptionalParams, + GlossaryGetCategoriesHeadersOptionalParams, + GlossaryGetCategoriesOptionalParams, + GlossaryDeleteOptionalParams, + GlossaryUpdateOptionalParams, + GlossaryGetOptionalParams, + GlossaryGetRelatedTermsOptionalParams, + GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, + GlossaryAssignTermToEntitiesOptionalParams, + GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryCreateTermsOptionalParams, + GlossaryPartialUpdateTermOptionalParams, + GlossaryDeleteTermOptionalParams, + GlossaryUpdateTermOptionalParams, + GlossaryGetTermOptionalParams, + GlossaryCreateTermOptionalParams, + GlossaryGetCategoryTermsOptionalParams, + GlossaryGetRelatedCategoriesOptionalParams, + GlossaryPartialUpdateCategoryOptionalParams, + GlossaryDeleteCategoryOptionalParams, + GlossaryUpdateCategoryOptionalParams, + GlossaryGetCategoryOptionalParams, + GlossaryCreateCategoryOptionalParams, + GlossaryCreateCategoriesOptionalParams, + GlossaryCreateOptionalParams, + GlossaryBatchGetOptionalParams, +} from "./api/glossary/index.js"; +export { + LineageGetByUniqueAttributeOptionalParams, + LineageGetNextPageOptionalParams, + LineageGetOptionalParams, +} from "./api/lineage/index.js"; +export { + RelationshipDeleteOptionalParams, + RelationshipGetOptionalParams, + RelationshipUpdateOptionalParams, + RelationshipCreateOptionalParams, +} from "./api/relationship/index.js"; +export { + TypeDefinitionGetTermTemplateByNameOptionalParams, + TypeDefinitionGetTermTemplateByIdOptionalParams, + TypeDefinitionGetHeadersOptionalParams, + TypeDefinitionBatchDeleteOptionalParams, + TypeDefinitionBatchUpdateOptionalParams, + TypeDefinitionBatchCreateOptionalParams, + TypeDefinitionGetOptionalParams, + TypeDefinitionDeleteOptionalParams, + TypeDefinitionGetByNameOptionalParams, + TypeDefinitionGetByIdOptionalParams, + TypeDefinitionGetStructByNameOptionalParams, + TypeDefinitionGetStructByIdOptionalParams, + TypeDefinitionGetRelationshipByNameOptionalParams, + TypeDefinitionGetRelationshipByIdOptionalParams, + TypeDefinitionGetEnumByNameOptionalParams, + TypeDefinitionGetEnumByIdOptionalParams, + TypeDefinitionGetEntityByNameOptionalParams, + TypeDefinitionGetEntityByIdOptionalParams, + TypeDefinitionGetClassificationByNameOptionalParams, + TypeDefinitionGetClassificationByIdOptionalParams, + TypeDefinitionGetBusinessMetadataByNameOptionalParams, + TypeDefinitionGetBusinessMetadataByIdOptionalParams, +} from "./api/typeDefinition/index.js"; +export { + DiscoveryOperations, + EntityOperations, + GlossaryOperations, + LineageOperations, + RelationshipOperations, + TypeDefinitionOperations, +} from "./classic/index.js"; +export { FileContents }; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/logger.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/logger.ts new file mode 100644 index 0000000000..478d52044a --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/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("purview-datamap"); diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/index.ts new file mode 100644 index 0000000000..d17ec87c23 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/index.ts @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + AtlasEntityWithExtInfo, + AtlasEntity, + AtlasClassification, + EntityStatus, + TimeBoundary, + AtlasTermAssignmentHeader, + AtlasTermAssignmentStatus, + ContactInfo, + EntityMutationResult, + AtlasEntityHeader, + AtlasErrorResponse, + AtlasEntitiesWithExtInfo, + ClassificationAssociateOptions, + AtlasClassifications, + SortType, + AtlasEntityHeaders, + BusinessMetadataOptions, + BulkImportResult, + ImportInfo, + ImportStatus, + MoveEntitiesOptions, + AtlasGlossary, + AtlasRelatedCategoryHeader, + AtlasRelatedTermHeader, + AtlasTermRelationshipStatus, + AtlasGlossaryCategory, + AtlasGlossaryHeader, + AtlasGlossaryTerm, + TermStatus, + PurviewObjectId, + ResourceLink, + AtlasRelatedObjectId, + AtlasStruct, + StatusAtlasRelationship, + AtlasTermCategorizationHeader, + AtlasGlossaryExtInfo, + QueryOptions, + SearchFacetItem, + SearchFacetSort, + SearchSortOrder, + SearchTaxonomySetting, + QueryResult, + SearchFacetResultValue, + SearchFacetItemValue, + SearchResultValue, + SearchHighlights, + TermSearchResultValue, + ContactSearchResultValue, + SuggestOptions, + SuggestResult, + SuggestResultValue, + AutoCompleteOptions, + AutoCompleteResult, + AutoCompleteResultValue, + AtlasLineageInfo, + LineageDirection, + ParentRelation, + LineageRelation, + AtlasRelationship, + AtlasObjectId, + AtlasRelationshipWithExtInfo, + AtlasBusinessMetadataDef, + TypeCategory, + DateFormat, + NumberFormat, + RoundingMode, + TimeZone, + AtlasAttributeDef, + CardinalityValue, + AtlasConstraintDef, + AtlasClassificationDef, + AtlasEntityDef, + AtlasRelationshipAttributeDef, + AtlasEnumDef, + AtlasEnumElementDef, + AtlasRelationshipDef, + AtlasRelationshipEndDef, + RelationshipCategory, + AtlasStructDef, + AtlasTypeDef, + AtlasTypesDef, + TermTemplateDef, + AtlasTypeDefHeader, + BusinessAttributeUpdateBehavior, + KnownApiVersions, +} from "./models.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/models.ts new file mode 100644 index 0000000000..e0f8137709 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/models/models.ts @@ -0,0 +1,4560 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + FileContents, + createFilePartDescriptor, +} from "../static-helpers/multipartHelpers.js"; + +/** + * An instance of an entity along with extended info - like hive_table, + * hive_database. + */ +export interface AtlasEntityWithExtInfo { + /** The referred entities. */ + referredEntities?: Record; + /** An instance of an entity - like hive_table, hive_database. */ + entity?: AtlasEntity; +} + +export function atlasEntityWithExtInfoSerializer( + item: AtlasEntityWithExtInfo, +): any { + return { + referredEntities: !item["referredEntities"] + ? item["referredEntities"] + : atlasEntityRecordSerializer(item["referredEntities"]), + entity: !item["entity"] + ? item["entity"] + : atlasEntitySerializer(item["entity"]), + }; +} + +export function atlasEntityWithExtInfoDeserializer( + item: any, +): AtlasEntityWithExtInfo { + return { + referredEntities: !item["referredEntities"] + ? item["referredEntities"] + : atlasEntityRecordDeserializer(item["referredEntities"]), + entity: !item["entity"] + ? item["entity"] + : atlasEntityDeserializer(item["entity"]), + }; +} + +export function atlasEntityRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : atlasEntitySerializer(item[key]); + }); + return result; +} + +export function atlasEntityRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] ? item[key] : atlasEntityDeserializer(item[key]); + }); + return result; +} + +/** An instance of an entity - like hive_table, hive_database. */ +export interface AtlasEntity { + /** The attributes of the struct. */ + attributes?: Record; + /** The name of the type. */ + typeName?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** Business attributes */ + businessAttributes?: Record; + /** An array of classifications. */ + classifications?: AtlasClassification[]; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** Custom Attribute */ + customAttributes?: Record; + /** The GUID of the entity. */ + guid?: string; + /** The home ID of the entity. */ + homeId?: string; + /** The collection ID of the entity. */ + readonly collectionId?: string; + /** Whether it is a shell entity */ + isIncomplete?: boolean; + /** labels */ + labels?: string[]; + /** An array of term assignment headers indicating the meanings of the entity. */ + meanings?: AtlasTermAssignmentHeader[]; + /** Used to record the provenance of an instance of an entity or relationship. */ + provenanceType?: number; + /** Determines if there's a proxy. */ + proxy?: boolean; + /** The attributes of relationship. */ + relationshipAttributes?: Record; + /** + * Status of the entity - can be active or deleted. Deleted entities are not + * removed. + */ + status?: EntityStatus; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the entity. */ + version?: number; + /** The dictionary of contacts for entities. Key could be Expert or Owner. */ + contacts?: Record; +} + +export function atlasEntitySerializer(item: AtlasEntity): any { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + businessAttributes: item["businessAttributes"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArraySerializer(item["classifications"]), + createTime: item["createTime"], + createdBy: item["createdBy"], + customAttributes: item["customAttributes"], + guid: item["guid"], + homeId: item["homeId"], + isIncomplete: item["isIncomplete"], + labels: !item["labels"] + ? item["labels"] + : item["labels"].map((p: any) => { + return p; + }), + meanings: !item["meanings"] + ? item["meanings"] + : atlasTermAssignmentHeaderArraySerializer(item["meanings"]), + provenanceType: item["provenanceType"], + proxy: item["proxy"], + relationshipAttributes: item["relationshipAttributes"], + status: item["status"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + contacts: !item["contacts"] + ? item["contacts"] + : contactInfoArrayRecordSerializer(item["contacts"]), + }; +} + +export function atlasEntityDeserializer(item: any): AtlasEntity { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + businessAttributes: item["businessAttributes"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArrayDeserializer(item["classifications"]), + createTime: item["createTime"], + createdBy: item["createdBy"], + customAttributes: item["customAttributes"], + guid: item["guid"], + homeId: item["homeId"], + collectionId: item["collectionId"], + isIncomplete: item["isIncomplete"], + labels: !item["labels"] + ? item["labels"] + : item["labels"].map((p: any) => { + return p; + }), + meanings: !item["meanings"] + ? item["meanings"] + : atlasTermAssignmentHeaderArrayDeserializer(item["meanings"]), + provenanceType: item["provenanceType"], + proxy: item["proxy"], + relationshipAttributes: item["relationshipAttributes"], + status: item["status"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + contacts: !item["contacts"] + ? item["contacts"] + : contactInfoArrayRecordDeserializer(item["contacts"]), + }; +} + +export function atlasClassificationArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasClassificationSerializer(item); + }); +} + +export function atlasClassificationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasClassificationDeserializer(item); + }); +} + +/** + * An instance of a classification; it doesn't have an identity, this object + * exists only when associated with an entity. + */ +export interface AtlasClassification { + /** The attributes of the struct. */ + attributes?: Record; + /** The name of the type. */ + typeName?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The GUID of the entity. */ + entityGuid?: string; + /** + * Status of the entity - can be active or deleted. Deleted entities are not + * removed. + */ + entityStatus?: EntityStatus; + /** Determines if propagations will be removed on entity deletion. */ + removePropagationsOnEntityDelete?: boolean; + /** An array of time boundaries indicating validity periods. */ + validityPeriods?: TimeBoundary[]; +} + +export function atlasClassificationSerializer(item: AtlasClassification): any { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + entityGuid: item["entityGuid"], + entityStatus: item["entityStatus"], + removePropagationsOnEntityDelete: item["removePropagationsOnEntityDelete"], + validityPeriods: !item["validityPeriods"] + ? item["validityPeriods"] + : timeBoundaryArraySerializer(item["validityPeriods"]), + }; +} + +export function atlasClassificationDeserializer( + item: any, +): AtlasClassification { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + entityGuid: item["entityGuid"], + entityStatus: item["entityStatus"], + removePropagationsOnEntityDelete: item["removePropagationsOnEntityDelete"], + validityPeriods: !item["validityPeriods"] + ? item["validityPeriods"] + : timeBoundaryArrayDeserializer(item["validityPeriods"]), + }; +} + +/** Status - can be active or deleted */ +export type EntityStatus = "ACTIVE" | "DELETED"; + +export function timeBoundaryArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return timeBoundarySerializer(item); + }); +} + +export function timeBoundaryArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return timeBoundaryDeserializer(item); + }); +} + +/** Captures time-boundary details */ +export interface TimeBoundary { + /** The end of the time boundary. */ + endTime?: string; + /** The start of the time boundary. */ + startTime?: string; + /** The timezone of the time boundary. */ + timeZone?: string; +} + +export function timeBoundarySerializer(item: TimeBoundary): any { + return { + endTime: item["endTime"], + startTime: item["startTime"], + timeZone: item["timeZone"], + }; +} + +export function timeBoundaryDeserializer(item: any): TimeBoundary { + return { + endTime: item["endTime"], + startTime: item["startTime"], + timeZone: item["timeZone"], + }; +} + +export function atlasTermAssignmentHeaderArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasTermAssignmentHeaderSerializer(item); + }); +} + +export function atlasTermAssignmentHeaderArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasTermAssignmentHeaderDeserializer(item); + }); +} + +/** The header for term assignment. */ +export interface AtlasTermAssignmentHeader { + /** The confidence of the term assignment. */ + confidence?: number; + /** The user who created the record. */ + createdBy?: string; + /** The description of the term assignment. */ + description?: string; + /** The display text. */ + displayText?: string; + /** The expression of the term assignment. */ + expression?: string; + /** The GUID of the relationship. */ + relationGuid?: string; + /** The status of terms assignment. */ + status?: AtlasTermAssignmentStatus; + /** The steward of the term. */ + steward?: string; + /** The GUID of the term. */ + termGuid?: string; +} + +export function atlasTermAssignmentHeaderSerializer( + item: AtlasTermAssignmentHeader, +): any { + return { + confidence: item["confidence"], + createdBy: item["createdBy"], + description: item["description"], + displayText: item["displayText"], + expression: item["expression"], + relationGuid: item["relationGuid"], + status: item["status"], + steward: item["steward"], + termGuid: item["termGuid"], + }; +} + +export function atlasTermAssignmentHeaderDeserializer( + item: any, +): AtlasTermAssignmentHeader { + return { + confidence: item["confidence"], + createdBy: item["createdBy"], + description: item["description"], + displayText: item["displayText"], + expression: item["expression"], + relationGuid: item["relationGuid"], + status: item["status"], + steward: item["steward"], + termGuid: item["termGuid"], + }; +} + +/** Status for term assignment */ +export type AtlasTermAssignmentStatus = + | "DISCOVERED" + | "PROPOSED" + | "IMPORTED" + | "VALIDATED" + | "DEPRECATED" + | "OBSOLETE" + | "OTHER"; + +export function contactInfoArrayRecordSerializer( + item: Record>, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : contactInfoArraySerializer(item[key]); + }); + return result; +} + +export function contactInfoArrayRecordDeserializer( + item: Record, +): Record> { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : contactInfoArrayDeserializer(item[key]); + }); + return result; +} + +export function contactInfoArraySerializer(result: Array): any[] { + return result.map((item) => { + return contactInfoSerializer(item); + }); +} + +export function contactInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return contactInfoDeserializer(item); + }); +} + +/** ContactInfo */ +export interface ContactInfo { + /** Azure Active Directory object Id. */ + id?: string; + /** additional information to describe this contact. */ + info?: string; +} + +export function contactInfoSerializer(item: ContactInfo): any { + return { id: item["id"], info: item["info"] }; +} + +export function contactInfoDeserializer(item: any): ContactInfo { + return { + id: item["id"], + info: item["info"], + }; +} + +/** The mutation response result of entity. */ +export interface EntityMutationResult { + /** A map of GUID assignments with entities. */ + guidAssignments?: Record; + /** The entity headers of mutated entities. */ + mutatedEntities?: Record; + /** An array of entity headers that partially updated. */ + partialUpdatedEntities?: AtlasEntityHeader[]; +} + +export function entityMutationResultDeserializer( + item: any, +): EntityMutationResult { + return { + guidAssignments: item["guidAssignments"], + mutatedEntities: !item["mutatedEntities"] + ? item["mutatedEntities"] + : atlasEntityHeaderArrayRecordDeserializer(item["mutatedEntities"]), + partialUpdatedEntities: !item["partialUpdatedEntities"] + ? item["partialUpdatedEntities"] + : atlasEntityHeaderArrayDeserializer(item["partialUpdatedEntities"]), + }; +} + +export function atlasEntityHeaderArrayRecordSerializer( + item: Record>, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasEntityHeaderArraySerializer(item[key]); + }); + return result; +} + +export function atlasEntityHeaderArrayRecordDeserializer( + item: Record, +): Record> { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasEntityHeaderArrayDeserializer(item[key]); + }); + return result; +} + +export function atlasEntityHeaderArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEntityHeaderSerializer(item); + }); +} + +export function atlasEntityHeaderArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEntityHeaderDeserializer(item); + }); +} + +/** An instance of an entity - like hive_table, hive_database. */ +export interface AtlasEntityHeader { + /** The attributes of the struct. */ + attributes?: Record; + /** The name of the type. */ + typeName?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of classification names. */ + classificationNames?: string[]; + /** An array of classifications. */ + classifications?: AtlasClassification[]; + /** The display text. */ + displayText?: string; + /** The GUID of the record. */ + guid?: string; + /** Whether it is a shell entity */ + isIncomplete?: boolean; + /** labels */ + labels?: string[]; + /** An array of meanings. */ + meaningNames?: string[]; + /** An array of term assignment headers. */ + meanings?: AtlasTermAssignmentHeader[]; + /** + * Status of the entity - can be active or deleted. Deleted entities are not + * removed. + */ + status?: EntityStatus; +} + +export function atlasEntityHeaderSerializer(item: AtlasEntityHeader): any { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + classificationNames: !item["classificationNames"] + ? item["classificationNames"] + : item["classificationNames"].map((p: any) => { + return p; + }), + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArraySerializer(item["classifications"]), + displayText: item["displayText"], + guid: item["guid"], + isIncomplete: item["isIncomplete"], + labels: !item["labels"] + ? item["labels"] + : item["labels"].map((p: any) => { + return p; + }), + meaningNames: !item["meaningNames"] + ? item["meaningNames"] + : item["meaningNames"].map((p: any) => { + return p; + }), + meanings: !item["meanings"] + ? item["meanings"] + : atlasTermAssignmentHeaderArraySerializer(item["meanings"]), + status: item["status"], + }; +} + +export function atlasEntityHeaderDeserializer(item: any): AtlasEntityHeader { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + classificationNames: !item["classificationNames"] + ? item["classificationNames"] + : item["classificationNames"].map((p: any) => { + return p; + }), + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArrayDeserializer(item["classifications"]), + displayText: item["displayText"], + guid: item["guid"], + isIncomplete: item["isIncomplete"], + labels: !item["labels"] + ? item["labels"] + : item["labels"].map((p: any) => { + return p; + }), + meaningNames: !item["meaningNames"] + ? item["meaningNames"] + : item["meaningNames"].map((p: any) => { + return p; + }), + meanings: !item["meanings"] + ? item["meanings"] + : atlasTermAssignmentHeaderArrayDeserializer(item["meanings"]), + status: item["status"], + }; +} + +/** An error response from the service */ +export interface AtlasErrorResponse { + /** The request ID. */ + requestId?: string; + /** The error code. */ + errorCode?: string; + /** The error message. */ + errorMessage?: string; +} + +export function atlasErrorResponseDeserializer(item: any): AtlasErrorResponse { + return { + requestId: item["requestId"], + errorCode: item["errorCode"], + errorMessage: item["errorMessage"], + }; +} + +/** + * An instance of an entity along with extended info - like hive_table, + * hive_database. + */ +export interface AtlasEntitiesWithExtInfo { + /** The referred entities. */ + referredEntities?: Record; + /** An array of entities. */ + entities?: AtlasEntity[]; +} + +export function atlasEntitiesWithExtInfoSerializer( + item: AtlasEntitiesWithExtInfo, +): any { + return { + referredEntities: !item["referredEntities"] + ? item["referredEntities"] + : atlasEntityRecordSerializer(item["referredEntities"]), + entities: !item["entities"] + ? item["entities"] + : atlasEntityArraySerializer(item["entities"]), + }; +} + +export function atlasEntitiesWithExtInfoDeserializer( + item: any, +): AtlasEntitiesWithExtInfo { + return { + referredEntities: !item["referredEntities"] + ? item["referredEntities"] + : atlasEntityRecordDeserializer(item["referredEntities"]), + entities: !item["entities"] + ? item["entities"] + : atlasEntityArrayDeserializer(item["entities"]), + }; +} + +export function atlasEntityArraySerializer(result: Array): any[] { + return result.map((item) => { + return atlasEntitySerializer(item); + }); +} + +export function atlasEntityArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEntityDeserializer(item); + }); +} + +/** The request payload for classification association. */ +export interface ClassificationAssociateOptions { + /** + * An instance of a classification; it doesn't have an identity, this object + * exists only when associated with an entity. + */ + classification?: AtlasClassification; + /** The GUID of the entity. */ + entityGuids?: string[]; +} + +export function classificationAssociateOptionsSerializer( + item: ClassificationAssociateOptions, +): any { + return { + classification: !item["classification"] + ? item["classification"] + : atlasClassificationSerializer(item["classification"]), + entityGuids: !item["entityGuids"] + ? item["entityGuids"] + : item["entityGuids"].map((p: any) => { + return p; + }), + }; +} + +/** REST serialization friendly list. */ +export interface AtlasClassifications { + /** An array of objects. */ + list?: any[]; + /** The size of the page. */ + pageSize?: number; + /** The sorted by field. */ + sortBy?: string; + /** to specify whether the result should be sorted? If yes, whether asc or desc. */ + sortType?: SortType; + /** The start index of the page. */ + startIndex?: number; + /** The total count of items. */ + totalCount?: number; +} + +export function atlasClassificationsDeserializer( + item: any, +): AtlasClassifications { + return { + list: !item["list"] + ? item["list"] + : item["list"].map((p: any) => { + return p; + }), + pageSize: item["pageSize"], + sortBy: item["sortBy"], + sortType: item["sortType"], + startIndex: item["startIndex"], + totalCount: item["totalCount"], + }; +} + +/** Type for sorting */ +export type SortType = "NONE" | "ASC" | "DESC"; + +/** An instance of an entity header map. */ +export interface AtlasEntityHeaders { + /** The description of the guid header map, */ + guidHeaderMap?: Record; +} + +export function atlasEntityHeadersSerializer(item: AtlasEntityHeaders): any { + return { + guidHeaderMap: !item["guidHeaderMap"] + ? item["guidHeaderMap"] + : atlasEntityHeaderRecordSerializer(item["guidHeaderMap"]), + }; +} + +export function atlasEntityHeaderRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasEntityHeaderSerializer(item[key]); + }); + return result; +} + +export function atlasEntityHeaderRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasEntityHeaderDeserializer(item[key]); + }); + return result; +} + +/** Business metadata to send to the service */ +export interface BusinessMetadataOptions { + /** InputStream of file */ + file: + | FileContents + | { contents: FileContents; contentType?: string; filename?: string }; +} + +export function businessMetadataOptionsSerializer( + item: BusinessMetadataOptions, +): any { + return [ + createFilePartDescriptor("file", item["file"], "application/octet-stream"), + ]; +} + +/** Bulk import result */ +export interface BulkImportResult { + /** failed importInfoList */ + failedImportInfoList?: ImportInfo[]; + /** successful importInfoList */ + successImportInfoList?: ImportInfo[]; +} + +export function bulkImportResultDeserializer(item: any): BulkImportResult { + return { + failedImportInfoList: !item["failedImportInfoList"] + ? item["failedImportInfoList"] + : importInfoArrayDeserializer(item["failedImportInfoList"]), + successImportInfoList: !item["successImportInfoList"] + ? item["successImportInfoList"] + : importInfoArrayDeserializer(item["successImportInfoList"]), + }; +} + +export function importInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return importInfoDeserializer(item); + }); +} + +/** ImportInfo */ +export interface ImportInfo { + /** childObjectName */ + childObjectName?: string; + /** importStatus */ + importStatus?: ImportStatus; + /** parentObjectName */ + parentObjectName?: string; + /** remarks */ + remarks?: string; +} + +export function importInfoDeserializer(item: any): ImportInfo { + return { + childObjectName: item["childObjectName"], + importStatus: item["importStatus"], + parentObjectName: item["parentObjectName"], + remarks: item["remarks"], + }; +} + +/** Status for import */ +export type ImportStatus = "SUCCESS" | "FAILED"; + +/** MoveEntitiesOptions */ +export interface MoveEntitiesOptions { + /** An array of entity guids to be moved to target collection. */ + entityGuids?: string[]; +} + +export function moveEntitiesOptionsSerializer(item: MoveEntitiesOptions): any { + return { + entityGuids: !item["entityGuids"] + ? item["entityGuids"] + : item["entityGuids"].map((p: any) => { + return p; + }), + }; +} + +/** The glossary object. */ +export interface AtlasGlossary { + /** The GUID of the object. */ + guid?: string; + /** An array of classifications. */ + classifications?: AtlasClassification[]; + /** The long version description. */ + longDescription?: string; + /** The name of the glossary object. */ + name?: string; + /** The qualified name of the glossary object. */ + qualifiedName?: string; + /** The short version of description. */ + shortDescription?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** An array of categories. */ + categories?: AtlasRelatedCategoryHeader[]; + /** The language of the glossary. */ + language?: string; + /** An array of related term headers. */ + terms?: AtlasRelatedTermHeader[]; + /** The usage of the glossary. */ + usage?: string; +} + +export function atlasGlossarySerializer(item: AtlasGlossary): any { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArraySerializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + categories: !item["categories"] + ? item["categories"] + : atlasRelatedCategoryHeaderArraySerializer(item["categories"]), + language: item["language"], + terms: !item["terms"] + ? item["terms"] + : atlasRelatedTermHeaderArraySerializer(item["terms"]), + usage: item["usage"], + }; +} + +export function atlasGlossaryDeserializer(item: any): AtlasGlossary { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArrayDeserializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + categories: !item["categories"] + ? item["categories"] + : atlasRelatedCategoryHeaderArrayDeserializer(item["categories"]), + language: item["language"], + terms: !item["terms"] + ? item["terms"] + : atlasRelatedTermHeaderArrayDeserializer(item["terms"]), + usage: item["usage"], + }; +} + +export function atlasRelatedCategoryHeaderArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelatedCategoryHeaderSerializer(item); + }); +} + +export function atlasRelatedCategoryHeaderArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelatedCategoryHeaderDeserializer(item); + }); +} + +/** The header of the related category. */ +export interface AtlasRelatedCategoryHeader { + /** The GUID of the category. */ + categoryGuid?: string; + /** The description of the category header. */ + description?: string; + /** The display text. */ + displayText?: string; + /** The GUID of the parent category. */ + parentCategoryGuid?: string; + /** The GUID of the relationship. */ + relationGuid?: string; +} + +export function atlasRelatedCategoryHeaderSerializer( + item: AtlasRelatedCategoryHeader, +): any { + return { + categoryGuid: item["categoryGuid"], + description: item["description"], + displayText: item["displayText"], + parentCategoryGuid: item["parentCategoryGuid"], + relationGuid: item["relationGuid"], + }; +} + +export function atlasRelatedCategoryHeaderDeserializer( + item: any, +): AtlasRelatedCategoryHeader { + return { + categoryGuid: item["categoryGuid"], + description: item["description"], + displayText: item["displayText"], + parentCategoryGuid: item["parentCategoryGuid"], + relationGuid: item["relationGuid"], + }; +} + +export function atlasRelatedTermHeaderArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelatedTermHeaderSerializer(item); + }); +} + +export function atlasRelatedTermHeaderArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelatedTermHeaderDeserializer(item); + }); +} + +/** The header of the related term. */ +export interface AtlasRelatedTermHeader { + /** The description of the related term. */ + description?: string; + /** The display text. */ + displayText?: string; + /** The expression of the term. */ + expression?: string; + /** The GUID of the relationship. */ + relationGuid?: string; + /** The status of term relationship. */ + status?: AtlasTermRelationshipStatus; + /** The steward of the term. */ + steward?: string; + /** The GUID of the term. */ + termGuid?: string; +} + +export function atlasRelatedTermHeaderSerializer( + item: AtlasRelatedTermHeader, +): any { + return { + description: item["description"], + displayText: item["displayText"], + expression: item["expression"], + relationGuid: item["relationGuid"], + status: item["status"], + steward: item["steward"], + termGuid: item["termGuid"], + }; +} + +export function atlasRelatedTermHeaderDeserializer( + item: any, +): AtlasRelatedTermHeader { + return { + description: item["description"], + displayText: item["displayText"], + expression: item["expression"], + relationGuid: item["relationGuid"], + status: item["status"], + steward: item["steward"], + termGuid: item["termGuid"], + }; +} + +/** Status for atlas term relationship */ +export type AtlasTermRelationshipStatus = + | "DRAFT" + | "ACTIVE" + | "DEPRECATED" + | "OBSOLETE" + | "OTHER"; + +/** The glossary category. */ +export interface AtlasGlossaryCategory { + /** The GUID of the object. */ + guid?: string; + /** An array of classifications. */ + classifications?: AtlasClassification[]; + /** The long version description. */ + longDescription?: string; + /** The name of the glossary object. */ + name?: string; + /** The qualified name of the glossary object. */ + qualifiedName?: string; + /** The short version of description. */ + shortDescription?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The glossary header with basic information. */ + anchor?: AtlasGlossaryHeader; + /** An array of children categories. */ + childrenCategories?: AtlasRelatedCategoryHeader[]; + /** The header of the related category. */ + parentCategory?: AtlasRelatedCategoryHeader; + /** An array of related term headers. */ + terms?: AtlasRelatedTermHeader[]; +} + +export function atlasGlossaryCategorySerializer( + item: AtlasGlossaryCategory, +): any { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArraySerializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + anchor: !item["anchor"] + ? item["anchor"] + : atlasGlossaryHeaderSerializer(item["anchor"]), + childrenCategories: !item["childrenCategories"] + ? item["childrenCategories"] + : atlasRelatedCategoryHeaderArraySerializer(item["childrenCategories"]), + parentCategory: !item["parentCategory"] + ? item["parentCategory"] + : atlasRelatedCategoryHeaderSerializer(item["parentCategory"]), + terms: !item["terms"] + ? item["terms"] + : atlasRelatedTermHeaderArraySerializer(item["terms"]), + }; +} + +export function atlasGlossaryCategoryDeserializer( + item: any, +): AtlasGlossaryCategory { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArrayDeserializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + anchor: !item["anchor"] + ? item["anchor"] + : atlasGlossaryHeaderDeserializer(item["anchor"]), + childrenCategories: !item["childrenCategories"] + ? item["childrenCategories"] + : atlasRelatedCategoryHeaderArrayDeserializer(item["childrenCategories"]), + parentCategory: !item["parentCategory"] + ? item["parentCategory"] + : atlasRelatedCategoryHeaderDeserializer(item["parentCategory"]), + terms: !item["terms"] + ? item["terms"] + : atlasRelatedTermHeaderArrayDeserializer(item["terms"]), + }; +} + +/** The glossary header with basic information. */ +export interface AtlasGlossaryHeader { + /** The display text. */ + displayText?: string; + /** The GUID of the glossary. */ + glossaryGuid?: string; + /** The GUID of the relationship. */ + relationGuid?: string; +} + +export function atlasGlossaryHeaderSerializer(item: AtlasGlossaryHeader): any { + return { + displayText: item["displayText"], + glossaryGuid: item["glossaryGuid"], + relationGuid: item["relationGuid"], + }; +} + +export function atlasGlossaryHeaderDeserializer( + item: any, +): AtlasGlossaryHeader { + return { + displayText: item["displayText"], + glossaryGuid: item["glossaryGuid"], + relationGuid: item["relationGuid"], + }; +} + +/** The glossary term. */ +export interface AtlasGlossaryTerm { + /** The GUID of the object. */ + guid?: string; + /** An array of classifications. */ + classifications?: AtlasClassification[]; + /** The long version description. */ + longDescription?: string; + /** The name of the glossary object. */ + name?: string; + /** The qualified name of the glossary object. */ + qualifiedName?: string; + /** The short version of description. */ + shortDescription?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The abbreviation of the term. */ + abbreviation?: string; + /** The name of the template. */ + templateName?: any[]; + /** The glossary header with basic information. */ + anchor?: AtlasGlossaryHeader; + /** An array of related term headers as antonyms. */ + antonyms?: AtlasRelatedTermHeader[]; + /** Status of the AtlasGlossaryTerm */ + status?: TermStatus; + /** The nick name of the term. */ + nickName?: string; + /** The hierarchy information of the term. */ + hierarchyInfo?: PurviewObjectId[]; + /** An array of resource link for term */ + resources?: ResourceLink[]; + /** The dictionary of contacts for terms. Key could be Expert or Steward. */ + contacts?: Record; + /** + * The custom attributes of the term, which is map>. + * The + * key of the first layer map is term template name. + */ + attributes?: Record>; + /** An array of related object IDs. */ + assignedEntities?: AtlasRelatedObjectId[]; + /** An array of term categorization headers. */ + categories?: AtlasTermCategorizationHeader[]; + /** An array of related term headers. */ + classifies?: AtlasRelatedTermHeader[]; + /** An array of examples. */ + examples?: string[]; + /** An array of related term headers indicating the is-a relationship. */ + isA?: AtlasRelatedTermHeader[]; + /** An array of preferred related term headers. */ + preferredTerms?: AtlasRelatedTermHeader[]; + /** An array of related term headers that are preferred to. */ + preferredToTerms?: AtlasRelatedTermHeader[]; + /** An array of related term headers that are replaced by. */ + replacedBy?: AtlasRelatedTermHeader[]; + /** An array of related term headers for replacement. */ + replacementTerms?: AtlasRelatedTermHeader[]; + /** An array of related term headers for see also. */ + seeAlso?: AtlasRelatedTermHeader[]; + /** An array of related term headers as synonyms. */ + synonyms?: AtlasRelatedTermHeader[]; + /** An array of translated related term headers. */ + translatedTerms?: AtlasRelatedTermHeader[]; + /** An array of related term headers for translation. */ + translationTerms?: AtlasRelatedTermHeader[]; + /** The usage of the term. */ + usage?: string; + /** An array of related term headers as valid values. */ + validValues?: AtlasRelatedTermHeader[]; + /** An array of related term headers as valid values for other records. */ + validValuesFor?: AtlasRelatedTermHeader[]; +} + +export function atlasGlossaryTermSerializer(item: AtlasGlossaryTerm): any { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArraySerializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + abbreviation: item["abbreviation"], + templateName: !item["templateName"] + ? item["templateName"] + : item["templateName"].map((p: any) => { + return p; + }), + anchor: !item["anchor"] + ? item["anchor"] + : atlasGlossaryHeaderSerializer(item["anchor"]), + antonyms: !item["antonyms"] + ? item["antonyms"] + : atlasRelatedTermHeaderArraySerializer(item["antonyms"]), + status: item["status"], + nickName: item["nickName"], + hierarchyInfo: !item["hierarchyInfo"] + ? item["hierarchyInfo"] + : purviewObjectIdArraySerializer(item["hierarchyInfo"]), + resources: !item["resources"] + ? item["resources"] + : resourceLinkArraySerializer(item["resources"]), + contacts: !item["contacts"] + ? item["contacts"] + : contactInfoArrayRecordSerializer(item["contacts"]), + attributes: item["attributes"], + assignedEntities: !item["assignedEntities"] + ? item["assignedEntities"] + : atlasRelatedObjectIdArraySerializer(item["assignedEntities"]), + categories: !item["categories"] + ? item["categories"] + : atlasTermCategorizationHeaderArraySerializer(item["categories"]), + classifies: !item["classifies"] + ? item["classifies"] + : atlasRelatedTermHeaderArraySerializer(item["classifies"]), + examples: !item["examples"] + ? item["examples"] + : item["examples"].map((p: any) => { + return p; + }), + isA: !item["isA"] + ? item["isA"] + : atlasRelatedTermHeaderArraySerializer(item["isA"]), + preferredTerms: !item["preferredTerms"] + ? item["preferredTerms"] + : atlasRelatedTermHeaderArraySerializer(item["preferredTerms"]), + preferredToTerms: !item["preferredToTerms"] + ? item["preferredToTerms"] + : atlasRelatedTermHeaderArraySerializer(item["preferredToTerms"]), + replacedBy: !item["replacedBy"] + ? item["replacedBy"] + : atlasRelatedTermHeaderArraySerializer(item["replacedBy"]), + replacementTerms: !item["replacementTerms"] + ? item["replacementTerms"] + : atlasRelatedTermHeaderArraySerializer(item["replacementTerms"]), + seeAlso: !item["seeAlso"] + ? item["seeAlso"] + : atlasRelatedTermHeaderArraySerializer(item["seeAlso"]), + synonyms: !item["synonyms"] + ? item["synonyms"] + : atlasRelatedTermHeaderArraySerializer(item["synonyms"]), + translatedTerms: !item["translatedTerms"] + ? item["translatedTerms"] + : atlasRelatedTermHeaderArraySerializer(item["translatedTerms"]), + translationTerms: !item["translationTerms"] + ? item["translationTerms"] + : atlasRelatedTermHeaderArraySerializer(item["translationTerms"]), + usage: item["usage"], + validValues: !item["validValues"] + ? item["validValues"] + : atlasRelatedTermHeaderArraySerializer(item["validValues"]), + validValuesFor: !item["validValuesFor"] + ? item["validValuesFor"] + : atlasRelatedTermHeaderArraySerializer(item["validValuesFor"]), + }; +} + +export function atlasGlossaryTermDeserializer(item: any): AtlasGlossaryTerm { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArrayDeserializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + abbreviation: item["abbreviation"], + templateName: !item["templateName"] + ? item["templateName"] + : item["templateName"].map((p: any) => { + return p; + }), + anchor: !item["anchor"] + ? item["anchor"] + : atlasGlossaryHeaderDeserializer(item["anchor"]), + antonyms: !item["antonyms"] + ? item["antonyms"] + : atlasRelatedTermHeaderArrayDeserializer(item["antonyms"]), + status: item["status"], + nickName: item["nickName"], + hierarchyInfo: !item["hierarchyInfo"] + ? item["hierarchyInfo"] + : purviewObjectIdArrayDeserializer(item["hierarchyInfo"]), + resources: !item["resources"] + ? item["resources"] + : resourceLinkArrayDeserializer(item["resources"]), + contacts: !item["contacts"] + ? item["contacts"] + : contactInfoArrayRecordDeserializer(item["contacts"]), + attributes: item["attributes"], + assignedEntities: !item["assignedEntities"] + ? item["assignedEntities"] + : atlasRelatedObjectIdArrayDeserializer(item["assignedEntities"]), + categories: !item["categories"] + ? item["categories"] + : atlasTermCategorizationHeaderArrayDeserializer(item["categories"]), + classifies: !item["classifies"] + ? item["classifies"] + : atlasRelatedTermHeaderArrayDeserializer(item["classifies"]), + examples: !item["examples"] + ? item["examples"] + : item["examples"].map((p: any) => { + return p; + }), + isA: !item["isA"] + ? item["isA"] + : atlasRelatedTermHeaderArrayDeserializer(item["isA"]), + preferredTerms: !item["preferredTerms"] + ? item["preferredTerms"] + : atlasRelatedTermHeaderArrayDeserializer(item["preferredTerms"]), + preferredToTerms: !item["preferredToTerms"] + ? item["preferredToTerms"] + : atlasRelatedTermHeaderArrayDeserializer(item["preferredToTerms"]), + replacedBy: !item["replacedBy"] + ? item["replacedBy"] + : atlasRelatedTermHeaderArrayDeserializer(item["replacedBy"]), + replacementTerms: !item["replacementTerms"] + ? item["replacementTerms"] + : atlasRelatedTermHeaderArrayDeserializer(item["replacementTerms"]), + seeAlso: !item["seeAlso"] + ? item["seeAlso"] + : atlasRelatedTermHeaderArrayDeserializer(item["seeAlso"]), + synonyms: !item["synonyms"] + ? item["synonyms"] + : atlasRelatedTermHeaderArrayDeserializer(item["synonyms"]), + translatedTerms: !item["translatedTerms"] + ? item["translatedTerms"] + : atlasRelatedTermHeaderArrayDeserializer(item["translatedTerms"]), + translationTerms: !item["translationTerms"] + ? item["translationTerms"] + : atlasRelatedTermHeaderArrayDeserializer(item["translationTerms"]), + usage: item["usage"], + validValues: !item["validValues"] + ? item["validValues"] + : atlasRelatedTermHeaderArrayDeserializer(item["validValues"]), + validValuesFor: !item["validValuesFor"] + ? item["validValuesFor"] + : atlasRelatedTermHeaderArrayDeserializer(item["validValuesFor"]), + }; +} + +/** Status for term */ +export type TermStatus = "Draft" | "Approved" | "Alert" | "Expired"; + +export function purviewObjectIdArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return purviewObjectIdSerializer(item); + }); +} + +export function purviewObjectIdArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return purviewObjectIdDeserializer(item); + }); +} + +/** PurviewObjectId */ +export interface PurviewObjectId { + /** The GUID of the object. */ + guid?: string; + /** The name of the type. */ + typeName?: string; + /** The unique attributes of the object. */ + uniqueAttributes?: Record; + /** Name */ + name?: string; + /** Display text */ + displayText?: string; + /** Item path */ + itemPath?: string; + /** Resource Id */ + resourceId?: string; + /** Dictionary of */ + properties?: Record; +} + +export function purviewObjectIdSerializer(item: PurviewObjectId): any { + return { + guid: item["guid"], + typeName: item["typeName"], + uniqueAttributes: item["uniqueAttributes"], + name: item["name"], + displayText: item["displayText"], + itemPath: item["itemPath"], + resourceId: item["resourceId"], + properties: item["properties"], + }; +} + +export function purviewObjectIdDeserializer(item: any): PurviewObjectId { + return { + guid: item["guid"], + typeName: item["typeName"], + uniqueAttributes: item["uniqueAttributes"], + name: item["name"], + displayText: item["displayText"], + itemPath: item["itemPath"], + resourceId: item["resourceId"], + properties: item["properties"], + }; +} + +export function resourceLinkArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return resourceLinkSerializer(item); + }); +} + +export function resourceLinkArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return resourceLinkDeserializer(item); + }); +} + +/** ResourceLink */ +export interface ResourceLink { + /** Display name for url. */ + displayName?: string; + /** web url. http or https */ + url?: string; +} + +export function resourceLinkSerializer(item: ResourceLink): any { + return { displayName: item["displayName"], url: item["url"] }; +} + +export function resourceLinkDeserializer(item: any): ResourceLink { + return { + displayName: item["displayName"], + url: item["url"], + }; +} + +export function atlasRelatedObjectIdArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelatedObjectIdSerializer(item); + }); +} + +export function atlasRelatedObjectIdArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelatedObjectIdDeserializer(item); + }); +} + +/** + * Reference to an object-instance of AtlasEntity type used in relationship + * attribute values + */ +export interface AtlasRelatedObjectId { + /** The GUID of the object. */ + guid?: string; + /** The name of the type. */ + typeName?: string; + /** The unique attributes of the object. */ + uniqueAttributes?: Record; + /** The display text. */ + displayText?: string; + /** + * Status of the entity - can be active or deleted. Deleted entities are not + * removed. + */ + entityStatus?: EntityStatus; + /** Relationship type */ + relationshipType?: string; + /** + * Captures details of struct contents. Not instantiated directly, used only via + * AtlasEntity, AtlasClassification. + */ + relationshipAttributes?: AtlasStruct; + /** The GUID of the relationship. */ + relationshipGuid?: string; + /** The enum of relationship status. */ + relationshipStatus?: StatusAtlasRelationship; +} + +export function atlasRelatedObjectIdSerializer( + item: AtlasRelatedObjectId, +): any { + return { + guid: item["guid"], + typeName: item["typeName"], + uniqueAttributes: item["uniqueAttributes"], + displayText: item["displayText"], + entityStatus: item["entityStatus"], + relationshipType: item["relationshipType"], + relationshipAttributes: !item["relationshipAttributes"] + ? item["relationshipAttributes"] + : atlasStructSerializer(item["relationshipAttributes"]), + relationshipGuid: item["relationshipGuid"], + relationshipStatus: item["relationshipStatus"], + }; +} + +export function atlasRelatedObjectIdDeserializer( + item: any, +): AtlasRelatedObjectId { + return { + guid: item["guid"], + typeName: item["typeName"], + uniqueAttributes: item["uniqueAttributes"], + displayText: item["displayText"], + entityStatus: item["entityStatus"], + relationshipType: item["relationshipType"], + relationshipAttributes: !item["relationshipAttributes"] + ? item["relationshipAttributes"] + : atlasStructDeserializer(item["relationshipAttributes"]), + relationshipGuid: item["relationshipGuid"], + relationshipStatus: item["relationshipStatus"], + }; +} + +/** + * Captures details of struct contents. Not instantiated directly, used only via + * AtlasEntity, AtlasClassification. + */ +export interface AtlasStruct { + /** The attributes of the struct. */ + attributes?: Record; + /** The name of the type. */ + typeName?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; +} + +export function atlasStructSerializer(item: AtlasStruct): any { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + }; +} + +export function atlasStructDeserializer(item: any): AtlasStruct { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + }; +} + +/** Status for atlas relationship */ +export type StatusAtlasRelationship = "ACTIVE" | "DELETED"; + +export function atlasTermCategorizationHeaderArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasTermCategorizationHeaderSerializer(item); + }); +} + +export function atlasTermCategorizationHeaderArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasTermCategorizationHeaderDeserializer(item); + }); +} + +/** The basic information for term categorization. */ +export interface AtlasTermCategorizationHeader { + /** The GUID of the category. */ + categoryGuid?: string; + /** The description of the record. */ + description?: string; + /** The display text. */ + displayText?: string; + /** The GUID of the relationship. */ + relationGuid?: string; + /** The status of term relationship. */ + status?: AtlasTermRelationshipStatus; +} + +export function atlasTermCategorizationHeaderSerializer( + item: AtlasTermCategorizationHeader, +): any { + return { + categoryGuid: item["categoryGuid"], + description: item["description"], + displayText: item["displayText"], + relationGuid: item["relationGuid"], + status: item["status"], + }; +} + +export function atlasTermCategorizationHeaderDeserializer( + item: any, +): AtlasTermCategorizationHeader { + return { + categoryGuid: item["categoryGuid"], + description: item["description"], + displayText: item["displayText"], + relationGuid: item["relationGuid"], + status: item["status"], + }; +} + +/** The extended information of glossary. */ +export interface AtlasGlossaryExtInfo { + /** The GUID of the object. */ + guid?: string; + /** An array of classifications. */ + classifications?: AtlasClassification[]; + /** The long version description. */ + longDescription?: string; + /** The name of the glossary object. */ + name?: string; + /** The qualified name of the glossary object. */ + qualifiedName?: string; + /** The short version of description. */ + shortDescription?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** An array of categories. */ + categories?: AtlasRelatedCategoryHeader[]; + /** The language of the glossary. */ + language?: string; + /** An array of related term headers. */ + terms?: AtlasRelatedTermHeader[]; + /** The usage of the glossary. */ + usage?: string; + /** The glossary category information. */ + categoryInfo?: Record; + /** The glossary term information. */ + termInfo?: Record; +} + +export function atlasGlossaryExtInfoDeserializer( + item: any, +): AtlasGlossaryExtInfo { + return { + guid: item["guid"], + classifications: !item["classifications"] + ? item["classifications"] + : atlasClassificationArrayDeserializer(item["classifications"]), + longDescription: item["longDescription"], + name: item["name"], + qualifiedName: item["qualifiedName"], + shortDescription: item["shortDescription"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + categories: !item["categories"] + ? item["categories"] + : atlasRelatedCategoryHeaderArrayDeserializer(item["categories"]), + language: item["language"], + terms: !item["terms"] + ? item["terms"] + : atlasRelatedTermHeaderArrayDeserializer(item["terms"]), + usage: item["usage"], + categoryInfo: !item["categoryInfo"] + ? item["categoryInfo"] + : atlasGlossaryCategoryRecordDeserializer(item["categoryInfo"]), + termInfo: !item["termInfo"] + ? item["termInfo"] + : atlasGlossaryTermRecordDeserializer(item["termInfo"]), + }; +} + +export function atlasGlossaryCategoryRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasGlossaryCategorySerializer(item[key]); + }); + return result; +} + +export function atlasGlossaryCategoryRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasGlossaryCategoryDeserializer(item[key]); + }); + return result; +} + +export function atlasGlossaryTermRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasGlossaryTermSerializer(item[key]); + }); + return result; +} + +export function atlasGlossaryTermRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasGlossaryTermDeserializer(item[key]); + }); + return result; +} + +/** The search query of advanced search request. */ +export interface QueryOptions { + /** The keywords applied to all searchable fields. */ + keywords?: string; + /** + * The limit of the number of the search result. default value is 50; maximum + * value is 1000. + */ + limit?: number; + /** + * The token used to get next batch of data. Default 'Null' to get the first + * batch, and will return new token in each response unless there's no more data. + */ + continuationToken?: string; + /** The sort order of search results, can specify multiple fields. */ + orderby?: any[]; + /** The filter for the search. See examples for the usage of supported filters. */ + filter?: any; + /** The facets for search. See examples for the usage of supported facets. */ + facets?: SearchFacetItem[]; + /** The taxonomy setting for search. */ + taxonomySetting?: SearchTaxonomySetting; +} + +export function queryOptionsSerializer(item: QueryOptions): any { + return { + keywords: item["keywords"], + limit: item["limit"], + continuationToken: item["continuationToken"], + orderby: !item["orderby"] + ? item["orderby"] + : item["orderby"].map((p: any) => { + return p; + }), + filter: item["filter"], + facets: !item["facets"] + ? item["facets"] + : searchFacetItemArraySerializer(item["facets"]), + taxonomySetting: !item["taxonomySetting"] + ? item["taxonomySetting"] + : searchTaxonomySettingSerializer(item["taxonomySetting"]), + }; +} + +export function searchFacetItemArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return searchFacetItemSerializer(item); + }); +} + +/** The content of a search facet result item. */ +export interface SearchFacetItem { + /** The count of the facet item. */ + count?: number; + /** The name of the facet item. */ + facet?: string; + /** Define the sorting criteria for items */ + sort?: SearchFacetSort; +} + +export function searchFacetItemSerializer(item: SearchFacetItem): any { + return { + count: item["count"], + facet: item["facet"], + sort: !item["sort"] + ? item["sort"] + : searchFacetSortSerializer(item["sort"]), + }; +} + +/** The sorting criteria */ +export interface SearchFacetSort { + /** Order by count */ + count?: SearchSortOrder; + /** Order by value */ + value?: SearchSortOrder; +} + +export function searchFacetSortSerializer(item: SearchFacetSort): any { + return { count: item["count"], value: item["value"] }; +} + +/** Search sort order */ +export type SearchSortOrder = "asc" | "desc"; + +/** Taxonomy setting for search request */ +export interface SearchTaxonomySetting { + /** Asset types */ + assetTypes?: string[]; + /** The content of a search facet result item. */ + facet?: SearchFacetItem; +} + +export function searchTaxonomySettingSerializer( + item: SearchTaxonomySetting, +): any { + return { + assetTypes: !item["assetTypes"] + ? item["assetTypes"] + : item["assetTypes"].map((p: any) => { + return p; + }), + facet: !item["facet"] + ? item["facet"] + : searchFacetItemSerializer(item["facet"]), + }; +} + +/** The result of the search result. */ +export interface QueryResult { + /** + * The total number of search results (not the number of documents in a single + * page). + */ + searchCount?: number; + /** 'True' if the '@search.count' is an approximate value and vise versa. */ + searchCountApproximate?: boolean; + /** The token used to get next batch of data. Absent if there's no more data. */ + continuationToken?: string; + /** + * A facet list that consists of index fields assetType ,classification, + * contactId, and label. When the facet is specified in the request, the value of + * the facet is returned as an element of @search.facets. + */ + searchFacets?: SearchFacetResultValue; + /** Search result value */ + value?: SearchResultValue[]; +} + +export function queryResultDeserializer(item: any): QueryResult { + return { + searchCount: item["@search.count"], + searchCountApproximate: item["@search.count.approximate"], + continuationToken: item["continuationToken"], + searchFacets: !item["@search.facets"] + ? item["@search.facets"] + : searchFacetResultValueDeserializer(item["@search.facets"]), + value: !item["value"] + ? item["value"] + : searchResultValueArrayDeserializer(item["value"]), + }; +} + +/** + * A facet list that consists of index fields assetType ,classification, + * contactId, and label. When the facet is specified in the request, the value of + * the facet is returned as an element of @search.facets. + */ +export interface SearchFacetResultValue { + /** Entity type */ + entityType?: SearchFacetItemValue[]; + /** Asset type */ + assetType?: SearchFacetItemValue[]; + /** Classification */ + classification?: SearchFacetItemValue[]; + /** Term */ + term?: SearchFacetItemValue[]; + /** Contact id */ + contactId?: SearchFacetItemValue[]; + /** Contact type */ + contactType?: SearchFacetItemValue[]; + /** Label */ + label?: SearchFacetItemValue[]; + /** Glossary type */ + glossaryType?: SearchFacetItemValue[]; + /** Term status */ + termStatus?: SearchFacetItemValue[]; + /** Term template */ + termTemplate?: SearchFacetItemValue[]; +} + +export function searchFacetResultValueDeserializer( + item: any, +): SearchFacetResultValue { + return { + entityType: !item["entityType"] + ? item["entityType"] + : searchFacetItemValueArrayDeserializer(item["entityType"]), + assetType: !item["assetType"] + ? item["assetType"] + : searchFacetItemValueArrayDeserializer(item["assetType"]), + classification: !item["classification"] + ? item["classification"] + : searchFacetItemValueArrayDeserializer(item["classification"]), + term: !item["term"] + ? item["term"] + : searchFacetItemValueArrayDeserializer(item["term"]), + contactId: !item["contactId"] + ? item["contactId"] + : searchFacetItemValueArrayDeserializer(item["contactId"]), + contactType: !item["contactType"] + ? item["contactType"] + : searchFacetItemValueArrayDeserializer(item["contactType"]), + label: !item["label"] + ? item["label"] + : searchFacetItemValueArrayDeserializer(item["label"]), + glossaryType: !item["glossaryType"] + ? item["glossaryType"] + : searchFacetItemValueArrayDeserializer(item["glossaryType"]), + termStatus: !item["termStatus"] + ? item["termStatus"] + : searchFacetItemValueArrayDeserializer(item["termStatus"]), + termTemplate: !item["termTemplate"] + ? item["termTemplate"] + : searchFacetItemValueArrayDeserializer(item["termTemplate"]), + }; +} + +export function searchFacetItemValueArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return searchFacetItemValueDeserializer(item); + }); +} + +/** The content of a search facet result item. */ +export interface SearchFacetItemValue { + /** The count of the facet item. */ + count?: number; + /** The name of the facet item. */ + value?: string; +} + +export function searchFacetItemValueDeserializer( + item: any, +): SearchFacetItemValue { + return { + count: item["count"], + value: item["value"], + }; +} + +export function searchResultValueArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return searchResultValueDeserializer(item); + }); +} + +/** The value item of the search result. */ +export interface SearchResultValue { + /** + * The search score calculated by the search engine. The results are ordered by + * search score by default. + */ + searchScore?: number; + /** + * A highlight list that consists of index fields id ,qualifiedName, name, + * description, entityType. When the keyword appears in those fields, the value of + * the field, attached with emphasis mark, is returned as an element of + * @search.highlights. + */ + searchHighlights?: SearchHighlights; + /** + * The object type of the record. Object type is the top-level property to + * distinguish whether a record is an asset or a term. + */ + objectType?: string; + /** The create time of the record. The Unix epoch format. */ + createTime?: number; + /** The last update time of the record. The Unix epoch format. */ + updateTime?: number; + /** The GUID of the record. */ + id?: string; + /** The name of the record. */ + name?: string; + /** The qualified name of the record. */ + qualifiedName?: string; + /** The type name of the asset. */ + entityType?: string; + /** The description of the asset. */ + description?: string; + /** The endorsement of the asset. */ + endorsement?: string[]; + /** The owner of the record. */ + owner?: string; + /** The classifications of the record. */ + classification?: string[]; + /** The labels of the asset. */ + label?: string[]; + /** The terms assigned to the asset. */ + term?: TermSearchResultValue[]; + /** The contacts of the asset. */ + contact?: ContactSearchResultValue[]; + /** The asset types of the asset. */ + assetType?: string[]; + /** + * The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + * AtlasGlossaryCategory. + */ + glossaryType?: string; + /** The glossary name of the term. */ + glossary?: string; + /** The status of the term. */ + termStatus?: string; + /** The term template names used by the term. */ + termTemplate?: string[]; + /** The definition of the term. */ + longDescription?: string; +} + +export function searchResultValueDeserializer(item: any): SearchResultValue { + return { + searchScore: item["@search.score"], + searchHighlights: !item["@search.highlights"] + ? item["@search.highlights"] + : searchHighlightsDeserializer(item["@search.highlights"]), + objectType: item["objectType"], + createTime: item["createTime"], + updateTime: item["updateTime"], + id: item["id"], + name: item["name"], + qualifiedName: item["qualifiedName"], + entityType: item["entityType"], + description: item["description"], + endorsement: !item["endorsement"] + ? item["endorsement"] + : item["endorsement"].map((p: any) => { + return p; + }), + owner: item["owner"], + classification: !item["classification"] + ? item["classification"] + : item["classification"].map((p: any) => { + return p; + }), + label: !item["label"] + ? item["label"] + : item["label"].map((p: any) => { + return p; + }), + term: !item["term"] + ? item["term"] + : termSearchResultValueArrayDeserializer(item["term"]), + contact: !item["contact"] + ? item["contact"] + : contactSearchResultValueArrayDeserializer(item["contact"]), + assetType: !item["assetType"] + ? item["assetType"] + : item["assetType"].map((p: any) => { + return p; + }), + glossaryType: item["glossaryType"], + glossary: item["glossary"], + termStatus: item["termStatus"], + termTemplate: !item["termTemplate"] + ? item["termTemplate"] + : item["termTemplate"].map((p: any) => { + return p; + }), + longDescription: item["longDescription"], + }; +} + +/** + * A highlight list that consists of index fields id ,qualifiedName, name, + * description, entityType. When the keyword appears in those fields, the value of + * the field, attached with emphasis mark, is returned as an element of + * @search.highlights. + */ +export interface SearchHighlights { + /** Id */ + id?: string[]; + /** Qualified name */ + qualifiedName?: string[]; + /** Name */ + name?: string[]; + /** Description */ + description?: string[]; + /** Entity type */ + entityType?: string[]; +} + +export function searchHighlightsDeserializer(item: any): SearchHighlights { + return { + id: !item["id"] + ? item["id"] + : item["id"].map((p: any) => { + return p; + }), + qualifiedName: !item["qualifiedName"] + ? item["qualifiedName"] + : item["qualifiedName"].map((p: any) => { + return p; + }), + name: !item["name"] + ? item["name"] + : item["name"].map((p: any) => { + return p; + }), + description: !item["description"] + ? item["description"] + : item["description"].map((p: any) => { + return p; + }), + entityType: !item["entityType"] + ? item["entityType"] + : item["entityType"].map((p: any) => { + return p; + }), + }; +} + +export function termSearchResultValueArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return termSearchResultValueDeserializer(item); + }); +} + +/** The context. */ +export interface TermSearchResultValue { + /** The name of the term. */ + name?: string; + /** The name of the glossary which contains the term. */ + glossaryName?: string; + /** The GUID of the term. */ + guid?: string; +} + +export function termSearchResultValueDeserializer( + item: any, +): TermSearchResultValue { + return { + name: item["name"], + glossaryName: item["glossaryName"], + guid: item["guid"], + }; +} + +export function contactSearchResultValueArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return contactSearchResultValueDeserializer(item); + }); +} + +/** The contact in the search and suggest result. */ +export interface ContactSearchResultValue { + /** The GUID of the contact. */ + id?: string; + /** The description of the contact. */ + info?: string; + /** + * The type of the contact. It can be Expert or Owner for an entity. It can be + * Expert or Steward for a glossary term. + */ + contactType?: string; +} + +export function contactSearchResultValueDeserializer( + item: any, +): ContactSearchResultValue { + return { + id: item["id"], + info: item["info"], + contactType: item["contactType"], + }; +} + +/** The payload of suggest request. */ +export interface SuggestOptions { + /** + * The keywords applied to all fields that support suggest operation. It must be + * at least 1 character, and no more than 100 characters. In the index schema we + * defined a default suggester which lists all the supported fields and specifies + * a search mode. + */ + keywords?: string; + /** + * The number of suggestions we hope to return. The default value is 5. The value + * must be a number between 1 and 100. + */ + limit?: number; + /** The filter for the search. */ + filter?: any; +} + +export function suggestOptionsSerializer(item: SuggestOptions): any { + return { + keywords: item["keywords"], + limit: item["limit"], + filter: item["filter"], + }; +} + +/** The result item of the search suggest. */ +export interface SuggestResult { + /** The result value */ + value?: SuggestResultValue[]; +} + +export function suggestResultDeserializer(item: any): SuggestResult { + return { + value: !item["value"] + ? item["value"] + : suggestResultValueArrayDeserializer(item["value"]), + }; +} + +export function suggestResultValueArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return suggestResultValueDeserializer(item); + }); +} + +/** The value item of the search suggest. */ +export interface SuggestResultValue { + /** + * The search score calculated by the search engine. The results are ordered by + * search score by default. + */ + searchScore?: number; + /** + * The target text that contains the keyword as prefix. The keyword is wrapped + * with emphasis mark. + */ + searchText?: string; + /** + * The object type of the record. Object type is the top-level property to + * distinguish whether a record is an asset or a term. + */ + objectType?: string; + /** The create time of the record. The Unix epoch format. */ + createTime?: number; + /** The last update time of the record. The Unix epoch format. */ + updateTime?: number; + /** The GUID of the record. */ + id?: string; + /** The name of the record. */ + name?: string; + /** The qualified name of the record. */ + qualifiedName?: string; + /** The type name of the asset. */ + entityType?: string; + /** The description of the asset. */ + description?: string; + /** The endorsement of the asset. */ + endorsement?: string[]; + /** The owner of the record. */ + owner?: string; + /** The classifications of the record. */ + classification?: string[]; + /** The labels of the asset. */ + label?: string[]; + /** The terms assigned to the asset. */ + term?: TermSearchResultValue[]; + /** The contacts of the asset. */ + contact?: ContactSearchResultValue[]; + /** The asset types of the asset. */ + assetType?: string[]; + /** + * The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + * AtlasGlossaryCategory. + */ + glossaryType?: string; + /** The glossary name of the term. */ + glossary?: string; + /** The status of the term. */ + termStatus?: string; + /** The term template names used by the term. */ + termTemplate?: string[]; + /** The definition of the term. */ + longDescription?: string; +} + +export function suggestResultValueDeserializer(item: any): SuggestResultValue { + return { + searchScore: item["@search.score"], + searchText: item["@search.text"], + objectType: item["objectType"], + createTime: item["createTime"], + updateTime: item["updateTime"], + id: item["id"], + name: item["name"], + qualifiedName: item["qualifiedName"], + entityType: item["entityType"], + description: item["description"], + endorsement: !item["endorsement"] + ? item["endorsement"] + : item["endorsement"].map((p: any) => { + return p; + }), + owner: item["owner"], + classification: !item["classification"] + ? item["classification"] + : item["classification"].map((p: any) => { + return p; + }), + label: !item["label"] + ? item["label"] + : item["label"].map((p: any) => { + return p; + }), + term: !item["term"] + ? item["term"] + : termSearchResultValueArrayDeserializer(item["term"]), + contact: !item["contact"] + ? item["contact"] + : contactSearchResultValueArrayDeserializer(item["contact"]), + assetType: !item["assetType"] + ? item["assetType"] + : item["assetType"].map((p: any) => { + return p; + }), + glossaryType: item["glossaryType"], + glossary: item["glossary"], + termStatus: item["termStatus"], + termTemplate: !item["termTemplate"] + ? item["termTemplate"] + : item["termTemplate"].map((p: any) => { + return p; + }), + longDescription: item["longDescription"], + }; +} + +/** The payload of autocomplete request. */ +export interface AutoCompleteOptions { + /** + * The keywords applied to all fields that support autocomplete operation. It must + * be at least 1 character, and no more than 100 characters. + */ + keywords?: string; + /** + * The number of autocomplete results we hope to return. The default value is 50. + * The value must be a number between 1 and 100. + */ + limit?: number; + /** The filter for the autocomplete request. */ + filter?: any; +} + +export function autoCompleteOptionsSerializer(item: AutoCompleteOptions): any { + return { + keywords: item["keywords"], + limit: item["limit"], + filter: item["filter"], + }; +} + +/** The result of the autocomplete request. */ +export interface AutoCompleteResult { + /** The result value */ + value?: AutoCompleteResultValue[]; +} + +export function autoCompleteResultDeserializer(item: any): AutoCompleteResult { + return { + value: !item["value"] + ? item["value"] + : autoCompleteResultValueArrayDeserializer(item["value"]), + }; +} + +export function autoCompleteResultValueArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return autoCompleteResultValueDeserializer(item); + }); +} + +/** The value item of the autocomplete suggest. */ +export interface AutoCompleteResultValue { + /** The completed term or phrase. */ + text?: string; + /** The completed search query text. */ + queryPlusText?: string; +} + +export function autoCompleteResultValueDeserializer( + item: any, +): AutoCompleteResultValue { + return { + text: item["text"], + queryPlusText: item["queryPlusText"], + }; +} + +/** The lineage information. */ +export interface AtlasLineageInfo { + /** The GUID of the base entity. */ + baseEntityGuid?: string; + /** The GUID entity map. */ + guidEntityMap?: Record; + /** The entity count in specific direction. */ + widthCounts?: Record>; + /** The depth of lineage. */ + lineageDepth?: number; + /** The width of lineage. */ + lineageWidth?: number; + /** The number of children node. */ + childrenCount?: number; + /** The enum of lineage direction. */ + lineageDirection?: LineageDirection; + /** An array of parentRelations relations. */ + parentRelations?: ParentRelation[]; + /** An array of lineage relations. */ + relations?: LineageRelation[]; +} + +export function atlasLineageInfoDeserializer(item: any): AtlasLineageInfo { + return { + baseEntityGuid: item["baseEntityGuid"], + guidEntityMap: !item["guidEntityMap"] + ? item["guidEntityMap"] + : atlasEntityHeaderRecordDeserializer(item["guidEntityMap"]), + widthCounts: item["widthCounts"], + lineageDepth: item["lineageDepth"], + lineageWidth: item["lineageWidth"], + childrenCount: item["childrenCount"], + lineageDirection: item["lineageDirection"], + parentRelations: !item["parentRelations"] + ? item["parentRelations"] + : parentRelationArrayDeserializer(item["parentRelations"]), + relations: !item["relations"] + ? item["relations"] + : lineageRelationArrayDeserializer(item["relations"]), + }; +} + +/** Lineage direction */ +export type LineageDirection = "INPUT" | "OUTPUT" | "BOTH"; + +export function parentRelationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return parentRelationDeserializer(item); + }); +} + +/** The lineage parents relation with GUID of the parent entity and to child entity. */ +export interface ParentRelation { + /** The GUID of child entity. */ + childEntityId?: string; + /** The GUID of relationship. */ + relationshipId?: string; + /** The GUID of parent entity. */ + parentEntityId?: string; +} + +export function parentRelationDeserializer(item: any): ParentRelation { + return { + childEntityId: item["childEntityId"], + relationshipId: item["relationshipId"], + parentEntityId: item["parentEntityId"], + }; +} + +export function lineageRelationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return lineageRelationDeserializer(item); + }); +} + +/** The lineage relation with GUID of the from and to entity. */ +export interface LineageRelation { + /** The GUID of from-entity. */ + fromEntityId?: string; + /** The GUID of relationship. */ + relationshipId?: string; + /** The GUID of to-entity. */ + toEntityId?: string; +} + +export function lineageRelationDeserializer(item: any): LineageRelation { + return { + fromEntityId: item["fromEntityId"], + relationshipId: item["relationshipId"], + toEntityId: item["toEntityId"], + }; +} + +/** Atlas relationship instance. */ +export interface AtlasRelationship { + /** The attributes of the struct. */ + attributes?: Record; + /** The name of the type. */ + typeName?: string; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** Reference to an object-instance of a type - like entity. */ + end1?: AtlasObjectId; + /** Reference to an object-instance of a type - like entity. */ + end2?: AtlasObjectId; + /** The GUID of the relationship. */ + guid?: string; + /** The home ID of the relationship. */ + homeId?: string; + /** The label of the relationship. */ + label?: string; + /** Used to record the provenance of an instance of an entity or relationship */ + provenanceType?: number; + /** The enum of relationship status. */ + status?: StatusAtlasRelationship; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the relationship. */ + version?: number; +} + +export function atlasRelationshipSerializer(item: AtlasRelationship): any { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + end1: !item["end1"] ? item["end1"] : atlasObjectIdSerializer(item["end1"]), + end2: !item["end2"] ? item["end2"] : atlasObjectIdSerializer(item["end2"]), + guid: item["guid"], + homeId: item["homeId"], + label: item["label"], + provenanceType: item["provenanceType"], + status: item["status"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + }; +} + +export function atlasRelationshipDeserializer(item: any): AtlasRelationship { + return { + attributes: item["attributes"], + typeName: item["typeName"], + lastModifiedTS: item["lastModifiedTS"], + createTime: item["createTime"], + createdBy: item["createdBy"], + end1: !item["end1"] + ? item["end1"] + : atlasObjectIdDeserializer(item["end1"]), + end2: !item["end2"] + ? item["end2"] + : atlasObjectIdDeserializer(item["end2"]), + guid: item["guid"], + homeId: item["homeId"], + label: item["label"], + provenanceType: item["provenanceType"], + status: item["status"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + }; +} + +/** Reference to an object-instance of a type - like entity. */ +export interface AtlasObjectId { + /** The GUID of the object. */ + guid?: string; + /** The name of the type. */ + typeName?: string; + /** The unique attributes of the object. */ + uniqueAttributes?: Record; +} + +export function atlasObjectIdSerializer(item: AtlasObjectId): any { + return { + guid: item["guid"], + typeName: item["typeName"], + uniqueAttributes: item["uniqueAttributes"], + }; +} + +export function atlasObjectIdDeserializer(item: any): AtlasObjectId { + return { + guid: item["guid"], + typeName: item["typeName"], + uniqueAttributes: item["uniqueAttributes"], + }; +} + +/** The relationship with extended information. */ +export interface AtlasRelationshipWithExtInfo { + /** The referred entity header. */ + referredEntities?: Record; + /** Atlas relationship instance. */ + relationship?: AtlasRelationship; +} + +export function atlasRelationshipWithExtInfoDeserializer( + item: any, +): AtlasRelationshipWithExtInfo { + return { + referredEntities: !item["referredEntities"] + ? item["referredEntities"] + : atlasEntityHeaderRecordDeserializer(item["referredEntities"]), + relationship: !item["relationship"] + ? item["relationship"] + : atlasRelationshipDeserializer(item["relationship"]), + }; +} + +/** class that captures details of a struct-type. */ +export interface AtlasBusinessMetadataDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; +} + +export function atlasBusinessMetadataDefSerializer( + item: AtlasBusinessMetadataDef, +): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArraySerializer(item["attributeDefs"]), + }; +} + +export function atlasBusinessMetadataDefDeserializer( + item: any, +): AtlasBusinessMetadataDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + }; +} + +/** Type Category */ +export type TypeCategory = + | "PRIMITIVE" + | "OBJECT_ID_TYPE" + | "ENUM" + | "STRUCT" + | "CLASSIFICATION" + | "ENTITY" + | "ARRAY" + | "MAP" + | "RELATIONSHIP" + | "TERM_TEMPLATE"; + +/** The date format. */ +export interface DateFormat { + /** An array of available locales. */ + availableLocales?: string[]; + /** Calendar */ + calendar?: number; + /** The date format. */ + dateInstance?: DateFormat; + /** The date format. */ + dateTimeInstance?: DateFormat; + /** The date format. */ + instance?: DateFormat; + /** Determines the leniency of the date format. */ + lenient?: boolean; + /** The number format. */ + numberFormat?: NumberFormat; + /** The date format. */ + timeInstance?: DateFormat; + /** The timezone information. */ + timeZone?: TimeZone; +} + +export function dateFormatSerializer(item: DateFormat): any { + return { + availableLocales: !item["availableLocales"] + ? item["availableLocales"] + : item["availableLocales"].map((p: any) => { + return p; + }), + calendar: item["calendar"], + dateInstance: !item["dateInstance"] + ? item["dateInstance"] + : dateFormatSerializer(item["dateInstance"]), + dateTimeInstance: !item["dateTimeInstance"] + ? item["dateTimeInstance"] + : dateFormatSerializer(item["dateTimeInstance"]), + instance: !item["instance"] + ? item["instance"] + : dateFormatSerializer(item["instance"]), + lenient: item["lenient"], + numberFormat: !item["numberFormat"] + ? item["numberFormat"] + : numberFormatSerializer(item["numberFormat"]), + timeInstance: !item["timeInstance"] + ? item["timeInstance"] + : dateFormatSerializer(item["timeInstance"]), + timeZone: !item["timeZone"] + ? item["timeZone"] + : timeZoneSerializer(item["timeZone"]), + }; +} + +export function dateFormatDeserializer(item: any): DateFormat { + return { + availableLocales: !item["availableLocales"] + ? item["availableLocales"] + : item["availableLocales"].map((p: any) => { + return p; + }), + calendar: item["calendar"], + dateInstance: !item["dateInstance"] + ? item["dateInstance"] + : dateFormatDeserializer(item["dateInstance"]), + dateTimeInstance: !item["dateTimeInstance"] + ? item["dateTimeInstance"] + : dateFormatDeserializer(item["dateTimeInstance"]), + instance: !item["instance"] + ? item["instance"] + : dateFormatDeserializer(item["instance"]), + lenient: item["lenient"], + numberFormat: !item["numberFormat"] + ? item["numberFormat"] + : numberFormatDeserializer(item["numberFormat"]), + timeInstance: !item["timeInstance"] + ? item["timeInstance"] + : dateFormatDeserializer(item["timeInstance"]), + timeZone: !item["timeZone"] + ? item["timeZone"] + : timeZoneDeserializer(item["timeZone"]), + }; +} + +/** The number format. */ +export interface NumberFormat { + /** The number format. */ + availableLocales?: string[]; + /** The currency. */ + currency?: string; + /** The number format. */ + currencyInstance?: NumberFormat; + /** Determines if grouping is used. */ + groupingUsed?: boolean; + /** The number format. */ + instance?: NumberFormat; + /** The number format. */ + integerInstance?: NumberFormat; + /** The maximum of fraction digits. */ + maximumFractionDigits?: number; + /** The maximum of integer digits. */ + maximumIntegerDigits?: number; + /** The minimum of fraction digits. */ + minimumFractionDigits?: number; + /** The minimum of integer digits. */ + minimumIntegerDigits?: number; + /** The number format. */ + numberInstance?: NumberFormat; + /** Determines if only integer is parsed. */ + parseIntegerOnly?: boolean; + /** The number format. */ + percentInstance?: NumberFormat; + /** The enum of rounding mode. */ + roundingMode?: RoundingMode; +} + +export function numberFormatSerializer(item: NumberFormat): any { + return { + availableLocales: !item["availableLocales"] + ? item["availableLocales"] + : item["availableLocales"].map((p: any) => { + return p; + }), + currency: item["currency"], + currencyInstance: !item["currencyInstance"] + ? item["currencyInstance"] + : numberFormatSerializer(item["currencyInstance"]), + groupingUsed: item["groupingUsed"], + instance: !item["instance"] + ? item["instance"] + : numberFormatSerializer(item["instance"]), + integerInstance: !item["integerInstance"] + ? item["integerInstance"] + : numberFormatSerializer(item["integerInstance"]), + maximumFractionDigits: item["maximumFractionDigits"], + maximumIntegerDigits: item["maximumIntegerDigits"], + minimumFractionDigits: item["minimumFractionDigits"], + minimumIntegerDigits: item["minimumIntegerDigits"], + numberInstance: !item["numberInstance"] + ? item["numberInstance"] + : numberFormatSerializer(item["numberInstance"]), + parseIntegerOnly: item["parseIntegerOnly"], + percentInstance: !item["percentInstance"] + ? item["percentInstance"] + : numberFormatSerializer(item["percentInstance"]), + roundingMode: item["roundingMode"], + }; +} + +export function numberFormatDeserializer(item: any): NumberFormat { + return { + availableLocales: !item["availableLocales"] + ? item["availableLocales"] + : item["availableLocales"].map((p: any) => { + return p; + }), + currency: item["currency"], + currencyInstance: !item["currencyInstance"] + ? item["currencyInstance"] + : numberFormatDeserializer(item["currencyInstance"]), + groupingUsed: item["groupingUsed"], + instance: !item["instance"] + ? item["instance"] + : numberFormatDeserializer(item["instance"]), + integerInstance: !item["integerInstance"] + ? item["integerInstance"] + : numberFormatDeserializer(item["integerInstance"]), + maximumFractionDigits: item["maximumFractionDigits"], + maximumIntegerDigits: item["maximumIntegerDigits"], + minimumFractionDigits: item["minimumFractionDigits"], + minimumIntegerDigits: item["minimumIntegerDigits"], + numberInstance: !item["numberInstance"] + ? item["numberInstance"] + : numberFormatDeserializer(item["numberInstance"]), + parseIntegerOnly: item["parseIntegerOnly"], + percentInstance: !item["percentInstance"] + ? item["percentInstance"] + : numberFormatDeserializer(item["percentInstance"]), + roundingMode: item["roundingMode"], + }; +} + +/** Rounding Mode */ +export type RoundingMode = + | "UP" + | "DOWN" + | "CEILING" + | "FLOOR" + | "HALF_UP" + | "HALF_DOWN" + | "HALF_EVEN" + | "UNNECESSARY"; + +/** The timezone information. */ +export interface TimeZone { + /** The value of the daylight saving time. */ + dstSavings?: number; + /** The ID of the timezone. */ + id?: string; + /** An array of available IDs. */ + availableIds?: string[]; + /** The timezone information. */ + default?: TimeZone; + /** The display name of the timezone. */ + displayName?: string; + /** The raw offset of the timezone. */ + rawOffset?: number; +} + +export function timeZoneSerializer(item: TimeZone): any { + return { + dstSavings: item["dstSavings"], + id: item["id"], + availableIds: !item["availableIds"] + ? item["availableIds"] + : item["availableIds"].map((p: any) => { + return p; + }), + default: !item["default"] + ? item["default"] + : timeZoneSerializer(item["default"]), + displayName: item["displayName"], + rawOffset: item["rawOffset"], + }; +} + +export function timeZoneDeserializer(item: any): TimeZone { + return { + dstSavings: item["dstSavings"], + id: item["id"], + availableIds: !item["availableIds"] + ? item["availableIds"] + : item["availableIds"].map((p: any) => { + return p; + }), + default: !item["default"] + ? item["default"] + : timeZoneDeserializer(item["default"]), + displayName: item["displayName"], + rawOffset: item["rawOffset"], + }; +} + +export function atlasAttributeDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasAttributeDefSerializer(item); + }); +} + +export function atlasAttributeDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasAttributeDefDeserializer(item); + }); +} + +/** class that captures details of a struct-attribute. */ +export interface AtlasAttributeDef { + /** single-valued attribute or multi-valued attribute. */ + cardinality?: CardinalityValue; + /** An array of constraints. */ + constraints?: AtlasConstraintDef[]; + /** The default value of the attribute. */ + defaultValue?: string; + /** The description of the attribute. */ + description?: string; + /** Determines if it is included in notification. */ + includeInNotification?: boolean; + /** Determines if it is indexable. */ + isIndexable?: boolean; + /** Determines if it is optional. */ + isOptional?: boolean; + /** Determines if it unique. */ + isUnique?: boolean; + /** The name of the attribute. */ + name?: string; + /** The options for the attribute. */ + options?: Record; + /** The name of the type. */ + typeName?: string; + /** The maximum count of the values. */ + valuesMaxCount?: number; + /** The minimum count of the values. */ + valuesMinCount?: number; +} + +export function atlasAttributeDefSerializer(item: AtlasAttributeDef): any { + return { + cardinality: item["cardinality"], + constraints: !item["constraints"] + ? item["constraints"] + : atlasConstraintDefArraySerializer(item["constraints"]), + defaultValue: item["defaultValue"], + description: item["description"], + includeInNotification: item["includeInNotification"], + isIndexable: item["isIndexable"], + isOptional: item["isOptional"], + isUnique: item["isUnique"], + name: item["name"], + options: item["options"], + typeName: item["typeName"], + valuesMaxCount: item["valuesMaxCount"], + valuesMinCount: item["valuesMinCount"], + }; +} + +export function atlasAttributeDefDeserializer(item: any): AtlasAttributeDef { + return { + cardinality: item["cardinality"], + constraints: !item["constraints"] + ? item["constraints"] + : atlasConstraintDefArrayDeserializer(item["constraints"]), + defaultValue: item["defaultValue"], + description: item["description"], + includeInNotification: item["includeInNotification"], + isIndexable: item["isIndexable"], + isOptional: item["isOptional"], + isUnique: item["isUnique"], + name: item["name"], + options: item["options"], + typeName: item["typeName"], + valuesMaxCount: item["valuesMaxCount"], + valuesMinCount: item["valuesMinCount"], + }; +} + +/** Cardinality */ +export type CardinalityValue = "SINGLE" | "LIST" | "SET"; + +export function atlasConstraintDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasConstraintDefSerializer(item); + }); +} + +export function atlasConstraintDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasConstraintDefDeserializer(item); + }); +} + +/** class that captures details of a constraint. */ +export interface AtlasConstraintDef { + /** The parameters of the constraint definition. */ + params?: Record; + /** The type of the constraint. */ + type?: string; +} + +export function atlasConstraintDefSerializer(item: AtlasConstraintDef): any { + return { params: item["params"], type: item["type"] }; +} + +export function atlasConstraintDefDeserializer(item: any): AtlasConstraintDef { + return { + params: item["params"], + type: item["type"], + }; +} + +/** class that captures details of a classification-type. */ +export interface AtlasClassificationDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; + /** + * Specifying a list of entityType names in the classificationDef, ensures that + * classifications can + * only be applied to those entityTypes. + * + * Any subtypes of the entity types inherit the restriction. + * + * Any classificationDef subtypes inherit the parents entityTypes restrictions. + * + * Any classificationDef subtypes can further restrict the parents entityTypes + * restrictions by specifying a subset of the entityTypes. + * + * An empty entityTypes list when there are no parent restrictions means there are no + * restrictions. + * + * An empty entityTypes list when there are parent + * restrictions means that the subtype picks up the parents + * restrictions. + * + * If a list of entityTypes are supplied, where one inherits + * from another, this will be rejected. This should encourage cleaner + * classificationsDefs. + * + */ + entityTypes?: string[]; + /** An array of sub types. */ + subTypes?: string[]; + /** An array of super types. */ + superTypes?: string[]; +} + +export function atlasClassificationDefSerializer( + item: AtlasClassificationDef, +): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArraySerializer(item["attributeDefs"]), + entityTypes: !item["entityTypes"] + ? item["entityTypes"] + : item["entityTypes"].map((p: any) => { + return p; + }), + subTypes: !item["subTypes"] + ? item["subTypes"] + : item["subTypes"].map((p: any) => { + return p; + }), + superTypes: !item["superTypes"] + ? item["superTypes"] + : item["superTypes"].map((p: any) => { + return p; + }), + }; +} + +export function atlasClassificationDefDeserializer( + item: any, +): AtlasClassificationDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + entityTypes: !item["entityTypes"] + ? item["entityTypes"] + : item["entityTypes"].map((p: any) => { + return p; + }), + subTypes: !item["subTypes"] + ? item["subTypes"] + : item["subTypes"].map((p: any) => { + return p; + }), + superTypes: !item["superTypes"] + ? item["superTypes"] + : item["superTypes"].map((p: any) => { + return p; + }), + }; +} + +/** class that captures details of a entity-type. */ +export interface AtlasEntityDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; + /** An array of sub types. */ + subTypes?: string[]; + /** An array of super types. */ + superTypes?: string[]; + /** An array of relationship attributes. */ + relationshipAttributeDefs?: AtlasRelationshipAttributeDef[]; +} + +export function atlasEntityDefSerializer(item: AtlasEntityDef): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArraySerializer(item["attributeDefs"]), + subTypes: !item["subTypes"] + ? item["subTypes"] + : item["subTypes"].map((p: any) => { + return p; + }), + superTypes: !item["superTypes"] + ? item["superTypes"] + : item["superTypes"].map((p: any) => { + return p; + }), + relationshipAttributeDefs: !item["relationshipAttributeDefs"] + ? item["relationshipAttributeDefs"] + : atlasRelationshipAttributeDefArraySerializer( + item["relationshipAttributeDefs"], + ), + }; +} + +export function atlasEntityDefDeserializer(item: any): AtlasEntityDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + subTypes: !item["subTypes"] + ? item["subTypes"] + : item["subTypes"].map((p: any) => { + return p; + }), + superTypes: !item["superTypes"] + ? item["superTypes"] + : item["superTypes"].map((p: any) => { + return p; + }), + relationshipAttributeDefs: !item["relationshipAttributeDefs"] + ? item["relationshipAttributeDefs"] + : atlasRelationshipAttributeDefArrayDeserializer( + item["relationshipAttributeDefs"], + ), + }; +} + +export function atlasRelationshipAttributeDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelationshipAttributeDefSerializer(item); + }); +} + +export function atlasRelationshipAttributeDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelationshipAttributeDefDeserializer(item); + }); +} + +/** + * The relationshipEndDef represents an end of the relationship. The end of the + * relationship is defined by a type, an + * attribute name, cardinality and whether + * it is the container end of the relationship. + */ +export interface AtlasRelationshipAttributeDef { + /** single-valued attribute or multi-valued attribute. */ + cardinality?: CardinalityValue; + /** An array of constraints. */ + constraints?: AtlasConstraintDef[]; + /** The default value of the attribute. */ + defaultValue?: string; + /** The description of the attribute. */ + description?: string; + /** Determines if it is included in notification. */ + includeInNotification?: boolean; + /** Determines if it is indexable. */ + isIndexable?: boolean; + /** Determines if it is optional. */ + isOptional?: boolean; + /** Determines if it unique. */ + isUnique?: boolean; + /** The name of the attribute. */ + name?: string; + /** The options for the attribute. */ + options?: Record; + /** The name of the type. */ + typeName?: string; + /** The maximum count of the values. */ + valuesMaxCount?: number; + /** The minimum count of the values. */ + valuesMinCount?: number; + /** Determines if it is a legacy attribute. */ + isLegacyAttribute?: boolean; + /** The name of the relationship type. */ + relationshipTypeName?: string; +} + +export function atlasRelationshipAttributeDefSerializer( + item: AtlasRelationshipAttributeDef, +): any { + return { + cardinality: item["cardinality"], + constraints: !item["constraints"] + ? item["constraints"] + : atlasConstraintDefArraySerializer(item["constraints"]), + defaultValue: item["defaultValue"], + description: item["description"], + includeInNotification: item["includeInNotification"], + isIndexable: item["isIndexable"], + isOptional: item["isOptional"], + isUnique: item["isUnique"], + name: item["name"], + options: item["options"], + typeName: item["typeName"], + valuesMaxCount: item["valuesMaxCount"], + valuesMinCount: item["valuesMinCount"], + isLegacyAttribute: item["isLegacyAttribute"], + relationshipTypeName: item["relationshipTypeName"], + }; +} + +export function atlasRelationshipAttributeDefDeserializer( + item: any, +): AtlasRelationshipAttributeDef { + return { + cardinality: item["cardinality"], + constraints: !item["constraints"] + ? item["constraints"] + : atlasConstraintDefArrayDeserializer(item["constraints"]), + defaultValue: item["defaultValue"], + description: item["description"], + includeInNotification: item["includeInNotification"], + isIndexable: item["isIndexable"], + isOptional: item["isOptional"], + isUnique: item["isUnique"], + name: item["name"], + options: item["options"], + typeName: item["typeName"], + valuesMaxCount: item["valuesMaxCount"], + valuesMinCount: item["valuesMinCount"], + isLegacyAttribute: item["isLegacyAttribute"], + relationshipTypeName: item["relationshipTypeName"], + }; +} + +/** class that captures details of an enum-type. */ +export interface AtlasEnumDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** The default value. */ + defaultValue?: string; + /** An array of enum element definitions. */ + elementDefs?: AtlasEnumElementDef[]; +} + +export function atlasEnumDefSerializer(item: AtlasEnumDef): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + defaultValue: item["defaultValue"], + elementDefs: !item["elementDefs"] + ? item["elementDefs"] + : atlasEnumElementDefArraySerializer(item["elementDefs"]), + }; +} + +export function atlasEnumDefDeserializer(item: any): AtlasEnumDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + defaultValue: item["defaultValue"], + elementDefs: !item["elementDefs"] + ? item["elementDefs"] + : atlasEnumElementDefArrayDeserializer(item["elementDefs"]), + }; +} + +export function atlasEnumElementDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEnumElementDefSerializer(item); + }); +} + +export function atlasEnumElementDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEnumElementDefDeserializer(item); + }); +} + +/** class that captures details of an enum-element. */ +export interface AtlasEnumElementDef { + /** The description of the enum element definition. */ + description?: string; + /** The ordinal of the enum element definition. */ + ordinal?: number; + /** The value of the enum element definition. */ + value?: string; +} + +export function atlasEnumElementDefSerializer(item: AtlasEnumElementDef): any { + return { + description: item["description"], + ordinal: item["ordinal"], + value: item["value"], + }; +} + +export function atlasEnumElementDefDeserializer( + item: any, +): AtlasEnumElementDef { + return { + description: item["description"], + ordinal: item["ordinal"], + value: item["value"], + }; +} + +/** + * AtlasRelationshipDef is a TypeDef that defines a relationship. + * As with other typeDefs the AtlasRelationshipDef has a name. Once created the + * RelationshipDef has a guid. + * The name and the guid are the 2 ways that the + * RelationshipDef is identified. + * RelationshipDefs have 2 ends, each of which + * specify cardinality, an EntityDef type name and name and optionally + * whether the + * end is a container. + * RelationshipDefs can have AttributeDefs - though only + * primitive types are allowed. + * RelationshipDefs have a relationshipCategory + * specifying the UML type of relationship required + * The way EntityDefs and + * RelationshipDefs are intended to be used is that EntityDefs will define + * AttributeDefs these AttributeDefs + * will not specify an EntityDef type name as + * their types. + * RelationshipDefs introduce new attributes to the entity + * instances. For example + * EntityDef A might have attributes attr1,attr2,attr3 + * + * EntityDef B might have attributes attr4,attr5,attr6 + * RelationshipDef + * AtoB might define 2 ends + * + * end1: type A, name attr7 + * end2: type B, name attr8 + * + * When an instance of EntityDef A is created, it + * will have attributes attr1,attr2,attr3,attr7 + * When an instance of EntityDef + * B is created, it will have attributes attr4,attr5,attr6,attr8 + * + * In this way + * relationshipDefs can be authored separately from entityDefs and can inject + * relationship attributes into + * the entity instances + */ +export interface AtlasRelationshipDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; + /** + * The relationshipEndDef represents an end of the relationship. The end of the + * relationship is defined by a type, an + * attribute name, cardinality and whether + * it is the container end of the relationship. + */ + endDef1?: AtlasRelationshipEndDef; + /** + * The relationshipEndDef represents an end of the relationship. The end of the + * relationship is defined by a type, an + * attribute name, cardinality and whether + * it is the container end of the relationship. + */ + endDef2?: AtlasRelationshipEndDef; + /** + * The Relationship category determines the style of relationship around + * containment and lifecycle. + * UML terminology is used for the values. + * ASSOCIATION is a relationship with no containment. + * COMPOSITION and AGGREGATION are containment relationships. + * The difference being in the lifecycles of the container and its children. + * In the COMPOSITION case, the children cannot exist without the container. + * For AGGREGATION, the life cycles of the container and children are totally independent. + */ + relationshipCategory?: RelationshipCategory; + /** The label of the relationship. */ + relationshipLabel?: string; +} + +export function atlasRelationshipDefSerializer( + item: AtlasRelationshipDef, +): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArraySerializer(item["attributeDefs"]), + endDef1: !item["endDef1"] + ? item["endDef1"] + : atlasRelationshipEndDefSerializer(item["endDef1"]), + endDef2: !item["endDef2"] + ? item["endDef2"] + : atlasRelationshipEndDefSerializer(item["endDef2"]), + relationshipCategory: item["relationshipCategory"], + relationshipLabel: item["relationshipLabel"], + }; +} + +export function atlasRelationshipDefDeserializer( + item: any, +): AtlasRelationshipDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + endDef1: !item["endDef1"] + ? item["endDef1"] + : atlasRelationshipEndDefDeserializer(item["endDef1"]), + endDef2: !item["endDef2"] + ? item["endDef2"] + : atlasRelationshipEndDefDeserializer(item["endDef2"]), + relationshipCategory: item["relationshipCategory"], + relationshipLabel: item["relationshipLabel"], + }; +} + +/** + * The relationshipEndDef represents an end of the relationship. The end of the + * relationship is defined by a type, an + * attribute name, cardinality and whether + * it is the container end of the relationship. + */ +export interface AtlasRelationshipEndDef { + /** single-valued attribute or multi-valued attribute. */ + cardinality?: CardinalityValue; + /** The description of the relationship end definition. */ + description?: string; + /** Determines if it is container. */ + isContainer?: boolean; + /** Determines if it is a legacy attribute. */ + isLegacyAttribute?: boolean; + /** The name of the relationship end definition. */ + name?: string; + /** The type of the relationship end. */ + type?: string; +} + +export function atlasRelationshipEndDefSerializer( + item: AtlasRelationshipEndDef, +): any { + return { + cardinality: item["cardinality"], + description: item["description"], + isContainer: item["isContainer"], + isLegacyAttribute: item["isLegacyAttribute"], + name: item["name"], + type: item["type"], + }; +} + +export function atlasRelationshipEndDefDeserializer( + item: any, +): AtlasRelationshipEndDef { + return { + cardinality: item["cardinality"], + description: item["description"], + isContainer: item["isContainer"], + isLegacyAttribute: item["isLegacyAttribute"], + name: item["name"], + type: item["type"], + }; +} + +/** Relationship Category */ +export type RelationshipCategory = + | "ASSOCIATION" + | "AGGREGATION" + | "COMPOSITION"; + +/** class that captures details of a struct-type. */ +export interface AtlasStructDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; +} + +export function atlasStructDefSerializer(item: AtlasStructDef): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArraySerializer(item["attributeDefs"]), + }; +} + +export function atlasStructDefDeserializer(item: any): AtlasStructDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + }; +} + +/** The definitions of type. */ +export interface AtlasTypeDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** + * Specifying a list of entityType names in the classificationDef, ensures that + * classifications can + * only be applied to those entityTypes. + * + * Any subtypes of the entity types inherit the restriction. + * + * Any classificationDef subtypes inherit the parents entityTypes restrictions. + * + * Any classificationDef subtypes can further restrict the parents entityTypes + * restrictions by specifying a subset of the entityTypes. + * + * An empty entityTypes list when there are no parent restrictions means there are no + * restrictions. + * + * An empty entityTypes list when there are parent + * restrictions means that the subtype picks up the parents + * restrictions. + * + * If a list of entityTypes are supplied, where one inherits + * from another, this will be rejected. This should encourage cleaner + * classificationsDefs. + * + */ + entityTypes?: string[]; + /** An array of sub types. */ + subTypes?: string[]; + /** An array of super types. */ + superTypes?: string[]; + /** An array of relationship attributes. */ + relationshipAttributeDefs?: AtlasRelationshipAttributeDef[]; + /** The default value. */ + defaultValue?: string; + /** An array of enum element definitions. */ + elementDefs?: AtlasEnumElementDef[]; + /** + * The relationshipEndDef represents an end of the relationship. The end of the + * relationship is defined by a type, an + * attribute name, cardinality and whether + * it is the container end of the relationship. + */ + endDef1?: AtlasRelationshipEndDef; + /** + * The relationshipEndDef represents an end of the relationship. The end of the + * relationship is defined by a type, an + * attribute name, cardinality and whether + * it is the container end of the relationship. + */ + endDef2?: AtlasRelationshipEndDef; + /** + * The Relationship category determines the style of relationship around + * containment and lifecycle. + * UML terminology is used for the values. + * + * ASSOCIATION is a relationship with no containment. + * COMPOSITION and AGGREGATION are containment relationships. + * + * The difference being in the lifecycles of the container and its children. + * In the COMPOSITION case, the children cannot exist without the container. + * For AGGREGATION, the life cycles of the container and children are totally independent. + */ + relationshipCategory?: RelationshipCategory; + /** The label of the relationship. */ + relationshipLabel?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; +} + +export function atlasTypeDefDeserializer(item: any): AtlasTypeDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + entityTypes: !item["entityTypes"] + ? item["entityTypes"] + : item["entityTypes"].map((p: any) => { + return p; + }), + subTypes: !item["subTypes"] + ? item["subTypes"] + : item["subTypes"].map((p: any) => { + return p; + }), + superTypes: !item["superTypes"] + ? item["superTypes"] + : item["superTypes"].map((p: any) => { + return p; + }), + relationshipAttributeDefs: !item["relationshipAttributeDefs"] + ? item["relationshipAttributeDefs"] + : atlasRelationshipAttributeDefArrayDeserializer( + item["relationshipAttributeDefs"], + ), + defaultValue: item["defaultValue"], + elementDefs: !item["elementDefs"] + ? item["elementDefs"] + : atlasEnumElementDefArrayDeserializer(item["elementDefs"]), + endDef1: !item["endDef1"] + ? item["endDef1"] + : atlasRelationshipEndDefDeserializer(item["endDef1"]), + endDef2: !item["endDef2"] + ? item["endDef2"] + : atlasRelationshipEndDefDeserializer(item["endDef2"]), + relationshipCategory: item["relationshipCategory"], + relationshipLabel: item["relationshipLabel"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + }; +} + +/** The definitions of types. */ +export interface AtlasTypesDef { + /** businessMetadataDefs */ + businessMetadataDefs?: AtlasBusinessMetadataDef[]; + /** An array of classification definitions. */ + classificationDefs?: AtlasClassificationDef[]; + /** An array of entity definitions. */ + entityDefs?: AtlasEntityDef[]; + /** An array of enum definitions. */ + enumDefs?: AtlasEnumDef[]; + /** An array of relationship definitions. */ + relationshipDefs?: AtlasRelationshipDef[]; + /** An array of struct definitions. */ + structDefs?: AtlasStructDef[]; + /** An array of term template definitions. */ + termTemplateDefs?: TermTemplateDef[]; +} + +export function atlasTypesDefSerializer(item: AtlasTypesDef): any { + return { + businessMetadataDefs: !item["businessMetadataDefs"] + ? item["businessMetadataDefs"] + : atlasBusinessMetadataDefArraySerializer(item["businessMetadataDefs"]), + classificationDefs: !item["classificationDefs"] + ? item["classificationDefs"] + : atlasClassificationDefArraySerializer(item["classificationDefs"]), + entityDefs: !item["entityDefs"] + ? item["entityDefs"] + : atlasEntityDefArraySerializer(item["entityDefs"]), + enumDefs: !item["enumDefs"] + ? item["enumDefs"] + : atlasEnumDefArraySerializer(item["enumDefs"]), + relationshipDefs: !item["relationshipDefs"] + ? item["relationshipDefs"] + : atlasRelationshipDefArraySerializer(item["relationshipDefs"]), + structDefs: !item["structDefs"] + ? item["structDefs"] + : atlasStructDefArraySerializer(item["structDefs"]), + termTemplateDefs: !item["termTemplateDefs"] + ? item["termTemplateDefs"] + : termTemplateDefArraySerializer(item["termTemplateDefs"]), + }; +} + +export function atlasTypesDefDeserializer(item: any): AtlasTypesDef { + return { + businessMetadataDefs: !item["businessMetadataDefs"] + ? item["businessMetadataDefs"] + : atlasBusinessMetadataDefArrayDeserializer(item["businessMetadataDefs"]), + classificationDefs: !item["classificationDefs"] + ? item["classificationDefs"] + : atlasClassificationDefArrayDeserializer(item["classificationDefs"]), + entityDefs: !item["entityDefs"] + ? item["entityDefs"] + : atlasEntityDefArrayDeserializer(item["entityDefs"]), + enumDefs: !item["enumDefs"] + ? item["enumDefs"] + : atlasEnumDefArrayDeserializer(item["enumDefs"]), + relationshipDefs: !item["relationshipDefs"] + ? item["relationshipDefs"] + : atlasRelationshipDefArrayDeserializer(item["relationshipDefs"]), + structDefs: !item["structDefs"] + ? item["structDefs"] + : atlasStructDefArrayDeserializer(item["structDefs"]), + termTemplateDefs: !item["termTemplateDefs"] + ? item["termTemplateDefs"] + : termTemplateDefArrayDeserializer(item["termTemplateDefs"]), + }; +} + +export function atlasBusinessMetadataDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasBusinessMetadataDefSerializer(item); + }); +} + +export function atlasBusinessMetadataDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasBusinessMetadataDefDeserializer(item); + }); +} + +export function atlasClassificationDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasClassificationDefSerializer(item); + }); +} + +export function atlasClassificationDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasClassificationDefDeserializer(item); + }); +} + +export function atlasEntityDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEntityDefSerializer(item); + }); +} + +export function atlasEntityDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEntityDefDeserializer(item); + }); +} + +export function atlasEnumDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEnumDefSerializer(item); + }); +} + +export function atlasEnumDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasEnumDefDeserializer(item); + }); +} + +export function atlasRelationshipDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelationshipDefSerializer(item); + }); +} + +export function atlasRelationshipDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasRelationshipDefDeserializer(item); + }); +} + +export function atlasStructDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasStructDefSerializer(item); + }); +} + +export function atlasStructDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasStructDefDeserializer(item); + }); +} + +export function termTemplateDefArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return termTemplateDefSerializer(item); + }); +} + +export function termTemplateDefArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return termTemplateDefDeserializer(item); + }); +} + +/** Term template definition for glossary term. */ +export interface TermTemplateDef { + /** The enum of type category. */ + category?: TypeCategory; + /** The created time of the record. */ + createTime?: number; + /** The user who created the record. */ + createdBy?: string; + /** The date format. */ + dateFormatter?: DateFormat; + /** The description of the type definition. */ + description?: string; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; + /** The options for the type definition. */ + options?: Record; + /** The service type. */ + serviceType?: string; + /** The version of the type. */ + typeVersion?: string; + /** The update time of the record. */ + updateTime?: number; + /** The user who updated the record. */ + updatedBy?: string; + /** The version of the record. */ + version?: number; + /** ETag for concurrency control. */ + lastModifiedTS?: string; + /** An array of attribute definitions. */ + attributeDefs?: AtlasAttributeDef[]; +} + +export function termTemplateDefSerializer(item: TermTemplateDef): any { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatSerializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArraySerializer(item["attributeDefs"]), + }; +} + +export function termTemplateDefDeserializer(item: any): TermTemplateDef { + return { + category: item["category"], + createTime: item["createTime"], + createdBy: item["createdBy"], + dateFormatter: !item["dateFormatter"] + ? item["dateFormatter"] + : dateFormatDeserializer(item["dateFormatter"]), + description: item["description"], + guid: item["guid"], + name: item["name"], + options: item["options"], + serviceType: item["serviceType"], + typeVersion: item["typeVersion"], + updateTime: item["updateTime"], + updatedBy: item["updatedBy"], + version: item["version"], + lastModifiedTS: item["lastModifiedTS"], + attributeDefs: !item["attributeDefs"] + ? item["attributeDefs"] + : atlasAttributeDefArrayDeserializer(item["attributeDefs"]), + }; +} + +/** The basic information of the type definition. */ +export interface AtlasTypeDefHeader { + /** The enum of type category. */ + category?: TypeCategory; + /** The GUID of the type definition. */ + guid?: string; + /** The name of the type definition. */ + name?: string; +} + +export function atlasTypeDefHeaderDeserializer(item: any): AtlasTypeDefHeader { + return { + category: item["category"], + guid: item["guid"], + name: item["name"], + }; +} + +/** Enum for business attribute update behavior */ +export type BusinessAttributeUpdateBehavior = "ignore" | "replace" | "merge"; + +/** Service API versions */ +export enum KnownApiVersions { + /** 2023-09-01 service API version */ + V20230901 = "2023-09-01", +} + +export function atlasTypeDefHeaderArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasTypeDefHeaderDeserializer(item); + }); +} + +export function atlasGlossaryArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasGlossarySerializer(item); + }); +} + +export function atlasGlossaryArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasGlossaryDeserializer(item); + }); +} + +export function atlasGlossaryCategoryArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasGlossaryCategorySerializer(item); + }); +} + +export function atlasGlossaryCategoryArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasGlossaryCategoryDeserializer(item); + }); +} + +export function atlasRelatedCategoryHeaderArrayRecordSerializer( + item: Record>, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasRelatedCategoryHeaderArraySerializer(item[key]); + }); + return result; +} + +export function atlasRelatedCategoryHeaderArrayRecordDeserializer( + item: Record, +): Record> { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasRelatedCategoryHeaderArrayDeserializer(item[key]); + }); + return result; +} + +export function atlasGlossaryTermArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasGlossaryTermSerializer(item); + }); +} + +export function atlasGlossaryTermArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return atlasGlossaryTermDeserializer(item); + }); +} + +export function atlasRelatedTermHeaderArrayRecordSerializer( + item: Record>, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasRelatedTermHeaderArraySerializer(item[key]); + }); + return result; +} + +export function atlasRelatedTermHeaderArrayRecordDeserializer( + item: Record, +): Record> { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : atlasRelatedTermHeaderArrayDeserializer(item[key]); + }); + return result; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/multipartHelpers.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/multipartHelpers.ts new file mode 100644 index 0000000000..a2770ad2ab --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/multipartHelpers.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * Valid values for the contents of a binary file. + */ +export type FileContents = + | string + | NodeJS.ReadableStream + | ReadableStream + | Uint8Array + | Blob; + +export function createFilePartDescriptor( + partName: string, + fileInput: any, + defaultContentType?: string, +): any { + if (fileInput.contents) { + return { + name: partName, + body: fileInput.contents, + contentType: fileInput.contentType ?? defaultContentType, + filename: fileInput.filename, + }; + } else { + return { + name: partName, + body: fileInput, + contentType: defaultContentType, + }; + } +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/urlTemplate.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/urlTemplate.ts new file mode 100644 index 0000000000..adb647540a --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/static-helpers/urlTemplate.ts @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//--------------------- +// interfaces +//--------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string) { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string) { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string) { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any) { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [ + !!op && [";", "?", "&"].includes(op), + !!op && ["?", "&"].includes(op) ? "=" : "", + ]; +} + +function getFirstOrSep(op?: string, isFirst = false) { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions) { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + named && val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions) { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:\*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/tsconfig.json b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/tsconfig.json new file mode 100644 index 0000000000..031889db45 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2017", + "module": "NodeNext", + "lib": [], + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "sourceMap": true, + "importHelpers": true, + "strict": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/client.tsp b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/client.tsp new file mode 100644 index 0000000000..60cd31555f --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/client.tsp @@ -0,0 +1,152 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using PurviewDataMap; + +@TypeSpec.Versioning.useDependency(PurviewDataMap.ApiVersions.v2023_09_01) +@client({ + name: "DataMapClient", + service: PurviewDataMap, +}) +namespace Customizations; + +@@clientName(MoveEntitiesOptions, "MoveEntitiesConfig", "csharp"); +@@clientName(DateFormat, "AtlasDateFormat", "csharp"); +@@clientName(NumberFormat, "AtlasNumberFormat", "csharp"); +@@clientName(TimeZone, "AtlasTimeZone", "csharp"); +@@clientName(SortType, "AtlasSortType", "csharp"); +@@clientName(ClassificationAssociateOptions, + "ClassificationAssociateConfig", + "csharp" +); +@@clientName(QueryOptions, "QueryConfig", "csharp"); +@@clientName(SuggestOptions, "SuggestConfig", "csharp"); +@@clientName(AutoCompleteOptions, "AutoCompleteConfig", "csharp"); + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@operationGroup +interface Entity { + createOrUpdate is PurviewDataMap.Entity.createOrUpdate; + getByIds is PurviewDataMap.Entity.listByGuids; + batchCreateOrUpdate is PurviewDataMap.Entity.bulkCreateOrUpdate; + batchDelete is PurviewDataMap.Entity.bulkDelete; + addClassification is PurviewDataMap.Entity.addClassification; + get is PurviewDataMap.Entity.get; + updateAttributeById is PurviewDataMap.Entity.partialUpdateAttributeByGuid; + delete is PurviewDataMap.Entity.delete; + getClassification is PurviewDataMap.Entity.getClassification; + removeClassification is PurviewDataMap.Entity.removeClassification; + getClassifications is PurviewDataMap.Entity.getClassifications; + addClassifications is PurviewDataMap.Entity.addClassifications; + updateClassifications is PurviewDataMap.Entity.updateClassifications; + getByUniqueAttribute is PurviewDataMap.Entity.getByUniqueAttributes; + updateByUniqueAttribute is PurviewDataMap.Entity.partialUpdateByUniqueAttributes; + deleteByUniqueAttribute is PurviewDataMap.Entity.deleteByUniqueAttribute; + removeClassificationByUniqueAttribute is PurviewDataMap.Entity.removeClassificationByUniqueAttribute; + addClassificationsByUniqueAttribute is PurviewDataMap.Entity.addClassificationsByUniqueAttribute; + updateClassificationsUniqueByAttribute is PurviewDataMap.Entity.updateClassificationsByUniqueAttribute; + batchSetClassifications is PurviewDataMap.Entity.bulkSetClassifications; + batchGetByUniqueAttributes is PurviewDataMap.Entity.listByUniqueAttributes; + getHeader is PurviewDataMap.Entity.getHeader; + removeBusinessMetadata is PurviewDataMap.Entity.removeBusinessMetadata; + addOrUpdateBusinessMetadata is PurviewDataMap.Entity.addOrUpdateBusinessMetadata; + removeBusinessMetadataAttributes is PurviewDataMap.Entity.removeBusinessMetadataAttributes; + addOrUpdateBusinessMetadataAttributes is PurviewDataMap.Entity.addOrUpdateBusinessMetadataAttributes; + getBusinessMetadataTemplate is PurviewDataMap.Entity.getSampleBusinessMetadataTemplate; + #suppress "@azure-tools/typespec-azure-core/byos" "This is Atlas API" + importBusinessMetadata is PurviewDataMap.Entity.importBusinessMetadata; + removeLabels is PurviewDataMap.Entity.removeLabels; + setLabels is PurviewDataMap.Entity.setLabels; + addLabel is PurviewDataMap.Entity.addLabel; + removeLabelsByUniqueAttribute is PurviewDataMap.Entity.removeLabelsByUniqueAttribute; + setLabelsByUniqueAttribute is PurviewDataMap.Entity.setLabelsByUniqueAttribute; + addLabelsByUniqueAttribute is PurviewDataMap.Entity.addLabelsByUniqueAttribute; + moveEntitiesToCollection is PurviewDataMap.Entity.moveEntitiesToCollection; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@operationGroup +interface Glossary { + batchGet is PurviewDataMap.Glossary.list; + create is PurviewDataMap.Glossary.create; + createCategories is PurviewDataMap.Glossary.createCategories; + createCategory is PurviewDataMap.Glossary.createCategory; + getCategory is PurviewDataMap.Glossary.getCategory; + updateCategory is PurviewDataMap.Glossary.updateCategory; + deleteCategory is PurviewDataMap.Glossary.deleteCategory; + partialUpdateCategory is PurviewDataMap.Glossary.partialUpdateCategory; + getRelatedCategories is PurviewDataMap.Glossary.listRelatedCategories; + getCategoryTerms is PurviewDataMap.Glossary.listCategoryTerms; + createTerm is PurviewDataMap.Glossary.createTerm; + getTerm is PurviewDataMap.Glossary.getTerm; + updateTerm is PurviewDataMap.Glossary.updateTerm; + deleteTerm is PurviewDataMap.Glossary.deleteTerm; + partialUpdateTerm is PurviewDataMap.Glossary.partialUpdateTerm; + createTerms is PurviewDataMap.Glossary.createTerms; + getEntitiesAssignedWithTerm is PurviewDataMap.Glossary.listEntitiesAssignedWithTerm; + assignTermToEntities is PurviewDataMap.Glossary.assignTermToEntities; + deleteTermAssignmentFromEntities is PurviewDataMap.Glossary.deleteTermAssignmentFromEntities; + getRelatedTerms is PurviewDataMap.Glossary.listRelatedTerms; + get is PurviewDataMap.Glossary.get; + update is PurviewDataMap.Glossary.update; + delete is PurviewDataMap.Glossary.delete; + getCategories is PurviewDataMap.Glossary.listCategories; + getCategoriesHeaders is PurviewDataMap.Glossary.listCategoriesHeaders; + getDetailed is PurviewDataMap.Glossary.getDetailed; + partialUpdate is PurviewDataMap.Glossary.partialUpdate; + getTerms is PurviewDataMap.Glossary.listTerms; + getTermHeaders is PurviewDataMap.Glossary.listTermHeaders; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@operationGroup +interface Discovery { + query is PurviewDataMap.Discovery.query; + suggest is PurviewDataMap.Discovery.suggest; + autoComplete is PurviewDataMap.Discovery.autoComplete; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@operationGroup +interface Lineage { + get is PurviewDataMap.Lineage.get; + getNextPage is PurviewDataMap.Lineage.getNextPage; + getByUniqueAttribute is PurviewDataMap.Lineage.getByUniqueAttribute; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@operationGroup +interface Relationship { + create is PurviewDataMap.Relationship.create; + update is PurviewDataMap.Relationship.update; + get is PurviewDataMap.Relationship.get; + delete is PurviewDataMap.Relationship.delete; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" +@operationGroup +interface TypeDefinition { + getBusinessMetadataById is PurviewDataMap.Type.getBusinessMetadataDefByGuid; + getBusinessMetadataByName is PurviewDataMap.Type.getBusinessMetadataDefByName; + getClassificationById is PurviewDataMap.Type.getClassificationDefByGuid; + getClassificationByName is PurviewDataMap.Type.getClassificationDefByName; + getEntityById is PurviewDataMap.Type.getEntityDefByGuid; + getEntityByName is PurviewDataMap.Type.getEntityDefByName; + getEnumById is PurviewDataMap.Type.getEnumDefByGuid; + getEnumByName is PurviewDataMap.Type.getEnumDefByName; + getRelationshipById is PurviewDataMap.Type.getRelationshipDefByGuid; + getRelationshipByName is PurviewDataMap.Type.getRelationshipDefByName; + getStructById is PurviewDataMap.Type.getStructDefByGuid; + getStructByName is PurviewDataMap.Type.getStructDefByName; + getById is PurviewDataMap.Type.getByGuid; + getByName is PurviewDataMap.Type.getByName; + delete is PurviewDataMap.Type.delete; + get is PurviewDataMap.Type.list; + batchCreate is PurviewDataMap.Type.bulkCreate; + batchUpdate is PurviewDataMap.Type.bulkUpdate; + batchDelete is PurviewDataMap.Type.bulkDelete; + getHeaders is PurviewDataMap.Type.listHeaders; + getTermTemplateById is PurviewDataMap.Type.getTermTemplateDefByGuid; + getTermTemplateByName is PurviewDataMap.Type.getTermTemplateDefByName; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/main.tsp b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/main.tsp new file mode 100644 index 0000000000..50c00da1fc --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/main.tsp @@ -0,0 +1,40 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using TypeSpec.Versioning; + +@service(#{ title: "Azure Analytics Purview Data Map" }) +@server( + "{endpoint}/datamap/api", + "Purview Data Map Service is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. At the same time, Data Map helps organizations get more value from their existing investments.", + { + endpoint: url, + } +) +@doc(""" + Purview Data Map Service is a fully managed cloud service whose users can + discover the data sources they need and understand the data sources they find. + At the same time, Data Map helps organizations get more value from their + existing investments. This spec defines REST API of Purview Data Map Service. + """) +@useAuth(AuthToken) +@versioned(ApiVersions) +namespace PurviewDataMap; + +@doc("Service API versions") +enum ApiVersions { + @doc("2023-09-01 service API version") + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + v2023_09_01: "2023-09-01", +} + +alias AuthToken = OAuth2Auth<[ + { + type: OAuth2FlowType.implicit; + authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize"; + scopes: ["https://purview.azure.net/.default"]; + } +]>; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/models.tsp b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/models.tsp new file mode 100644 index 0000000000..fdbb8d299a --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/models.tsp @@ -0,0 +1,1997 @@ +import "@typespec/http"; +import "@typespec/rest"; + +using TypeSpec.Rest; +using TypeSpec.Http; + +namespace PurviewDataMap; + +@doc("Enum for business attribute update behavior") +union BusinessAttributeUpdateBehavior { + string, + + @doc("Ignore the business attribute payload for update.") + Ignore: "ignore", + + @doc("Replace all the business attributes using the payload.") + Replace: "replace", + + @doc("Merge the business attributes. Business attributes will not be updated if not provided.") + Merge: "merge", +} + +@doc("Status - can be active or deleted") +union EntityStatus { + string, + + @doc("The status is active.") + Active: "ACTIVE", + + @doc("The status is deleted.") + Deleted: "DELETED", +} + +@doc("Status for term assignment") +union AtlasTermAssignmentStatus { + string, + + @doc("The status is discovered.") + Discovered: "DISCOVERED", + + @doc("The status is proposed.") + Proposed: "PROPOSED", + + @doc("The status is imported.") + Imported: "IMPORTED", + + @doc("The status is validated.") + Validated: "VALIDATED", + + @doc("The status is deprecated.") + Deprecated: "DEPRECATED", + + @doc("The status is obsolete.") + Obsolete: "OBSOLETE", + + @doc("Other status.") + Other: "OTHER", +} + +@doc("Type for sorting") +union SortType { + string, + + @doc("No sorting order") + None: "NONE", + + @doc("Use ascending order for sorting") + Ascend: "ASC", + + @doc("Use descending order for sorting") + Descend: "DESC", +} + +@doc("Status for import") +union ImportStatus { + string, + + @doc("Success") + Success: "SUCCESS", + + @doc("Failed") + Failed: "FAILED", +} + +@doc("Status for atlas term relationship") +union AtlasTermRelationshipStatus { + string, + + @doc("draft") + Draft: "DRAFT", + + @doc("active") + Active: "ACTIVE", + + @doc("deprecated") + Deprecated: "DEPRECATED", + + @doc("obsolete") + Obsolete: "OBSOLETE", + + @doc("other") + Other: "OTHER", +} + +@doc("Status for term") +union TermStatus { + string, + + @doc("draft") + Draft: "Draft", + + @doc("approved") + Approved: "Approved", + + @doc("alert") + Alert: "Alert", + + @doc("expired") + Expired: "Expired", +} + +@doc("Status for atlas relationship") +union StatusAtlasRelationship { + string, + + @doc("active") + Active: "ACTIVE", + + @doc("deleted") + Deleted: "DELETED", +} + +@doc("Lineage direction") +union LineageDirection { + string, + + @doc("input") + Input: "INPUT", + + @doc("output") + Output: "OUTPUT", + + @doc("both") + Both: "BOTH", +} + +@doc("Cardinality") +union CardinalityValue { + string, + + @doc("single") + Single: "SINGLE", + + @doc("list") + List: "LIST", + + @doc("set") + Set: "SET", +} + +@doc("Type Category") +union TypeCategory { + string, + + @doc("primitive") + Primitive: "PRIMITIVE", + + @doc("object id type") + ObjectIdType: "OBJECT_ID_TYPE", + + @doc("enum") + Enum: "ENUM", + + @doc("struct") + Struct: "STRUCT", + + @doc("classification") + Classification: "CLASSIFICATION", + + @doc("entity") + Entity: "ENTITY", + + @doc("array") + Array: "ARRAY", + + @doc("map") + Map: "MAP", + + @doc("relationship") + Relationship: "RELATIONSHIP", + + @doc("term template") + TermTemplate: "TERM_TEMPLATE", +} + +@doc("Rounding Mode") +union RoundingMode { + string, + + @doc("up") + Up: "UP", + + @doc("down") + Down: "DOWN", + + @doc("ceiling") + Ceiling: "CEILING", + + @doc("floor") + Floor: "FLOOR", + + @doc("half up") + HalfUp: "HALF_UP", + + @doc("half down") + HalfDown: "HALF_DOWN", + + @doc("half even") + HalfEven: "HALF_EVEN", + + @doc("unnecessary") + Unnecessary: "UNNECESSARY", +} + +@doc("Relationship Category") +union RelationshipCategory { + string, + + @doc("association") + Association: "ASSOCIATION", + + @doc("aggregation") + Aggregation: "AGGREGATION", + + @doc("composition") + Composition: "COMPOSITION", +} + +@doc("Search Filter Operator") +union FilterOperator { + string, + + @doc("equal") + eq: "eq", + + @doc("not equal") + ne: "ne", + + @doc("greater than") + gt: "gt", + + @doc("less than") + lt: "lt", + + @doc("greater than or equal to") + ge: "ge", + + @doc("less than or equal to") + le: "le", + + @doc("contains") + contains: "contains", + + @doc("start with") + startswith: "startswith", + + @doc("prefix") + prefix: "prefix", + + @doc("time range") + timerange: "timerange", + + @doc("exists") + exists: "exists", +} + +@doc(""" + An instance of an entity along with extended info - like hive_table, + hive_database. + """) +model AtlasEntityWithExtInfo { + ...AtlasEntityExtInfo; + + @doc("An instance of an entity - like hive_table, hive_database.") + entity?: AtlasEntity; +} + +@doc("An instance of an entity - like hive_table, hive_database.") +model AtlasEntity { + ...AtlasStruct; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Record to model Map" + @doc("Business attributes") + businessAttributes?: Record; + + @doc("An array of classifications.") + classifications?: AtlasClassification[]; + + @doc("The created time of the record.") + createTime?: safeint; + + @doc("The user who created the record.") + createdBy?: string; + + @doc("Custom Attribute") + customAttributes?: Record; + + @doc("The GUID of the entity.") + guid?: string; + + @doc("The home ID of the entity.") + homeId?: string; + + @doc("The collection ID of the entity.") + @visibility(Lifecycle.Read) + collectionId?: string; + + @doc("Whether it is a shell entity") + isIncomplete?: boolean; + + @doc("labels") + labels?: string[]; + + @doc("An array of term assignment headers indicating the meanings of the entity.") + meanings?: AtlasTermAssignmentHeader[]; + + @doc("Used to record the provenance of an instance of an entity or relationship.") + provenanceType?: int32; + + @doc("Determines if there's a proxy.") + proxy?: boolean; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Record to model Map" + @doc("The attributes of relationship.") + relationshipAttributes?: Record; + + @doc(""" + Status of the entity - can be active or deleted. Deleted entities are not + removed. + """) + status?: EntityStatus; + + @doc("The update time of the record.") + updateTime?: safeint; + + @doc("The user who updated the record.") + updatedBy?: string; + + @doc("The version of the entity.") + version?: int64; + + @doc("The dictionary of contacts for entities. Key could be Expert or Owner.") + contacts?: Record; +} + +@doc(""" + An instance of a classification; it doesn't have an identity, this object + exists only when associated with an entity. + """) +model AtlasClassification { + ...AtlasStruct; + + @doc("The GUID of the entity.") + entityGuid?: string; + + @doc(""" + Status of the entity - can be active or deleted. Deleted entities are not + removed. + """) + entityStatus?: EntityStatus; + + @doc("Determines if propagations will be removed on entity deletion.") + removePropagationsOnEntityDelete?: boolean; + + @doc("An array of time boundaries indicating validity periods.") + validityPeriods?: TimeBoundary[]; +} + +@doc("Captures time-boundary details") +model TimeBoundary { + @doc("The end of the time boundary.") + endTime?: string; + + @doc("The start of the time boundary.") + startTime?: string; + + @doc("The timezone of the time boundary.") + timeZone?: string; +} + +@doc(""" + Captures details of struct contents. Not instantiated directly, used only via + AtlasEntity, AtlasClassification. + """) +model AtlasStruct { + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Record to model Map" + @doc("The attributes of the struct.") + attributes?: Record; + + @doc("The name of the type.") + typeName?: string; + + #suppress "@azure-tools/typespec-azure-core/casing-style" "It is an Atlas model" + @doc("ETag for concurrency control.") + lastModifiedTS?: string; +} + +@doc("The header for term assignment.") +model AtlasTermAssignmentHeader { + @doc("The confidence of the term assignment.") + confidence?: int32; + + @doc("The user who created the record.") + createdBy?: string; + + @doc("The description of the term assignment.") + description?: string; + + @doc("The display text.") + displayText?: string; + + @doc("The expression of the term assignment.") + expression?: string; + + @doc("The GUID of the relationship.") + relationGuid?: Azure.Core.uuid; + + @doc("The status of terms assignment.") + status?: AtlasTermAssignmentStatus; + + @doc("The steward of the term.") + steward?: string; + + @doc("The GUID of the term.") + termGuid?: Azure.Core.uuid; +} + +@doc("ContactInfo") +model ContactInfo { + @doc("Azure Active Directory object Id.") + id?: string; + + @doc("additional information to describe this contact.") + info?: string; +} + +@doc(""" + An instance of an entity along with extended info - like hive_table, + hive_database. + """) +model AtlasEntityExtInfo { + @doc("The referred entities.") + referredEntities?: Record; +} + +@doc("The mutation response result of entity.") +model EntityMutationResult { + @doc("A map of GUID assignments with entities.") + guidAssignments?: Record; + + @doc("The entity headers of mutated entities.") + mutatedEntities?: Record; + + @doc("An array of entity headers that partially updated.") + partialUpdatedEntities?: AtlasEntityHeader[]; +} + +@doc("An instance of an entity - like hive_table, hive_database.") +model AtlasEntityHeader { + ...AtlasStruct; + + @doc("An array of classification names.") + classificationNames?: string[]; + + @doc("An array of classifications.") + classifications?: AtlasClassification[]; + + @doc("The display text.") + displayText?: string; + + @doc("The GUID of the record.") + guid?: string; + + @doc("Whether it is a shell entity") + isIncomplete?: boolean; + + @doc("labels") + labels?: string[]; + + @doc("An array of meanings.") + meaningNames?: string[]; + + @doc("An array of term assignment headers.") + meanings?: AtlasTermAssignmentHeader[]; + + @doc(""" + Status of the entity - can be active or deleted. Deleted entities are not + removed. + """) + status?: EntityStatus; +} + +@doc("An error response from the service") +@error +model AtlasErrorResponse { + @doc("The request ID.") + requestId?: Azure.Core.uuid; + + @doc("The error code.") + errorCode?: string; + + @doc("The error message.") + errorMessage?: string; +} + +@doc(""" + An instance of an entity along with extended info - like hive_table, + hive_database. + """) +model AtlasEntitiesWithExtInfo { + ...AtlasEntityExtInfo; + + @doc("An array of entities.") + entities?: AtlasEntity[]; +} + +@doc("The request payload for classification association.") +model ClassificationAssociateOptions { + @doc(""" + An instance of a classification; it doesn't have an identity, this object + exists only when associated with an entity. + """) + classification?: AtlasClassification; + + @doc("The GUID of the entity.") + entityGuids?: string[]; +} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" +@doc("REST serialization friendly list.") +model AtlasClassifications { + ...PList; +} + +#suppress "@azure-tools/typespec-azure-core/casing-style" "It is an Atlas model" +@doc("Paginated-list, for returning search results.") +model PList { + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object>" + @doc("An array of objects.") + list?: unknown[]; + + @doc("The size of the page.") + pageSize?: int32; + + @doc("The sorted by field.") + sortBy?: string; + + @doc("to specify whether the result should be sorted? If yes, whether asc or desc.") + sortType?: SortType; + + @doc("The start index of the page.") + startIndex?: int32; + + @doc("The total count of items.") + totalCount?: int32; +} + +@doc("An instance of an entity header map.") +model AtlasEntityHeaders { + @doc("The description of the guid header map,") + guidHeaderMap?: Record; +} + +@doc("Bulk import result") +model BulkImportResult { + @doc("failed importInfoList") + failedImportInfoList?: ImportInfo[]; + + @doc("successful importInfoList") + successImportInfoList?: ImportInfo[]; +} + +@doc("Business metadata to send to the service") +model BusinessMetadataOptions { + @doc("InputStream of file") + file: HttpPart; +} + +@doc("ImportInfo") +model ImportInfo { + @doc("childObjectName") + childObjectName?: string; + + @doc("importStatus") + importStatus?: ImportStatus; + + @doc("parentObjectName") + parentObjectName?: string; + + @doc("remarks") + remarks?: string; +} + +@doc("MoveEntitiesOptions") +model MoveEntitiesOptions { + @doc("An array of entity guids to be moved to target collection.") + entityGuids?: string[]; +} + +@doc("The glossary object.") +model AtlasGlossary { + ...AtlasGlossaryBaseObject; + + @doc("An array of categories.") + categories?: AtlasRelatedCategoryHeader[]; + + @doc("The language of the glossary.") + language?: string; + + @doc("An array of related term headers.") + terms?: AtlasRelatedTermHeader[]; + + @doc("The usage of the glossary.") + usage?: string; +} + +@doc("The header of the related category.") +model AtlasRelatedCategoryHeader { + @doc("The GUID of the category.") + categoryGuid?: string; + + @doc("The description of the category header.") + description?: string; + + @doc("The display text.") + displayText?: string; + + @doc("The GUID of the parent category.") + parentCategoryGuid?: string; + + @doc("The GUID of the relationship.") + relationGuid?: string; +} + +@doc("The header of the related term.") +model AtlasRelatedTermHeader { + @doc("The description of the related term.") + description?: string; + + @doc("The display text.") + displayText?: string; + + @doc("The expression of the term.") + expression?: string; + + @doc("The GUID of the relationship.") + relationGuid?: string; + + @doc("The status of term relationship.") + status?: AtlasTermRelationshipStatus; + + @doc("The steward of the term.") + steward?: string; + + @doc("The GUID of the term.") + termGuid?: string; +} + +@doc("The glossary base object.") +model AtlasGlossaryBaseObject { + ...AtlasBaseModelObject; + + @doc("An array of classifications.") + classifications?: AtlasClassification[]; + + @doc("The long version description.") + longDescription?: string; + + @doc("The name of the glossary object.") + name?: string; + + @doc("The qualified name of the glossary object.") + qualifiedName?: string; + + @doc("The short version of description.") + shortDescription?: string; + + #suppress "@azure-tools/typespec-azure-core/casing-style" "It is an Atlas model" + @doc("ETag for concurrency control.") + lastModifiedTS?: string; + + @doc("The created time of the record.") + createTime?: safeint; + + @doc("The user who created the record.") + createdBy?: string; + + @doc("The update time of the record.") + updateTime?: safeint; + + @doc("The user who updated the record.") + updatedBy?: string; +} + +alias AtlasBaseModelObject = { + @doc("The GUID of the object.") + guid?: string; +}; + +@doc("The glossary category.") +model AtlasGlossaryCategory { + ...AtlasGlossaryBaseObject; + + @doc("The glossary header with basic information.") + anchor?: AtlasGlossaryHeader; + + @doc("An array of children categories.") + childrenCategories?: AtlasRelatedCategoryHeader[]; + + @doc("The header of the related category.") + parentCategory?: AtlasRelatedCategoryHeader; + + @doc("An array of related term headers.") + terms?: AtlasRelatedTermHeader[]; +} + +@doc("The glossary header with basic information.") +model AtlasGlossaryHeader { + @doc("The display text.") + displayText?: string; + + @doc("The GUID of the glossary.") + glossaryGuid?: string; + + @doc("The GUID of the relationship.") + relationGuid?: string; +} + +@doc("The glossary term.") +model AtlasGlossaryTerm { + ...AtlasGlossaryBaseObject; + + @doc("The abbreviation of the term.") + abbreviation?: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + @doc("The name of the template.") + templateName?: unknown[]; + + @doc("The glossary header with basic information.") + anchor?: AtlasGlossaryHeader; + + @doc("An array of related term headers as antonyms.") + antonyms?: AtlasRelatedTermHeader[]; + + @doc("Status of the AtlasGlossaryTerm") + status?: TermStatus; + + @doc("The nick name of the term.") + nickName?: string; + + @doc("The hierarchy information of the term.") + hierarchyInfo?: PurviewObjectId[]; + + @doc("An array of resource link for term") + resources?: ResourceLink[]; + + @doc("The dictionary of contacts for terms. Key could be Expert or Steward.") + contacts?: Record; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Recode to model Map" + @doc(""" + The custom attributes of the term, which is map>. + The + key of the first layer map is term template name. + """) + attributes?: Record>; + + @doc("An array of related object IDs.") + assignedEntities?: AtlasRelatedObjectId[]; + + @doc("An array of term categorization headers.") + categories?: AtlasTermCategorizationHeader[]; + + @doc("An array of related term headers.") + classifies?: AtlasRelatedTermHeader[]; + + @doc("An array of examples.") + examples?: string[]; + + @doc("An array of related term headers indicating the is-a relationship.") + isA?: AtlasRelatedTermHeader[]; + + @doc("An array of preferred related term headers.") + preferredTerms?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers that are preferred to.") + preferredToTerms?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers that are replaced by.") + replacedBy?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers for replacement.") + replacementTerms?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers for see also.") + seeAlso?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers as synonyms.") + synonyms?: AtlasRelatedTermHeader[]; + + @doc("An array of translated related term headers.") + translatedTerms?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers for translation.") + translationTerms?: AtlasRelatedTermHeader[]; + + @doc("The usage of the term.") + usage?: string; + + @doc("An array of related term headers as valid values.") + validValues?: AtlasRelatedTermHeader[]; + + @doc("An array of related term headers as valid values for other records.") + validValuesFor?: AtlasRelatedTermHeader[]; +} + +@doc("PurviewObjectId") +model PurviewObjectId { + ...AtlasObjectId; + + @doc("Name") + name?: string; + + @doc("Display text") + displayText?: string; + + @doc("Item path") + itemPath?: string; + + @doc("Resource Id") + resourceId?: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Recode to model Map" + @doc("Dictionary of ") + properties?: Record; +} + +@doc("Reference to an object-instance of a type - like entity.") +model AtlasObjectId { + @doc("The GUID of the object.") + guid?: string; + + @doc("The name of the type.") + typeName?: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Recode to model Map" + @doc("The unique attributes of the object.") + uniqueAttributes?: Record; +} + +@doc("ResourceLink") +model ResourceLink { + @doc("Display name for url.") + displayName?: string; + + @doc("web url. http or https") + url?: string; +} + +@doc(""" + Reference to an object-instance of AtlasEntity type used in relationship + attribute values + """) +model AtlasRelatedObjectId { + ...AtlasObjectId; + + @doc("The display text.") + displayText?: string; + + @doc(""" + Status of the entity - can be active or deleted. Deleted entities are not + removed. + """) + entityStatus?: EntityStatus; + + @doc("Relationship type") + relationshipType?: string; + + @doc(""" + Captures details of struct contents. Not instantiated directly, used only via + AtlasEntity, AtlasClassification. + """) + relationshipAttributes?: AtlasStruct; + + @doc("The GUID of the relationship.") + relationshipGuid?: Azure.Core.uuid; + + @doc("The enum of relationship status.") + relationshipStatus?: StatusAtlasRelationship; +} + +@doc("The basic information for term categorization.") +model AtlasTermCategorizationHeader { + @doc("The GUID of the category.") + categoryGuid?: Azure.Core.uuid; + + @doc("The description of the record.") + description?: string; + + @doc("The display text.") + displayText?: string; + + @doc("The GUID of the relationship.") + relationGuid?: Azure.Core.uuid; + + @doc("The status of term relationship.") + status?: AtlasTermRelationshipStatus; +} + +@doc("The extended information of glossary.") +model AtlasGlossaryExtInfo { + ...AtlasGlossary; + + @doc("The glossary category information.") + categoryInfo?: Record; + + @doc("The glossary term information.") + termInfo?: Record; +} + +@doc("The search query of advanced search request.") +model QueryOptions { + @doc("The keywords applied to all searchable fields.") + keywords?: string; + + @doc(""" + The limit of the number of the search result. default value is 50; maximum + value is 1000. + """) + limit?: int32; + + @doc(""" + The token used to get next batch of data. Default 'Null' to get the first + batch, and will return new token in each response unless there's no more data. + """) + continuationToken?: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "This is a flexible property" + @doc("The sort order of search results, can specify multiple fields.") + orderby?: unknown[]; + + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc("The filter for the search. See examples for the usage of supported filters.") + filter?: unknown; + + @doc("The facets for search. See examples for the usage of supported facets.") + facets?: SearchFacetItem[]; + + @doc("The taxonomy setting for search.") + taxonomySetting?: SearchTaxonomySetting; +} + +@doc("The content of a search facet result item.") +model SearchFacetItem { + @doc("The count of the facet item.") + count?: int32; + + @doc("The name of the facet item.") + facet?: string; + + @doc("Define the sorting criteria for items") + sort?: SearchFacetSort; +} + +@doc("The sorting criteria") +model SearchFacetSort { + @doc("Order by count") + count?: SearchSortOrder; + + @doc("Order by value") + value?: SearchSortOrder; +} + +@doc("Search sort order") +union SearchSortOrder { + string, + + @doc("Use ascending order for sorting") + Ascend: "asc", + + @doc("Use descending order for sorting") + Descend: "desc", +} + +@doc("Taxonomy setting for search request") +model SearchTaxonomySetting { + @doc("Asset types") + assetTypes?: string[]; + + @doc("The content of a search facet result item.") + facet?: SearchFacetItem; +} + +@doc("The result of the search result.") +model QueryResult { + @doc(""" + The total number of search results (not the number of documents in a single + page). + """) + @encodedName("application/json", "@search.count") + searchCount?: int32; + + @doc("'True' if the '@search.count' is an approximate value and vise versa.") + @encodedName("application/json", "@search.count.approximate") + searchCountApproximate?: boolean; + + @doc("The token used to get next batch of data. Absent if there's no more data.") + continuationToken?: string; + + @doc(""" + A facet list that consists of index fields assetType ,classification, + contactId, and label. When the facet is specified in the request, the value of + the facet is returned as an element of @search.facets. + """) + @encodedName("application/json", "@search.facets") + searchFacets?: SearchFacetResultValue; + + @doc("Search result value") + value?: SearchResultValue[]; +} + +@doc(""" + A facet list that consists of index fields assetType ,classification, + contactId, and label. When the facet is specified in the request, the value of + the facet is returned as an element of @search.facets. + """) +model SearchFacetResultValue { + @doc("Entity type") + entityType?: SearchFacetItemValue[]; + + @doc("Asset type") + assetType?: SearchFacetItemValue[]; + + @doc("Classification") + classification?: SearchFacetItemValue[]; + + @doc("Term") + term?: SearchFacetItemValue[]; + + @doc("Contact id") + contactId?: SearchFacetItemValue[]; + + @doc("Contact type") + contactType?: SearchFacetItemValue[]; + + @doc("Label") + label?: SearchFacetItemValue[]; + + @doc("Glossary type") + glossaryType?: SearchFacetItemValue[]; + + @doc("Term status") + termStatus?: SearchFacetItemValue[]; + + @doc("Term template") + termTemplate?: SearchFacetItemValue[]; +} + +@doc("The content of a search facet result item.") +model SearchFacetItemValue { + @doc("The count of the facet item.") + count?: int32; + + @doc("The name of the facet item.") + value?: string; +} + +@doc("The value item of the search result.") +model SearchResultValue { + @doc(""" + The search score calculated by the search engine. The results are ordered by + search score by default. + """) + @encodedName("application/json", "@search.score") + searchScore?: float32; + + @doc(""" + A highlight list that consists of index fields id ,qualifiedName, name, + description, entityType. When the keyword appears in those fields, the value of + the field, attached with emphasis mark, is returned as an element of + @search.highlights. + """) + @encodedName("application/json", "@search.highlights") + searchHighlights?: SearchHighlights; + + @doc(""" + The object type of the record. Object type is the top-level property to + distinguish whether a record is an asset or a term. + """) + objectType?: string; + + @doc("The create time of the record. The Unix epoch format.") + createTime?: safeint; + + @doc("The last update time of the record. The Unix epoch format.") + updateTime?: safeint; + + @doc("The GUID of the record.") + id?: string; + + @doc("The name of the record.") + name?: string; + + @doc("The qualified name of the record.") + qualifiedName?: string; + + @doc("The type name of the asset.") + entityType?: string; + + @doc("The description of the asset.") + description?: string; + + @doc("The endorsement of the asset.") + endorsement?: string[]; + + @doc("The owner of the record.") + owner?: string; + + @doc("The classifications of the record.") + classification?: string[]; + + @doc("The labels of the asset.") + label?: string[]; + + @doc("The terms assigned to the asset.") + term?: TermSearchResultValue[]; + + @doc("The contacts of the asset.") + contact?: ContactSearchResultValue[]; + + @doc("The asset types of the asset.") + assetType?: string[]; + + @doc(""" + The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + AtlasGlossaryCategory. + """) + glossaryType?: string; + + @doc("The glossary name of the term.") + glossary?: string; + + @doc("The status of the term.") + termStatus?: string; + + @doc("The term template names used by the term.") + termTemplate?: string[]; + + @doc("The definition of the term.") + longDescription?: string; +} + +@doc(""" + A highlight list that consists of index fields id ,qualifiedName, name, + description, entityType. When the keyword appears in those fields, the value of + the field, attached with emphasis mark, is returned as an element of + @search.highlights. + """) +model SearchHighlights { + @doc("Id") + id?: string[]; + + @doc("Qualified name") + qualifiedName?: string[]; + + @doc("Name") + name?: string[]; + + @doc("Description") + description?: string[]; + + @doc("Entity type") + entityType?: string[]; +} + +@doc("The context.") +model TermSearchResultValue { + @doc("The name of the term.") + name?: string; + + @doc("The name of the glossary which contains the term.") + glossaryName?: string; + + @doc("The GUID of the term.") + guid?: string; +} + +@doc("The contact in the search and suggest result.") +model ContactSearchResultValue { + @doc("The GUID of the contact.") + id?: string; + + @doc("The description of the contact.") + info?: string; + + @doc(""" + The type of the contact. It can be Expert or Owner for an entity. It can be + Expert or Steward for a glossary term. + """) + contactType?: string; +} + +@doc("The payload of suggest request.") +model SuggestOptions { + @doc(""" + The keywords applied to all fields that support suggest operation. It must be + at least 1 character, and no more than 100 characters. In the index schema we + defined a default suggester which lists all the supported fields and specifies + a search mode. + """) + keywords?: string; + + @doc(""" + The number of suggestions we hope to return. The default value is 5. The value + must be a number between 1 and 100. + """) + limit?: int32; + + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc("The filter for the search.") + filter?: unknown; +} + +@doc("The result item of the search suggest.") +model SuggestResult { + @doc("The result value") + value?: SuggestResultValue[]; +} + +@doc("The value item of the search suggest.") +model SuggestResultValue { + @doc(""" + The search score calculated by the search engine. The results are ordered by + search score by default. + """) + @encodedName("application/json", "@search.score") + searchScore?: float32; + + @doc(""" + The target text that contains the keyword as prefix. The keyword is wrapped + with emphasis mark. + """) + @encodedName("application/json", "@search.text") + searchText?: string; + + @doc(""" + The object type of the record. Object type is the top-level property to + distinguish whether a record is an asset or a term. + """) + objectType?: string; + + @doc("The create time of the record. The Unix epoch format.") + createTime?: safeint; + + @doc("The last update time of the record. The Unix epoch format.") + updateTime?: safeint; + + @doc("The GUID of the record.") + id?: string; + + @doc("The name of the record.") + name?: string; + + @doc("The qualified name of the record.") + qualifiedName?: string; + + @doc("The type name of the asset.") + entityType?: string; + + @doc("The description of the asset.") + description?: string; + + @doc("The endorsement of the asset.") + endorsement?: string[]; + + @doc("The owner of the record.") + owner?: string; + + @doc("The classifications of the record.") + classification?: string[]; + + @doc("The labels of the asset.") + label?: string[]; + + @doc("The terms assigned to the asset.") + term?: TermSearchResultValue[]; + + @doc("The contacts of the asset.") + contact?: ContactSearchResultValue[]; + + @doc("The asset types of the asset.") + assetType?: string[]; + + @doc(""" + The type name of the term. Could be AtlasGlossary, AtlasGlossaryTerm or + AtlasGlossaryCategory. + """) + glossaryType?: string; + + @doc("The glossary name of the term.") + glossary?: string; + + @doc("The status of the term.") + termStatus?: string; + + @doc("The term template names used by the term.") + termTemplate?: string[]; + + @doc("The definition of the term.") + longDescription?: string; +} + +@doc("The payload of autocomplete request.") +model AutoCompleteOptions { + @doc(""" + The keywords applied to all fields that support autocomplete operation. It must + be at least 1 character, and no more than 100 characters. + """) + keywords?: string; + + @doc(""" + The number of autocomplete results we hope to return. The default value is 50. + The value must be a number between 1 and 100. + """) + limit?: int32; + + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc("The filter for the autocomplete request.") + filter?: unknown; +} + +@doc("The result of the autocomplete request.") +model AutoCompleteResult { + @doc("The result value") + value?: AutoCompleteResultValue[]; +} + +@doc("The value item of the autocomplete suggest.") +model AutoCompleteResultValue { + @doc("The completed term or phrase.") + text?: string; + + @doc("The completed search query text.") + queryPlusText?: string; +} + +@doc("The lineage information.") +model AtlasLineageInfo { + @doc("The GUID of the base entity.") + baseEntityGuid?: string; + + @doc("The GUID entity map.") + guidEntityMap?: Record; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use Record to model Map" + @doc("The entity count in specific direction.") + widthCounts?: Record>; + + @doc("The depth of lineage.") + lineageDepth?: int32; + + @doc("The width of lineage.") + lineageWidth?: int32; + + @doc("The number of children node.") + childrenCount?: int32; + + @doc("The enum of lineage direction.") + lineageDirection?: LineageDirection; + + @doc("An array of parentRelations relations.") + parentRelations?: ParentRelation[]; + + @doc("An array of lineage relations.") + relations?: LineageRelation[]; +} + +@doc("The lineage parents relation with GUID of the parent entity and to child entity.") +model ParentRelation { + @doc("The GUID of child entity.") + childEntityId?: string; + + @doc("The GUID of relationship.") + relationshipId?: string; + + @doc("The GUID of parent entity.") + parentEntityId?: string; +} + +@doc("The lineage relation with GUID of the from and to entity.") +model LineageRelation { + @doc("The GUID of from-entity.") + fromEntityId?: string; + + @doc("The GUID of relationship.") + relationshipId?: string; + + @doc("The GUID of to-entity.") + toEntityId?: string; +} + +@doc("Atlas relationship instance.") +model AtlasRelationship { + ...AtlasStruct; + + @doc("The created time of the record.") + createTime?: safeint; + + @doc("The user who created the record.") + createdBy?: string; + + @doc("Reference to an object-instance of a type - like entity.") + end1?: AtlasObjectId; + + @doc("Reference to an object-instance of a type - like entity.") + end2?: AtlasObjectId; + + @doc("The GUID of the relationship.") + guid?: string; + + @doc("The home ID of the relationship.") + homeId?: string; + + @doc("The label of the relationship.") + label?: string; + + @doc("Used to record the provenance of an instance of an entity or relationship") + provenanceType?: int32; + + @doc("The enum of relationship status.") + status?: StatusAtlasRelationship; + + @doc("The update time of the record.") + updateTime?: safeint; + + @doc("The user who updated the record.") + updatedBy?: string; + + @doc("The version of the relationship.") + version?: int64; +} + +@doc("The relationship with extended information.") +model AtlasRelationshipWithExtInfo { + @doc("The referred entity header.") + referredEntities?: Record; + + @doc("Atlas relationship instance.") + relationship?: AtlasRelationship; +} + +@doc("class that captures details of a struct-type.") +model AtlasBusinessMetadataDef { + ...AtlasStructDef; +} + +@doc("class that captures details of a struct-type.") +model AtlasStructDef { + ...AtlasBaseTypeDef; + + @doc("An array of attribute definitions.") + attributeDefs?: AtlasAttributeDef[]; +} + +@doc("class that captures details of a struct-attribute.") +model AtlasAttributeDef { + @doc("single-valued attribute or multi-valued attribute.") + cardinality?: CardinalityValue; + + @doc("An array of constraints.") + constraints?: AtlasConstraintDef[]; + + @doc("The default value of the attribute.") + defaultValue?: string; + + @doc("The description of the attribute.") + description?: string; + + @doc("Determines if it is included in notification.") + includeInNotification?: boolean; + + @doc("Determines if it is indexable.") + isIndexable?: boolean; + + @doc("Determines if it is optional.") + isOptional?: boolean; + + @doc("Determines if it unique.") + isUnique?: boolean; + + @doc("The name of the attribute.") + name?: string; + + @doc("The options for the attribute.") + options?: Record; + + @doc("The name of the type.") + typeName?: string; + + @doc("The maximum count of the values.") + valuesMaxCount?: int32; + + @doc("The minimum count of the values.") + valuesMinCount?: int32; +} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" +@doc("class that captures details of a constraint.") +model AtlasConstraintDef { + @doc("The parameters of the constraint definition.") + params?: Record; + + @doc("The type of the constraint.") + type?: string; +} + +alias AtlasBaseTypeDef = { + @doc("The enum of type category.") + category?: TypeCategory; + + @doc("The created time of the record.") + createTime?: safeint; + + @doc("The user who created the record.") + createdBy?: string; + + @doc("The date format.") + dateFormatter?: DateFormat; + + @doc("The description of the type definition.") + description?: string; + + @doc("The GUID of the type definition.") + guid?: string; + + @doc("The name of the type definition.") + name?: string; + + @doc("The options for the type definition.") + options?: Record; + + @doc("The service type.") + serviceType?: string; + + @doc("The version of the type.") + typeVersion?: string; + + @doc("The update time of the record.") + updateTime?: safeint; + + @doc("The user who updated the record.") + updatedBy?: string; + + @doc("The version of the record.") + version?: int64; + + #suppress "@azure-tools/typespec-azure-core/casing-style" "It is an Atlas model" + @doc("ETag for concurrency control.") + lastModifiedTS?: string; +}; + +@doc("The date format.") +model DateFormat { + @doc("An array of available locales.") + availableLocales?: string[]; + + @doc("Calendar") + calendar?: float32; + + @doc("The date format.") + dateInstance?: DateFormat; + + @doc("The date format.") + dateTimeInstance?: DateFormat; + + @doc("The date format.") + instance?: DateFormat; + + @doc("Determines the leniency of the date format.") + lenient?: boolean; + + @doc("The number format.") + numberFormat?: NumberFormat; + + @doc("The date format.") + timeInstance?: DateFormat; + + @doc("The timezone information.") + timeZone?: TimeZone; +} + +@doc("The number format.") +model NumberFormat { + @doc("The number format.") + availableLocales?: string[]; + + @doc("The currency.") + currency?: string; + + @doc("The number format.") + currencyInstance?: NumberFormat; + + @doc("Determines if grouping is used.") + groupingUsed?: boolean; + + @doc("The number format.") + instance?: NumberFormat; + + @doc("The number format.") + integerInstance?: NumberFormat; + + @doc("The maximum of fraction digits.") + maximumFractionDigits?: int32; + + @doc("The maximum of integer digits.") + maximumIntegerDigits?: int32; + + @doc("The minimum of fraction digits.") + minimumFractionDigits?: int32; + + @doc("The minimum of integer digits.") + minimumIntegerDigits?: int32; + + @doc("The number format.") + numberInstance?: NumberFormat; + + @doc("Determines if only integer is parsed.") + parseIntegerOnly?: boolean; + + @doc("The number format.") + percentInstance?: NumberFormat; + + @doc("The enum of rounding mode.") + roundingMode?: RoundingMode; +} + +@doc("The timezone information.") +model TimeZone { + @doc("The value of the daylight saving time.") + dstSavings?: int32; + + @doc("The ID of the timezone.") + id?: string; + + @doc("An array of available IDs.") + availableIds?: string[]; + + @doc("The timezone information.") + default?: TimeZone; + + @doc("The display name of the timezone.") + displayName?: string; + + @doc("The raw offset of the timezone.") + rawOffset?: int32; +} + +@doc("class that captures details of a classification-type.") +model AtlasClassificationDef { + ...AtlasStructDef; + + @doc(""" + Specifying a list of entityType names in the classificationDef, ensures that + classifications can + only be applied to those entityTypes. + + Any subtypes of the entity types inherit the restriction. + + Any classificationDef subtypes inherit the parents entityTypes restrictions. + + Any classificationDef subtypes can further restrict the parents entityTypes + restrictions by specifying a subset of the entityTypes. + + An empty entityTypes list when there are no parent restrictions means there are no + restrictions. + + An empty entityTypes list when there are parent + restrictions means that the subtype picks up the parents + restrictions. + + If a list of entityTypes are supplied, where one inherits + from another, this will be rejected. This should encourage cleaner + classificationsDefs. + + """) + entityTypes?: string[]; + + @doc("An array of sub types.") + subTypes?: string[]; + + @doc("An array of super types.") + superTypes?: string[]; +} + +@doc("class that captures details of a entity-type.") +model AtlasEntityDef { + ...AtlasStructDef; + + @doc("An array of sub types.") + subTypes?: string[]; + + @doc("An array of super types.") + superTypes?: string[]; + + @doc("An array of relationship attributes.") + relationshipAttributeDefs?: AtlasRelationshipAttributeDef[]; +} + +@doc(""" + The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + """) +model AtlasRelationshipAttributeDef { + ...AtlasAttributeDef; + + @doc("Determines if it is a legacy attribute.") + isLegacyAttribute?: boolean; + + @doc("The name of the relationship type.") + relationshipTypeName?: string; +} + +@doc("class that captures details of an enum-type.") +model AtlasEnumDef { + ...AtlasBaseTypeDef; + + @doc("The default value.") + defaultValue?: string; + + @doc("An array of enum element definitions.") + elementDefs?: AtlasEnumElementDef[]; +} + +@doc("class that captures details of an enum-element.") +model AtlasEnumElementDef { + @doc("The description of the enum element definition.") + description?: string; + + @doc("The ordinal of the enum element definition.") + ordinal?: int32; + + @doc("The value of the enum element definition.") + value?: string; +} + +@doc(""" + AtlasRelationshipDef is a TypeDef that defines a relationship. + As with other typeDefs the AtlasRelationshipDef has a name. Once created the + RelationshipDef has a guid. + The name and the guid are the 2 ways that the + RelationshipDef is identified. + RelationshipDefs have 2 ends, each of which + specify cardinality, an EntityDef type name and name and optionally + whether the + end is a container. + RelationshipDefs can have AttributeDefs - though only + primitive types are allowed. + RelationshipDefs have a relationshipCategory + specifying the UML type of relationship required + The way EntityDefs and + RelationshipDefs are intended to be used is that EntityDefs will define + AttributeDefs these AttributeDefs + will not specify an EntityDef type name as + their types. + RelationshipDefs introduce new attributes to the entity + instances. For example + EntityDef A might have attributes attr1,attr2,attr3 + + EntityDef B might have attributes attr4,attr5,attr6 + RelationshipDef + AtoB might define 2 ends + + end1: type A, name attr7 + end2: type B, name attr8 + + When an instance of EntityDef A is created, it + will have attributes attr1,attr2,attr3,attr7 + When an instance of EntityDef + B is created, it will have attributes attr4,attr5,attr6,attr8 + + In this way + relationshipDefs can be authored separately from entityDefs and can inject + relationship attributes into + the entity instances + """) +model AtlasRelationshipDef { + ...AtlasStructDef; + + @doc(""" + The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + """) + endDef1?: AtlasRelationshipEndDef; + + @doc(""" + The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + """) + endDef2?: AtlasRelationshipEndDef; + + @doc(""" + The Relationship category determines the style of relationship around + containment and lifecycle. + UML terminology is used for the values. + ASSOCIATION is a relationship with no containment. + COMPOSITION and AGGREGATION are containment relationships. + The difference being in the lifecycles of the container and its children. + In the COMPOSITION case, the children cannot exist without the container. + For AGGREGATION, the life cycles of the container and children are totally independent. + """) + relationshipCategory?: RelationshipCategory; + + @doc("The label of the relationship.") + relationshipLabel?: string; +} + +@doc(""" + The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + """) +model AtlasRelationshipEndDef { + @doc("single-valued attribute or multi-valued attribute.") + cardinality?: CardinalityValue; + + @doc("The description of the relationship end definition.") + description?: string; + + @doc("Determines if it is container.") + isContainer?: boolean; + + @doc("Determines if it is a legacy attribute.") + isLegacyAttribute?: boolean; + + @doc("The name of the relationship end definition.") + name?: string; + + @doc("The type of the relationship end.") + type?: string; +} + +@doc("The definitions of type.") +model AtlasTypeDef { + ...AtlasBaseTypeDef; + ...AtlasExtraTypeDef; +} + +@doc("Extra properties for a type.") +model AtlasExtraTypeDef { + @doc(""" + Specifying a list of entityType names in the classificationDef, ensures that + classifications can + only be applied to those entityTypes. + + Any subtypes of the entity types inherit the restriction. + + Any classificationDef subtypes inherit the parents entityTypes restrictions. + + Any classificationDef subtypes can further restrict the parents entityTypes + restrictions by specifying a subset of the entityTypes. + + An empty entityTypes list when there are no parent restrictions means there are no + restrictions. + + An empty entityTypes list when there are parent + restrictions means that the subtype picks up the parents + restrictions. + + If a list of entityTypes are supplied, where one inherits + from another, this will be rejected. This should encourage cleaner + classificationsDefs. + + """) + entityTypes?: string[]; + + @doc("An array of sub types.") + subTypes?: string[]; + + @doc("An array of super types.") + superTypes?: string[]; + + @doc("An array of relationship attributes.") + relationshipAttributeDefs?: AtlasRelationshipAttributeDef[]; + + @doc("The default value.") + defaultValue?: string; + + @doc("An array of enum element definitions.") + elementDefs?: AtlasEnumElementDef[]; + + @doc(""" + The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + """) + endDef1?: AtlasRelationshipEndDef; + + @doc(""" + The relationshipEndDef represents an end of the relationship. The end of the + relationship is defined by a type, an + attribute name, cardinality and whether + it is the container end of the relationship. + """) + endDef2?: AtlasRelationshipEndDef; + + @doc(""" + The Relationship category determines the style of relationship around + containment and lifecycle. + UML terminology is used for the values. + + ASSOCIATION is a relationship with no containment. + COMPOSITION and AGGREGATION are containment relationships. + + The difference being in the lifecycles of the container and its children. + In the COMPOSITION case, the children cannot exist without the container. + For AGGREGATION, the life cycles of the container and children are totally independent. + """) + relationshipCategory?: RelationshipCategory; + + @doc("The label of the relationship.") + relationshipLabel?: string; + + @doc("An array of attribute definitions.") + attributeDefs?: AtlasAttributeDef[]; +} + +@doc("The definitions of types.") +model AtlasTypesDef { + @doc("businessMetadataDefs") + businessMetadataDefs?: AtlasBusinessMetadataDef[]; + + @doc("An array of classification definitions.") + classificationDefs?: AtlasClassificationDef[]; + + @doc("An array of entity definitions.") + entityDefs?: AtlasEntityDef[]; + + @doc("An array of enum definitions.") + enumDefs?: AtlasEnumDef[]; + + @doc("An array of relationship definitions.") + relationshipDefs?: AtlasRelationshipDef[]; + + @doc("An array of struct definitions.") + structDefs?: AtlasStructDef[]; + + @doc("An array of term template definitions.") + termTemplateDefs?: TermTemplateDef[]; +} + +@doc("Term template definition for glossary term.") +model TermTemplateDef { + ...AtlasStructDef; +} + +@doc("The basic information of the type definition.") +model AtlasTypeDefHeader { + @doc("The enum of type category.") + category?: TypeCategory; + + @doc("The GUID of the type definition.") + guid?: string; + + @doc("The name of the type definition.") + name?: string; +} + +alias BodyParameter< + T, + TName extends valueof string = "body", + TDoc extends valueof string = "Body parameter." +> = { + #suppress "@azure-tools/typespec-azure-core/friendly-name" "Legacy" + @doc(TDoc) + @friendlyName(TName) + @bodyRoot + body: T; +}; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/routes.tsp b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/routes.tsp new file mode 100644 index 0000000000..cc25f0e4b7 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/spec/routes.tsp @@ -0,0 +1,2135 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/http"; +import "@typespec/versioning"; +import "@typespec/rest"; +import "./models.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; +using Azure.Core.Traits.Private; + +namespace PurviewDataMap; + +@doc("The ApiVersion query parameter for Atlas API.") +model AtlasApiVersionParameter { + @doc("The API version to use for this operation.") + @query("api-version") + @minLength(1) + apiVersion?: string; +} + +alias AtlasApiVersionParameterTraits = Azure.Core.Traits.VersionParameterTrait; + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" +@doc("The operation defined for Atlas APIs") +op AtlasOperation< + TParams extends TypeSpec.Reflection.Model, + TResponse, + Traits extends TypeSpec.Reflection.Model = {} +>( + ...TraitProperties, + ...TParams, +): TResponse | AtlasErrorResponse; + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" +op AtlasRpcOperation< + TParams extends TypeSpec.Reflection.Model, + TResponse extends TypeSpec.Reflection.Model, + Traits extends TypeSpec.Reflection.Model = {}, + TraitContexts extends TraitContext = TraitContext.Undefined +> is AtlasOperation< + TParams & TraitProperties, + TResponse & TraitProperties, + Traits +>; + +alias OkResponse = { + @statusCode + status: 200; + + @bodyRoot + data: T; +}; + +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" +op AtlasImportOperation< + TParams extends TypeSpec.Reflection.Model, + TResponse extends TypeSpec.Reflection.Model, + Traits extends TypeSpec.Reflection.Model = {}, + TraitContexts extends TraitContext = TraitContext.Undefined +> is AtlasOperation< + TParams & + TraitProperties< + Traits & + NoConditionalRequests & + NoRepeatableRequests & + NoClientRequestId, + TraitLocation.Parameters, + TraitContext.Action + >, + TResponse & + TraitProperties< + Traits & + NoConditionalRequests & + NoRepeatableRequests & + NoClientRequestId, + TraitLocation.Response, + TraitContext.Action + >, + Traits +>; + +alias MultipartFormDataRequestHeadersTraits = Azure.Core.Traits.RequestHeadersTrait<{ + @doc("The content type for the operation. Always multipart/form-data for this operation.") + @header("content-type") + contentType: "multipart/form-data"; +}>; + +interface Entity { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc(""" + Create or update an entity. + Existing entity is matched using its unique guid if + supplied or by its unique attributes eg: qualifiedName. + Map and array of + collections are not well supported. E.g., array>, array>. + For each contact type, the maximum number of contacts is 20. + """) + @route("/atlas/v2/entity") + @post + createOrUpdate is AtlasOperation< + { + @doc(""" + Used to define the update behavior for business attributes when updating + entities. + """) + @query + businessAttributeUpdateBehavior?: BusinessAttributeUpdateBehavior; + + @doc(""" + The collection where entities will be moved to. Only specify a value if you + need to move an entity to another collection. + """) + @query + collectionId?: string; + } & BodyParameter, + EntityMutationResult, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("List entities in bulk identified by its GUIDs.") + @route("/atlas/v2/entity/bulk") + @get + listByGuids is AtlasOperation< + { + #suppress "@azure-tools/typespec-azure-core/no-query-explode" "This is an existing Atlas API" + @doc("An array of GUIDs of entities to list.") + @query(#{ explode: true }) + guid: string[]; + + @doc("Whether to return minimal information for referred entities.") + @query + minExtInfo?: boolean; + + @doc("Whether to ignore relationship attributes.") + @query + ignoreRelationships?: boolean; + }, + AtlasEntitiesWithExtInfo, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc(""" + Create or update entities in bulk. + Existing entity is matched using its unique + guid if supplied or by its unique attributes eg: qualifiedName. + Map and array + of collections are not well supported. E.g., array>, + array>. + For each contact type, the maximum number of contacts + is 20. + """) + @route("/atlas/v2/entity/bulk") + @post + bulkCreateOrUpdate is AtlasOperation< + { + @doc(""" + The collection where entities will be moved to. Only specify a value if you + need to move an entity to another collection. + """) + @query + collectionId?: string; + + @doc(""" + Used to define the update behavior for business attributes when updating + entities. + """) + @query + businessAttributeUpdateBehavior?: BusinessAttributeUpdateBehavior; + } & BodyParameter, + EntityMutationResult, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/no-query-explode" "This is an existing Atlas API" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Delete a list of entities in bulk identified by their GUIDs or unique + attributes. + """) + @route("/atlas/v2/entity/bulk") + @delete + bulkDelete is AtlasOperation< + { + @doc("An array of GUIDs of entities to delete.") + @query(#{ explode: true }) + guid: string[]; + }, + EntityMutationResult, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Associate a classification to multiple entities in bulk.") + @route("/atlas/v2/entity/bulk/classification") + @post + addClassification is AtlasOperation< + BodyParameter, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get complete definition of an entity given its GUID.") + @route("/atlas/v2/entity/guid/{guid}") + @get + get is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("Whether to return minimal information for referred entities.") + @query + minExtInfo?: boolean; + + @doc("Whether to ignore relationship attributes.") + @query + ignoreRelationships?: boolean; + }, + AtlasEntityWithExtInfo, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Update entity partially - create or update entity attribute identified by its + GUID. + Supports only primitive attribute type and entity references. + It does not support updating complex types like arrays, and maps. + Null updates are not possible. + """) + @route("/atlas/v2/entity/guid/{guid}") + @put + partialUpdateAttributeByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("The name of the attribute.") + @query + name: string; + + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc("The value of the attribute.") + @bodyRoot + body: unknown; + }, + EntityMutationResult, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete an entity identified by its GUID.") + @route("/atlas/v2/entity/guid/{guid}") + @delete + delete is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + }, + EntityMutationResult, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get classification for a given entity represented by a GUID.") + @route("/atlas/v2/entity/guid/{guid}/classification/{classificationName}") + @get + getClassification is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("The name of the classification.") + @path + classificationName: string; + }, + AtlasClassification, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete a given classification from an existing entity represented by a GUID.") + @route("/atlas/v2/entity/guid/{guid}/classification/{classificationName}") + @delete + removeClassification is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("The name of the classification.") + @path + classificationName: string; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("List classifications for a given entity represented by a GUID.") + @route("/atlas/v2/entity/guid/{guid}/classifications") + @get + getClassifications is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + }, + AtlasClassifications, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Add classifications to an existing entity represented by a GUID.") + @route("/atlas/v2/entity/guid/{guid}/classifications") + @post + addClassifications is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("An array of classifications to be added.") + @bodyRoot + body: AtlasClassification[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Update classifications to an existing entity represented by a guid.") + @route("/atlas/v2/entity/guid/{guid}/classifications") + @put + updateClassifications is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("An array of classifications to be updated.") + @bodyRoot + body: AtlasClassification[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Get complete definition of an entity given its type and unique attribute. + + In + addition to the typeName path parameter, attribute key-value pair(s) can be + provided in the following format: + attr:\\=. + + NOTE: The + attrName and attrValue should be unique across entities, eg. + qualifiedName. + + The REST request would look something like this: + GET + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}") + @get + getByUniqueAttributes is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc("Whether to return minimal information for referred entities.") + @query + minExtInfo?: boolean; + + @doc("Whether to ignore relationship attributes.") + @query + ignoreRelationships?: boolean; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + }, + AtlasEntityWithExtInfo, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Update entity partially - Allow a subset of attributes to be updated on an + entity which is identified by its type and unique attribute eg: + Referenceable.qualifiedName. Null updates are not possible. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + + attr:=. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}") + @put + partialUpdateByUniqueAttributes is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + } & BodyParameter, + EntityMutationResult, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Delete an entity identified by its type and unique attributes. + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: + attr:\\=\\. + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: + DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}") + @delete + deleteByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + }, + EntityMutationResult, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Delete a given classification from an entity identified by its type and unique + attributes. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}/classification/{classificationName}") + @delete + removeClassificationByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc("The name of the classification.") + @path + classificationName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Add classification to the entity identified by its type and unique attributes.") + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}/classifications") + @post + addClassificationsByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + + @doc("An array of classification to be added.") + @bodyRoot + body: AtlasClassification[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Update classification on an entity identified by its type and unique attributes.") + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}/classifications") + @put + updateClassificationsByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + + @doc("An array of classification to be updated.") + @bodyRoot + body: AtlasClassification[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Set classifications on entities in bulk.") + @route("/atlas/v2/entity/bulk/setClassifications") + @post + bulkSetClassifications is AtlasOperation< + BodyParameter, + OkResponse, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/casing-style" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Bulk API to retrieve list of entities identified by its unique attributes. + In + addition to the typeName path parameter, attribute key-value pair(s) can be + provided in the following + format + + typeName=\\&attr_1:\\=\\&attr_2:\\=\\&attr_3:\\=\\ + + NOTE: + The attrName should be an unique attribute for the given entity-type. + The REST + request would look something like this + + GET + /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_1:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 + + Note: + at least one unique attribute must be provided. + """) + @route("/atlas/v2/entity/bulk/uniqueAttribute/type/{typeName}") + @get + listByUniqueAttributes is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc("Whether to return minimal information for referred entities.") + @query + minExtInfo?: boolean; + + @doc("Whether to ignore relationship attributes.") + @query + ignoreRelationships?: boolean; + + @doc(""" + Qualified name of an entity. E.g. to find 2 entities you can set + attrs_1:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. (This is only an + example. qualifiedName can be changed to other unique attributes) + """) + @query + `attr_N:qualifiedName`?: string; + }, + AtlasEntitiesWithExtInfo, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get entity header given its GUID.") + @route("/atlas/v2/entity/guid/{guid}/header") + @get + getHeader is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + }, + AtlasEntityHeader, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Remove business metadata from an entity.") + @route("/atlas/v2/entity/guid/{guid}/businessmetadata") + @delete + removeBusinessMetadata is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + @doc("Business metadata payload") + @bodyRoot + body: Record>; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Add business metadata to an entity.") + @route("/atlas/v2/entity/guid/{guid}/businessmetadata") + @post + addOrUpdateBusinessMetadata is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc(""" + Whether to overwrite the existing business metadata on the entity or not, + default is false. + """) + @query("isOverwrite") + overwrite?: boolean; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + @doc("BusinessMetadata payload") + @bodyRoot + body: Record>; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an Atlas existing api" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete business metadata attributes from an entity.") + @route("/atlas/v2/entity/guid/{guid}/businessmetadata/{businessMetadataName}") + @delete + removeBusinessMetadataAttributes is AtlasOperation< + { + @doc("BusinessMetadata name") + @path + businessMetadataName: string; + + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + @doc("Business metadata attribute payload") + @bodyRoot + body: Record; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an Atlas existing api" + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Add or update business metadata attributes.") + @route("/atlas/v2/entity/guid/{guid}/businessmetadata/{businessMetadataName}") + @post + addOrUpdateBusinessMetadataAttributes is AtlasOperation< + { + @doc("BusinessMetadata name") + @path + businessMetadataName: string; + + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "Should use unknown to model Object" + @doc("Business metadata attribute payload") + @bodyRoot + body: Record; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the sample Template for uploading/creating bulk BusinessMetaData") + @route("/atlas/v2/entity/businessmetadata/import/template") + @get + getSampleBusinessMetadataTemplate is AtlasRpcOperation< + {}, + { + @header contentType: "application/octet-stream"; + @bodyRoot body: bytes; + }, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/byos" "representation of existing multipart/form-data operation" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("Upload the file for creating Business Metadata in BULK") + @route("/atlas/v2/entity/businessmetadata/import") + @post + importBusinessMetadata is AtlasImportOperation< + { + /** Multipart body */ + @multipartBody body: BusinessMetadataOptions; + }, + BulkImportResult, + MultipartFormDataRequestHeadersTraits + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("Delete given labels to a given entity.") + @route("/atlas/v2/entity/guid/{guid}/labels") + @delete + removeLabels is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("set of labels to be deleted") + @bodyRoot + body?: string[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Set labels to a given entity.") + @route("/atlas/v2/entity/guid/{guid}/labels") + @post + setLabels is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("set of labels to be set to the entity") + @bodyRoot + body?: string[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Add given labels to a given entity.") + @route("/atlas/v2/entity/guid/{guid}/labels") + @put + addLabel is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("set of labels to be added") + @bodyRoot + body?: string[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Delete given labels to a given entity identified by its type and unique + attribute. + + If labels is null/empty, no labels will be removed. + + If any labels + in labels set are non-existing labels, they will be ignored, only existing + labels will be removed. In addition to the typeName path parameter, attribute + key-value pair(s) can be provided in the following format: + attr:=. NOTE: The attrName and attrValue should be unique + across entities, eg. qualifiedName. The REST request would look something like + this: DELETE + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels") + @delete + removeLabelsByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + + @doc("set of labels to be deleted") + @bodyRoot + body?: string[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Set labels to a given entity identified by its type and unique attributes. + + If + labels is null/empty, existing labels will all be removed. + + In addition to the + typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr:=. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: POST + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels") + @post + setLabelsByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + + @doc("set of labels to be set") + @bodyRoot + body?: string[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Add given labels to a given entity identified by its type and unique + attributes. + + If labels is null/empty, no labels will be added. + + In addition to + the typeName path parameter, attribute key-value pair(s) can be provided in the + following format: attr:=. + + NOTE: The attrName and + attrValue should be unique across entities, eg. qualifiedName. + + The REST + request would look something like this: PUT + /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/entity/uniqueAttribute/type/{typeName}/labels") + @put + addLabelsByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + + @doc("set of labels to be added") + @bodyRoot + body?: string[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Move existing entities to the target collection.") + @route("/entity/moveTo") + @post + moveEntitiesToCollection is Azure.Core.Foundations.Operation< + { + @doc("The collection where entities will be moved to.") + @query + collectionId: string; + } & BodyParameter, + EntityMutationResult, + {}, + AtlasErrorResponse + >; +} + +interface Glossary { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc(""" + Get all glossaries. Recommend using limit/offset to get pagination result. + Recommend using 'ignoreTermsAndCategories=true' and fetch terms/categories + separately using 'GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms' + and 'GET '/datamap/api/atlas/v2/glossary/{glossaryId}/categories'. + """) + @route("/atlas/v2/glossary") + @get + list is AtlasOperation< + { + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + + @doc("Whether ignore terms and categories") + @query + ignoreTermsAndCategories?: boolean; + }, + OkResponse, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Create a glossary.") + @route("/atlas/v2/glossary") + @post + create is AtlasOperation, AtlasGlossary, {}>; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Create glossary category in bulk.") + @route("/atlas/v2/glossary/categories") + @post + createCategories is AtlasOperation< + { + @doc("An array of glossary category definitions to be created.") + @bodyRoot + body: AtlasGlossaryCategory[]; + }, + OkResponse, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Create a glossary category.") + @route("/atlas/v2/glossary/category") + @post + createCategory is AtlasOperation< + BodyParameter, + AtlasGlossaryCategory, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get specific glossary category by its GUID.") + @route("/atlas/v2/glossary/category/{categoryId}") + @get + getCategory is AtlasOperation< + { + @doc("The globally unique identifier of the category.") + @path + categoryId: string; + }, + AtlasGlossaryCategory, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Update the given glossary category by its GUID.") + @route("/atlas/v2/glossary/category/{categoryId}") + @put + updateCategory is AtlasOperation< + { + @doc("The globally unique identifier of the category.") + @path + categoryId: string; + } & BodyParameter, + AtlasGlossaryCategory, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete a glossary category.") + @route("/atlas/v2/glossary/category/{categoryId}") + @delete + deleteCategory is AtlasOperation< + { + @doc("The globally unique identifier of the category.") + @path + categoryId: string; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc(""" + Update the glossary category partially. So far we only supports partial + updating shortDescription and longDescription for category. + """) + @route("/atlas/v2/glossary/category/{categoryId}/partial") + @put + partialUpdateCategory is AtlasOperation< + { + @doc("The globally unique identifier of the category.") + @path + categoryId: string; + + @doc(""" + A map containing keys as attribute names and values as corresponding attribute + values for partial update. + """) + @bodyRoot + body: Record; + }, + AtlasGlossaryCategory, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Get all related categories (parent and children). Limit, offset, and sort + parameters are currently not being enabled and won't work even they are passed. + """) + @route("/atlas/v2/glossary/category/{categoryId}/related") + @get + listRelatedCategories is AtlasOperation< + { + @doc("The globally unique identifier of the category.") + @path + categoryId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse>, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get all terms associated with the specific category.") + @route("/atlas/v2/glossary/category/{categoryId}/terms") + @get + listCategoryTerms is AtlasOperation< + { + @doc("The globally unique identifier of the category.") + @path + categoryId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Create a glossary term.") + @route("/atlas/v2/glossary/term") + @post + createTerm is AtlasOperation< + { + @doc("Whether include term hierarchy") + @query + includeTermHierarchy?: boolean; + } & BodyParameter, + AtlasGlossaryTerm, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("Get a specific glossary term by its GUID. ") + @route("/atlas/v2/glossary/term/{termId}") + @get + getTerm is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + }, + AtlasGlossaryTerm, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("Update the given glossary term by its GUID.") + @route("/atlas/v2/glossary/term/{termId}") + @put + updateTerm is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + + @doc("Whether include term hierarchy") + @query + includeTermHierarchy?: boolean; + } & BodyParameter, + AtlasGlossaryTerm, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete a glossary term.") + @route("/atlas/v2/glossary/term/{termId}") + @delete + deleteTerm is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc(""" + Update the glossary term partially. So far we only supports partial updating + shortDescription, longDescription, abbreviation, usage and status for term. + """) + @route("/atlas/v2/glossary/term/{termId}/partial") + @put + partialUpdateTerm is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + + @doc("Whether include term hierarchy") + @query + includeTermHierarchy?: boolean; + + @doc(""" + A map containing keys as attribute names and values as corresponding attribute + values to be updated. + """) + @bodyRoot + body: Record; + }, + AtlasGlossaryTerm, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("Create glossary terms in bulk.") + @route("/atlas/v2/glossary/terms") + @post + createTerms is AtlasOperation< + { + @doc("Whether include term hierarchy") + @query + includeTermHierarchy?: boolean; + + @doc("An array of glossary term definitions to be created in bulk.") + @bodyRoot + body: AtlasGlossaryTerm[]; + }, + OkResponse, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + List all related objects assigned with the specified term. Recommend using + limit/offset to get pagination result. + """) + @route("/atlas/v2/glossary/terms/{termId}/assignedEntities") + @get + listEntitiesAssignedWithTerm is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Assign the given term to the provided list of related objects. Recommend using + small batches with multiple API calls. + + [Entities Create Or Update + operation](https://learn.microsoft.com/en-us/rest/api/purview/datamapdataplane/entity/bulk-create-or-update?tabs=HTTP) + is an alternative to assign a term to multiple entities. + """) + @route("/atlas/v2/glossary/terms/{termId}/assignedEntities") + @post + assignTermToEntities is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + + @doc("An array of related object IDs to which the term has to be associated.") + @bodyRoot + body: AtlasRelatedObjectId[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete the term assignment for the given list of related objects.") + @route("/atlas/v2/glossary/terms/{termId}/assignedEntities") + @delete + deleteTermAssignmentFromEntities is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + + @doc("An array of related object IDs from which the term has to be dissociated.") + @bodyRoot + body: AtlasRelatedObjectId[]; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc(""" + Get all related terms for a specific term by its GUID. Limit, offset, and sort + parameters are currently not being enabled and won't work even they are passed. + """) + @route("/atlas/v2/glossary/terms/{termId}/related") + @get + listRelatedTerms is AtlasOperation< + { + @doc("The globally unique identifier for glossary term.") + @path + termId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse>, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get a specific Glossary by its GUID.") + @route("/atlas/v2/glossary/{glossaryId}") + @get + get is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + }, + AtlasGlossary, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("Update the given glossary.") + @route("/atlas/v2/glossary/{glossaryId}") + @put + update is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + + @doc("Whether ignore terms and categories") + @query + ignoreTermsAndCategories?: boolean; + } & BodyParameter, + AtlasGlossary, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Delete a glossary. Will delete underlying terms/categories together. Recommend + separate delete terms and categories. + """) + @route("/atlas/v2/glossary/{glossaryId}") + @delete + delete is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Get the categories belonging to a specific glossary. Recommend using + limit/offset to get pagination result. + """) + @route("/atlas/v2/glossary/{glossaryId}/categories") + @get + listCategories is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Get the category headers belonging to a specific glossary. Recommend using + limit/offset to get pagination result. + """) + @route("/atlas/v2/glossary/{glossaryId}/categories/headers") + @get + listCategoriesHeaders is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc(""" + Get a specific glossary with detailed information. This API is not + recommend. + + Recommend to fetch terms/categories details separately using + + GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms and + + GET /datamap/api/atlas/v2/glossary/{glossaryId}/categories. + """) + @route("/atlas/v2/glossary/{glossaryId}/detailed") + @get + getDetailed is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + }, + AtlasGlossaryExtInfo, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/no-unknown" "Should use unknown to model Object" + @doc(""" + Update the glossary partially. Some properties such as qualifiedName are not + allowed to be updated. + + So far we only supports partial updating + shortDescription, longDescription, language and usage for glossary. + + Recommend + using 'ignoreTermsAndCategories=true' to reduce response body size. + """) + @route("/atlas/v2/glossary/{glossaryId}/partial") + @put + partialUpdate is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + + @doc("Whether ignore terms and categories") + @query + ignoreTermsAndCategories?: boolean; + + @doc(""" + A map containing keys as attribute names and values as corresponding attribute + values. + """) + @bodyRoot + body: Record; + }, + AtlasGlossary, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc(""" + Get terms belonging to a specific glossary. Recommend using limit/offset to get + pagination result. + """) + @route("/atlas/v2/glossary/{glossaryId}/terms") + @get + listTerms is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Get term headers belonging to a specific glossary. Recommend using limit/offset + to get pagination result. + """) + @route("/atlas/v2/glossary/{glossaryId}/terms/headers") + @get + listTermHeaders is AtlasOperation< + { + @doc("The globally unique identifier for glossary.") + @path + glossaryId: string; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The sort order, ASC (default) or DESC.") + @query + sort?: string; + }, + OkResponse, + {} + >; +} + +interface Discovery { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Get data using search.") + @route("/search/query") + @post + query is Azure.Core.Foundations.Operation< + BodyParameter, + QueryResult, + {}, + AtlasErrorResponse + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Get search suggestions by query criteria.") + @route("/search/suggest") + @post + suggest is Azure.Core.Foundations.Operation< + BodyParameter, + SuggestResult, + {}, + AtlasErrorResponse + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Get auto complete options.") + @route("/search/autocomplete") + @post + autoComplete is Azure.Core.Foundations.Operation< + BodyParameter, + AutoCompleteResult, + {}, + AtlasErrorResponse + >; +} + +interface Lineage { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get lineage info of the entity specified by GUID.") + @route("/atlas/v2/lineage/{guid}") + @get + get is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("The number of hops for lineage.") + @query + depth?: int32; + + @doc("The direction of the lineage, which could be INPUT, OUTPUT or BOTH.") + @query + direction: LineageDirection; + }, + AtlasLineageInfo + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Return immediate next page lineage info about entity with pagination") + @route("/lineage/{guid}/next") + @get + getNextPage is Azure.Core.Foundations.Operation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + + @doc("The direction of the lineage, which could be INPUT, OUTPUT or BOTH.") + @query + direction: LineageDirection; + + @doc("The offset for pagination purpose.") + @query + offset?: int32; + + @doc("The page size - by default there is no paging.") + @query + limit?: int32; + }, + AtlasLineageInfo, + {}, + AtlasErrorResponse + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Return lineage info about entity. + + In addition to the typeName path parameter, + attribute key-value pair(s) can be provided in the following + format + + attr:[attrName]=[attrValue] + + NOTE: The attrName and attrValue should be + unique across entities, eg. qualifiedName. + + The REST request would look + something like this: + + GET + /v2/lineage/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. + """) + @route("/atlas/v2/lineage/uniqueAttribute/type/{typeName}") + @get + getByUniqueAttribute is AtlasOperation< + { + @doc("The name of the type.") + @path + typeName: string; + + @doc("The number of hops for lineage.") + @query + depth?: int32; + + @doc("The direction of the lineage, which could be INPUT, OUTPUT or BOTH.") + @query + direction: LineageDirection; + + @doc(""" + The qualified name of the entity. (This is only an example. qualifiedName can + be changed to other unique attributes) + """) + @query("attr:qualifiedName") + attribute?: string; + }, + AtlasLineageInfo, + {} + >; +} + +interface Relationship { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Create a new relationship between entities.") + @route("/atlas/v2/relationship") + @post + create is AtlasOperation< + BodyParameter, + AtlasRelationship, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Update an existing relationship between entities.") + @route("/atlas/v2/relationship") + @put + update is AtlasOperation< + BodyParameter, + AtlasRelationship, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get relationship information between entities by its GUID.") + @route("/atlas/v2/relationship/guid/{guid}") + @get + get is AtlasOperation< + { + @doc("The globally unique identifier of the relationship.") + @path + guid: string; + + @doc("Limits whether includes extended information.") + @query + extendedInfo?: boolean; + }, + AtlasRelationshipWithExtInfo, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete a relationship between entities by its GUID.") + @route("/atlas/v2/relationship/guid/{guid}") + @delete + delete is AtlasOperation< + { + @doc("The globally unique identifier of the relationship.") + @path + guid: string; + }, + void, + {} + >; +} + +interface Type { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the businessMetadata definition for the given guid.") + @route("/atlas/v2/types/businessmetadatadef/guid/{guid}") + @get + getBusinessMetadataDefByGuid is AtlasOperation< + { + @doc("businessMetadata guid") + @path + guid: string; + }, + AtlasBusinessMetadataDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the businessMetadata definition by it's name (unique).") + @route("/atlas/v2/types/businessmetadatadef/name/{name}") + @get + getBusinessMetadataDefByName is AtlasOperation< + { + @doc("businessMetadata name") + @path + name: string; + }, + AtlasBusinessMetadataDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the classification definition for the given GUID.") + @route("/atlas/v2/types/classificationdef/guid/{guid}") + @get + getClassificationDefByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the classification.") + @path + guid: string; + }, + AtlasClassificationDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the classification definition by its name (unique).") + @route("/atlas/v2/types/classificationdef/name/{name}") + @get + getClassificationDefByName is AtlasOperation< + { + @doc("The name of the classification.") + @path + name: string; + }, + AtlasClassificationDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the Entity definition for the given GUID.") + @route("/atlas/v2/types/entitydef/guid/{guid}") + @get + getEntityDefByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the entity.") + @path + guid: string; + }, + AtlasEntityDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the entity definition by its name (unique).") + @route("/atlas/v2/types/entitydef/name/{name}") + @get + getEntityDefByName is AtlasOperation< + { + @doc("The name of the entity.") + @path + name: string; + }, + AtlasEntityDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the enum definition for the given GUID.") + @route("/atlas/v2/types/enumdef/guid/{guid}") + @get + getEnumDefByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the enum.") + @path + guid: string; + }, + AtlasEnumDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the enum definition by its name (unique).") + @route("/atlas/v2/types/enumdef/name/{name}") + @get + getEnumDefByName is AtlasOperation< + { + @doc("The name of the enum.") + @path + name: string; + }, + AtlasEnumDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the relationship definition for the given GUID.") + @route("/atlas/v2/types/relationshipdef/guid/{guid}") + @get + getRelationshipDefByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the relationship.") + @path + guid: string; + }, + AtlasRelationshipDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the relationship definition by its name (unique).") + @route("/atlas/v2/types/relationshipdef/name/{name}") + @get + getRelationshipDefByName is AtlasOperation< + { + @doc("The name of the relationship.") + @path + name: string; + }, + AtlasRelationshipDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the struct definition for the given GUID.") + @route("/atlas/v2/types/structdef/guid/{guid}") + @get + getStructDefByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the struct.") + @path + guid: string; + }, + AtlasStructDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the struct definition by its name (unique).") + @route("/atlas/v2/types/structdef/name/{name}") + @get + getStructDefByName is AtlasOperation< + { + @doc("The name of the struct.") + @path + name: string; + }, + AtlasStructDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the type definition for the given GUID.") + @route("/atlas/v2/types/typedef/guid/{guid}") + @get + getByGuid is AtlasOperation< + { + @doc("The globally unique identifier of the type.") + @path + guid: string; + }, + AtlasTypeDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Get the type definition by its name (unique).") + @route("/atlas/v2/types/typedef/name/{name}") + @get + getByName is AtlasOperation< + { + @doc("The name of the type.") + @path + name: string; + }, + AtlasTypeDef, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete API for type identified by its name.") + @route("/atlas/v2/types/typedef/name/{name}") + @delete + delete is AtlasOperation< + { + @doc("The name of the type.") + @path + name: string; + }, + void, + {} + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("List all type definitions in bulk.") + @route("/atlas/v2/types/typedefs") + @get + list is AtlasOperation< + { + @doc(""" + Whether include termtemplatedef when return all typedefs. + This is always true + when search filter type=term_template + """) + @query + includeTermTemplate?: boolean; + + @doc("Typedef name as search filter when get typedefs.") + @query + type?: TypeCategory; + }, + AtlasTypesDef, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Create all atlas type definitions in bulk. Please avoid recreating existing types. + """) + @route("/atlas/v2/types/typedefs") + @post + bulkCreate is AtlasOperation, AtlasTypesDef, {}>; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc(""" + Update all types in bulk, changes detected in the type definitions would be + persisted. + """) + @route("/atlas/v2/types/typedefs") + @put + bulkUpdate is AtlasOperation, AtlasTypesDef, {}>; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" + @doc("Delete API for all types in bulk.") + @route("/atlas/v2/types/typedefs") + @delete + bulkDelete is AtlasOperation, void, {}>; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" + @doc("List all type definitions returned as a list of minimal information header.") + @route("/atlas/v2/types/typedefs/headers") + @get + listHeaders is AtlasOperation< + { + @doc(""" + Whether include termtemplatedef when return all typedefs. + This is always true + when search filter type=term_template + """) + @query + includeTermTemplate?: boolean; + + @doc("Typedef name as search filter when get typedefs.") + @query + type?: TypeCategory; + }, + OkResponse, + AtlasApiVersionParameterTraits + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Get the term template definition for the given GUID.") + @route("/types/termtemplatedef/guid/{guid}") + @get + getTermTemplateDefByGuid is Azure.Core.Foundations.Operation< + { + @doc("The globally unique identifier of the term template.") + @path + guid: string; + }, + TermTemplateDef, + {}, + AtlasErrorResponse + >; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing API" + @doc("Get the term template definition by its name (unique).") + @route("/types/termtemplatedef/name/{name}") + @get + getTermTemplateDefByName is Azure.Core.Foundations.Operation< + { + @doc("The unique name of the term template.") + @path + name: string; + }, + TermTemplateDef, + {}, + AtlasErrorResponse + >; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/tspconfig.yaml b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/tspconfig.yaml new file mode 100644 index 0000000000..f8ba28785f --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/tspconfig.yaml @@ -0,0 +1,10 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + azure-sdk-for-js: false + is-modular-library: true + emitter-output-dir: "{project-root}/generated/typespec-ts" + package-details: + name: "@azure-rest/purview-datamap" + description: "Purview DataMap Service" From 1dfbb2f288cc956ad56dde1c491fc79cdd0f914a Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:15:01 +0800 Subject: [PATCH 2/4] add ut --- .../clientContextWithApiVersion.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md diff --git a/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md b/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md new file mode 100644 index 0000000000..2463f3a956 --- /dev/null +++ b/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md @@ -0,0 +1,29 @@ +# Client Context with API Version + +Tests client context generation when API version parameter is present + +## TypeSpec + +```tsp +@route("/test") +interface Operations { + @doc("Test operation") + @get + testOperation(@query apiVersion: string): string; +} +``` + +## Config + +```yaml +needTCGC: true +withVersionedApiVersion: true +``` + +## Code + +```ts +export interface AzureTypeScriptTestingContext extends Client { + apiVersion: string; +} +``` From fd26c1721db5f1af67678512fc458247ff323406 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:16:44 +0800 Subject: [PATCH 3/4] add ut --- .../scenarios/clientContext/clientContextWithApiVersion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md b/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md index 2463f3a956..63e361e794 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/clientContext/clientContextWithApiVersion.md @@ -22,7 +22,7 @@ withVersionedApiVersion: true ## Code -```ts +```ts clientContext export interface AzureTypeScriptTestingContext extends Client { apiVersion: string; } From ca5b5350bd65aa2214579c4d6983c673d2f482b6 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Mon, 18 Aug 2025 15:45:49 +0800 Subject: [PATCH 4/4] regen code --- .../generated/typespec-ts/README.md | 26 +- .../generated/typespec-ts/package.json | 2 +- .../src/api/discovery/operations.ts | 2 +- .../typespec-ts/src/api/entity/index.ts | 40 +- .../typespec-ts/src/api/entity/operations.ts | 178 ++++----- .../typespec-ts/src/api/entity/options.ts | 20 +- .../typespec-ts/src/api/glossary/index.ts | 36 +- .../src/api/glossary/operations.ts | 146 +++---- .../typespec-ts/src/api/glossary/options.ts | 19 +- .../generated/typespec-ts/src/api/index.ts | 8 +- .../typespec-ts/src/api/lineage/operations.ts | 2 +- ...MapContext.ts => purviewDataMapContext.ts} | 22 +- .../src/api/relationship/operations.ts | 2 +- .../typespec-ts/src/api/type/index.ts | 51 +++ .../{typeDefinition => type}/operations.ts | 358 +++++++++--------- .../api/{typeDefinition => type}/options.ts | 51 ++- .../src/api/typeDefinition/index.ts | 51 --- .../src/classic/discovery/index.ts | 6 +- .../typespec-ts/src/classic/entity/index.ts | 142 +++---- .../typespec-ts/src/classic/glossary/index.ts | 129 ++++--- .../typespec-ts/src/classic/index.ts | 2 +- .../typespec-ts/src/classic/lineage/index.ts | 6 +- .../src/classic/relationship/index.ts | 6 +- .../typespec-ts/src/classic/type/index.ts | 263 +++++++++++++ .../src/classic/typeDefinition/index.ts | 274 -------------- .../generated/typespec-ts/src/index.ts | 90 ++--- ...taMapClient.ts => purviewDataMapClient.ts} | 33 +- 27 files changed, 977 insertions(+), 988 deletions(-) rename packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/{dataMapContext.ts => purviewDataMapContext.ts} (68%) create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/index.ts rename packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/{typeDefinition => type}/operations.ts (71%) rename packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/{typeDefinition => type}/options.ts (51%) delete mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts create mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/type/index.ts delete mode 100644 packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts rename packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/{dataMapClient.ts => purviewDataMapClient.ts} (68%) diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md index 062956a8a9..48a0611fd8 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/README.md @@ -1,6 +1,6 @@ -# Azure DataMap client library for JavaScript +# Azure PurviewDataMap client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure DataMap client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure PurviewDataMap client. Purview Data Map Service is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. @@ -27,16 +27,16 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure-rest/purview-datamap` package -Install the Azure DataMap client library for JavaScript with `npm`: +Install the Azure PurviewDataMap client library for JavaScript with `npm`: ```bash npm install @azure-rest/purview-datamap ``` -### Create and authenticate a `DataMapClient` +### Create and authenticate a `PurviewDataMapClient` -To create a client object to access the Azure DataMap API, you will need the `endpoint` of your Azure DataMap resource and a `credential`. The Azure DataMap client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure DataMap resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure PurviewDataMap API, you will need the `endpoint` of your Azure PurviewDataMap resource and a `credential`. The Azure PurviewDataMap client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure PurviewDataMap resource in the [Azure Portal][azure_portal]. You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). @@ -46,30 +46,30 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure DataMap** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +You will also need to **register a new AAD application and grant access to Azure PurviewDataMap** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. ```ts -import { DataMapClient } from "@azure-rest/purview-datamap"; +import { PurviewDataMapClient } from "@azure-rest/purview-datamap"; import { DefaultAzureCredential } from "@azure/identity"; -const client = new DataMapClient("", new DefaultAzureCredential()); +const client = new PurviewDataMapClient("", new DefaultAzureCredential()); ``` For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. ```ts import { InteractiveBrowserCredential } from "@azure/identity"; -import { DataMapClient } from "@azure-rest/purview-datamap"; +import { PurviewDataMapClient } from "@azure-rest/purview-datamap"; const credential = new InteractiveBrowserCredential({ tenantId: "", clientId: "" }); -const client = new DataMapClient("", credential); +const client = new PurviewDataMapClient("", credential); ``` @@ -78,9 +78,9 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### DataMapClient +### PurviewDataMapClient -`DataMapClient` is the primary interface for developers using the Azure DataMap client library. Explore the methods on this client object to understand the different features of the Azure DataMap service that you can access. +`PurviewDataMapClient` is the primary interface for developers using the Azure PurviewDataMap client library. Explore the methods on this client object to understand the different features of the Azure PurviewDataMap service that you can access. ## Troubleshooting diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json index 2b1a9c143c..1d7983219e 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/package.json @@ -12,7 +12,7 @@ "./package.json": "./package.json", ".": "./src/index.ts", "./api": "./src/api/index.ts", - "./api/typeDefinition": "src/api/typeDefinition/index.ts", + "./api/type": "src/api/type/index.ts", "./api/relationship": "src/api/relationship/index.ts", "./api/lineage": "src/api/lineage/index.ts", "./api/discovery": "src/api/discovery/index.ts", diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts index b266413ac7..41c341f64f 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/discovery/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext as Client } from "../index.js"; +import { PurviewDataMapContext as Client } from "../index.js"; import { atlasErrorResponseDeserializer, QueryOptions, diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts index 249febd8c5..de664944dc 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/index.ts @@ -10,32 +10,32 @@ export { setLabels, removeLabels, importBusinessMetadata, - getBusinessMetadataTemplate, + getSampleBusinessMetadataTemplate, addOrUpdateBusinessMetadataAttributes, removeBusinessMetadataAttributes, addOrUpdateBusinessMetadata, removeBusinessMetadata, getHeader, - batchGetByUniqueAttributes, - batchSetClassifications, - updateClassificationsUniqueByAttribute, + listByUniqueAttributes, + bulkSetClassifications, + updateClassificationsByUniqueAttribute, addClassificationsByUniqueAttribute, removeClassificationByUniqueAttribute, deleteByUniqueAttribute, - updateByUniqueAttribute, - getByUniqueAttribute, + partialUpdateByUniqueAttributes, + getByUniqueAttributes, updateClassifications, addClassifications, getClassifications, removeClassification, getClassification, $delete, - updateAttributeById, + partialUpdateAttributeByGuid, get, addClassification, - batchDelete, - batchCreateOrUpdate, - getByIds, + bulkDelete, + bulkCreateOrUpdate, + listByGuids, createOrUpdate, } from "./operations.js"; export { @@ -47,31 +47,31 @@ export { EntitySetLabelsOptionalParams, EntityRemoveLabelsOptionalParams, EntityImportBusinessMetadataOptionalParams, - EntityGetBusinessMetadataTemplateOptionalParams, + EntityGetSampleBusinessMetadataTemplateOptionalParams, EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, EntityRemoveBusinessMetadataAttributesOptionalParams, EntityAddOrUpdateBusinessMetadataOptionalParams, EntityRemoveBusinessMetadataOptionalParams, EntityGetHeaderOptionalParams, - EntityBatchGetByUniqueAttributesOptionalParams, - EntityBatchSetClassificationsOptionalParams, - EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityListByUniqueAttributesOptionalParams, + EntityBulkSetClassificationsOptionalParams, + EntityUpdateClassificationsByUniqueAttributeOptionalParams, EntityAddClassificationsByUniqueAttributeOptionalParams, EntityRemoveClassificationByUniqueAttributeOptionalParams, EntityDeleteByUniqueAttributeOptionalParams, - EntityUpdateByUniqueAttributeOptionalParams, - EntityGetByUniqueAttributeOptionalParams, + EntityPartialUpdateByUniqueAttributesOptionalParams, + EntityGetByUniqueAttributesOptionalParams, EntityUpdateClassificationsOptionalParams, EntityAddClassificationsOptionalParams, EntityGetClassificationsOptionalParams, EntityRemoveClassificationOptionalParams, EntityGetClassificationOptionalParams, EntityDeleteOptionalParams, - EntityUpdateAttributeByIdOptionalParams, + EntityPartialUpdateAttributeByGuidOptionalParams, EntityGetOptionalParams, EntityAddClassificationOptionalParams, - EntityBatchDeleteOptionalParams, - EntityBatchCreateOrUpdateOptionalParams, - EntityGetByIdsOptionalParams, + EntityBulkDeleteOptionalParams, + EntityBulkCreateOrUpdateOptionalParams, + EntityListByGuidsOptionalParams, EntityCreateOrUpdateOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts index 09c234b719..4c96bcbe98 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext as Client } from "../index.js"; +import { PurviewDataMapContext as Client } from "../index.js"; import { AtlasEntityWithExtInfo, atlasEntityWithExtInfoSerializer, @@ -40,32 +40,32 @@ import { EntitySetLabelsOptionalParams, EntityRemoveLabelsOptionalParams, EntityImportBusinessMetadataOptionalParams, - EntityGetBusinessMetadataTemplateOptionalParams, + EntityGetSampleBusinessMetadataTemplateOptionalParams, EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, EntityRemoveBusinessMetadataAttributesOptionalParams, EntityAddOrUpdateBusinessMetadataOptionalParams, EntityRemoveBusinessMetadataOptionalParams, EntityGetHeaderOptionalParams, - EntityBatchGetByUniqueAttributesOptionalParams, - EntityBatchSetClassificationsOptionalParams, - EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityListByUniqueAttributesOptionalParams, + EntityBulkSetClassificationsOptionalParams, + EntityUpdateClassificationsByUniqueAttributeOptionalParams, EntityAddClassificationsByUniqueAttributeOptionalParams, EntityRemoveClassificationByUniqueAttributeOptionalParams, EntityDeleteByUniqueAttributeOptionalParams, - EntityUpdateByUniqueAttributeOptionalParams, - EntityGetByUniqueAttributeOptionalParams, + EntityPartialUpdateByUniqueAttributesOptionalParams, + EntityGetByUniqueAttributesOptionalParams, EntityUpdateClassificationsOptionalParams, EntityAddClassificationsOptionalParams, EntityGetClassificationsOptionalParams, EntityRemoveClassificationOptionalParams, EntityGetClassificationOptionalParams, EntityDeleteOptionalParams, - EntityUpdateAttributeByIdOptionalParams, + EntityPartialUpdateAttributeByGuidOptionalParams, EntityGetOptionalParams, EntityAddClassificationOptionalParams, - EntityBatchDeleteOptionalParams, - EntityBatchCreateOrUpdateOptionalParams, - EntityGetByIdsOptionalParams, + EntityBulkDeleteOptionalParams, + EntityBulkCreateOrUpdateOptionalParams, + EntityListByGuidsOptionalParams, EntityCreateOrUpdateOptionalParams, } from "./options.js"; import { @@ -546,9 +546,9 @@ export async function importBusinessMetadata( return _importBusinessMetadataDeserialize(result); } -export function _getBusinessMetadataTemplateSend( +export function _getSampleBusinessMetadataTemplateSend( context: Client, - options: EntityGetBusinessMetadataTemplateOptionalParams = { + options: EntityGetSampleBusinessMetadataTemplateOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -564,7 +564,7 @@ export function _getBusinessMetadataTemplateSend( }); } -export async function _getBusinessMetadataTemplateDeserialize( +export async function _getSampleBusinessMetadataTemplateDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -578,14 +578,14 @@ export async function _getBusinessMetadataTemplateDeserialize( } /** Get the sample Template for uploading/creating bulk BusinessMetaData */ -export async function getBusinessMetadataTemplate( +export async function getSampleBusinessMetadataTemplate( context: Client, - options: EntityGetBusinessMetadataTemplateOptionalParams = { + options: EntityGetSampleBusinessMetadataTemplateOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _getBusinessMetadataTemplateSend(context, options); - return _getBusinessMetadataTemplateDeserialize(result); + const result = await _getSampleBusinessMetadataTemplateSend(context, options); + return _getSampleBusinessMetadataTemplateDeserialize(result); } export function _addOrUpdateBusinessMetadataAttributesSend( @@ -874,12 +874,10 @@ export async function getHeader( return _getHeaderDeserialize(result); } -export function _batchGetByUniqueAttributesSend( +export function _listByUniqueAttributesSend( context: Client, typeName: string, - options: EntityBatchGetByUniqueAttributesOptionalParams = { - requestOptions: {}, - }, + options: EntityListByUniqueAttributesOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/bulk/uniqueAttribute/type/{typeName}{?minExtInfo,ignoreRelationships,attr_N%3AqualifiedName}", @@ -905,7 +903,7 @@ export function _batchGetByUniqueAttributesSend( }); } -export async function _batchGetByUniqueAttributesDeserialize( +export async function _listByUniqueAttributesDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -938,25 +936,19 @@ export async function _batchGetByUniqueAttributesDeserialize( * Note: * at least one unique attribute must be provided. */ -export async function batchGetByUniqueAttributes( +export async function listByUniqueAttributes( context: Client, typeName: string, - options: EntityBatchGetByUniqueAttributesOptionalParams = { - requestOptions: {}, - }, + options: EntityListByUniqueAttributesOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchGetByUniqueAttributesSend( - context, - typeName, - options, - ); - return _batchGetByUniqueAttributesDeserialize(result); + const result = await _listByUniqueAttributesSend(context, typeName, options); + return _listByUniqueAttributesDeserialize(result); } -export function _batchSetClassificationsSend( +export function _bulkSetClassificationsSend( context: Client, body: AtlasEntityHeaders, - options: EntityBatchSetClassificationsOptionalParams = { requestOptions: {} }, + options: EntityBulkSetClassificationsOptionalParams = { requestOptions: {} }, ): StreamableMethod { context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context @@ -972,7 +964,7 @@ export function _batchSetClassificationsSend( }); } -export async function _batchSetClassificationsDeserialize( +export async function _bulkSetClassificationsDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -988,20 +980,20 @@ export async function _batchSetClassificationsDeserialize( } /** Set classifications on entities in bulk. */ -export async function batchSetClassifications( +export async function bulkSetClassifications( context: Client, body: AtlasEntityHeaders, - options: EntityBatchSetClassificationsOptionalParams = { requestOptions: {} }, + options: EntityBulkSetClassificationsOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchSetClassificationsSend(context, body, options); - return _batchSetClassificationsDeserialize(result); + const result = await _bulkSetClassificationsSend(context, body, options); + return _bulkSetClassificationsDeserialize(result); } -export function _updateClassificationsUniqueByAttributeSend( +export function _updateClassificationsByUniqueAttributeSend( context: Client, typeName: string, body: AtlasClassification[], - options: EntityUpdateClassificationsUniqueByAttributeOptionalParams = { + options: EntityUpdateClassificationsByUniqueAttributeOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -1025,7 +1017,7 @@ export function _updateClassificationsUniqueByAttributeSend( }); } -export async function _updateClassificationsUniqueByAttributeDeserialize( +export async function _updateClassificationsByUniqueAttributeDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -1039,21 +1031,21 @@ export async function _updateClassificationsUniqueByAttributeDeserialize( } /** Update classification on an entity identified by its type and unique attributes. */ -export async function updateClassificationsUniqueByAttribute( +export async function updateClassificationsByUniqueAttribute( context: Client, typeName: string, body: AtlasClassification[], - options: EntityUpdateClassificationsUniqueByAttributeOptionalParams = { + options: EntityUpdateClassificationsByUniqueAttributeOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _updateClassificationsUniqueByAttributeSend( + const result = await _updateClassificationsByUniqueAttributeSend( context, typeName, body, options, ); - return _updateClassificationsUniqueByAttributeDeserialize(result); + return _updateClassificationsByUniqueAttributeDeserialize(result); } export function _addClassificationsByUniqueAttributeSend( @@ -1237,11 +1229,13 @@ export async function deleteByUniqueAttribute( return _deleteByUniqueAttributeDeserialize(result); } -export function _updateByUniqueAttributeSend( +export function _partialUpdateByUniqueAttributesSend( context: Client, typeName: string, body: AtlasEntityWithExtInfo, - options: EntityUpdateByUniqueAttributeOptionalParams = { requestOptions: {} }, + options: EntityPartialUpdateByUniqueAttributesOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/uniqueAttribute/type/{typeName}{?attr%3AqualifiedName}", @@ -1267,7 +1261,7 @@ export function _updateByUniqueAttributeSend( }); } -export async function _updateByUniqueAttributeDeserialize( +export async function _partialUpdateByUniqueAttributesDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1298,25 +1292,27 @@ export async function _updateByUniqueAttributeDeserialize( * PUT * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. */ -export async function updateByUniqueAttribute( +export async function partialUpdateByUniqueAttributes( context: Client, typeName: string, body: AtlasEntityWithExtInfo, - options: EntityUpdateByUniqueAttributeOptionalParams = { requestOptions: {} }, + options: EntityPartialUpdateByUniqueAttributesOptionalParams = { + requestOptions: {}, + }, ): Promise { - const result = await _updateByUniqueAttributeSend( + const result = await _partialUpdateByUniqueAttributesSend( context, typeName, body, options, ); - return _updateByUniqueAttributeDeserialize(result); + return _partialUpdateByUniqueAttributesDeserialize(result); } -export function _getByUniqueAttributeSend( +export function _getByUniqueAttributesSend( context: Client, typeName: string, - options: EntityGetByUniqueAttributeOptionalParams = { requestOptions: {} }, + options: EntityGetByUniqueAttributesOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/uniqueAttribute/type/{typeName}{?minExtInfo,ignoreRelationships,attr%3AqualifiedName}", @@ -1342,7 +1338,7 @@ export function _getByUniqueAttributeSend( }); } -export async function _getByUniqueAttributeDeserialize( +export async function _getByUniqueAttributesDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1371,13 +1367,13 @@ export async function _getByUniqueAttributeDeserialize( * GET * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. */ -export async function getByUniqueAttribute( +export async function getByUniqueAttributes( context: Client, typeName: string, - options: EntityGetByUniqueAttributeOptionalParams = { requestOptions: {} }, + options: EntityGetByUniqueAttributesOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getByUniqueAttributeSend(context, typeName, options); - return _getByUniqueAttributeDeserialize(result); + const result = await _getByUniqueAttributesSend(context, typeName, options); + return _getByUniqueAttributesDeserialize(result); } export function _updateClassificationsSend( @@ -1689,12 +1685,14 @@ export async function $delete( return _$deleteDeserialize(result); } -export function _updateAttributeByIdSend( +export function _partialUpdateAttributeByGuidSend( context: Client, guid: string, name: string, body: any, - options: EntityUpdateAttributeByIdOptionalParams = { requestOptions: {} }, + options: EntityPartialUpdateAttributeByGuidOptionalParams = { + requestOptions: {}, + }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/guid/{guid}{?name}", @@ -1720,7 +1718,7 @@ export function _updateAttributeByIdSend( }); } -export async function _updateAttributeByIdDeserialize( +export async function _partialUpdateAttributeByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1740,21 +1738,23 @@ export async function _updateAttributeByIdDeserialize( * It does not support updating complex types like arrays, and maps. * Null updates are not possible. */ -export async function updateAttributeById( +export async function partialUpdateAttributeByGuid( context: Client, guid: string, name: string, body: any, - options: EntityUpdateAttributeByIdOptionalParams = { requestOptions: {} }, + options: EntityPartialUpdateAttributeByGuidOptionalParams = { + requestOptions: {}, + }, ): Promise { - const result = await _updateAttributeByIdSend( + const result = await _partialUpdateAttributeByGuidSend( context, guid, name, body, options, ); - return _updateAttributeByIdDeserialize(result); + return _partialUpdateAttributeByGuidDeserialize(result); } export function _getSend( @@ -1846,10 +1846,10 @@ export async function addClassification( return _addClassificationDeserialize(result); } -export function _batchDeleteSend( +export function _bulkDeleteSend( context: Client, guid: string[], - options: EntityBatchDeleteOptionalParams = { requestOptions: {} }, + options: EntityBulkDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/bulk{?guid*}", @@ -1874,7 +1874,7 @@ export function _batchDeleteSend( }); } -export async function _batchDeleteDeserialize( +export async function _bulkDeleteDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1891,19 +1891,19 @@ export async function _batchDeleteDeserialize( * Delete a list of entities in bulk identified by their GUIDs or unique * attributes. */ -export async function batchDelete( +export async function bulkDelete( context: Client, guid: string[], - options: EntityBatchDeleteOptionalParams = { requestOptions: {} }, + options: EntityBulkDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchDeleteSend(context, guid, options); - return _batchDeleteDeserialize(result); + const result = await _bulkDeleteSend(context, guid, options); + return _bulkDeleteDeserialize(result); } -export function _batchCreateOrUpdateSend( +export function _bulkCreateOrUpdateSend( context: Client, body: AtlasEntitiesWithExtInfo, - options: EntityBatchCreateOrUpdateOptionalParams = { requestOptions: {} }, + options: EntityBulkCreateOrUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/bulk{?api%2Dversion,collectionId,businessAttributeUpdateBehavior}", @@ -1929,7 +1929,7 @@ export function _batchCreateOrUpdateSend( }); } -export async function _batchCreateOrUpdateDeserialize( +export async function _bulkCreateOrUpdateDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1952,19 +1952,19 @@ export async function _batchCreateOrUpdateDeserialize( * For each contact type, the maximum number of contacts * is 20. */ -export async function batchCreateOrUpdate( +export async function bulkCreateOrUpdate( context: Client, body: AtlasEntitiesWithExtInfo, - options: EntityBatchCreateOrUpdateOptionalParams = { requestOptions: {} }, + options: EntityBulkCreateOrUpdateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchCreateOrUpdateSend(context, body, options); - return _batchCreateOrUpdateDeserialize(result); + const result = await _bulkCreateOrUpdateSend(context, body, options); + return _bulkCreateOrUpdateDeserialize(result); } -export function _getByIdsSend( +export function _listByGuidsSend( context: Client, guid: string[], - options: EntityGetByIdsOptionalParams = { requestOptions: {} }, + options: EntityListByGuidsOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/entity/bulk{?api%2Dversion,guid*,minExtInfo,ignoreRelationships}", @@ -1991,7 +1991,7 @@ export function _getByIdsSend( }); } -export async function _getByIdsDeserialize( +export async function _listByGuidsDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -2005,13 +2005,13 @@ export async function _getByIdsDeserialize( } /** List entities in bulk identified by its GUIDs. */ -export async function getByIds( +export async function listByGuids( context: Client, guid: string[], - options: EntityGetByIdsOptionalParams = { requestOptions: {} }, + options: EntityListByGuidsOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getByIdsSend(context, guid, options); - return _getByIdsDeserialize(result); + const result = await _listByGuidsSend(context, guid, options); + return _listByGuidsDeserialize(result); } export function _createOrUpdateSend( diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts index 7e29545543..66a706fa6b 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/entity/options.ts @@ -67,7 +67,7 @@ export interface EntityImportBusinessMetadataOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EntityGetBusinessMetadataTemplateOptionalParams +export interface EntityGetSampleBusinessMetadataTemplateOptionalParams extends OperationOptions {} /** Optional parameters. */ @@ -96,7 +96,7 @@ export interface EntityRemoveBusinessMetadataOptionalParams export interface EntityGetHeaderOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EntityBatchGetByUniqueAttributesOptionalParams +export interface EntityListByUniqueAttributesOptionalParams extends OperationOptions { /** Whether to return minimal information for referred entities. */ minExtInfo?: boolean; @@ -111,11 +111,11 @@ export interface EntityBatchGetByUniqueAttributesOptionalParams } /** Optional parameters. */ -export interface EntityBatchSetClassificationsOptionalParams +export interface EntityBulkSetClassificationsOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EntityUpdateClassificationsUniqueByAttributeOptionalParams +export interface EntityUpdateClassificationsByUniqueAttributeOptionalParams extends OperationOptions { /** * The qualified name of the entity. (This is only an example. qualifiedName can @@ -155,7 +155,7 @@ export interface EntityDeleteByUniqueAttributeOptionalParams } /** Optional parameters. */ -export interface EntityUpdateByUniqueAttributeOptionalParams +export interface EntityPartialUpdateByUniqueAttributesOptionalParams extends OperationOptions { /** * The qualified name of the entity. (This is only an example. qualifiedName can @@ -165,7 +165,7 @@ export interface EntityUpdateByUniqueAttributeOptionalParams } /** Optional parameters. */ -export interface EntityGetByUniqueAttributeOptionalParams +export interface EntityGetByUniqueAttributesOptionalParams extends OperationOptions { /** Whether to return minimal information for referred entities. */ minExtInfo?: boolean; @@ -202,7 +202,7 @@ export interface EntityGetClassificationOptionalParams export interface EntityDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EntityUpdateAttributeByIdOptionalParams +export interface EntityPartialUpdateAttributeByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ @@ -218,10 +218,10 @@ export interface EntityAddClassificationOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EntityBatchDeleteOptionalParams extends OperationOptions {} +export interface EntityBulkDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface EntityBatchCreateOrUpdateOptionalParams +export interface EntityBulkCreateOrUpdateOptionalParams extends OperationOptions { /** * The collection where entities will be moved to. Only specify a value if you @@ -236,7 +236,7 @@ export interface EntityBatchCreateOrUpdateOptionalParams } /** Optional parameters. */ -export interface EntityGetByIdsOptionalParams extends OperationOptions { +export interface EntityListByGuidsOptionalParams extends OperationOptions { /** Whether to return minimal information for referred entities. */ minExtInfo?: boolean; /** Whether to ignore relationship attributes. */ diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts index 1307b39061..d7bd8b3ab7 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/index.ts @@ -2,27 +2,27 @@ // Licensed under the MIT License. export { - getTermHeaders, - getTerms, + listTermHeaders, + listTerms, partialUpdate, getDetailed, - getCategoriesHeaders, - getCategories, + listCategoriesHeaders, + listCategories, $delete, update, get, - getRelatedTerms, + listRelatedTerms, deleteTermAssignmentFromEntities, assignTermToEntities, - getEntitiesAssignedWithTerm, + listEntitiesAssignedWithTerm, createTerms, partialUpdateTerm, deleteTerm, updateTerm, getTerm, createTerm, - getCategoryTerms, - getRelatedCategories, + listCategoryTerms, + listRelatedCategories, partialUpdateCategory, deleteCategory, updateCategory, @@ -30,30 +30,30 @@ export { createCategory, createCategories, create, - batchGet, + list, } from "./operations.js"; export { - GlossaryGetTermHeadersOptionalParams, - GlossaryGetTermsOptionalParams, + GlossaryListTermHeadersOptionalParams, + GlossaryListTermsOptionalParams, GlossaryPartialUpdateOptionalParams, GlossaryGetDetailedOptionalParams, - GlossaryGetCategoriesHeadersOptionalParams, - GlossaryGetCategoriesOptionalParams, + GlossaryListCategoriesHeadersOptionalParams, + GlossaryListCategoriesOptionalParams, GlossaryDeleteOptionalParams, GlossaryUpdateOptionalParams, GlossaryGetOptionalParams, - GlossaryGetRelatedTermsOptionalParams, + GlossaryListRelatedTermsOptionalParams, GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, GlossaryAssignTermToEntitiesOptionalParams, - GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryListEntitiesAssignedWithTermOptionalParams, GlossaryCreateTermsOptionalParams, GlossaryPartialUpdateTermOptionalParams, GlossaryDeleteTermOptionalParams, GlossaryUpdateTermOptionalParams, GlossaryGetTermOptionalParams, GlossaryCreateTermOptionalParams, - GlossaryGetCategoryTermsOptionalParams, - GlossaryGetRelatedCategoriesOptionalParams, + GlossaryListCategoryTermsOptionalParams, + GlossaryListRelatedCategoriesOptionalParams, GlossaryPartialUpdateCategoryOptionalParams, GlossaryDeleteCategoryOptionalParams, GlossaryUpdateCategoryOptionalParams, @@ -61,5 +61,5 @@ export { GlossaryCreateCategoryOptionalParams, GlossaryCreateCategoriesOptionalParams, GlossaryCreateOptionalParams, - GlossaryBatchGetOptionalParams, + GlossaryListOptionalParams, } from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts index ccdb0c3b24..ca504bb780 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext as Client } from "../index.js"; +import { PurviewDataMapContext as Client } from "../index.js"; import { atlasErrorResponseDeserializer, AtlasGlossary, @@ -32,27 +32,27 @@ import { } from "../../models/models.js"; import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; import { - GlossaryGetTermHeadersOptionalParams, - GlossaryGetTermsOptionalParams, + GlossaryListTermHeadersOptionalParams, + GlossaryListTermsOptionalParams, GlossaryPartialUpdateOptionalParams, GlossaryGetDetailedOptionalParams, - GlossaryGetCategoriesHeadersOptionalParams, - GlossaryGetCategoriesOptionalParams, + GlossaryListCategoriesHeadersOptionalParams, + GlossaryListCategoriesOptionalParams, GlossaryDeleteOptionalParams, GlossaryUpdateOptionalParams, GlossaryGetOptionalParams, - GlossaryGetRelatedTermsOptionalParams, + GlossaryListRelatedTermsOptionalParams, GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, GlossaryAssignTermToEntitiesOptionalParams, - GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryListEntitiesAssignedWithTermOptionalParams, GlossaryCreateTermsOptionalParams, GlossaryPartialUpdateTermOptionalParams, GlossaryDeleteTermOptionalParams, GlossaryUpdateTermOptionalParams, GlossaryGetTermOptionalParams, GlossaryCreateTermOptionalParams, - GlossaryGetCategoryTermsOptionalParams, - GlossaryGetRelatedCategoriesOptionalParams, + GlossaryListCategoryTermsOptionalParams, + GlossaryListRelatedCategoriesOptionalParams, GlossaryPartialUpdateCategoryOptionalParams, GlossaryDeleteCategoryOptionalParams, GlossaryUpdateCategoryOptionalParams, @@ -60,7 +60,7 @@ import { GlossaryCreateCategoryOptionalParams, GlossaryCreateCategoriesOptionalParams, GlossaryCreateOptionalParams, - GlossaryBatchGetOptionalParams, + GlossaryListOptionalParams, } from "./options.js"; import { StreamableMethod, @@ -69,10 +69,10 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getTermHeadersSend( +export function _listTermHeadersSend( context: Client, glossaryId: string, - options: GlossaryGetTermHeadersOptionalParams = { requestOptions: {} }, + options: GlossaryListTermHeadersOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/{glossaryId}/terms/headers{?limit,offset,sort}", @@ -98,7 +98,7 @@ export function _getTermHeadersSend( }); } -export async function _getTermHeadersDeserialize( +export async function _listTermHeadersDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -115,19 +115,19 @@ export async function _getTermHeadersDeserialize( * Get term headers belonging to a specific glossary. Recommend using limit/offset * to get pagination result. */ -export async function getTermHeaders( +export async function listTermHeaders( context: Client, glossaryId: string, - options: GlossaryGetTermHeadersOptionalParams = { requestOptions: {} }, + options: GlossaryListTermHeadersOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getTermHeadersSend(context, glossaryId, options); - return _getTermHeadersDeserialize(result); + const result = await _listTermHeadersSend(context, glossaryId, options); + return _listTermHeadersDeserialize(result); } -export function _getTermsSend( +export function _listTermsSend( context: Client, glossaryId: string, - options: GlossaryGetTermsOptionalParams = { requestOptions: {} }, + options: GlossaryListTermsOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/{glossaryId}/terms{?api%2Dversion,limit,offset,sort}", @@ -153,7 +153,7 @@ export function _getTermsSend( }); } -export async function _getTermsDeserialize( +export async function _listTermsDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -170,13 +170,13 @@ export async function _getTermsDeserialize( * Get terms belonging to a specific glossary. Recommend using limit/offset to get * pagination result. */ -export async function getTerms( +export async function listTerms( context: Client, glossaryId: string, - options: GlossaryGetTermsOptionalParams = { requestOptions: {} }, + options: GlossaryListTermsOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getTermsSend(context, glossaryId, options); - return _getTermsDeserialize(result); + const result = await _listTermsSend(context, glossaryId, options); + return _listTermsDeserialize(result); } export function _partialUpdateSend( @@ -300,10 +300,10 @@ export async function getDetailed( return _getDetailedDeserialize(result); } -export function _getCategoriesHeadersSend( +export function _listCategoriesHeadersSend( context: Client, glossaryId: string, - options: GlossaryGetCategoriesHeadersOptionalParams = { requestOptions: {} }, + options: GlossaryListCategoriesHeadersOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/{glossaryId}/categories/headers{?limit,offset,sort}", @@ -329,7 +329,7 @@ export function _getCategoriesHeadersSend( }); } -export async function _getCategoriesHeadersDeserialize( +export async function _listCategoriesHeadersDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -346,19 +346,19 @@ export async function _getCategoriesHeadersDeserialize( * Get the category headers belonging to a specific glossary. Recommend using * limit/offset to get pagination result. */ -export async function getCategoriesHeaders( +export async function listCategoriesHeaders( context: Client, glossaryId: string, - options: GlossaryGetCategoriesHeadersOptionalParams = { requestOptions: {} }, + options: GlossaryListCategoriesHeadersOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getCategoriesHeadersSend(context, glossaryId, options); - return _getCategoriesHeadersDeserialize(result); + const result = await _listCategoriesHeadersSend(context, glossaryId, options); + return _listCategoriesHeadersDeserialize(result); } -export function _getCategoriesSend( +export function _listCategoriesSend( context: Client, glossaryId: string, - options: GlossaryGetCategoriesOptionalParams = { requestOptions: {} }, + options: GlossaryListCategoriesOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/{glossaryId}/categories{?limit,offset,sort}", @@ -384,7 +384,7 @@ export function _getCategoriesSend( }); } -export async function _getCategoriesDeserialize( +export async function _listCategoriesDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -401,13 +401,13 @@ export async function _getCategoriesDeserialize( * Get the categories belonging to a specific glossary. Recommend using * limit/offset to get pagination result. */ -export async function getCategories( +export async function listCategories( context: Client, glossaryId: string, - options: GlossaryGetCategoriesOptionalParams = { requestOptions: {} }, + options: GlossaryListCategoriesOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getCategoriesSend(context, glossaryId, options); - return _getCategoriesDeserialize(result); + const result = await _listCategoriesSend(context, glossaryId, options); + return _listCategoriesDeserialize(result); } export function _$deleteSend( @@ -564,10 +564,10 @@ export async function get( return _getDeserialize(result); } -export function _getRelatedTermsSend( +export function _listRelatedTermsSend( context: Client, termId: string, - options: GlossaryGetRelatedTermsOptionalParams = { requestOptions: {} }, + options: GlossaryListRelatedTermsOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/terms/{termId}/related{?api%2Dversion,limit,offset,sort}", @@ -593,7 +593,7 @@ export function _getRelatedTermsSend( }); } -export async function _getRelatedTermsDeserialize( +export async function _listRelatedTermsDeserialize( result: PathUncheckedResponse, ): Promise> { const expectedStatuses = ["200"]; @@ -610,13 +610,13 @@ export async function _getRelatedTermsDeserialize( * Get all related terms for a specific term by its GUID. Limit, offset, and sort * parameters are currently not being enabled and won't work even they are passed. */ -export async function getRelatedTerms( +export async function listRelatedTerms( context: Client, termId: string, - options: GlossaryGetRelatedTermsOptionalParams = { requestOptions: {} }, + options: GlossaryListRelatedTermsOptionalParams = { requestOptions: {} }, ): Promise> { - const result = await _getRelatedTermsSend(context, termId, options); - return _getRelatedTermsDeserialize(result); + const result = await _listRelatedTermsSend(context, termId, options); + return _listRelatedTermsDeserialize(result); } export function _deleteTermAssignmentFromEntitiesSend( @@ -738,10 +738,10 @@ export async function assignTermToEntities( return _assignTermToEntitiesDeserialize(result); } -export function _getEntitiesAssignedWithTermSend( +export function _listEntitiesAssignedWithTermSend( context: Client, termId: string, - options: GlossaryGetEntitiesAssignedWithTermOptionalParams = { + options: GlossaryListEntitiesAssignedWithTermOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -769,7 +769,7 @@ export function _getEntitiesAssignedWithTermSend( }); } -export async function _getEntitiesAssignedWithTermDeserialize( +export async function _listEntitiesAssignedWithTermDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -786,19 +786,19 @@ export async function _getEntitiesAssignedWithTermDeserialize( * List all related objects assigned with the specified term. Recommend using * limit/offset to get pagination result. */ -export async function getEntitiesAssignedWithTerm( +export async function listEntitiesAssignedWithTerm( context: Client, termId: string, - options: GlossaryGetEntitiesAssignedWithTermOptionalParams = { + options: GlossaryListEntitiesAssignedWithTermOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _getEntitiesAssignedWithTermSend( + const result = await _listEntitiesAssignedWithTermSend( context, termId, options, ); - return _getEntitiesAssignedWithTermDeserialize(result); + return _listEntitiesAssignedWithTermDeserialize(result); } export function _createTermsSend( @@ -1106,10 +1106,10 @@ export async function createTerm( return _createTermDeserialize(result); } -export function _getCategoryTermsSend( +export function _listCategoryTermsSend( context: Client, categoryId: string, - options: GlossaryGetCategoryTermsOptionalParams = { requestOptions: {} }, + options: GlossaryListCategoryTermsOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/category/{categoryId}/terms{?limit,offset,sort}", @@ -1135,7 +1135,7 @@ export function _getCategoryTermsSend( }); } -export async function _getCategoryTermsDeserialize( +export async function _listCategoryTermsDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1149,19 +1149,19 @@ export async function _getCategoryTermsDeserialize( } /** Get all terms associated with the specific category. */ -export async function getCategoryTerms( +export async function listCategoryTerms( context: Client, categoryId: string, - options: GlossaryGetCategoryTermsOptionalParams = { requestOptions: {} }, + options: GlossaryListCategoryTermsOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getCategoryTermsSend(context, categoryId, options); - return _getCategoryTermsDeserialize(result); + const result = await _listCategoryTermsSend(context, categoryId, options); + return _listCategoryTermsDeserialize(result); } -export function _getRelatedCategoriesSend( +export function _listRelatedCategoriesSend( context: Client, categoryId: string, - options: GlossaryGetRelatedCategoriesOptionalParams = { requestOptions: {} }, + options: GlossaryListRelatedCategoriesOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary/category/{categoryId}/related{?limit,offset,sort}", @@ -1187,7 +1187,7 @@ export function _getRelatedCategoriesSend( }); } -export async function _getRelatedCategoriesDeserialize( +export async function _listRelatedCategoriesDeserialize( result: PathUncheckedResponse, ): Promise> { const expectedStatuses = ["200"]; @@ -1204,13 +1204,13 @@ export async function _getRelatedCategoriesDeserialize( * Get all related categories (parent and children). Limit, offset, and sort * parameters are currently not being enabled and won't work even they are passed. */ -export async function getRelatedCategories( +export async function listRelatedCategories( context: Client, categoryId: string, - options: GlossaryGetRelatedCategoriesOptionalParams = { requestOptions: {} }, + options: GlossaryListRelatedCategoriesOptionalParams = { requestOptions: {} }, ): Promise> { - const result = await _getRelatedCategoriesSend(context, categoryId, options); - return _getRelatedCategoriesDeserialize(result); + const result = await _listRelatedCategoriesSend(context, categoryId, options); + return _listRelatedCategoriesDeserialize(result); } export function _partialUpdateCategorySend( @@ -1545,9 +1545,9 @@ export async function create( return _createDeserialize(result); } -export function _batchGetSend( +export function _listSend( context: Client, - options: GlossaryBatchGetOptionalParams = { requestOptions: {} }, + options: GlossaryListOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/glossary{?api%2Dversion,limit,offset,sort,ignoreTermsAndCategories}", @@ -1573,7 +1573,7 @@ export function _batchGetSend( }); } -export async function _batchGetDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1592,10 +1592,10 @@ export async function _batchGetDeserialize( * separately using 'GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms' * and 'GET '/datamap/api/atlas/v2/glossary/{glossaryId}/categories'. */ -export async function batchGet( +export async function list( context: Client, - options: GlossaryBatchGetOptionalParams = { requestOptions: {} }, + options: GlossaryListOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchGetSend(context, options); - return _batchGetDeserialize(result); + const result = await _listSend(context, options); + return _listDeserialize(result); } diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts index f51a788019..723492de1f 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/glossary/options.ts @@ -4,7 +4,8 @@ import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface GlossaryGetTermHeadersOptionalParams extends OperationOptions { +export interface GlossaryListTermHeadersOptionalParams + extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; /** The offset for pagination purpose. */ @@ -14,7 +15,7 @@ export interface GlossaryGetTermHeadersOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface GlossaryGetTermsOptionalParams extends OperationOptions { +export interface GlossaryListTermsOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; /** The offset for pagination purpose. */ @@ -33,7 +34,7 @@ export interface GlossaryPartialUpdateOptionalParams extends OperationOptions { export interface GlossaryGetDetailedOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GlossaryGetCategoriesHeadersOptionalParams +export interface GlossaryListCategoriesHeadersOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; @@ -44,7 +45,7 @@ export interface GlossaryGetCategoriesHeadersOptionalParams } /** Optional parameters. */ -export interface GlossaryGetCategoriesOptionalParams extends OperationOptions { +export interface GlossaryListCategoriesOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; /** The offset for pagination purpose. */ @@ -66,7 +67,7 @@ export interface GlossaryUpdateOptionalParams extends OperationOptions { export interface GlossaryGetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GlossaryGetRelatedTermsOptionalParams +export interface GlossaryListRelatedTermsOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; @@ -85,7 +86,7 @@ export interface GlossaryAssignTermToEntitiesOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GlossaryGetEntitiesAssignedWithTermOptionalParams +export interface GlossaryListEntitiesAssignedWithTermOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; @@ -127,7 +128,7 @@ export interface GlossaryCreateTermOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface GlossaryGetCategoryTermsOptionalParams +export interface GlossaryListCategoryTermsOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; @@ -138,7 +139,7 @@ export interface GlossaryGetCategoryTermsOptionalParams } /** Optional parameters. */ -export interface GlossaryGetRelatedCategoriesOptionalParams +export interface GlossaryListRelatedCategoriesOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; @@ -175,7 +176,7 @@ export interface GlossaryCreateCategoriesOptionalParams export interface GlossaryCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface GlossaryBatchGetOptionalParams extends OperationOptions { +export interface GlossaryListOptionalParams extends OperationOptions { /** The page size - by default there is no paging. */ limit?: number; /** The offset for pagination purpose. */ diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts index 5374155e74..4b07d0f6f7 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/index.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. export { - createDataMap, - DataMapContext, - DataMapClientOptionalParams, -} from "./dataMapContext.js"; + createPurviewDataMap, + PurviewDataMapContext, + PurviewDataMapClientOptionalParams, +} from "./purviewDataMapContext.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts index 9d15873130..387a47644d 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/lineage/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext as Client } from "../index.js"; +import { PurviewDataMapContext as Client } from "../index.js"; import { atlasErrorResponseDeserializer, AtlasLineageInfo, diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/purviewDataMapContext.ts similarity index 68% rename from packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts rename to packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/purviewDataMapContext.ts index 0b3430e996..b4cf5515b7 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/dataMapContext.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/purviewDataMapContext.ts @@ -6,20 +6,32 @@ import { KnownApiVersions } from "../models/models.js"; import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; import { TokenCredential } from "@azure/core-auth"; -export interface DataMapContext extends Client {} +/** + * Purview Data Map Service is a fully managed cloud service whose users can + * discover the data sources they need and understand the data sources they find. + * At the same time, Data Map helps organizations get more value from their + * existing investments. This spec defines REST API of Purview Data Map Service. + */ +export interface PurviewDataMapContext extends Client {} /** Optional parameters for the client. */ -export interface DataMapClientOptionalParams extends ClientOptions { +export interface PurviewDataMapClientOptionalParams extends ClientOptions { /** The API version to use for this operation. */ /** Known values of {@link KnownApiVersions} that the service accepts. */ apiVersion?: string; } -export function createDataMap( +/** + * Purview Data Map Service is a fully managed cloud service whose users can + * discover the data sources they need and understand the data sources they find. + * At the same time, Data Map helps organizations get more value from their + * existing investments. This spec defines REST API of Purview Data Map Service. + */ +export function createPurviewDataMap( endpointParam: string, credential: TokenCredential, - options: DataMapClientOptionalParams = {}, -): DataMapContext { + options: PurviewDataMapClientOptionalParams = {}, +): PurviewDataMapContext { const endpointUrl = options.endpoint ?? `${endpointParam}/datamap/api`; const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-purview-datamap/1.0.0-beta.1`; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts index d3e0682ed4..741efcf80a 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/relationship/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext as Client } from "../index.js"; +import { PurviewDataMapContext as Client } from "../index.js"; import { atlasErrorResponseDeserializer, AtlasRelationship, diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/index.ts new file mode 100644 index 0000000000..e1f8b1006c --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/index.ts @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + getTermTemplateDefByName, + getTermTemplateDefByGuid, + listHeaders, + bulkDelete, + bulkUpdate, + bulkCreate, + list, + $delete, + getByName, + getByGuid, + getStructDefByName, + getStructDefByGuid, + getRelationshipDefByName, + getRelationshipDefByGuid, + getEnumDefByName, + getEnumDefByGuid, + getEntityDefByName, + getEntityDefByGuid, + getClassificationDefByName, + getClassificationDefByGuid, + getBusinessMetadataDefByName, + getBusinessMetadataDefByGuid, +} from "./operations.js"; +export { + TypeGetTermTemplateDefByNameOptionalParams, + TypeGetTermTemplateDefByGuidOptionalParams, + TypeListHeadersOptionalParams, + TypeBulkDeleteOptionalParams, + TypeBulkUpdateOptionalParams, + TypeBulkCreateOptionalParams, + TypeListOptionalParams, + TypeDeleteOptionalParams, + TypeGetByNameOptionalParams, + TypeGetByGuidOptionalParams, + TypeGetStructDefByNameOptionalParams, + TypeGetStructDefByGuidOptionalParams, + TypeGetRelationshipDefByNameOptionalParams, + TypeGetRelationshipDefByGuidOptionalParams, + TypeGetEnumDefByNameOptionalParams, + TypeGetEnumDefByGuidOptionalParams, + TypeGetEntityDefByNameOptionalParams, + TypeGetEntityDefByGuidOptionalParams, + TypeGetClassificationDefByNameOptionalParams, + TypeGetClassificationDefByGuidOptionalParams, + TypeGetBusinessMetadataDefByNameOptionalParams, + TypeGetBusinessMetadataDefByGuidOptionalParams, +} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/operations.ts similarity index 71% rename from packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts rename to packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/operations.ts index 03988cf7bc..78bc441c0b 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/operations.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/operations.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext as Client } from "../index.js"; +import { PurviewDataMapContext as Client } from "../index.js"; import { atlasErrorResponseDeserializer, AtlasBusinessMetadataDef, @@ -28,28 +28,28 @@ import { } from "../../models/models.js"; import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; import { - TypeDefinitionGetTermTemplateByNameOptionalParams, - TypeDefinitionGetTermTemplateByIdOptionalParams, - TypeDefinitionGetHeadersOptionalParams, - TypeDefinitionBatchDeleteOptionalParams, - TypeDefinitionBatchUpdateOptionalParams, - TypeDefinitionBatchCreateOptionalParams, - TypeDefinitionGetOptionalParams, - TypeDefinitionDeleteOptionalParams, - TypeDefinitionGetByNameOptionalParams, - TypeDefinitionGetByIdOptionalParams, - TypeDefinitionGetStructByNameOptionalParams, - TypeDefinitionGetStructByIdOptionalParams, - TypeDefinitionGetRelationshipByNameOptionalParams, - TypeDefinitionGetRelationshipByIdOptionalParams, - TypeDefinitionGetEnumByNameOptionalParams, - TypeDefinitionGetEnumByIdOptionalParams, - TypeDefinitionGetEntityByNameOptionalParams, - TypeDefinitionGetEntityByIdOptionalParams, - TypeDefinitionGetClassificationByNameOptionalParams, - TypeDefinitionGetClassificationByIdOptionalParams, - TypeDefinitionGetBusinessMetadataByNameOptionalParams, - TypeDefinitionGetBusinessMetadataByIdOptionalParams, + TypeGetTermTemplateDefByNameOptionalParams, + TypeGetTermTemplateDefByGuidOptionalParams, + TypeListHeadersOptionalParams, + TypeBulkDeleteOptionalParams, + TypeBulkUpdateOptionalParams, + TypeBulkCreateOptionalParams, + TypeListOptionalParams, + TypeDeleteOptionalParams, + TypeGetByNameOptionalParams, + TypeGetByGuidOptionalParams, + TypeGetStructDefByNameOptionalParams, + TypeGetStructDefByGuidOptionalParams, + TypeGetRelationshipDefByNameOptionalParams, + TypeGetRelationshipDefByGuidOptionalParams, + TypeGetEnumDefByNameOptionalParams, + TypeGetEnumDefByGuidOptionalParams, + TypeGetEntityDefByNameOptionalParams, + TypeGetEntityDefByGuidOptionalParams, + TypeGetClassificationDefByNameOptionalParams, + TypeGetClassificationDefByGuidOptionalParams, + TypeGetBusinessMetadataDefByNameOptionalParams, + TypeGetBusinessMetadataDefByGuidOptionalParams, } from "./options.js"; import { StreamableMethod, @@ -58,12 +58,10 @@ import { operationOptionsToRequestParameters, } from "@azure-rest/core-client"; -export function _getTermTemplateByNameSend( +export function _getTermTemplateDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetTermTemplateByNameOptionalParams = { - requestOptions: {}, - }, + options: TypeGetTermTemplateDefByNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/types/termtemplatedef/name/{name}{?api%2Dversion}", @@ -86,7 +84,7 @@ export function _getTermTemplateByNameSend( }); } -export async function _getTermTemplateByNameDeserialize( +export async function _getTermTemplateDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -100,23 +98,19 @@ export async function _getTermTemplateByNameDeserialize( } /** Get the term template definition by its name (unique). */ -export async function getTermTemplateByName( +export async function getTermTemplateDefByName( context: Client, name: string, - options: TypeDefinitionGetTermTemplateByNameOptionalParams = { - requestOptions: {}, - }, + options: TypeGetTermTemplateDefByNameOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getTermTemplateByNameSend(context, name, options); - return _getTermTemplateByNameDeserialize(result); + const result = await _getTermTemplateDefByNameSend(context, name, options); + return _getTermTemplateDefByNameDeserialize(result); } -export function _getTermTemplateByIdSend( +export function _getTermTemplateDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetTermTemplateByIdOptionalParams = { - requestOptions: {}, - }, + options: TypeGetTermTemplateDefByGuidOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/types/termtemplatedef/guid/{guid}{?api%2Dversion}", @@ -139,7 +133,7 @@ export function _getTermTemplateByIdSend( }); } -export async function _getTermTemplateByIdDeserialize( +export async function _getTermTemplateDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -153,20 +147,18 @@ export async function _getTermTemplateByIdDeserialize( } /** Get the term template definition for the given GUID. */ -export async function getTermTemplateById( +export async function getTermTemplateDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetTermTemplateByIdOptionalParams = { - requestOptions: {}, - }, + options: TypeGetTermTemplateDefByGuidOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getTermTemplateByIdSend(context, guid, options); - return _getTermTemplateByIdDeserialize(result); + const result = await _getTermTemplateDefByGuidSend(context, guid, options); + return _getTermTemplateDefByGuidDeserialize(result); } -export function _getHeadersSend( +export function _listHeadersSend( context: Client, - options: TypeDefinitionGetHeadersOptionalParams = { requestOptions: {} }, + options: TypeListHeadersOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/typedefs/headers{?api%2Dversion,includeTermTemplate,type}", @@ -190,7 +182,7 @@ export function _getHeadersSend( }); } -export async function _getHeadersDeserialize( +export async function _listHeadersDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -204,18 +196,18 @@ export async function _getHeadersDeserialize( } /** List all type definitions returned as a list of minimal information header. */ -export async function getHeaders( +export async function listHeaders( context: Client, - options: TypeDefinitionGetHeadersOptionalParams = { requestOptions: {} }, + options: TypeListHeadersOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getHeadersSend(context, options); - return _getHeadersDeserialize(result); + const result = await _listHeadersSend(context, options); + return _listHeadersDeserialize(result); } -export function _batchDeleteSend( +export function _bulkDeleteSend( context: Client, body: AtlasTypesDef, - options: TypeDefinitionBatchDeleteOptionalParams = { requestOptions: {} }, + options: TypeBulkDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context @@ -227,7 +219,7 @@ export function _batchDeleteSend( }); } -export async function _batchDeleteDeserialize( +export async function _bulkDeleteDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["204"]; @@ -241,19 +233,19 @@ export async function _batchDeleteDeserialize( } /** Delete API for all types in bulk. */ -export async function batchDelete( +export async function bulkDelete( context: Client, body: AtlasTypesDef, - options: TypeDefinitionBatchDeleteOptionalParams = { requestOptions: {} }, + options: TypeBulkDeleteOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchDeleteSend(context, body, options); - return _batchDeleteDeserialize(result); + const result = await _bulkDeleteSend(context, body, options); + return _bulkDeleteDeserialize(result); } -export function _batchUpdateSend( +export function _bulkUpdateSend( context: Client, body: AtlasTypesDef, - options: TypeDefinitionBatchUpdateOptionalParams = { requestOptions: {} }, + options: TypeBulkUpdateOptionalParams = { requestOptions: {} }, ): StreamableMethod { context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context @@ -269,7 +261,7 @@ export function _batchUpdateSend( }); } -export async function _batchUpdateDeserialize( +export async function _bulkUpdateDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -286,19 +278,19 @@ export async function _batchUpdateDeserialize( * Update all types in bulk, changes detected in the type definitions would be * persisted. */ -export async function batchUpdate( +export async function bulkUpdate( context: Client, body: AtlasTypesDef, - options: TypeDefinitionBatchUpdateOptionalParams = { requestOptions: {} }, + options: TypeBulkUpdateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchUpdateSend(context, body, options); - return _batchUpdateDeserialize(result); + const result = await _bulkUpdateSend(context, body, options); + return _bulkUpdateDeserialize(result); } -export function _batchCreateSend( +export function _bulkCreateSend( context: Client, body: AtlasTypesDef, - options: TypeDefinitionBatchCreateOptionalParams = { requestOptions: {} }, + options: TypeBulkCreateOptionalParams = { requestOptions: {} }, ): StreamableMethod { context.pipeline.removePolicy({ name: "ClientApiVersionPolicy" }); return context @@ -314,7 +306,7 @@ export function _batchCreateSend( }); } -export async function _batchCreateDeserialize( +export async function _bulkCreateDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -328,18 +320,18 @@ export async function _batchCreateDeserialize( } /** Create all atlas type definitions in bulk. Please avoid recreating existing types. */ -export async function batchCreate( +export async function bulkCreate( context: Client, body: AtlasTypesDef, - options: TypeDefinitionBatchCreateOptionalParams = { requestOptions: {} }, + options: TypeBulkCreateOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _batchCreateSend(context, body, options); - return _batchCreateDeserialize(result); + const result = await _bulkCreateSend(context, body, options); + return _bulkCreateDeserialize(result); } -export function _getSend( +export function _listSend( context: Client, - options: TypeDefinitionGetOptionalParams = { requestOptions: {} }, + options: TypeListOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/typedefs{?api%2Dversion,includeTermTemplate,type}", @@ -363,7 +355,7 @@ export function _getSend( }); } -export async function _getDeserialize( +export async function _listDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -377,18 +369,18 @@ export async function _getDeserialize( } /** List all type definitions in bulk. */ -export async function get( +export async function list( context: Client, - options: TypeDefinitionGetOptionalParams = { requestOptions: {} }, + options: TypeListOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getSend(context, options); - return _getDeserialize(result); + const result = await _listSend(context, options); + return _listDeserialize(result); } export function _$deleteSend( context: Client, name: string, - options: TypeDefinitionDeleteOptionalParams = { requestOptions: {} }, + options: TypeDeleteOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/typedef/name/{name}", @@ -427,7 +419,7 @@ export async function _$deleteDeserialize( export async function $delete( context: Client, name: string, - options: TypeDefinitionDeleteOptionalParams = { requestOptions: {} }, + options: TypeDeleteOptionalParams = { requestOptions: {} }, ): Promise { const result = await _$deleteSend(context, name, options); return _$deleteDeserialize(result); @@ -436,7 +428,7 @@ export async function $delete( export function _getByNameSend( context: Client, name: string, - options: TypeDefinitionGetByNameOptionalParams = { requestOptions: {} }, + options: TypeGetByNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/typedef/name/{name}", @@ -476,16 +468,16 @@ export async function _getByNameDeserialize( export async function getByName( context: Client, name: string, - options: TypeDefinitionGetByNameOptionalParams = { requestOptions: {} }, + options: TypeGetByNameOptionalParams = { requestOptions: {} }, ): Promise { const result = await _getByNameSend(context, name, options); return _getByNameDeserialize(result); } -export function _getByIdSend( +export function _getByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetByIdOptionalParams = { requestOptions: {} }, + options: TypeGetByGuidOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/typedef/guid/{guid}", @@ -508,7 +500,7 @@ export function _getByIdSend( }); } -export async function _getByIdDeserialize( +export async function _getByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -522,19 +514,19 @@ export async function _getByIdDeserialize( } /** Get the type definition for the given GUID. */ -export async function getById( +export async function getByGuid( context: Client, guid: string, - options: TypeDefinitionGetByIdOptionalParams = { requestOptions: {} }, + options: TypeGetByGuidOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getByIdSend(context, guid, options); - return _getByIdDeserialize(result); + const result = await _getByGuidSend(context, guid, options); + return _getByGuidDeserialize(result); } -export function _getStructByNameSend( +export function _getStructDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetStructByNameOptionalParams = { requestOptions: {} }, + options: TypeGetStructDefByNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/structdef/name/{name}", @@ -557,7 +549,7 @@ export function _getStructByNameSend( }); } -export async function _getStructByNameDeserialize( +export async function _getStructDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -571,19 +563,19 @@ export async function _getStructByNameDeserialize( } /** Get the struct definition by its name (unique). */ -export async function getStructByName( +export async function getStructDefByName( context: Client, name: string, - options: TypeDefinitionGetStructByNameOptionalParams = { requestOptions: {} }, + options: TypeGetStructDefByNameOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getStructByNameSend(context, name, options); - return _getStructByNameDeserialize(result); + const result = await _getStructDefByNameSend(context, name, options); + return _getStructDefByNameDeserialize(result); } -export function _getStructByIdSend( +export function _getStructDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetStructByIdOptionalParams = { requestOptions: {} }, + options: TypeGetStructDefByGuidOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/structdef/guid/{guid}", @@ -606,7 +598,7 @@ export function _getStructByIdSend( }); } -export async function _getStructByIdDeserialize( +export async function _getStructDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -620,21 +612,19 @@ export async function _getStructByIdDeserialize( } /** Get the struct definition for the given GUID. */ -export async function getStructById( +export async function getStructDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetStructByIdOptionalParams = { requestOptions: {} }, + options: TypeGetStructDefByGuidOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getStructByIdSend(context, guid, options); - return _getStructByIdDeserialize(result); + const result = await _getStructDefByGuidSend(context, guid, options); + return _getStructDefByGuidDeserialize(result); } -export function _getRelationshipByNameSend( +export function _getRelationshipDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetRelationshipByNameOptionalParams = { - requestOptions: {}, - }, + options: TypeGetRelationshipDefByNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/relationshipdef/name/{name}", @@ -657,7 +647,7 @@ export function _getRelationshipByNameSend( }); } -export async function _getRelationshipByNameDeserialize( +export async function _getRelationshipDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -671,23 +661,19 @@ export async function _getRelationshipByNameDeserialize( } /** Get the relationship definition by its name (unique). */ -export async function getRelationshipByName( +export async function getRelationshipDefByName( context: Client, name: string, - options: TypeDefinitionGetRelationshipByNameOptionalParams = { - requestOptions: {}, - }, + options: TypeGetRelationshipDefByNameOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getRelationshipByNameSend(context, name, options); - return _getRelationshipByNameDeserialize(result); + const result = await _getRelationshipDefByNameSend(context, name, options); + return _getRelationshipDefByNameDeserialize(result); } -export function _getRelationshipByIdSend( +export function _getRelationshipDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetRelationshipByIdOptionalParams = { - requestOptions: {}, - }, + options: TypeGetRelationshipDefByGuidOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/relationshipdef/guid/{guid}", @@ -710,7 +696,7 @@ export function _getRelationshipByIdSend( }); } -export async function _getRelationshipByIdDeserialize( +export async function _getRelationshipDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -724,21 +710,19 @@ export async function _getRelationshipByIdDeserialize( } /** Get the relationship definition for the given GUID. */ -export async function getRelationshipById( +export async function getRelationshipDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetRelationshipByIdOptionalParams = { - requestOptions: {}, - }, + options: TypeGetRelationshipDefByGuidOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getRelationshipByIdSend(context, guid, options); - return _getRelationshipByIdDeserialize(result); + const result = await _getRelationshipDefByGuidSend(context, guid, options); + return _getRelationshipDefByGuidDeserialize(result); } -export function _getEnumByNameSend( +export function _getEnumDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetEnumByNameOptionalParams = { requestOptions: {} }, + options: TypeGetEnumDefByNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/enumdef/name/{name}", @@ -761,7 +745,7 @@ export function _getEnumByNameSend( }); } -export async function _getEnumByNameDeserialize( +export async function _getEnumDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -775,19 +759,19 @@ export async function _getEnumByNameDeserialize( } /** Get the enum definition by its name (unique). */ -export async function getEnumByName( +export async function getEnumDefByName( context: Client, name: string, - options: TypeDefinitionGetEnumByNameOptionalParams = { requestOptions: {} }, + options: TypeGetEnumDefByNameOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getEnumByNameSend(context, name, options); - return _getEnumByNameDeserialize(result); + const result = await _getEnumDefByNameSend(context, name, options); + return _getEnumDefByNameDeserialize(result); } -export function _getEnumByIdSend( +export function _getEnumDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetEnumByIdOptionalParams = { requestOptions: {} }, + options: TypeGetEnumDefByGuidOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/enumdef/guid/{guid}", @@ -810,7 +794,7 @@ export function _getEnumByIdSend( }); } -export async function _getEnumByIdDeserialize( +export async function _getEnumDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -824,19 +808,19 @@ export async function _getEnumByIdDeserialize( } /** Get the enum definition for the given GUID. */ -export async function getEnumById( +export async function getEnumDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetEnumByIdOptionalParams = { requestOptions: {} }, + options: TypeGetEnumDefByGuidOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getEnumByIdSend(context, guid, options); - return _getEnumByIdDeserialize(result); + const result = await _getEnumDefByGuidSend(context, guid, options); + return _getEnumDefByGuidDeserialize(result); } -export function _getEntityByNameSend( +export function _getEntityDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetEntityByNameOptionalParams = { requestOptions: {} }, + options: TypeGetEntityDefByNameOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/entitydef/name/{name}", @@ -859,7 +843,7 @@ export function _getEntityByNameSend( }); } -export async function _getEntityByNameDeserialize( +export async function _getEntityDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -873,19 +857,19 @@ export async function _getEntityByNameDeserialize( } /** Get the entity definition by its name (unique). */ -export async function getEntityByName( +export async function getEntityDefByName( context: Client, name: string, - options: TypeDefinitionGetEntityByNameOptionalParams = { requestOptions: {} }, + options: TypeGetEntityDefByNameOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getEntityByNameSend(context, name, options); - return _getEntityByNameDeserialize(result); + const result = await _getEntityDefByNameSend(context, name, options); + return _getEntityDefByNameDeserialize(result); } -export function _getEntityByIdSend( +export function _getEntityDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetEntityByIdOptionalParams = { requestOptions: {} }, + options: TypeGetEntityDefByGuidOptionalParams = { requestOptions: {} }, ): StreamableMethod { const path = expandUrlTemplate( "/atlas/v2/types/entitydef/guid/{guid}", @@ -908,7 +892,7 @@ export function _getEntityByIdSend( }); } -export async function _getEntityByIdDeserialize( +export async function _getEntityDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -922,19 +906,19 @@ export async function _getEntityByIdDeserialize( } /** Get the Entity definition for the given GUID. */ -export async function getEntityById( +export async function getEntityDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetEntityByIdOptionalParams = { requestOptions: {} }, + options: TypeGetEntityDefByGuidOptionalParams = { requestOptions: {} }, ): Promise { - const result = await _getEntityByIdSend(context, guid, options); - return _getEntityByIdDeserialize(result); + const result = await _getEntityDefByGuidSend(context, guid, options); + return _getEntityDefByGuidDeserialize(result); } -export function _getClassificationByNameSend( +export function _getClassificationDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetClassificationByNameOptionalParams = { + options: TypeGetClassificationDefByNameOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -959,7 +943,7 @@ export function _getClassificationByNameSend( }); } -export async function _getClassificationByNameDeserialize( +export async function _getClassificationDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -973,21 +957,21 @@ export async function _getClassificationByNameDeserialize( } /** Get the classification definition by its name (unique). */ -export async function getClassificationByName( +export async function getClassificationDefByName( context: Client, name: string, - options: TypeDefinitionGetClassificationByNameOptionalParams = { + options: TypeGetClassificationDefByNameOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _getClassificationByNameSend(context, name, options); - return _getClassificationByNameDeserialize(result); + const result = await _getClassificationDefByNameSend(context, name, options); + return _getClassificationDefByNameDeserialize(result); } -export function _getClassificationByIdSend( +export function _getClassificationDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetClassificationByIdOptionalParams = { + options: TypeGetClassificationDefByGuidOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -1012,7 +996,7 @@ export function _getClassificationByIdSend( }); } -export async function _getClassificationByIdDeserialize( +export async function _getClassificationDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1026,21 +1010,21 @@ export async function _getClassificationByIdDeserialize( } /** Get the classification definition for the given GUID. */ -export async function getClassificationById( +export async function getClassificationDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetClassificationByIdOptionalParams = { + options: TypeGetClassificationDefByGuidOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _getClassificationByIdSend(context, guid, options); - return _getClassificationByIdDeserialize(result); + const result = await _getClassificationDefByGuidSend(context, guid, options); + return _getClassificationDefByGuidDeserialize(result); } -export function _getBusinessMetadataByNameSend( +export function _getBusinessMetadataDefByNameSend( context: Client, name: string, - options: TypeDefinitionGetBusinessMetadataByNameOptionalParams = { + options: TypeGetBusinessMetadataDefByNameOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -1065,7 +1049,7 @@ export function _getBusinessMetadataByNameSend( }); } -export async function _getBusinessMetadataByNameDeserialize( +export async function _getBusinessMetadataDefByNameDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1079,21 +1063,25 @@ export async function _getBusinessMetadataByNameDeserialize( } /** Get the businessMetadata definition by it's name (unique). */ -export async function getBusinessMetadataByName( +export async function getBusinessMetadataDefByName( context: Client, name: string, - options: TypeDefinitionGetBusinessMetadataByNameOptionalParams = { + options: TypeGetBusinessMetadataDefByNameOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _getBusinessMetadataByNameSend(context, name, options); - return _getBusinessMetadataByNameDeserialize(result); + const result = await _getBusinessMetadataDefByNameSend( + context, + name, + options, + ); + return _getBusinessMetadataDefByNameDeserialize(result); } -export function _getBusinessMetadataByIdSend( +export function _getBusinessMetadataDefByGuidSend( context: Client, guid: string, - options: TypeDefinitionGetBusinessMetadataByIdOptionalParams = { + options: TypeGetBusinessMetadataDefByGuidOptionalParams = { requestOptions: {}, }, ): StreamableMethod { @@ -1118,7 +1106,7 @@ export function _getBusinessMetadataByIdSend( }); } -export async function _getBusinessMetadataByIdDeserialize( +export async function _getBusinessMetadataDefByGuidDeserialize( result: PathUncheckedResponse, ): Promise { const expectedStatuses = ["200"]; @@ -1132,13 +1120,17 @@ export async function _getBusinessMetadataByIdDeserialize( } /** Get the businessMetadata definition for the given guid. */ -export async function getBusinessMetadataById( +export async function getBusinessMetadataDefByGuid( context: Client, guid: string, - options: TypeDefinitionGetBusinessMetadataByIdOptionalParams = { + options: TypeGetBusinessMetadataDefByGuidOptionalParams = { requestOptions: {}, }, ): Promise { - const result = await _getBusinessMetadataByIdSend(context, guid, options); - return _getBusinessMetadataByIdDeserialize(result); + const result = await _getBusinessMetadataDefByGuidSend( + context, + guid, + options, + ); + return _getBusinessMetadataDefByGuidDeserialize(result); } diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/options.ts similarity index 51% rename from packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts rename to packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/options.ts index a5bfcefebc..3a8d1f2479 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/options.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/type/options.ts @@ -5,16 +5,15 @@ import { TypeCategory } from "../../models/models.js"; import { OperationOptions } from "@azure-rest/core-client"; /** Optional parameters. */ -export interface TypeDefinitionGetTermTemplateByNameOptionalParams +export interface TypeGetTermTemplateDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetTermTemplateByIdOptionalParams +export interface TypeGetTermTemplateDefByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetHeadersOptionalParams - extends OperationOptions { +export interface TypeListHeadersOptionalParams extends OperationOptions { /** * Whether include termtemplatedef when return all typedefs. * This is always true @@ -26,19 +25,16 @@ export interface TypeDefinitionGetHeadersOptionalParams } /** Optional parameters. */ -export interface TypeDefinitionBatchDeleteOptionalParams - extends OperationOptions {} +export interface TypeBulkDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionBatchUpdateOptionalParams - extends OperationOptions {} +export interface TypeBulkUpdateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionBatchCreateOptionalParams - extends OperationOptions {} +export interface TypeBulkCreateOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetOptionalParams extends OperationOptions { +export interface TypeListOptionalParams extends OperationOptions { /** * Whether include termtemplatedef when return all typedefs. * This is always true @@ -50,59 +46,56 @@ export interface TypeDefinitionGetOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface TypeDefinitionDeleteOptionalParams extends OperationOptions {} +export interface TypeDeleteOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetByNameOptionalParams - extends OperationOptions {} +export interface TypeGetByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetByIdOptionalParams extends OperationOptions {} +export interface TypeGetByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetStructByNameOptionalParams +export interface TypeGetStructDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetStructByIdOptionalParams +export interface TypeGetStructDefByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetRelationshipByNameOptionalParams +export interface TypeGetRelationshipDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetRelationshipByIdOptionalParams +export interface TypeGetRelationshipDefByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetEnumByNameOptionalParams - extends OperationOptions {} +export interface TypeGetEnumDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetEnumByIdOptionalParams - extends OperationOptions {} +export interface TypeGetEnumDefByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetEntityByNameOptionalParams +export interface TypeGetEntityDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetEntityByIdOptionalParams +export interface TypeGetEntityDefByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetClassificationByNameOptionalParams +export interface TypeGetClassificationDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetClassificationByIdOptionalParams +export interface TypeGetClassificationDefByGuidOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetBusinessMetadataByNameOptionalParams +export interface TypeGetBusinessMetadataDefByNameOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface TypeDefinitionGetBusinessMetadataByIdOptionalParams +export interface TypeGetBusinessMetadataDefByGuidOptionalParams extends OperationOptions {} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts deleted file mode 100644 index b888c84788..0000000000 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/api/typeDefinition/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { - getTermTemplateByName, - getTermTemplateById, - getHeaders, - batchDelete, - batchUpdate, - batchCreate, - get, - $delete, - getByName, - getById, - getStructByName, - getStructById, - getRelationshipByName, - getRelationshipById, - getEnumByName, - getEnumById, - getEntityByName, - getEntityById, - getClassificationByName, - getClassificationById, - getBusinessMetadataByName, - getBusinessMetadataById, -} from "./operations.js"; -export { - TypeDefinitionGetTermTemplateByNameOptionalParams, - TypeDefinitionGetTermTemplateByIdOptionalParams, - TypeDefinitionGetHeadersOptionalParams, - TypeDefinitionBatchDeleteOptionalParams, - TypeDefinitionBatchUpdateOptionalParams, - TypeDefinitionBatchCreateOptionalParams, - TypeDefinitionGetOptionalParams, - TypeDefinitionDeleteOptionalParams, - TypeDefinitionGetByNameOptionalParams, - TypeDefinitionGetByIdOptionalParams, - TypeDefinitionGetStructByNameOptionalParams, - TypeDefinitionGetStructByIdOptionalParams, - TypeDefinitionGetRelationshipByNameOptionalParams, - TypeDefinitionGetRelationshipByIdOptionalParams, - TypeDefinitionGetEnumByNameOptionalParams, - TypeDefinitionGetEnumByIdOptionalParams, - TypeDefinitionGetEntityByNameOptionalParams, - TypeDefinitionGetEntityByIdOptionalParams, - TypeDefinitionGetClassificationByNameOptionalParams, - TypeDefinitionGetClassificationByIdOptionalParams, - TypeDefinitionGetBusinessMetadataByNameOptionalParams, - TypeDefinitionGetBusinessMetadataByIdOptionalParams, -} from "./options.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts index 1980880c4d..e752ac6063 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/discovery/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext } from "../../api/dataMapContext.js"; +import { PurviewDataMapContext } from "../../api/purviewDataMapContext.js"; import { autoComplete, suggest, @@ -40,7 +40,7 @@ export interface DiscoveryOperations { ) => Promise; } -function _getDiscovery(context: DataMapContext) { +function _getDiscovery(context: PurviewDataMapContext) { return { autoComplete: ( body: AutoCompleteOptions, @@ -54,7 +54,7 @@ function _getDiscovery(context: DataMapContext) { } export function _getDiscoveryOperations( - context: DataMapContext, + context: PurviewDataMapContext, ): DiscoveryOperations { return { ..._getDiscovery(context), diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts index e401cc9e45..f7ab9e5bc2 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/entity/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext } from "../../api/dataMapContext.js"; +import { PurviewDataMapContext } from "../../api/purviewDataMapContext.js"; import { moveEntitiesToCollection, addLabelsByUniqueAttribute, @@ -11,32 +11,32 @@ import { setLabels, removeLabels, importBusinessMetadata, - getBusinessMetadataTemplate, + getSampleBusinessMetadataTemplate, addOrUpdateBusinessMetadataAttributes, removeBusinessMetadataAttributes, addOrUpdateBusinessMetadata, removeBusinessMetadata, getHeader, - batchGetByUniqueAttributes, - batchSetClassifications, - updateClassificationsUniqueByAttribute, + listByUniqueAttributes, + bulkSetClassifications, + updateClassificationsByUniqueAttribute, addClassificationsByUniqueAttribute, removeClassificationByUniqueAttribute, deleteByUniqueAttribute, - updateByUniqueAttribute, - getByUniqueAttribute, + partialUpdateByUniqueAttributes, + getByUniqueAttributes, updateClassifications, addClassifications, getClassifications, removeClassification, getClassification, $delete, - updateAttributeById, + partialUpdateAttributeByGuid, get, addClassification, - batchDelete, - batchCreateOrUpdate, - getByIds, + bulkDelete, + bulkCreateOrUpdate, + listByGuids, createOrUpdate, } from "../../api/entity/operations.js"; import { @@ -48,32 +48,32 @@ import { EntitySetLabelsOptionalParams, EntityRemoveLabelsOptionalParams, EntityImportBusinessMetadataOptionalParams, - EntityGetBusinessMetadataTemplateOptionalParams, + EntityGetSampleBusinessMetadataTemplateOptionalParams, EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, EntityRemoveBusinessMetadataAttributesOptionalParams, EntityAddOrUpdateBusinessMetadataOptionalParams, EntityRemoveBusinessMetadataOptionalParams, EntityGetHeaderOptionalParams, - EntityBatchGetByUniqueAttributesOptionalParams, - EntityBatchSetClassificationsOptionalParams, - EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityListByUniqueAttributesOptionalParams, + EntityBulkSetClassificationsOptionalParams, + EntityUpdateClassificationsByUniqueAttributeOptionalParams, EntityAddClassificationsByUniqueAttributeOptionalParams, EntityRemoveClassificationByUniqueAttributeOptionalParams, EntityDeleteByUniqueAttributeOptionalParams, - EntityUpdateByUniqueAttributeOptionalParams, - EntityGetByUniqueAttributeOptionalParams, + EntityPartialUpdateByUniqueAttributesOptionalParams, + EntityGetByUniqueAttributesOptionalParams, EntityUpdateClassificationsOptionalParams, EntityAddClassificationsOptionalParams, EntityGetClassificationsOptionalParams, EntityRemoveClassificationOptionalParams, EntityGetClassificationOptionalParams, EntityDeleteOptionalParams, - EntityUpdateAttributeByIdOptionalParams, + EntityPartialUpdateAttributeByGuidOptionalParams, EntityGetOptionalParams, EntityAddClassificationOptionalParams, - EntityBatchDeleteOptionalParams, - EntityBatchCreateOrUpdateOptionalParams, - EntityGetByIdsOptionalParams, + EntityBulkDeleteOptionalParams, + EntityBulkCreateOrUpdateOptionalParams, + EntityListByGuidsOptionalParams, EntityCreateOrUpdateOptionalParams, } from "../../api/entity/options.js"; import { @@ -180,8 +180,8 @@ export interface EntityOperations { options?: EntityImportBusinessMetadataOptionalParams, ) => Promise; /** Get the sample Template for uploading/creating bulk BusinessMetaData */ - getBusinessMetadataTemplate: ( - options?: EntityGetBusinessMetadataTemplateOptionalParams, + getSampleBusinessMetadataTemplate: ( + options?: EntityGetSampleBusinessMetadataTemplateOptionalParams, ) => Promise; /** Add or update business metadata attributes. */ addOrUpdateBusinessMetadataAttributes: ( @@ -234,20 +234,20 @@ export interface EntityOperations { * Note: * at least one unique attribute must be provided. */ - batchGetByUniqueAttributes: ( + listByUniqueAttributes: ( typeName: string, - options?: EntityBatchGetByUniqueAttributesOptionalParams, + options?: EntityListByUniqueAttributesOptionalParams, ) => Promise; /** Set classifications on entities in bulk. */ - batchSetClassifications: ( + bulkSetClassifications: ( body: AtlasEntityHeaders, - options?: EntityBatchSetClassificationsOptionalParams, + options?: EntityBulkSetClassificationsOptionalParams, ) => Promise; /** Update classification on an entity identified by its type and unique attributes. */ - updateClassificationsUniqueByAttribute: ( + updateClassificationsByUniqueAttribute: ( typeName: string, body: AtlasClassification[], - options?: EntityUpdateClassificationsUniqueByAttributeOptionalParams, + options?: EntityUpdateClassificationsByUniqueAttributeOptionalParams, ) => Promise; /** Add classification to the entity identified by its type and unique attributes. */ addClassificationsByUniqueAttribute: ( @@ -300,10 +300,10 @@ export interface EntityOperations { * PUT * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. */ - updateByUniqueAttribute: ( + partialUpdateByUniqueAttributes: ( typeName: string, body: AtlasEntityWithExtInfo, - options?: EntityUpdateByUniqueAttributeOptionalParams, + options?: EntityPartialUpdateByUniqueAttributesOptionalParams, ) => Promise; /** * Get complete definition of an entity given its type and unique attribute. @@ -321,9 +321,9 @@ export interface EntityOperations { * GET * /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. */ - getByUniqueAttribute: ( + getByUniqueAttributes: ( typeName: string, - options?: EntityGetByUniqueAttributeOptionalParams, + options?: EntityGetByUniqueAttributesOptionalParams, ) => Promise; /** Update classifications to an existing entity represented by a guid. */ updateClassifications: ( @@ -371,11 +371,11 @@ export interface EntityOperations { * It does not support updating complex types like arrays, and maps. * Null updates are not possible. */ - updateAttributeById: ( + partialUpdateAttributeByGuid: ( guid: string, name: string, body: any, - options?: EntityUpdateAttributeByIdOptionalParams, + options?: EntityPartialUpdateAttributeByGuidOptionalParams, ) => Promise; /** Get complete definition of an entity given its GUID. */ get: ( @@ -391,9 +391,9 @@ export interface EntityOperations { * Delete a list of entities in bulk identified by their GUIDs or unique * attributes. */ - batchDelete: ( + bulkDelete: ( guid: string[], - options?: EntityBatchDeleteOptionalParams, + options?: EntityBulkDeleteOptionalParams, ) => Promise; /** * Create or update entities in bulk. @@ -405,14 +405,14 @@ export interface EntityOperations { * For each contact type, the maximum number of contacts * is 20. */ - batchCreateOrUpdate: ( + bulkCreateOrUpdate: ( body: AtlasEntitiesWithExtInfo, - options?: EntityBatchCreateOrUpdateOptionalParams, + options?: EntityBulkCreateOrUpdateOptionalParams, ) => Promise; /** List entities in bulk identified by its GUIDs. */ - getByIds: ( + listByGuids: ( guid: string[], - options?: EntityGetByIdsOptionalParams, + options?: EntityListByGuidsOptionalParams, ) => Promise; /** * Create or update an entity. @@ -429,7 +429,7 @@ export interface EntityOperations { ) => Promise; } -function _getEntity(context: DataMapContext) { +function _getEntity(context: PurviewDataMapContext) { return { moveEntitiesToCollection: ( collectionId: string, @@ -458,9 +458,9 @@ function _getEntity(context: DataMapContext) { body: BusinessMetadataOptions, options?: EntityImportBusinessMetadataOptionalParams, ) => importBusinessMetadata(context, body, options), - getBusinessMetadataTemplate: ( - options?: EntityGetBusinessMetadataTemplateOptionalParams, - ) => getBusinessMetadataTemplate(context, options), + getSampleBusinessMetadataTemplate: ( + options?: EntityGetSampleBusinessMetadataTemplateOptionalParams, + ) => getSampleBusinessMetadataTemplate(context, options), addOrUpdateBusinessMetadataAttributes: ( businessMetadataName: string, guid: string, @@ -499,20 +499,20 @@ function _getEntity(context: DataMapContext) { ) => removeBusinessMetadata(context, guid, body, options), getHeader: (guid: string, options?: EntityGetHeaderOptionalParams) => getHeader(context, guid, options), - batchGetByUniqueAttributes: ( + listByUniqueAttributes: ( typeName: string, - options?: EntityBatchGetByUniqueAttributesOptionalParams, - ) => batchGetByUniqueAttributes(context, typeName, options), - batchSetClassifications: ( + options?: EntityListByUniqueAttributesOptionalParams, + ) => listByUniqueAttributes(context, typeName, options), + bulkSetClassifications: ( body: AtlasEntityHeaders, - options?: EntityBatchSetClassificationsOptionalParams, - ) => batchSetClassifications(context, body, options), - updateClassificationsUniqueByAttribute: ( + options?: EntityBulkSetClassificationsOptionalParams, + ) => bulkSetClassifications(context, body, options), + updateClassificationsByUniqueAttribute: ( typeName: string, body: AtlasClassification[], - options?: EntityUpdateClassificationsUniqueByAttributeOptionalParams, + options?: EntityUpdateClassificationsByUniqueAttributeOptionalParams, ) => - updateClassificationsUniqueByAttribute(context, typeName, body, options), + updateClassificationsByUniqueAttribute(context, typeName, body, options), addClassificationsByUniqueAttribute: ( typeName: string, body: AtlasClassification[], @@ -533,15 +533,15 @@ function _getEntity(context: DataMapContext) { typeName: string, options?: EntityDeleteByUniqueAttributeOptionalParams, ) => deleteByUniqueAttribute(context, typeName, options), - updateByUniqueAttribute: ( + partialUpdateByUniqueAttributes: ( typeName: string, body: AtlasEntityWithExtInfo, - options?: EntityUpdateByUniqueAttributeOptionalParams, - ) => updateByUniqueAttribute(context, typeName, body, options), - getByUniqueAttribute: ( + options?: EntityPartialUpdateByUniqueAttributesOptionalParams, + ) => partialUpdateByUniqueAttributes(context, typeName, body, options), + getByUniqueAttributes: ( typeName: string, - options?: EntityGetByUniqueAttributeOptionalParams, - ) => getByUniqueAttribute(context, typeName, options), + options?: EntityGetByUniqueAttributesOptionalParams, + ) => getByUniqueAttributes(context, typeName, options), updateClassifications: ( guid: string, body: AtlasClassification[], @@ -568,26 +568,26 @@ function _getEntity(context: DataMapContext) { ) => getClassification(context, guid, classificationName, options), delete: (guid: string, options?: EntityDeleteOptionalParams) => $delete(context, guid, options), - updateAttributeById: ( + partialUpdateAttributeByGuid: ( guid: string, name: string, body: any, - options?: EntityUpdateAttributeByIdOptionalParams, - ) => updateAttributeById(context, guid, name, body, options), + options?: EntityPartialUpdateAttributeByGuidOptionalParams, + ) => partialUpdateAttributeByGuid(context, guid, name, body, options), get: (guid: string, options?: EntityGetOptionalParams) => get(context, guid, options), addClassification: ( body: ClassificationAssociateOptions, options?: EntityAddClassificationOptionalParams, ) => addClassification(context, body, options), - batchDelete: (guid: string[], options?: EntityBatchDeleteOptionalParams) => - batchDelete(context, guid, options), - batchCreateOrUpdate: ( + bulkDelete: (guid: string[], options?: EntityBulkDeleteOptionalParams) => + bulkDelete(context, guid, options), + bulkCreateOrUpdate: ( body: AtlasEntitiesWithExtInfo, - options?: EntityBatchCreateOrUpdateOptionalParams, - ) => batchCreateOrUpdate(context, body, options), - getByIds: (guid: string[], options?: EntityGetByIdsOptionalParams) => - getByIds(context, guid, options), + options?: EntityBulkCreateOrUpdateOptionalParams, + ) => bulkCreateOrUpdate(context, body, options), + listByGuids: (guid: string[], options?: EntityListByGuidsOptionalParams) => + listByGuids(context, guid, options), createOrUpdate: ( body: AtlasEntityWithExtInfo, options?: EntityCreateOrUpdateOptionalParams, @@ -596,7 +596,7 @@ function _getEntity(context: DataMapContext) { } export function _getEntityOperations( - context: DataMapContext, + context: PurviewDataMapContext, ): EntityOperations { return { ..._getEntity(context), diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts index 12edbd917a..aaebcb2ab5 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/glossary/index.ts @@ -1,29 +1,29 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext } from "../../api/dataMapContext.js"; +import { PurviewDataMapContext } from "../../api/purviewDataMapContext.js"; import { - getTermHeaders, - getTerms, + listTermHeaders, + listTerms, partialUpdate, getDetailed, - getCategoriesHeaders, - getCategories, + listCategoriesHeaders, + listCategories, $delete, update, get, - getRelatedTerms, + listRelatedTerms, deleteTermAssignmentFromEntities, assignTermToEntities, - getEntitiesAssignedWithTerm, + listEntitiesAssignedWithTerm, createTerms, partialUpdateTerm, deleteTerm, updateTerm, getTerm, createTerm, - getCategoryTerms, - getRelatedCategories, + listCategoryTerms, + listRelatedCategories, partialUpdateCategory, deleteCategory, updateCategory, @@ -31,30 +31,30 @@ import { createCategory, createCategories, create, - batchGet, + list, } from "../../api/glossary/operations.js"; import { - GlossaryGetTermHeadersOptionalParams, - GlossaryGetTermsOptionalParams, + GlossaryListTermHeadersOptionalParams, + GlossaryListTermsOptionalParams, GlossaryPartialUpdateOptionalParams, GlossaryGetDetailedOptionalParams, - GlossaryGetCategoriesHeadersOptionalParams, - GlossaryGetCategoriesOptionalParams, + GlossaryListCategoriesHeadersOptionalParams, + GlossaryListCategoriesOptionalParams, GlossaryDeleteOptionalParams, GlossaryUpdateOptionalParams, GlossaryGetOptionalParams, - GlossaryGetRelatedTermsOptionalParams, + GlossaryListRelatedTermsOptionalParams, GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, GlossaryAssignTermToEntitiesOptionalParams, - GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryListEntitiesAssignedWithTermOptionalParams, GlossaryCreateTermsOptionalParams, GlossaryPartialUpdateTermOptionalParams, GlossaryDeleteTermOptionalParams, GlossaryUpdateTermOptionalParams, GlossaryGetTermOptionalParams, GlossaryCreateTermOptionalParams, - GlossaryGetCategoryTermsOptionalParams, - GlossaryGetRelatedCategoriesOptionalParams, + GlossaryListCategoryTermsOptionalParams, + GlossaryListRelatedCategoriesOptionalParams, GlossaryPartialUpdateCategoryOptionalParams, GlossaryDeleteCategoryOptionalParams, GlossaryUpdateCategoryOptionalParams, @@ -62,7 +62,7 @@ import { GlossaryCreateCategoryOptionalParams, GlossaryCreateCategoriesOptionalParams, GlossaryCreateOptionalParams, - GlossaryBatchGetOptionalParams, + GlossaryListOptionalParams, } from "../../api/glossary/options.js"; import { AtlasGlossary, @@ -80,17 +80,17 @@ export interface GlossaryOperations { * Get term headers belonging to a specific glossary. Recommend using limit/offset * to get pagination result. */ - getTermHeaders: ( + listTermHeaders: ( glossaryId: string, - options?: GlossaryGetTermHeadersOptionalParams, + options?: GlossaryListTermHeadersOptionalParams, ) => Promise; /** * Get terms belonging to a specific glossary. Recommend using limit/offset to get * pagination result. */ - getTerms: ( + listTerms: ( glossaryId: string, - options?: GlossaryGetTermsOptionalParams, + options?: GlossaryListTermsOptionalParams, ) => Promise; /** * Update the glossary partially. Some properties such as qualifiedName are not @@ -125,17 +125,17 @@ export interface GlossaryOperations { * Get the category headers belonging to a specific glossary. Recommend using * limit/offset to get pagination result. */ - getCategoriesHeaders: ( + listCategoriesHeaders: ( glossaryId: string, - options?: GlossaryGetCategoriesHeadersOptionalParams, + options?: GlossaryListCategoriesHeadersOptionalParams, ) => Promise; /** * Get the categories belonging to a specific glossary. Recommend using * limit/offset to get pagination result. */ - getCategories: ( + listCategories: ( glossaryId: string, - options?: GlossaryGetCategoriesOptionalParams, + options?: GlossaryListCategoriesOptionalParams, ) => Promise; /** * Delete a glossary. Will delete underlying terms/categories together. Recommend @@ -165,9 +165,9 @@ export interface GlossaryOperations { * Get all related terms for a specific term by its GUID. Limit, offset, and sort * parameters are currently not being enabled and won't work even they are passed. */ - getRelatedTerms: ( + listRelatedTerms: ( termId: string, - options?: GlossaryGetRelatedTermsOptionalParams, + options?: GlossaryListRelatedTermsOptionalParams, ) => Promise>; /** Delete the term assignment for the given list of related objects. */ deleteTermAssignmentFromEntities: ( @@ -192,9 +192,9 @@ export interface GlossaryOperations { * List all related objects assigned with the specified term. Recommend using * limit/offset to get pagination result. */ - getEntitiesAssignedWithTerm: ( + listEntitiesAssignedWithTerm: ( termId: string, - options?: GlossaryGetEntitiesAssignedWithTermOptionalParams, + options?: GlossaryListEntitiesAssignedWithTermOptionalParams, ) => Promise; /** Create glossary terms in bulk. */ createTerms: ( @@ -232,17 +232,17 @@ export interface GlossaryOperations { options?: GlossaryCreateTermOptionalParams, ) => Promise; /** Get all terms associated with the specific category. */ - getCategoryTerms: ( + listCategoryTerms: ( categoryId: string, - options?: GlossaryGetCategoryTermsOptionalParams, + options?: GlossaryListCategoryTermsOptionalParams, ) => Promise; /** * Get all related categories (parent and children). Limit, offset, and sort * parameters are currently not being enabled and won't work even they are passed. */ - getRelatedCategories: ( + listRelatedCategories: ( categoryId: string, - options?: GlossaryGetRelatedCategoriesOptionalParams, + options?: GlossaryListRelatedCategoriesOptionalParams, ) => Promise>; /** * Update the glossary category partially. So far we only supports partial @@ -290,19 +290,19 @@ export interface GlossaryOperations { * separately using 'GET /datamap/api/atlas/v2/glossary/{glossaryId}/terms' * and 'GET '/datamap/api/atlas/v2/glossary/{glossaryId}/categories'. */ - batchGet: ( - options?: GlossaryBatchGetOptionalParams, - ) => Promise; + list: (options?: GlossaryListOptionalParams) => Promise; } -function _getGlossary(context: DataMapContext) { +function _getGlossary(context: PurviewDataMapContext) { return { - getTermHeaders: ( + listTermHeaders: ( glossaryId: string, - options?: GlossaryGetTermHeadersOptionalParams, - ) => getTermHeaders(context, glossaryId, options), - getTerms: (glossaryId: string, options?: GlossaryGetTermsOptionalParams) => - getTerms(context, glossaryId, options), + options?: GlossaryListTermHeadersOptionalParams, + ) => listTermHeaders(context, glossaryId, options), + listTerms: ( + glossaryId: string, + options?: GlossaryListTermsOptionalParams, + ) => listTerms(context, glossaryId, options), partialUpdate: ( glossaryId: string, body: Record, @@ -312,14 +312,14 @@ function _getGlossary(context: DataMapContext) { glossaryId: string, options?: GlossaryGetDetailedOptionalParams, ) => getDetailed(context, glossaryId, options), - getCategoriesHeaders: ( + listCategoriesHeaders: ( glossaryId: string, - options?: GlossaryGetCategoriesHeadersOptionalParams, - ) => getCategoriesHeaders(context, glossaryId, options), - getCategories: ( + options?: GlossaryListCategoriesHeadersOptionalParams, + ) => listCategoriesHeaders(context, glossaryId, options), + listCategories: ( glossaryId: string, - options?: GlossaryGetCategoriesOptionalParams, - ) => getCategories(context, glossaryId, options), + options?: GlossaryListCategoriesOptionalParams, + ) => listCategories(context, glossaryId, options), delete: (glossaryId: string, options?: GlossaryDeleteOptionalParams) => $delete(context, glossaryId, options), update: ( @@ -329,10 +329,10 @@ function _getGlossary(context: DataMapContext) { ) => update(context, glossaryId, body, options), get: (glossaryId: string, options?: GlossaryGetOptionalParams) => get(context, glossaryId, options), - getRelatedTerms: ( + listRelatedTerms: ( termId: string, - options?: GlossaryGetRelatedTermsOptionalParams, - ) => getRelatedTerms(context, termId, options), + options?: GlossaryListRelatedTermsOptionalParams, + ) => listRelatedTerms(context, termId, options), deleteTermAssignmentFromEntities: ( termId: string, body: AtlasRelatedObjectId[], @@ -343,10 +343,10 @@ function _getGlossary(context: DataMapContext) { body: AtlasRelatedObjectId[], options?: GlossaryAssignTermToEntitiesOptionalParams, ) => assignTermToEntities(context, termId, body, options), - getEntitiesAssignedWithTerm: ( + listEntitiesAssignedWithTerm: ( termId: string, - options?: GlossaryGetEntitiesAssignedWithTermOptionalParams, - ) => getEntitiesAssignedWithTerm(context, termId, options), + options?: GlossaryListEntitiesAssignedWithTermOptionalParams, + ) => listEntitiesAssignedWithTerm(context, termId, options), createTerms: ( body: AtlasGlossaryTerm[], options?: GlossaryCreateTermsOptionalParams, @@ -369,14 +369,14 @@ function _getGlossary(context: DataMapContext) { body: AtlasGlossaryTerm, options?: GlossaryCreateTermOptionalParams, ) => createTerm(context, body, options), - getCategoryTerms: ( + listCategoryTerms: ( categoryId: string, - options?: GlossaryGetCategoryTermsOptionalParams, - ) => getCategoryTerms(context, categoryId, options), - getRelatedCategories: ( + options?: GlossaryListCategoryTermsOptionalParams, + ) => listCategoryTerms(context, categoryId, options), + listRelatedCategories: ( categoryId: string, - options?: GlossaryGetRelatedCategoriesOptionalParams, - ) => getRelatedCategories(context, categoryId, options), + options?: GlossaryListRelatedCategoriesOptionalParams, + ) => listRelatedCategories(context, categoryId, options), partialUpdateCategory: ( categoryId: string, body: Record, @@ -405,13 +405,12 @@ function _getGlossary(context: DataMapContext) { ) => createCategories(context, body, options), create: (body: AtlasGlossary, options?: GlossaryCreateOptionalParams) => create(context, body, options), - batchGet: (options?: GlossaryBatchGetOptionalParams) => - batchGet(context, options), + list: (options?: GlossaryListOptionalParams) => list(context, options), }; } export function _getGlossaryOperations( - context: DataMapContext, + context: PurviewDataMapContext, ): GlossaryOperations { return { ..._getGlossary(context), diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts index b392fcb3e7..a78529dc9e 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/index.ts @@ -6,4 +6,4 @@ export { EntityOperations } from "./entity/index.js"; export { GlossaryOperations } from "./glossary/index.js"; export { LineageOperations } from "./lineage/index.js"; export { RelationshipOperations } from "./relationship/index.js"; -export { TypeDefinitionOperations } from "./typeDefinition/index.js"; +export { TypeOperations } from "./type/index.js"; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts index b51f383cd0..d9f60951cd 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/lineage/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext } from "../../api/dataMapContext.js"; +import { PurviewDataMapContext } from "../../api/purviewDataMapContext.js"; import { getByUniqueAttribute, getNextPage, @@ -53,7 +53,7 @@ export interface LineageOperations { ) => Promise; } -function _getLineage(context: DataMapContext) { +function _getLineage(context: PurviewDataMapContext) { return { getByUniqueAttribute: ( typeName: string, @@ -74,7 +74,7 @@ function _getLineage(context: DataMapContext) { } export function _getLineageOperations( - context: DataMapContext, + context: PurviewDataMapContext, ): LineageOperations { return { ..._getLineage(context), diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts index 1f51a057a4..dd7b0031a0 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/relationship/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { DataMapContext } from "../../api/dataMapContext.js"; +import { PurviewDataMapContext } from "../../api/purviewDataMapContext.js"; import { $delete, get, @@ -48,7 +48,7 @@ export interface RelationshipOperations { ) => Promise; } -function _getRelationship(context: DataMapContext) { +function _getRelationship(context: PurviewDataMapContext) { return { delete: (guid: string, options?: RelationshipDeleteOptionalParams) => $delete(context, guid, options), @@ -66,7 +66,7 @@ function _getRelationship(context: DataMapContext) { } export function _getRelationshipOperations( - context: DataMapContext, + context: PurviewDataMapContext, ): RelationshipOperations { return { ..._getRelationship(context), diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/type/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/type/index.ts new file mode 100644 index 0000000000..2675afb1e5 --- /dev/null +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/type/index.ts @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PurviewDataMapContext } from "../../api/purviewDataMapContext.js"; +import { + getTermTemplateDefByName, + getTermTemplateDefByGuid, + listHeaders, + bulkDelete, + bulkUpdate, + bulkCreate, + list, + $delete, + getByName, + getByGuid, + getStructDefByName, + getStructDefByGuid, + getRelationshipDefByName, + getRelationshipDefByGuid, + getEnumDefByName, + getEnumDefByGuid, + getEntityDefByName, + getEntityDefByGuid, + getClassificationDefByName, + getClassificationDefByGuid, + getBusinessMetadataDefByName, + getBusinessMetadataDefByGuid, +} from "../../api/type/operations.js"; +import { + TypeGetTermTemplateDefByNameOptionalParams, + TypeGetTermTemplateDefByGuidOptionalParams, + TypeListHeadersOptionalParams, + TypeBulkDeleteOptionalParams, + TypeBulkUpdateOptionalParams, + TypeBulkCreateOptionalParams, + TypeListOptionalParams, + TypeDeleteOptionalParams, + TypeGetByNameOptionalParams, + TypeGetByGuidOptionalParams, + TypeGetStructDefByNameOptionalParams, + TypeGetStructDefByGuidOptionalParams, + TypeGetRelationshipDefByNameOptionalParams, + TypeGetRelationshipDefByGuidOptionalParams, + TypeGetEnumDefByNameOptionalParams, + TypeGetEnumDefByGuidOptionalParams, + TypeGetEntityDefByNameOptionalParams, + TypeGetEntityDefByGuidOptionalParams, + TypeGetClassificationDefByNameOptionalParams, + TypeGetClassificationDefByGuidOptionalParams, + TypeGetBusinessMetadataDefByNameOptionalParams, + TypeGetBusinessMetadataDefByGuidOptionalParams, +} from "../../api/type/options.js"; +import { + AtlasBusinessMetadataDef, + AtlasClassificationDef, + AtlasEntityDef, + AtlasEnumDef, + AtlasRelationshipDef, + AtlasStructDef, + AtlasTypeDef, + AtlasTypesDef, + TermTemplateDef, + AtlasTypeDefHeader, +} from "../../models/models.js"; + +/** Interface representing a Type operations. */ +export interface TypeOperations { + /** Get the term template definition by its name (unique). */ + getTermTemplateDefByName: ( + name: string, + options?: TypeGetTermTemplateDefByNameOptionalParams, + ) => Promise; + /** Get the term template definition for the given GUID. */ + getTermTemplateDefByGuid: ( + guid: string, + options?: TypeGetTermTemplateDefByGuidOptionalParams, + ) => Promise; + /** List all type definitions returned as a list of minimal information header. */ + listHeaders: ( + options?: TypeListHeadersOptionalParams, + ) => Promise; + /** Delete API for all types in bulk. */ + bulkDelete: ( + body: AtlasTypesDef, + options?: TypeBulkDeleteOptionalParams, + ) => Promise; + /** + * Update all types in bulk, changes detected in the type definitions would be + * persisted. + */ + bulkUpdate: ( + body: AtlasTypesDef, + options?: TypeBulkUpdateOptionalParams, + ) => Promise; + /** Create all atlas type definitions in bulk. Please avoid recreating existing types. */ + bulkCreate: ( + body: AtlasTypesDef, + options?: TypeBulkCreateOptionalParams, + ) => Promise; + /** List all type definitions in bulk. */ + list: (options?: TypeListOptionalParams) => Promise; + /** Delete API for type identified by its name. */ + /** + * @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?: TypeDeleteOptionalParams) => Promise; + /** Get the type definition by its name (unique). */ + getByName: ( + name: string, + options?: TypeGetByNameOptionalParams, + ) => Promise; + /** Get the type definition for the given GUID. */ + getByGuid: ( + guid: string, + options?: TypeGetByGuidOptionalParams, + ) => Promise; + /** Get the struct definition by its name (unique). */ + getStructDefByName: ( + name: string, + options?: TypeGetStructDefByNameOptionalParams, + ) => Promise; + /** Get the struct definition for the given GUID. */ + getStructDefByGuid: ( + guid: string, + options?: TypeGetStructDefByGuidOptionalParams, + ) => Promise; + /** Get the relationship definition by its name (unique). */ + getRelationshipDefByName: ( + name: string, + options?: TypeGetRelationshipDefByNameOptionalParams, + ) => Promise; + /** Get the relationship definition for the given GUID. */ + getRelationshipDefByGuid: ( + guid: string, + options?: TypeGetRelationshipDefByGuidOptionalParams, + ) => Promise; + /** Get the enum definition by its name (unique). */ + getEnumDefByName: ( + name: string, + options?: TypeGetEnumDefByNameOptionalParams, + ) => Promise; + /** Get the enum definition for the given GUID. */ + getEnumDefByGuid: ( + guid: string, + options?: TypeGetEnumDefByGuidOptionalParams, + ) => Promise; + /** Get the entity definition by its name (unique). */ + getEntityDefByName: ( + name: string, + options?: TypeGetEntityDefByNameOptionalParams, + ) => Promise; + /** Get the Entity definition for the given GUID. */ + getEntityDefByGuid: ( + guid: string, + options?: TypeGetEntityDefByGuidOptionalParams, + ) => Promise; + /** Get the classification definition by its name (unique). */ + getClassificationDefByName: ( + name: string, + options?: TypeGetClassificationDefByNameOptionalParams, + ) => Promise; + /** Get the classification definition for the given GUID. */ + getClassificationDefByGuid: ( + guid: string, + options?: TypeGetClassificationDefByGuidOptionalParams, + ) => Promise; + /** Get the businessMetadata definition by it's name (unique). */ + getBusinessMetadataDefByName: ( + name: string, + options?: TypeGetBusinessMetadataDefByNameOptionalParams, + ) => Promise; + /** Get the businessMetadata definition for the given guid. */ + getBusinessMetadataDefByGuid: ( + guid: string, + options?: TypeGetBusinessMetadataDefByGuidOptionalParams, + ) => Promise; +} + +function _getType(context: PurviewDataMapContext) { + return { + getTermTemplateDefByName: ( + name: string, + options?: TypeGetTermTemplateDefByNameOptionalParams, + ) => getTermTemplateDefByName(context, name, options), + getTermTemplateDefByGuid: ( + guid: string, + options?: TypeGetTermTemplateDefByGuidOptionalParams, + ) => getTermTemplateDefByGuid(context, guid, options), + listHeaders: (options?: TypeListHeadersOptionalParams) => + listHeaders(context, options), + bulkDelete: (body: AtlasTypesDef, options?: TypeBulkDeleteOptionalParams) => + bulkDelete(context, body, options), + bulkUpdate: (body: AtlasTypesDef, options?: TypeBulkUpdateOptionalParams) => + bulkUpdate(context, body, options), + bulkCreate: (body: AtlasTypesDef, options?: TypeBulkCreateOptionalParams) => + bulkCreate(context, body, options), + list: (options?: TypeListOptionalParams) => list(context, options), + delete: (name: string, options?: TypeDeleteOptionalParams) => + $delete(context, name, options), + getByName: (name: string, options?: TypeGetByNameOptionalParams) => + getByName(context, name, options), + getByGuid: (guid: string, options?: TypeGetByGuidOptionalParams) => + getByGuid(context, guid, options), + getStructDefByName: ( + name: string, + options?: TypeGetStructDefByNameOptionalParams, + ) => getStructDefByName(context, name, options), + getStructDefByGuid: ( + guid: string, + options?: TypeGetStructDefByGuidOptionalParams, + ) => getStructDefByGuid(context, guid, options), + getRelationshipDefByName: ( + name: string, + options?: TypeGetRelationshipDefByNameOptionalParams, + ) => getRelationshipDefByName(context, name, options), + getRelationshipDefByGuid: ( + guid: string, + options?: TypeGetRelationshipDefByGuidOptionalParams, + ) => getRelationshipDefByGuid(context, guid, options), + getEnumDefByName: ( + name: string, + options?: TypeGetEnumDefByNameOptionalParams, + ) => getEnumDefByName(context, name, options), + getEnumDefByGuid: ( + guid: string, + options?: TypeGetEnumDefByGuidOptionalParams, + ) => getEnumDefByGuid(context, guid, options), + getEntityDefByName: ( + name: string, + options?: TypeGetEntityDefByNameOptionalParams, + ) => getEntityDefByName(context, name, options), + getEntityDefByGuid: ( + guid: string, + options?: TypeGetEntityDefByGuidOptionalParams, + ) => getEntityDefByGuid(context, guid, options), + getClassificationDefByName: ( + name: string, + options?: TypeGetClassificationDefByNameOptionalParams, + ) => getClassificationDefByName(context, name, options), + getClassificationDefByGuid: ( + guid: string, + options?: TypeGetClassificationDefByGuidOptionalParams, + ) => getClassificationDefByGuid(context, guid, options), + getBusinessMetadataDefByName: ( + name: string, + options?: TypeGetBusinessMetadataDefByNameOptionalParams, + ) => getBusinessMetadataDefByName(context, name, options), + getBusinessMetadataDefByGuid: ( + guid: string, + options?: TypeGetBusinessMetadataDefByGuidOptionalParams, + ) => getBusinessMetadataDefByGuid(context, guid, options), + }; +} + +export function _getTypeOperations( + context: PurviewDataMapContext, +): TypeOperations { + return { + ..._getType(context), + }; +} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts deleted file mode 100644 index bc5f6155dd..0000000000 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/classic/typeDefinition/index.ts +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { DataMapContext } from "../../api/dataMapContext.js"; -import { - getTermTemplateByName, - getTermTemplateById, - getHeaders, - batchDelete, - batchUpdate, - batchCreate, - get, - $delete, - getByName, - getById, - getStructByName, - getStructById, - getRelationshipByName, - getRelationshipById, - getEnumByName, - getEnumById, - getEntityByName, - getEntityById, - getClassificationByName, - getClassificationById, - getBusinessMetadataByName, - getBusinessMetadataById, -} from "../../api/typeDefinition/operations.js"; -import { - TypeDefinitionGetTermTemplateByNameOptionalParams, - TypeDefinitionGetTermTemplateByIdOptionalParams, - TypeDefinitionGetHeadersOptionalParams, - TypeDefinitionBatchDeleteOptionalParams, - TypeDefinitionBatchUpdateOptionalParams, - TypeDefinitionBatchCreateOptionalParams, - TypeDefinitionGetOptionalParams, - TypeDefinitionDeleteOptionalParams, - TypeDefinitionGetByNameOptionalParams, - TypeDefinitionGetByIdOptionalParams, - TypeDefinitionGetStructByNameOptionalParams, - TypeDefinitionGetStructByIdOptionalParams, - TypeDefinitionGetRelationshipByNameOptionalParams, - TypeDefinitionGetRelationshipByIdOptionalParams, - TypeDefinitionGetEnumByNameOptionalParams, - TypeDefinitionGetEnumByIdOptionalParams, - TypeDefinitionGetEntityByNameOptionalParams, - TypeDefinitionGetEntityByIdOptionalParams, - TypeDefinitionGetClassificationByNameOptionalParams, - TypeDefinitionGetClassificationByIdOptionalParams, - TypeDefinitionGetBusinessMetadataByNameOptionalParams, - TypeDefinitionGetBusinessMetadataByIdOptionalParams, -} from "../../api/typeDefinition/options.js"; -import { - AtlasBusinessMetadataDef, - AtlasClassificationDef, - AtlasEntityDef, - AtlasEnumDef, - AtlasRelationshipDef, - AtlasStructDef, - AtlasTypeDef, - AtlasTypesDef, - TermTemplateDef, - AtlasTypeDefHeader, -} from "../../models/models.js"; - -/** Interface representing a TypeDefinition operations. */ -export interface TypeDefinitionOperations { - /** Get the term template definition by its name (unique). */ - getTermTemplateByName: ( - name: string, - options?: TypeDefinitionGetTermTemplateByNameOptionalParams, - ) => Promise; - /** Get the term template definition for the given GUID. */ - getTermTemplateById: ( - guid: string, - options?: TypeDefinitionGetTermTemplateByIdOptionalParams, - ) => Promise; - /** List all type definitions returned as a list of minimal information header. */ - getHeaders: ( - options?: TypeDefinitionGetHeadersOptionalParams, - ) => Promise; - /** Delete API for all types in bulk. */ - batchDelete: ( - body: AtlasTypesDef, - options?: TypeDefinitionBatchDeleteOptionalParams, - ) => Promise; - /** - * Update all types in bulk, changes detected in the type definitions would be - * persisted. - */ - batchUpdate: ( - body: AtlasTypesDef, - options?: TypeDefinitionBatchUpdateOptionalParams, - ) => Promise; - /** Create all atlas type definitions in bulk. Please avoid recreating existing types. */ - batchCreate: ( - body: AtlasTypesDef, - options?: TypeDefinitionBatchCreateOptionalParams, - ) => Promise; - /** List all type definitions in bulk. */ - get: (options?: TypeDefinitionGetOptionalParams) => Promise; - /** Delete API for type identified by its name. */ - /** - * @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?: TypeDefinitionDeleteOptionalParams, - ) => Promise; - /** Get the type definition by its name (unique). */ - getByName: ( - name: string, - options?: TypeDefinitionGetByNameOptionalParams, - ) => Promise; - /** Get the type definition for the given GUID. */ - getById: ( - guid: string, - options?: TypeDefinitionGetByIdOptionalParams, - ) => Promise; - /** Get the struct definition by its name (unique). */ - getStructByName: ( - name: string, - options?: TypeDefinitionGetStructByNameOptionalParams, - ) => Promise; - /** Get the struct definition for the given GUID. */ - getStructById: ( - guid: string, - options?: TypeDefinitionGetStructByIdOptionalParams, - ) => Promise; - /** Get the relationship definition by its name (unique). */ - getRelationshipByName: ( - name: string, - options?: TypeDefinitionGetRelationshipByNameOptionalParams, - ) => Promise; - /** Get the relationship definition for the given GUID. */ - getRelationshipById: ( - guid: string, - options?: TypeDefinitionGetRelationshipByIdOptionalParams, - ) => Promise; - /** Get the enum definition by its name (unique). */ - getEnumByName: ( - name: string, - options?: TypeDefinitionGetEnumByNameOptionalParams, - ) => Promise; - /** Get the enum definition for the given GUID. */ - getEnumById: ( - guid: string, - options?: TypeDefinitionGetEnumByIdOptionalParams, - ) => Promise; - /** Get the entity definition by its name (unique). */ - getEntityByName: ( - name: string, - options?: TypeDefinitionGetEntityByNameOptionalParams, - ) => Promise; - /** Get the Entity definition for the given GUID. */ - getEntityById: ( - guid: string, - options?: TypeDefinitionGetEntityByIdOptionalParams, - ) => Promise; - /** Get the classification definition by its name (unique). */ - getClassificationByName: ( - name: string, - options?: TypeDefinitionGetClassificationByNameOptionalParams, - ) => Promise; - /** Get the classification definition for the given GUID. */ - getClassificationById: ( - guid: string, - options?: TypeDefinitionGetClassificationByIdOptionalParams, - ) => Promise; - /** Get the businessMetadata definition by it's name (unique). */ - getBusinessMetadataByName: ( - name: string, - options?: TypeDefinitionGetBusinessMetadataByNameOptionalParams, - ) => Promise; - /** Get the businessMetadata definition for the given guid. */ - getBusinessMetadataById: ( - guid: string, - options?: TypeDefinitionGetBusinessMetadataByIdOptionalParams, - ) => Promise; -} - -function _getTypeDefinition(context: DataMapContext) { - return { - getTermTemplateByName: ( - name: string, - options?: TypeDefinitionGetTermTemplateByNameOptionalParams, - ) => getTermTemplateByName(context, name, options), - getTermTemplateById: ( - guid: string, - options?: TypeDefinitionGetTermTemplateByIdOptionalParams, - ) => getTermTemplateById(context, guid, options), - getHeaders: (options?: TypeDefinitionGetHeadersOptionalParams) => - getHeaders(context, options), - batchDelete: ( - body: AtlasTypesDef, - options?: TypeDefinitionBatchDeleteOptionalParams, - ) => batchDelete(context, body, options), - batchUpdate: ( - body: AtlasTypesDef, - options?: TypeDefinitionBatchUpdateOptionalParams, - ) => batchUpdate(context, body, options), - batchCreate: ( - body: AtlasTypesDef, - options?: TypeDefinitionBatchCreateOptionalParams, - ) => batchCreate(context, body, options), - get: (options?: TypeDefinitionGetOptionalParams) => get(context, options), - delete: (name: string, options?: TypeDefinitionDeleteOptionalParams) => - $delete(context, name, options), - getByName: ( - name: string, - options?: TypeDefinitionGetByNameOptionalParams, - ) => getByName(context, name, options), - getById: (guid: string, options?: TypeDefinitionGetByIdOptionalParams) => - getById(context, guid, options), - getStructByName: ( - name: string, - options?: TypeDefinitionGetStructByNameOptionalParams, - ) => getStructByName(context, name, options), - getStructById: ( - guid: string, - options?: TypeDefinitionGetStructByIdOptionalParams, - ) => getStructById(context, guid, options), - getRelationshipByName: ( - name: string, - options?: TypeDefinitionGetRelationshipByNameOptionalParams, - ) => getRelationshipByName(context, name, options), - getRelationshipById: ( - guid: string, - options?: TypeDefinitionGetRelationshipByIdOptionalParams, - ) => getRelationshipById(context, guid, options), - getEnumByName: ( - name: string, - options?: TypeDefinitionGetEnumByNameOptionalParams, - ) => getEnumByName(context, name, options), - getEnumById: ( - guid: string, - options?: TypeDefinitionGetEnumByIdOptionalParams, - ) => getEnumById(context, guid, options), - getEntityByName: ( - name: string, - options?: TypeDefinitionGetEntityByNameOptionalParams, - ) => getEntityByName(context, name, options), - getEntityById: ( - guid: string, - options?: TypeDefinitionGetEntityByIdOptionalParams, - ) => getEntityById(context, guid, options), - getClassificationByName: ( - name: string, - options?: TypeDefinitionGetClassificationByNameOptionalParams, - ) => getClassificationByName(context, name, options), - getClassificationById: ( - guid: string, - options?: TypeDefinitionGetClassificationByIdOptionalParams, - ) => getClassificationById(context, guid, options), - getBusinessMetadataByName: ( - name: string, - options?: TypeDefinitionGetBusinessMetadataByNameOptionalParams, - ) => getBusinessMetadataByName(context, name, options), - getBusinessMetadataById: ( - guid: string, - options?: TypeDefinitionGetBusinessMetadataByIdOptionalParams, - ) => getBusinessMetadataById(context, guid, options), - }; -} - -export function _getTypeDefinitionOperations( - context: DataMapContext, -): TypeDefinitionOperations { - return { - ..._getTypeDefinition(context), - }; -} diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts index c3243629e0..c0c7842ab9 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/index.ts @@ -3,7 +3,7 @@ import { FileContents } from "./static-helpers/multipartHelpers.js"; -export { DataMapClient } from "./dataMapClient.js"; +export { PurviewDataMapClient } from "./purviewDataMapClient.js"; export { AtlasEntityWithExtInfo, AtlasEntity, @@ -91,7 +91,7 @@ export { BusinessAttributeUpdateBehavior, KnownApiVersions, } from "./models/index.js"; -export { DataMapClientOptionalParams } from "./api/index.js"; +export { PurviewDataMapClientOptionalParams } from "./api/index.js"; export { DiscoveryAutoCompleteOptionalParams, DiscoverySuggestOptionalParams, @@ -106,56 +106,56 @@ export { EntitySetLabelsOptionalParams, EntityRemoveLabelsOptionalParams, EntityImportBusinessMetadataOptionalParams, - EntityGetBusinessMetadataTemplateOptionalParams, + EntityGetSampleBusinessMetadataTemplateOptionalParams, EntityAddOrUpdateBusinessMetadataAttributesOptionalParams, EntityRemoveBusinessMetadataAttributesOptionalParams, EntityAddOrUpdateBusinessMetadataOptionalParams, EntityRemoveBusinessMetadataOptionalParams, EntityGetHeaderOptionalParams, - EntityBatchGetByUniqueAttributesOptionalParams, - EntityBatchSetClassificationsOptionalParams, - EntityUpdateClassificationsUniqueByAttributeOptionalParams, + EntityListByUniqueAttributesOptionalParams, + EntityBulkSetClassificationsOptionalParams, + EntityUpdateClassificationsByUniqueAttributeOptionalParams, EntityAddClassificationsByUniqueAttributeOptionalParams, EntityRemoveClassificationByUniqueAttributeOptionalParams, EntityDeleteByUniqueAttributeOptionalParams, - EntityUpdateByUniqueAttributeOptionalParams, - EntityGetByUniqueAttributeOptionalParams, + EntityPartialUpdateByUniqueAttributesOptionalParams, + EntityGetByUniqueAttributesOptionalParams, EntityUpdateClassificationsOptionalParams, EntityAddClassificationsOptionalParams, EntityGetClassificationsOptionalParams, EntityRemoveClassificationOptionalParams, EntityGetClassificationOptionalParams, EntityDeleteOptionalParams, - EntityUpdateAttributeByIdOptionalParams, + EntityPartialUpdateAttributeByGuidOptionalParams, EntityGetOptionalParams, EntityAddClassificationOptionalParams, - EntityBatchDeleteOptionalParams, - EntityBatchCreateOrUpdateOptionalParams, - EntityGetByIdsOptionalParams, + EntityBulkDeleteOptionalParams, + EntityBulkCreateOrUpdateOptionalParams, + EntityListByGuidsOptionalParams, EntityCreateOrUpdateOptionalParams, } from "./api/entity/index.js"; export { - GlossaryGetTermHeadersOptionalParams, - GlossaryGetTermsOptionalParams, + GlossaryListTermHeadersOptionalParams, + GlossaryListTermsOptionalParams, GlossaryPartialUpdateOptionalParams, GlossaryGetDetailedOptionalParams, - GlossaryGetCategoriesHeadersOptionalParams, - GlossaryGetCategoriesOptionalParams, + GlossaryListCategoriesHeadersOptionalParams, + GlossaryListCategoriesOptionalParams, GlossaryDeleteOptionalParams, GlossaryUpdateOptionalParams, GlossaryGetOptionalParams, - GlossaryGetRelatedTermsOptionalParams, + GlossaryListRelatedTermsOptionalParams, GlossaryDeleteTermAssignmentFromEntitiesOptionalParams, GlossaryAssignTermToEntitiesOptionalParams, - GlossaryGetEntitiesAssignedWithTermOptionalParams, + GlossaryListEntitiesAssignedWithTermOptionalParams, GlossaryCreateTermsOptionalParams, GlossaryPartialUpdateTermOptionalParams, GlossaryDeleteTermOptionalParams, GlossaryUpdateTermOptionalParams, GlossaryGetTermOptionalParams, GlossaryCreateTermOptionalParams, - GlossaryGetCategoryTermsOptionalParams, - GlossaryGetRelatedCategoriesOptionalParams, + GlossaryListCategoryTermsOptionalParams, + GlossaryListRelatedCategoriesOptionalParams, GlossaryPartialUpdateCategoryOptionalParams, GlossaryDeleteCategoryOptionalParams, GlossaryUpdateCategoryOptionalParams, @@ -163,7 +163,7 @@ export { GlossaryCreateCategoryOptionalParams, GlossaryCreateCategoriesOptionalParams, GlossaryCreateOptionalParams, - GlossaryBatchGetOptionalParams, + GlossaryListOptionalParams, } from "./api/glossary/index.js"; export { LineageGetByUniqueAttributeOptionalParams, @@ -177,35 +177,35 @@ export { RelationshipCreateOptionalParams, } from "./api/relationship/index.js"; export { - TypeDefinitionGetTermTemplateByNameOptionalParams, - TypeDefinitionGetTermTemplateByIdOptionalParams, - TypeDefinitionGetHeadersOptionalParams, - TypeDefinitionBatchDeleteOptionalParams, - TypeDefinitionBatchUpdateOptionalParams, - TypeDefinitionBatchCreateOptionalParams, - TypeDefinitionGetOptionalParams, - TypeDefinitionDeleteOptionalParams, - TypeDefinitionGetByNameOptionalParams, - TypeDefinitionGetByIdOptionalParams, - TypeDefinitionGetStructByNameOptionalParams, - TypeDefinitionGetStructByIdOptionalParams, - TypeDefinitionGetRelationshipByNameOptionalParams, - TypeDefinitionGetRelationshipByIdOptionalParams, - TypeDefinitionGetEnumByNameOptionalParams, - TypeDefinitionGetEnumByIdOptionalParams, - TypeDefinitionGetEntityByNameOptionalParams, - TypeDefinitionGetEntityByIdOptionalParams, - TypeDefinitionGetClassificationByNameOptionalParams, - TypeDefinitionGetClassificationByIdOptionalParams, - TypeDefinitionGetBusinessMetadataByNameOptionalParams, - TypeDefinitionGetBusinessMetadataByIdOptionalParams, -} from "./api/typeDefinition/index.js"; + TypeGetTermTemplateDefByNameOptionalParams, + TypeGetTermTemplateDefByGuidOptionalParams, + TypeListHeadersOptionalParams, + TypeBulkDeleteOptionalParams, + TypeBulkUpdateOptionalParams, + TypeBulkCreateOptionalParams, + TypeListOptionalParams, + TypeDeleteOptionalParams, + TypeGetByNameOptionalParams, + TypeGetByGuidOptionalParams, + TypeGetStructDefByNameOptionalParams, + TypeGetStructDefByGuidOptionalParams, + TypeGetRelationshipDefByNameOptionalParams, + TypeGetRelationshipDefByGuidOptionalParams, + TypeGetEnumDefByNameOptionalParams, + TypeGetEnumDefByGuidOptionalParams, + TypeGetEntityDefByNameOptionalParams, + TypeGetEntityDefByGuidOptionalParams, + TypeGetClassificationDefByNameOptionalParams, + TypeGetClassificationDefByGuidOptionalParams, + TypeGetBusinessMetadataDefByNameOptionalParams, + TypeGetBusinessMetadataDefByGuidOptionalParams, +} from "./api/type/index.js"; export { DiscoveryOperations, EntityOperations, GlossaryOperations, LineageOperations, RelationshipOperations, - TypeDefinitionOperations, + TypeOperations, } from "./classic/index.js"; export { FileContents }; diff --git a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/purviewDataMapClient.ts similarity index 68% rename from packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts rename to packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/purviewDataMapClient.ts index 5bf327486b..8f39831b59 100644 --- a/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/dataMapClient.ts +++ b/packages/typespec-test/test/Azure.Analytics.Purview.DataMap/generated/typespec-ts/src/purviewDataMapClient.ts @@ -2,9 +2,9 @@ // Licensed under the MIT License. import { - createDataMap, - DataMapContext, - DataMapClientOptionalParams, + createPurviewDataMap, + PurviewDataMapContext, + PurviewDataMapClientOptionalParams, } from "./api/index.js"; import { DiscoveryOperations, @@ -26,35 +26,38 @@ import { RelationshipOperations, _getRelationshipOperations, } from "./classic/relationship/index.js"; -import { - TypeDefinitionOperations, - _getTypeDefinitionOperations, -} from "./classic/typeDefinition/index.js"; +import { TypeOperations, _getTypeOperations } from "./classic/type/index.js"; import { TokenCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; -export { DataMapClientOptionalParams } from "./api/dataMapContext.js"; +export { PurviewDataMapClientOptionalParams } from "./api/purviewDataMapContext.js"; -export class DataMapClient { - private _client: DataMapContext; +export class PurviewDataMapClient { + private _client: PurviewDataMapContext; /** The pipeline used by this client to make requests */ public readonly pipeline: Pipeline; + /** + * Purview Data Map Service is a fully managed cloud service whose users can + * discover the data sources they need and understand the data sources they find. + * At the same time, Data Map helps organizations get more value from their + * existing investments. This spec defines REST API of Purview Data Map Service. + */ constructor( endpointParam: string, credential: TokenCredential, - options: DataMapClientOptionalParams = {}, + options: PurviewDataMapClientOptionalParams = {}, ) { const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : `azsdk-js-client`; - this._client = createDataMap(endpointParam, credential, { + this._client = createPurviewDataMap(endpointParam, credential, { ...options, userAgentOptions: { userAgentPrefix }, }); this.pipeline = this._client.pipeline; - this.typeDefinition = _getTypeDefinitionOperations(this._client); + this.type = _getTypeOperations(this._client); this.relationship = _getRelationshipOperations(this._client); this.lineage = _getLineageOperations(this._client); this.discovery = _getDiscoveryOperations(this._client); @@ -62,8 +65,8 @@ export class DataMapClient { this.entity = _getEntityOperations(this._client); } - /** The operation groups for typeDefinition */ - public readonly typeDefinition: TypeDefinitionOperations; + /** The operation groups for type */ + public readonly type: TypeOperations; /** The operation groups for relationship */ public readonly relationship: RelationshipOperations; /** The operation groups for lineage */