diff --git a/rush.json b/rush.json index ddf01f788db5..e2e518a02e83 100644 --- a/rush.json +++ b/rush.json @@ -784,6 +784,11 @@ "packageName": "@azure-tests/perf-core-rest-pipeline", "projectFolder": "sdk/core/perf-tests/core-rest-pipeline", "versionPolicyName": "test" + }, + { + "packageName": "@azure/maps-creator", + "projectFolder": "sdk/maps/maps-creator", + "versionPolicyName": "client" } ] } diff --git a/sdk/maps/maps-creator/LICENSE.txt b/sdk/maps/maps-creator/LICENSE.txt new file mode 100644 index 000000000000..ccb63b166732 --- /dev/null +++ b/sdk/maps/maps-creator/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +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/sdk/maps/maps-creator/README.md b/sdk/maps/maps-creator/README.md new file mode 100644 index 000000000000..d9d4bd1ccbb1 --- /dev/null +++ b/sdk/maps/maps-creator/README.md @@ -0,0 +1,91 @@ +# Azure Creator client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Creator client. + +APIs for managing aliases in Azure Maps. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator) | +[Package (NPM)](https://www.npmjs.com/package/@azure/maps-creator) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/maps-creator) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator/samples) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/maps-creator` package + +Install the Azure Creator client library for JavaScript with `npm`: + +```bash +npm install @azure/maps-creator +``` + +### Create and authenticate a `CreatorClient` + +To create a client object to access the Azure Creator API, you will need the `endpoint` of your Azure Creator resource and a `credential`. The Azure Creator client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Creator resource in the [Azure Portal][azure_portal]. + +#### Using an Azure Active Directory Credential + +You can authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. 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 Creator by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +```javascript +const { CreatorClient } = require("@azure/maps-creator"); +const { DefaultAzureCredential } = require("@azure/identity"); +const client = new CreatorClient("", new DefaultAzureCredential()); +``` + +## Key concepts + +### CreatorClient + +`CreatorClient` is the primary interface for developers using the Azure Creator client library. Explore the methods on this client object to understand the different features of the Azure Creator 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`: + +```javascript +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/master/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator/samples) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/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) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmaps%2Fmaps-creator%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential diff --git a/sdk/maps/maps-creator/api-extractor.json b/sdk/maps/maps-creator/api-extractor.json new file mode 100644 index 000000000000..5fb5b21b56f2 --- /dev/null +++ b/sdk/maps/maps-creator/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./esm/index.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/maps/maps-creator/package.json b/sdk/maps/maps-creator/package.json new file mode 100644 index 000000000000..f60bd7c01534 --- /dev/null +++ b/sdk/maps/maps-creator/package.json @@ -0,0 +1,87 @@ +{ + "name": "@azure/maps-creator", + "sdk-type": "client", + "author": "Microsoft Corporation", + "description": "A generated SDK for CreatorClient.", + "version": "1.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, + "dependencies": { + "@azure/core-lro": "^1.0.6", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.1.1", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" + }, + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], + "license": "MIT", + "main": "./dist/index.js", + "module": "./esm/index.js", + "types": "./esm/index.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "7.7.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-node-resolve": "^3.4.0", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm install && npm run build", + "pack": "npm pack 2>&1", + "extract-api": "mkdirp ./review && api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "echo skipped", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "echo skipped", + "prebuild": "echo skipped", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "echo skipped", + "unit-test:node": "echo skipped", + "unit-test:browser": "echo skipped", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "integration-test": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/maps/maps-creator/review/maps-creator.api.md b/sdk/maps/maps-creator/review/maps-creator.api.md new file mode 100644 index 000000000000..9d11f13508b1 --- /dev/null +++ b/sdk/maps/maps-creator/review/maps-creator.api.md @@ -0,0 +1,1213 @@ +## API Report File for "@azure/maps-creator" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import * as coreRestPipeline from '@azure/core-rest-pipeline'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface Alias { + assign(aliasId: string, creatorDataItemId: string, options?: AliasAssignOptionalParams): Promise; + create(options?: AliasCreateOptionalParams): Promise; + delete(aliasId: string, options?: AliasDeleteOptionalParams): Promise; + getDetails(aliasId: string, options?: AliasGetDetailsOptionalParams): Promise; + list(options?: AliasListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AliasAssignOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AliasAssignResponse = AliasListItem; + +// @public +export interface AliasCreateHeaders { + accessControlExposeHeaders?: string; +} + +// @public +export interface AliasCreateOptionalParams extends coreClient.OperationOptions { + creatorDataItemId?: string; +} + +// @public +export type AliasCreateResponse = AliasCreateHeaders & AliasesCreateResponse; + +// @public +export interface AliasDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface AliasesCreateResponse { + readonly aliasId?: string; + readonly createdTimestamp?: string; + readonly creatorDataItemId?: string; + readonly lastUpdatedTimestamp?: string; +} + +// @public +export interface AliasGetDetailsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AliasGetDetailsResponse = AliasListItem; + +// @public +export interface AliasListItem { + readonly aliasId?: string; + readonly createdTimestamp?: string; + readonly creatorDataItemId?: string | null; + readonly lastUpdatedTimestamp?: string; +} + +// @public +export interface AliasListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AliasListNextResponse = AliasListResponse; + +// @public +export type AliasListOperationResponse = AliasListResponse; + +// @public +export interface AliasListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface AliasListResponse { + readonly aliases?: AliasListItem[]; + readonly nextLink?: string; +} + +// @public +export interface BooleanRuleObject { + false?: string; + true?: string; +} + +// @public +export type BooleanTypeStyleRule = StyleObject & { + type: "boolean"; + rules: BooleanRuleObject[]; +}; + +// @public +export interface BufferRequestBody { + distances?: number[]; + geometries?: Record; +} + +// @public +export interface BufferResponse { + result?: GeoJsonFeatureCollectionUnion; + readonly summary?: BufferResponseSummary; +} + +// @public +export interface BufferResponseSummary { + readonly information?: string; + readonly udid?: string; +} + +// @public +export interface ClosestPointResponse { + result?: ClosestPointResultEntry[]; + readonly summary?: ClosestPointSummary; +} + +// @public +export interface ClosestPointResultEntry { + readonly distanceInMeters?: number; + readonly geometryId?: string; + position?: SpatialCoordinate; +} + +// @public +export interface ClosestPointSummary { + readonly information?: string; + sourcePoint?: SpatialCoordinate; + readonly udid?: string; +} + +// @public +export interface CollectionDefinitionResponse { + description?: string; + featureTypes: string[]; + geometryType: GeoJsonGeometryType; + idPrefix: string; + links?: WfsEndpointLink[]; + name: string; + readonly ontology?: string; + properties?: DefinitionProperties[]; + title?: string; +} + +// @public (undocumented) +export interface CollectionInfo { + description?: string; + links: WfsEndpointLink[]; + name: string; + readonly ontology?: string; + title?: string; +} + +// @public (undocumented) +export interface CollectionsResponse { + collections: CollectionInfo[]; + links: WfsEndpointLink[]; + readonly ontology?: string; +} + +// @public (undocumented) +export interface ConformanceResponse { + conformsTo: string[]; +} + +// @public +export interface Conversion { + beginConvert(udid: string, outputOntology: string, options?: ConversionConvertOptionalParams): Promise, ConversionConvertResponse>>; + beginConvertAndWait(udid: string, outputOntology: string, options?: ConversionConvertOptionalParams): Promise; + delete(conversionId: string, options?: ConversionDeleteOptionalParams): Promise; + get(conversionId: string, options?: ConversionGetOptionalParams): Promise; + getOperation(operationId: string, options?: ConversionGetOperationOptionalParams): Promise; + list(options?: ConversionListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ConversionConvertHeaders { + resourceLocation?: string; +} + +// @public +export interface ConversionConvertOptionalParams extends coreClient.OperationOptions { + description?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ConversionConvertResponse = ConversionConvertHeaders & LongRunningOperationResult; + +// @public +export interface ConversionDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConversionGetOperationHeaders { + resourceLocation?: string; +} + +// @public +export interface ConversionGetOperationOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConversionGetOperationResponse = ConversionGetOperationHeaders & LongRunningOperationResult; + +// @public +export interface ConversionGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConversionGetResponse = ConversionListDetailInfo; + +// @public +export interface ConversionListDetailInfo { + readonly conversionId?: string; + readonly created?: string; + readonly description?: string; + readonly featureCounts?: Record; + readonly ontology?: string; + readonly udid?: string; +} + +// @public +export interface ConversionListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ConversionListNextResponse = ConversionListResponse; + +// @public +export type ConversionListOperationResponse = ConversionListResponse; + +// @public +export interface ConversionListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ConversionListResponse { + readonly conversions?: ConversionListDetailInfo[]; + readonly nextLink?: string; +} + +// @public (undocumented) +export class CreatorClient extends CreatorClientContext { + constructor(credentials: coreAuth.TokenCredential, options?: CreatorClientOptionalParams); + // (undocumented) + alias: Alias; + // (undocumented) + conversion: Conversion; + // (undocumented) + data: Data; + // (undocumented) + dataset: Dataset; + // (undocumented) + featureState: FeatureState; + // (undocumented) + spatial: Spatial; + // (undocumented) + tileset: Tileset; + // (undocumented) + wfs: Wfs; +} + +// @public (undocumented) +export class CreatorClientContext extends coreClient.ServiceClient { + constructor(credentials: coreAuth.TokenCredential, options?: CreatorClientOptionalParams); + // (undocumented) + geography: Geography; + // (undocumented) + xMsClientId?: string; +} + +// @public +export interface CreatorClientOptionalParams extends coreClient.ServiceClientOptions { + endpoint?: string; + geography?: Geography; + xMsClientId?: string; +} + +// @public +export interface Data { + beginUpdatePreview(uniqueDataId: string, updateContent: Record, options?: DataUpdatePreviewOptionalParams): Promise, DataUpdatePreviewResponse>>; + beginUpdatePreviewAndWait(uniqueDataId: string, updateContent: Record, options?: DataUpdatePreviewOptionalParams): Promise; + beginUploadPreview(...args: [ + UploadDataFormat, + "application/octet-stream", + coreRestPipeline.RequestBodyType, + DataUploadPreview$binaryOptionalParams? + ] | [ + UploadDataFormat, + "application/json", + Record, + DataUploadPreview$jsonOptionalParams? + ]): Promise, DataUploadPreviewResponse>>; + beginUploadPreviewAndWait(...args: [ + UploadDataFormat, + "application/octet-stream", + coreRestPipeline.RequestBodyType, + DataUploadPreview$binaryOptionalParams? + ] | [ + UploadDataFormat, + "application/json", + Record, + DataUploadPreview$jsonOptionalParams? + ]): Promise; + deletePreview(uniqueDataId: string, options?: DataDeletePreviewOptionalParams): Promise; + downloadPreview(uniqueDataId: string, options?: DataDownloadPreviewOptionalParams): Promise; + getOperationPreview(operationId: string, options?: DataGetOperationPreviewOptionalParams): Promise; + listPreview(options?: DataListPreviewOptionalParams): Promise; +} + +// @public +export interface DataDeletePreviewOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface DataDownloadPreviewHeaders { + contentType?: string; +} + +// @public +export interface DataDownloadPreviewOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DataDownloadPreviewResponse = DataDownloadPreviewHeaders & { + blobBody?: Promise; + readableStreamBody?: NodeJS.ReadableStream; +}; + +// @public +export interface DataGetOperationPreviewHeaders { + resourceLocation?: string; +} + +// @public +export interface DataGetOperationPreviewOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DataGetOperationPreviewResponse = DataGetOperationPreviewHeaders & LongRunningOperationResult; + +// @public +export interface DataListPreviewOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DataListPreviewResponse = MapDataListResponse; + +// @public +export interface Dataset { + beginCreate(conversionId: string, options?: DatasetCreateOptionalParams): Promise, DatasetCreateResponse>>; + beginCreateAndWait(conversionId: string, options?: DatasetCreateOptionalParams): Promise; + delete(datasetId: string, options?: DatasetDeleteOptionalParams): Promise; + get(datasetId: string, options?: DatasetGetOptionalParams): Promise; + getOperation(operationId: string, options?: DatasetGetOperationOptionalParams): Promise; + list(options?: DatasetListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DatasetCreateHeaders { + resourceLocation?: string; +} + +// @public +export interface DatasetCreateOptionalParams extends coreClient.OperationOptions { + datasetId?: string; + descriptionDataset?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DatasetCreateResponse = DatasetCreateHeaders & LongRunningOperationResult; + +// @public +export interface DatasetDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface DatasetDetailInfo { + readonly created?: string; + readonly datasetId?: string; + datasetSources?: DatasetSources; + readonly description?: string; + readonly featureCounts?: Record; + readonly ontology?: string; +} + +// @public +export interface DatasetGetOperationHeaders { + resourceLocation?: string; +} + +// @public +export interface DatasetGetOperationOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DatasetGetOperationResponse = DatasetGetOperationHeaders & LongRunningOperationResult; + +// @public +export interface DatasetGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DatasetGetResponse = DatasetDetailInfo; + +// @public +export interface DatasetListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DatasetListNextResponse = DatasetListResponse; + +// @public +export type DatasetListOperationResponse = DatasetListResponse; + +// @public +export interface DatasetListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface DatasetListResponse { + readonly datasets?: DatasetDetailInfo[]; + readonly nextLink?: string; +} + +// @public +export interface DatasetSources { + readonly appendDatasetId?: string; + readonly conversionIds?: string[]; +} + +// @public +export interface DataUpdatePreviewHeaders { + resourceLocation?: string; +} + +// @public +export interface DataUpdatePreviewOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; + uploadDataDescription?: string; +} + +// @public +export type DataUpdatePreviewResponse = DataUpdatePreviewHeaders & LongRunningOperationResult; + +// @public +export interface DataUploadPreview$binaryOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; + uploadDataDescription?: string; +} + +// @public +export interface DataUploadPreview$jsonOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; + uploadDataDescription?: string; +} + +// @public +export interface DataUploadPreviewHeaders { + resourceLocation?: string; +} + +// @public +export type DataUploadPreviewResponse = DataUploadPreviewHeaders & LongRunningOperationResult; + +// @public (undocumented) +export interface DefinitionProperties { + name: string; + required: boolean; + type: Record; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export type ExtendedGeoJsonFeatureCollection = GeoJsonFeatureCollection & ExtendedGeoJsonFeatureCollectionData & {}; + +// @public (undocumented) +export interface ExtendedGeoJsonFeatureCollectionData { + links?: WfsEndpointLink[]; + numberReturned?: number; + readonly ontology?: string; +} + +// @public (undocumented) +export interface FeatureResponse { + feature: GeoJsonFeature; + links?: WfsEndpointLink[]; + readonly ontology?: string; +} + +// @public +export interface FeatureState { + createStateset(datasetId: string, statesetCreateRequestBody: StylesObject, options?: FeatureStateCreateStatesetOptionalParams): Promise; + deleteState(statesetId: string, featureId: string, stateKeyName: string, options?: FeatureStateDeleteStateOptionalParams): Promise; + deleteStateset(statesetId: string, options?: FeatureStateDeleteStatesetOptionalParams): Promise; + getStates(statesetId: string, featureId: string, options?: FeatureStateGetStatesOptionalParams): Promise; + getStateset(statesetId: string, options?: FeatureStateGetStatesetOptionalParams): Promise; + listStateset(options?: FeatureStateListStatesetOptionalParams): PagedAsyncIterableIterator; + putStateset(statesetId: string, statesetStyleUpdateRequestBody: StylesObject, options?: FeatureStatePutStatesetOptionalParams): Promise; + updateStates(statesetId: string, featureId: string, featureStateUpdateRequestBody: FeatureStatesStructure, options?: FeatureStateUpdateStatesOptionalParams): Promise; +} + +// @public +export interface FeatureStateCreateStatesetOptionalParams extends coreClient.OperationOptions { + description?: string; +} + +// @public +export type FeatureStateCreateStatesetResponse = StatesetCreatedResponse; + +// @public +export interface FeatureStateDeleteStateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface FeatureStateDeleteStatesetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface FeatureStateGetStatesetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FeatureStateGetStatesetResponse = StatesetGetResponse; + +// @public +export interface FeatureStateGetStatesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FeatureStateGetStatesResponse = FeatureStatesStructure; + +// @public +export interface FeatureStateListStatesetNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FeatureStateListStatesetNextResponse = StatesetListResponse; + +// @public +export interface FeatureStateListStatesetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FeatureStateListStatesetResponse = StatesetListResponse; + +// @public +export interface FeatureStateObject { + eventTimestamp?: string; + keyName?: string; + value?: string; +} + +// @public +export interface FeatureStatePutStatesetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface FeatureStatesStructure { + states?: FeatureStateObject[]; +} + +// @public +export interface FeatureStateUpdateStatesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface GeofenceGeometry { + readonly deviceId?: string; + readonly distance?: number; + readonly geometryId?: string; + readonly nearestLat?: number; + readonly nearestLon?: number; + readonly nearestZ?: number; + readonly udId?: string; +} + +// @public +export type GeofenceMode = string; + +// @public +export interface GeofenceResponse { + readonly expiredGeofenceGeometryId?: string[]; + readonly geometries?: GeofenceGeometry[]; + readonly invalidPeriodGeofenceGeometryId?: string[]; + readonly isEventPublished?: boolean; +} + +// @public +export type GeographicResourceLocation = string; + +// @public +export type Geography = string; + +// @public +export type GeoJsonFeature = GeoJsonObject & GeoJsonFeatureData & { + type: "Feature"; +}; + +// @public +export type GeoJsonFeatureCollection = GeoJsonObject & GeoJsonFeatureCollectionData & { + type: "FeatureCollection" | "FeatureCollection"; +}; + +// @public (undocumented) +export interface GeoJsonFeatureCollectionData { + features: GeoJsonFeature[]; +} + +// @public (undocumented) +export type GeoJsonFeatureCollectionUnion = GeoJsonFeatureCollection | ExtendedGeoJsonFeatureCollection; + +// @public (undocumented) +export interface GeoJsonFeatureData { + featureType?: string; + geometry: GeoJsonGeometryUnion; + id?: string; + properties?: Record; +} + +// @public +export type GeoJsonGeometry = GeoJsonObject & { + type: "GeoJsonGeometry" | "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon" | "GeometryCollection"; +}; + +// @public +export type GeoJsonGeometryCollection = GeoJsonGeometry & GeoJsonGeometryCollectionData & {}; + +// @public (undocumented) +export interface GeoJsonGeometryCollectionData { + geometries: GeoJsonGeometryUnion[]; +} + +// @public +export type GeoJsonGeometryType = string; + +// @public (undocumented) +export type GeoJsonGeometryUnion = GeoJsonGeometry | GeoJsonPoint | GeoJsonMultiPoint | GeoJsonLineString | GeoJsonMultiLineString | GeoJsonPolygon | GeoJsonMultiPolygon | GeoJsonGeometryCollection; + +// @public +export type GeoJsonLineString = GeoJsonGeometry & GeoJsonLineStringData & {}; + +// @public (undocumented) +export interface GeoJsonLineStringData { + coordinates: number[][]; +} + +// @public +export type GeoJsonMultiLineString = GeoJsonGeometry & GeoJsonMultiLineStringData & {}; + +// @public (undocumented) +export interface GeoJsonMultiLineStringData { + coordinates: number[][][]; +} + +// @public +export type GeoJsonMultiPoint = GeoJsonGeometry & GeoJsonMultiPointData & {}; + +// @public +export interface GeoJsonMultiPointData { + coordinates: number[][]; +} + +// @public +export type GeoJsonMultiPolygon = GeoJsonGeometry & GeoJsonMultiPolygonData & {}; + +// @public (undocumented) +export interface GeoJsonMultiPolygonData { + coordinates: number[][][][]; +} + +// @public +export interface GeoJsonObject { + type: "GeoJsonGeometry" | "Feature" | "FeatureCollection" | "FeatureCollection" | "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon" | "GeometryCollection"; +} + +// @public +export type GeoJsonObjectType = string; + +// @public (undocumented) +export type GeoJsonObjectUnion = GeoJsonObject | GeoJsonGeometryUnion | GeoJsonFeature | GeoJsonFeatureCollectionUnion; + +// @public +export type GeoJsonPoint = GeoJsonGeometry & GeoJsonPointData & {}; + +// @public +export interface GeoJsonPointData { + coordinates: number[]; +} + +// @public +export type GeoJsonPolygon = GeoJsonGeometry & GeoJsonPolygonData & {}; + +// @public (undocumented) +export interface GeoJsonPolygonData { + coordinates: number[][][]; +} + +// @public +export interface GreatCircleDistanceResponse { + readonly result?: GreatCircleDistanceResponseResult; + readonly summary?: GreatCircleDistanceResponseSummary; +} + +// @public +export interface GreatCircleDistanceResponseResult { + readonly distanceInMeters?: number; +} + +// @public +export interface GreatCircleDistanceResponseSummary { + sourcePoint?: SpatialCoordinate; + targetPoint?: SpatialCoordinate; +} + +// @public +export const enum KnownGeofenceMode { + All = "All", + EnterAndExit = "EnterAndExit" +} + +// @public +export const enum KnownGeographicResourceLocation { + Eu = "eu", + Us = "us" +} + +// @public +export const enum KnownGeography { + // (undocumented) + Eu = "eu", + // (undocumented) + Us = "us" +} + +// @public +export const enum KnownGeoJsonGeometryType { + GeoJsonGeometryCollection = "GeometryCollection", + GeoJsonLineString = "LineString", + GeoJsonMultiLineString = "MultiLineString", + GeoJsonMultiPoint = "MultiPoint", + GeoJsonMultiPolygon = "MultiPolygon", + GeoJsonPoint = "Point", + GeoJsonPolygon = "Polygon" +} + +// @public +export const enum KnownGeoJsonObjectType { + GeoJsonFeature = "Feature", + GeoJsonFeatureCollection = "FeatureCollection", + GeoJsonGeometryCollection = "GeometryCollection", + GeoJsonLineString = "LineString", + GeoJsonMultiLineString = "MultiLineString", + GeoJsonMultiPoint = "MultiPoint", + GeoJsonMultiPolygon = "MultiPolygon", + GeoJsonPoint = "Point", + GeoJsonPolygon = "Polygon" +} + +// @public +export const enum KnownLroStatus { + Failed = "Failed", + NotStarted = "NotStarted", + Running = "Running", + Succeeded = "Succeeded" +} + +// @public +export const enum KnownResponseFormat { + Json = "json" +} + +// @public +export const enum KnownStyleObjectType { + BooleanTypeStyleRule = "boolean", + NumberTypeStyleRule = "number", + StringTypeStyleRule = "string" +} + +// @public +export const enum KnownUploadDataFormat { + Dwgzippackage = "dwgzippackage", + Geojson = "geojson", + Zip = "zip" +} + +// @public (undocumented) +export interface LandingPageResponse { + links: WfsEndpointLink[]; + readonly ontology?: string; +} + +// @public +export interface LongRunningOperationResult { + readonly created?: string; + error?: ErrorDetail; + operationId?: string; + readonly status?: LroStatus; + warning?: ErrorDetail; +} + +// @public +export type LroStatus = string; + +// @public +export interface MapDataDetailInfo { + readonly dataFormat?: string; + readonly description?: string; + readonly location?: string; + readonly sizeInBytes?: number; + readonly udid?: string; + readonly uploadStatus?: string; +} + +// @public +export interface MapDataListResponse { + readonly mapDataList?: MapDataDetailInfo[]; +} + +// @public +export interface NumberRuleObject { + color?: string; + range?: RangeObject; +} + +// @public +export type NumberTypeStyleRule = StyleObject & { + type: "number"; + rules: NumberRuleObject[]; +}; + +// @public +export interface PointInPolygonResponse { + result?: PointInPolygonResult; + readonly summary?: PointInPolygonSummary; +} + +// @public +export interface PointInPolygonResult { + readonly intersectingGeometries?: string[]; + readonly pointInPolygons?: boolean; +} + +// @public +export interface PointInPolygonSummary { + readonly information?: string; + sourcePoint?: SpatialCoordinate; + readonly udid?: string; +} + +// @public +export interface RangeObject { + exclusiveMaximum?: number; + exclusiveMinimum?: number; + maximum?: number; + minimum?: number; +} + +// @public +export type ResponseFormat = string; + +// @public +export interface Spatial { + getBuffer(format: ResponseFormat, udid: string, distances: string, options?: SpatialGetBufferOptionalParams): Promise; + getClosestPoint(format: ResponseFormat, udid: string, latitude: number, longitude: number, options?: SpatialGetClosestPointOptionalParams): Promise; + getGeofence(format: ResponseFormat, deviceId: string, udid: string, latitude: number, longitude: number, options?: SpatialGetGeofenceOptionalParams): Promise; + getGreatCircleDistance(format: ResponseFormat, query: string, options?: SpatialGetGreatCircleDistanceOptionalParams): Promise; + getPointInPolygon(format: ResponseFormat, udid: string, latitude: number, longitude: number, options?: SpatialGetPointInPolygonOptionalParams): Promise; + postBuffer(format: ResponseFormat, bufferRequestBody: BufferRequestBody, options?: SpatialPostBufferOptionalParams): Promise; + postClosestPoint(format: ResponseFormat, latitude: number, longitude: number, closestPointRequestBody: Record, options?: SpatialPostClosestPointOptionalParams): Promise; + postGeofence(format: ResponseFormat, deviceId: string, latitude: number, longitude: number, searchGeofenceRequestBody: Record, options?: SpatialPostGeofenceOptionalParams): Promise; + postPointInPolygon(format: ResponseFormat, latitude: number, longitude: number, pointInPolygonRequestBody: Record, options?: SpatialPostPointInPolygonOptionalParams): Promise; +} + +// @public +export interface SpatialCoordinate { + readonly lat?: number; + readonly lon?: number; +} + +// @public +export interface SpatialGetBufferOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SpatialGetBufferResponse = BufferResponse; + +// @public +export interface SpatialGetClosestPointOptionalParams extends coreClient.OperationOptions { + numberOfClosestPoints?: number; +} + +// @public +export type SpatialGetClosestPointResponse = ClosestPointResponse; + +// @public +export interface SpatialGetGeofenceHeaders { + xCorrelationId?: string; +} + +// @public +export interface SpatialGetGeofenceOptionalParams extends coreClient.OperationOptions { + isAsync?: boolean; + mode?: GeofenceMode; + searchBuffer?: number; + userTime?: Date; + z?: number; +} + +// @public +export type SpatialGetGeofenceResponse = SpatialGetGeofenceHeaders & GeofenceResponse; + +// @public +export interface SpatialGetGreatCircleDistanceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SpatialGetGreatCircleDistanceResponse = GreatCircleDistanceResponse; + +// @public +export interface SpatialGetPointInPolygonOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SpatialGetPointInPolygonResponse = PointInPolygonResponse; + +// @public +export interface SpatialPostBufferOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SpatialPostBufferResponse = BufferResponse; + +// @public +export interface SpatialPostClosestPointOptionalParams extends coreClient.OperationOptions { + numberOfClosestPoints?: number; +} + +// @public +export type SpatialPostClosestPointResponse = ClosestPointResponse; + +// @public +export interface SpatialPostGeofenceHeaders { + xCorrelationId?: string; +} + +// @public +export interface SpatialPostGeofenceOptionalParams extends coreClient.OperationOptions { + isAsync?: boolean; + mode?: GeofenceMode; + searchBuffer?: number; + userTime?: Date; + z?: number; +} + +// @public +export type SpatialPostGeofenceResponse = SpatialPostGeofenceHeaders & GeofenceResponse; + +// @public +export interface SpatialPostPointInPolygonOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SpatialPostPointInPolygonResponse = PointInPolygonResponse; + +// @public +export interface StatesetCreatedResponse { + readonly statesetId?: string; +} + +// @public +export interface StatesetGetResponse { + datasetIds?: string[]; + readonly description?: string; + statesetStyle?: StylesObject; +} + +// @public +export interface StatesetInfoObject { + datasetIds?: string[]; + readonly description?: string; + statesetId?: string; + statesetStyle?: StylesObject; +} + +// @public +export interface StatesetListResponse { + readonly nextLink?: string; + statesets?: StatesetInfoObject[]; +} + +// @public +export type StringTypeStyleRule = StyleObject & { + type: "string"; + rules: { + [propertyName: string]: string; + }[]; +}; + +// @public +export interface StyleObject { + keyName: string; + type: "boolean" | "number" | "string"; +} + +// @public +export type StyleObjectType = string; + +// @public (undocumented) +export type StyleObjectUnion = StyleObject | BooleanTypeStyleRule | NumberTypeStyleRule | StringTypeStyleRule; + +// @public +export interface StylesObject { + styles?: StyleObjectUnion[]; +} + +// @public +export interface Tileset { + beginCreate(datasetId: string, options?: TilesetCreateOptionalParams): Promise, TilesetCreateResponse>>; + beginCreateAndWait(datasetId: string, options?: TilesetCreateOptionalParams): Promise; + delete(tilesetId: string, options?: TilesetDeleteOptionalParams): Promise; + get(tilesetId: string, options?: TilesetGetOptionalParams): Promise; + getOperation(operationId: string, options?: TilesetGetOperationOptionalParams): Promise; + list(options?: TilesetListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface TilesetCreateHeaders { + resourceLocation?: string; +} + +// @public +export interface TilesetCreateOptionalParams extends coreClient.OperationOptions { + description?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type TilesetCreateResponse = TilesetCreateHeaders & LongRunningOperationResult; + +// @public +export interface TilesetDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface TilesetDetailInfo { + readonly bbox?: number[]; + readonly datasetId?: string; + readonly description?: string; + readonly maxZoom?: number; + readonly minZoom?: number; + readonly ontology?: string; + readonly tilesetId?: string; +} + +// @public +export interface TilesetGetOperationHeaders { + resourceLocation?: string; +} + +// @public +export interface TilesetGetOperationOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TilesetGetOperationResponse = TilesetGetOperationHeaders & LongRunningOperationResult; + +// @public +export interface TilesetGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TilesetGetResponse = TilesetDetailInfo; + +// @public +export interface TilesetListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TilesetListNextResponse = TilesetListResponse; + +// @public +export type TilesetListOperationResponse = TilesetListResponse; + +// @public +export interface TilesetListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface TilesetListResponse { + readonly nextLink?: string; + readonly tilesets?: TilesetDetailInfo[]; +} + +// @public +export type UploadDataFormat = string; + +// @public +export interface Wfs { + deleteFeature(datasetId: string, collectionId: string, featureId: string, options?: WfsDeleteFeatureOptionalParams): Promise; + getCollection(datasetId: string, collectionId: string, options?: WfsGetCollectionOptionalParams): Promise; + getCollectionDefinition(datasetId: string, collectionId: string, options?: WfsGetCollectionDefinitionOptionalParams): Promise; + getCollections(datasetId: string, options?: WfsGetCollectionsOptionalParams): Promise; + getConformance(datasetId: string, options?: WfsGetConformanceOptionalParams): Promise; + getFeature(datasetId: string, collectionId: string, featureId: string, options?: WfsGetFeatureOptionalParams): Promise; + getFeatures(datasetId: string, collectionId: string, options?: WfsGetFeaturesOptionalParams): Promise; + getLandingPage(datasetId: string, options?: WfsGetLandingPageOptionalParams): Promise; +} + +// @public +export interface WfsDeleteFeatureOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface WfsEndpointLink { + href: string; + hreflang?: string; + rel?: string; + title?: string; + type?: string; +} + +// @public +export interface WfsGetCollectionDefinitionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WfsGetCollectionDefinitionResponse = CollectionDefinitionResponse; + +// @public +export interface WfsGetCollectionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WfsGetCollectionResponse = CollectionInfo; + +// @public +export interface WfsGetCollectionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WfsGetCollectionsResponse = CollectionsResponse; + +// @public +export interface WfsGetConformanceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WfsGetConformanceResponse = ConformanceResponse; + +// @public +export interface WfsGetFeatureOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WfsGetFeatureResponse = FeatureResponse; + +// @public +export interface WfsGetFeaturesOptionalParams extends coreClient.OperationOptions { + bbox?: string; + filter?: string; + limit?: number; +} + +// @public +export type WfsGetFeaturesResponse = ExtendedGeoJsonFeatureCollection; + +// @public +export interface WfsGetLandingPageOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WfsGetLandingPageResponse = LandingPageResponse; + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/maps/maps-creator/rollup.config.js b/sdk/maps/maps-creator/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/maps/maps-creator/rollup.config.js @@ -0,0 +1,188 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/maps/maps-creator/samples/resources/data_sample_update.json b/sdk/maps/maps-creator/samples/resources/data_sample_update.json new file mode 100644 index 000000000000..5e0c29ad53e5 --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/data_sample_update.json @@ -0,0 +1,19 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -123.126986, + 48.639754 + ] + }, + "properties": { + "geometryId": "001", + "radius": 255 + } + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/data_sample_upload.json b/sdk/maps/maps-creator/samples/resources/data_sample_upload.json new file mode 100644 index 000000000000..d7601b903395 --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/data_sample_upload.json @@ -0,0 +1,19 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -122.126986, + 47.639754 + ] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/data_sample_upload.zip b/sdk/maps/maps-creator/samples/resources/data_sample_upload.zip new file mode 100644 index 000000000000..6ccd25662311 Binary files /dev/null and b/sdk/maps/maps-creator/samples/resources/data_sample_upload.zip differ diff --git a/sdk/maps/maps-creator/samples/resources/featurestate_sample_create.json b/sdk/maps/maps-creator/samples/resources/featurestate_sample_create.json new file mode 100644 index 000000000000..324cfd8cb765 --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/featurestate_sample_create.json @@ -0,0 +1,57 @@ +{ + "styles": [ + { + "keyName": "s1", + "type": "boolean", + "rules": [ + { + "true": "#FF0000", + "false": "#00FF00" + } + ] + }, + { + "keyName": "s2", + "type": "number", + "rules": [ + { + "range": { + "exclusiveMaximum": 50 + }, + "color": "#343deb" + }, + { + "range": { + "minimum": 50, + "exclusiveMaximum": 70 + }, + "color": "#34ebb1" + }, + { + "range": { + "minimum": 70, + "exclusiveMaximum": 90 + }, + "color": "#eba834" + }, + { + "range": { + "minimum": 90 + }, + "color": "#eb3434" + } + ] + }, + { + "keyName": "s3", + "type": "string", + "rules": [ + { + "stateValue1": "#FF0000", + "stateValue2": "#FF00AA", + "stateValueN": "#00FF00" + } + ] + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/featurestate_sample_put.json b/sdk/maps/maps-creator/samples/resources/featurestate_sample_put.json new file mode 100644 index 000000000000..324cfd8cb765 --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/featurestate_sample_put.json @@ -0,0 +1,57 @@ +{ + "styles": [ + { + "keyName": "s1", + "type": "boolean", + "rules": [ + { + "true": "#FF0000", + "false": "#00FF00" + } + ] + }, + { + "keyName": "s2", + "type": "number", + "rules": [ + { + "range": { + "exclusiveMaximum": 50 + }, + "color": "#343deb" + }, + { + "range": { + "minimum": 50, + "exclusiveMaximum": 70 + }, + "color": "#34ebb1" + }, + { + "range": { + "minimum": 70, + "exclusiveMaximum": 90 + }, + "color": "#eba834" + }, + { + "range": { + "minimum": 90 + }, + "color": "#eb3434" + } + ] + }, + { + "keyName": "s3", + "type": "string", + "rules": [ + { + "stateValue1": "#FF0000", + "stateValue2": "#FF00AA", + "stateValueN": "#00FF00" + } + ] + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/featurestate_sample_update_states.json b/sdk/maps/maps-creator/samples/resources/featurestate_sample_update_states.json new file mode 100644 index 000000000000..e2c754da01ad --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/featurestate_sample_update_states.json @@ -0,0 +1,9 @@ +{ + "states": [ + { + "keyName": "s1", + "value": "true", + "eventTimestamp": "2019-08-16 13:01" + } + ] +} diff --git a/sdk/maps/maps-creator/samples/resources/spatial_buffer_request_body.json b/sdk/maps/maps-creator/samples/resources/spatial_buffer_request_body.json new file mode 100644 index 000000000000..185e253df56c --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/spatial_buffer_request_body.json @@ -0,0 +1,23 @@ +{ + "geometries": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "geometryId": "ExampleId" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -111.9267386, + 33.5362475 + ] + } + } + ] + }, + "distances": [ + 176.3 + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/spatial_closest_point_request_body.json b/sdk/maps/maps-creator/samples/resources/spatial_closest_point_request_body.json new file mode 100644 index 000000000000..808e471ffbba --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/spatial_closest_point_request_body.json @@ -0,0 +1,44 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "geometryId": 1001 + }, + "geometry": { + "type": "Point", + "coordinates": [ + -105.02860293715861, + 40.516153406773952 + ] + } + }, + { + "type": "Feature", + "properties": { + "geometryId": 1002 + }, + "geometry": { + "type": "Point", + "coordinates": [ + -105.02860381672178, + 40.515990990037309 + ] + } + }, + { + "type": "Feature", + "properties": { + "geometryId": 1003 + }, + "geometry": { + "type": "Point", + "coordinates": [ + -105.02812292879467, + 40.516058678088562 + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/spatial_geofence_request_body.json b/sdk/maps/maps-creator/samples/resources/spatial_geofence_request_body.json new file mode 100644 index 000000000000..966f0c0a3a92 --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/spatial_geofence_request_body.json @@ -0,0 +1,93 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -122.13241226662022, + 47.61701140091722 + ], + [ + -122.12810106940353, + 47.6169969269402 + ], + [ + -122.12824948956276, + 47.61907683751349 + ], + [ + -122.12833297981392, + 47.621929787055336 + ], + [ + -122.12971398040168, + 47.62184100705295 + ], + [ + -122.1318413862121, + 47.62195364373008 + ], + [ + -122.13231034769727, + 47.61716332618121 + ], + [ + -122.13241226662022, + 47.61701140091722 + ] + ] + ] + }, + "properties": { + "geometryId": "2", + "name": "Crossroad Mall" + } + }, + { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -122.1534220563239, + 47.60981818546625 + ], + [ + -122.153451623509, + 47.60628733146004 + ], + [ + -122.14971782206638, + 47.606250040787046 + ], + [ + -122.14817354810637, + 47.606391046012305 + ], + [ + -122.1482735128807, + 47.60983316796356 + ], + [ + -122.15225500989803, + 47.60982613678752 + ], + [ + -122.1534220563239, + 47.60981818546625 + ] + ] + ] + }, + "properties": { + "geometryId": "1", + "name": "Sammamish High school" + } + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/resources/spatial_point_in_polygon_request_body.json b/sdk/maps/maps-creator/samples/resources/spatial_point_in_polygon_request_body.json new file mode 100644 index 000000000000..021b89712fa4 --- /dev/null +++ b/sdk/maps/maps-creator/samples/resources/spatial_point_in_polygon_request_body.json @@ -0,0 +1,34 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "geometryId": 1001 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -111.9267386, + 33.5362475 + ], + [ + -111.9627875, + 33.5104882 + ], + [ + -111.9027061, + 33.5004686 + ], + [ + -111.9267386, + 33.5362475 + ] + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/maps/maps-creator/samples/v1/javascript/README.md b/sdk/maps/maps-creator/samples/v1/javascript/README.md new file mode 100644 index 000000000000..da7116570a8c --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/README.md @@ -0,0 +1,68 @@ +--- +page_type: sample +languages: + - javascript +products: + - azure +urlFragment: maps-creator-javascript +--- + +# Azure Maps Creator client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for Azure Maps Creator in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| [alias.js][alias] | Manages aliases of the data uploaded using [Data API][data]. | +| [conversion.js][conversion] | Converts DWG ZIP packages uploaded using [Data API][data]. | +| [data.js][data] | Uploads both GeoJSON files for [Spatial API][spatial] and DWG ZIP packages for [Conversion][conversion] and [Dataset][dataset] APIs. | +| [dataset.js][dataset] | Creates dataset from converted DWG ZIP file. | +| [featurestate.js][featurestate] | Manages states of the features of the given dataset. | +| [spatial.js][spatial] | Operations for geospatial calculations. | +| [tileset.js][tileset] | Manages tileset used for rendering the dataset. | +| [wfs.js][wfs] | The Web Feature Service API that manages features and feature collections within the dataset. | + +## Prerequisites + +The sample programs are compatible with Node.js >=12.0.0. + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node data.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env MAPS_SUBSCRIPTION_KEY="" node data.js +``` + +[alias]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/alias.js +[conversion]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/conversion.js +[data]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/data.js +[dataset]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/dataset.js +[featurestate]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/featurestate.js +[spatial]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/spatial.js +[tileset]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/tileset.js +[wfs]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/javascript/src/wfs.js +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator/README.md diff --git a/sdk/maps/maps-creator/samples/v1/javascript/alias.js b/sdk/maps/maps-creator/samples/v1/javascript/alias.js new file mode 100644 index 000000000000..098d3327ad6e --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/alias.js @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Alias API usage. Simple CRUD operations are performed. + */ + +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const alias = new CreatorClient(credential).alias; + + console.log(" --- Create Alias:"); + const aliasCreateResponse = await alias.create(operationOptions); + console.log(aliasCreateResponse); + const aliasId = aliasCreateResponse.aliasId; + + // TO USE need to have some data uploaded already - please use env CREATOR_DWG_ZIP_UDID or CREATOR_GEOJSON_UDID + const udid = process.env.CREATOR_DWG_ZIP_UDID; + if ((typeof udid === "string") && (udid.length == 36)) { + console.log(" --- Assign the aliasId to some Creator's udid:"); + console.log(await alias.assign(aliasId, udid, operationOptions)); + } + + console.log(" --- Get details about the created Alias:"); + console.log(await alias.getDetails(aliasId, operationOptions)); + + console.log(" --- Delete the created Alias:"); + await alias.delete(aliasId, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the created Aliases:"); + for await (const aliasItem of alias.list(operationOptions)) { + console.log(aliasItem); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/conversion.js b/sdk/maps/maps-creator/samples/v1/javascript/conversion.js new file mode 100644 index 000000000000..0f223183ac16 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/conversion.js @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Conversion API usage. Simple CRUD operations are performed. + */ + +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +const wait = (ms) => new Promise(res => setTimeout(res, ms)); + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +async function pollUntilOperationIsDone(operation) { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + const operationError = operationResponse.error; + if ((operationError !== null) && (operationError !== void 0)) { + console.log(operationError.details); + if (operationError.details) + console.log(operationError.details[0].details); + } + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceLocation = operationResponse.resourceLocation; + if ((resourceLocation === null) || (resourceLocation === void 0)) + return Promise.resolve(void 0); + const resourceId = resourceLocation.match("[0-9A-Fa-f\-]{36}"); + if ((resourceId === null) || (resourceId === void 0)) + return Promise.resolve(void 0); + return Promise.resolve(resourceId.join()); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const conversion = new CreatorClient(credential).conversion; + + // TO USE need to have some DWG data uploaded already - please use env CREATOR_DWG_ZIP_UDID + const udid = process.env.CREATOR_DWG_ZIP_UDID; + if ((typeof udid !== "string") || (udid.length != 36)) { + throw "This sample needs some DWG data uploaded"; + } + + console.log(" --- Begin the Conversion:"); + const convertResult = await conversion.beginConvertAndWait(udid, "facility-2.0", operationOptions); + console.log(convertResult); + const conversionId = await pollUntilOperationIsDone(() => conversion.getOperation(convertResult.operationId, operationOptions)); + + // ! you can use the converted data in the Dataset API - please put in env CREATOR_CONVERSION_ID + + console.log(" --- Get details about the created Conversion:"); + console.log(await conversion.get(conversionId, operationOptions)); + + console.log(" --- Delete the created Conversion:"); + await conversion.delete(conversionId, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Conversions:"); + for await (const conversionItem of conversion.list(operationOptions)) { + console.log(conversionItem); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/data.js b/sdk/maps/maps-creator/samples/v1/javascript/data.js new file mode 100644 index 000000000000..c66c38706951 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/data.js @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Data API usage. Simple CRUD operations are performed. + */ + +const fs = require("fs"); +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +const wait = (ms) => new Promise(res => setTimeout(res, ms)); + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +async function pollUntilOperationIsDone(operation) { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + const operationError = operationResponse.error; + if ((operationError !== null) && (operationError !== void 0)) { + console.log(operationError.details); + if (operationError.details) + console.log(operationError.details[0].details); + } + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceLocation = operationResponse.resourceLocation; + if ((resourceLocation === null) || (resourceLocation === void 0)) + return Promise.resolve(void 0); + const resourceId = resourceLocation.match("[0-9A-Fa-f\-]{36}"); + if ((resourceId === null) || (resourceId === void 0)) + return Promise.resolve(void 0); + return Promise.resolve(resourceId.join()); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const data = new CreatorClient(credential).data; + + const filePathForUpload = "../../resources/data_sample_upload.json"; + const filePathForZipUpload = "../../resources/data_sample_upload.zip" + const filePathForUpdate = "../../resources/data_sample_update.json"; + + + // This will upload new resource for Creator returning unique ID (udid) that might be used for other + // Creator's services: Alias, Conversion, etc. Please put it in the env CREATOR_DWG_ZIP_UDID or CREATOR_GEOJSON_UDID. + + // Upload GeoJson: + + const geoJsonUpload = JSON.parse(fs.readFileSync(filePathForUpload, "utf8")); + + console.log(" --- Begin the upload Data (single JSON file):"); + const uploadResult = await data.beginUploadPreviewAndWait("geojson", "application/json", geoJsonUpload, operationOptions); + console.log(uploadResult); + const udid = await pollUntilOperationIsDone(() => data.getOperationPreview(uploadResult.operationId, operationOptions)); + + console.log(" --- Download the uploaded Data:"); + let result = await data.downloadPreview(udid, operationOptions); + console.log("Done (content type: " + result.contentType + ")"); + // use result.blobBody for Browser, readableStreamBody for Node.js: + console.log("Matches input? " + (JSON.stringify(geoJsonUpload) == result.readableStreamBody?.read().toString())); + + // Update GeoJson: + + const geoJsonUpdate = JSON.parse(fs.readFileSync(filePathForUpdate, "utf8")); + + console.log(" --- Begin the update Data (single JSON file):"); + const updateResult = await data.beginUpdatePreviewAndWait(udid, geoJsonUpdate, operationOptions); + console.log(updateResult); + await pollUntilOperationIsDone(() => data.getOperationPreview(updateResult.operationId, operationOptions)); + + console.log(" --- Download the updated Data:"); + result = await data.downloadPreview(udid, operationOptions); + console.log("Done (content type: " + result.contentType + ")"); + // use result.blobBody for Browser, readableStreamBody for Node.js: + console.log("Matches input? " + (JSON.stringify(geoJsonUpdate) == result.readableStreamBody?.read().toString())); + + // Delete the data (cleanup) + + console.log(" --- Delete the created Data item:"); + await data.deletePreview(udid, operationOptions); + console.log("Done (no response body)"); + + + // Upload ZIP with DWG files: + + console.log(" --- Begin the upload Data (single ZIP file):"); + const uploadZipResult = await data.beginUploadPreviewAndWait("dwgzippackage", "application/octet-stream", fs.readFileSync(filePathForZipUpload), operationOptions); + console.log(uploadZipResult); + const zipUdid = await pollUntilOperationIsDone(() => data.getOperationPreview(uploadZipResult.operationId, operationOptions)); + + if (!fs.existsSync("tmp")) + fs.mkdirSync("tmp"); + console.log(" --- Download the uploaded Data:"); + let zipResult = await data.downloadPreview(zipUdid, operationOptions); + console.log("Done (content type: " + zipResult.contentType + ")"); + // use result.blobBody for Browser, readableStreamBody for Node.js: + zipResult.readableStreamBody?.pipe(fs.createWriteStream("tmp/Data_uploaded.zip")); + + // Delete the data (cleanup) + + console.log(" --- Delete the created Data item:"); + await data.deletePreview(zipUdid, operationOptions); + console.log("Done (no response body)"); + + + // List all the data + + console.log(" --- List all the Data uploaded:"); + (await data.listPreview(operationOptions)).mapDataList?.forEach((dataItem) => { console.log(dataItem); }); + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/dataset.js b/sdk/maps/maps-creator/samples/v1/javascript/dataset.js new file mode 100644 index 000000000000..2c99f3cc255a --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/dataset.js @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Dataset API usage. Simple CRUD operations are performed. + */ + +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +const wait = (ms) => new Promise(res => setTimeout(res, ms)); + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +async function pollUntilOperationIsDone(operation) { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + const operationError = operationResponse.error; + if ((operationError !== null) && (operationError !== void 0)) { + console.log(operationError.details); + if (operationError.details) + console.log(operationError.details[0].details); + } + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceLocation = operationResponse.resourceLocation; + if ((resourceLocation === null) || (resourceLocation === void 0)) + return Promise.resolve(void 0); + const resourceId = resourceLocation.match("[0-9A-Fa-f\-]{36}"); + if ((resourceId === null) || (resourceId === void 0)) + return Promise.resolve(void 0); + return Promise.resolve(resourceId.join()); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const dataset = new CreatorClient(credential).dataset; + + // TO USE need to have some DWG Conversion done already - please use env CREATOR_CONVERSION_ID + const conversionId = process.env.CREATOR_CONVERSION_ID; + if ((typeof conversionId !== "string") || (conversionId.length != 36)) { + throw "This sample needs some DWG Conversion done"; + } + + console.log(" --- Create Dataset:"); + const createResult = await dataset.beginCreateAndWait(conversionId, operationOptions); + console.log(createResult); + const datasetId = await pollUntilOperationIsDone(() => dataset.getOperation(createResult.operationId, operationOptions)); + + // ! you can use the created dataset in the Tileset API - please put in env CREATOR_DATASET_ID + + console.log(" --- Get details about the created Dataset:"); + console.log(await dataset.get(datasetId, operationOptions)); + + console.log(" --- Delete the created Dataset:"); + await dataset.delete(datasetId, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Datasets:"); + for await (const datasetItem of dataset.list(operationOptions)) { + console.log(datasetItem); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/featurestate.js b/sdk/maps/maps-creator/samples/v1/javascript/featurestate.js new file mode 100644 index 000000000000..a633f63ef402 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/featurestate.js @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Feature State API usage. Simple CRUD operations are performed. + */ + +const fs = require("fs"); +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const featureState = new CreatorClient(credential).featureState; + + const filePathForCreate = "../../s/featurestate_sample_create.json"; + const filePathForUpdate = "../../resources/featurestate_sample_put.json"; + const filePathForUpdateStates = "../../resources/featurestate_sample_update_states.json"; + + // TO USE need to have some Dataset created already - please use env CREATOR_DATASET_ID + const datasetId = process.env.CREATOR_DATASET_ID; + if ((typeof datasetId !== "string") || (datasetId.length != 36)) { + throw "This sample needs some Dataset created"; + } + const featureId = "FCL13"; // this is taken from WFS GetFeatures call with "facility" as a collection + + const featureStateSetCreate = JSON.parse(fs.readFileSync(filePathForCreate, "utf8")); + + console.log(" --- Create Feature State Set:"); + const createResult = await featureState.createStateset(datasetId, featureStateSetCreate, operationOptions); + console.log(createResult); + const statesetId = createResult.statesetId; + + console.log(" --- Get Feature State Set:"); + console.log(await featureState.getStateset(statesetId, operationOptions)); + + const featureStateSetUpdateStates = JSON.parse(fs.readFileSync(filePathForUpdateStates, "utf8")); + + console.log(" --- Update states of the Feature State set:"); + console.log(await featureState.updateStates(statesetId, featureId, featureStateSetUpdateStates, operationOptions)); + + console.log(" --- Get states of the Feature State set:"); + console.log(await featureState.getStates(statesetId, featureId, operationOptions)); + + const featureStateSetUpdate = JSON.parse(fs.readFileSync(filePathForUpdate, "utf8")); + + console.log(" --- Update Feature State set:"); + console.log(await featureState.putStateset(statesetId, featureStateSetUpdate, operationOptions)); + + console.log(" --- Get states of the Feature State set:"); + console.log(await featureState.getStates(statesetId, featureId, operationOptions)); + + console.log(" --- Delete state of the Feature State set:"); + console.log(await featureState.deleteState(statesetId, featureId, "s2", operationOptions)); + + console.log(" --- Get states of the Feature State set:"); + console.log(await featureState.getStates(statesetId, featureId, operationOptions)); + + console.log(" --- Delete the created Feature State set:"); + await featureState.deleteStateset(statesetId, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Feature State sets:"); + for await (const featureStateSet of featureState.listStateset(operationOptions)) { + console.log(featureStateSet); + } +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/package.json b/sdk/maps/maps-creator/samples/v1/javascript/package.json new file mode 100644 index 000000000000..17abd7ffdab2 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/package.json @@ -0,0 +1,28 @@ +{ + "name": "azure-maps-creator-samples-js", + "private": true, + "version": "1.0.0", + "description": "Azure Maps Creator client library samples for JavaScript", + "engine": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/maps/maps-creator" + }, + "keywords": [ + "Azure", + "cloud" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator", + "dependencies": { + "@azure/maps-creator": "next", + "dotenv": "latest" + } +} diff --git a/sdk/maps/maps-creator/samples/v1/javascript/sample.env b/sdk/maps/maps-creator/samples/v1/javascript/sample.env new file mode 100644 index 000000000000..e7ee18aa8ede --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/sample.env @@ -0,0 +1,15 @@ +# Maps subscription key when using AzureKey authentication +MAPS_SUBSCRIPTION_KEY="" + +# Maps Azure AD authentication +AZURE_CLIENT_ID="" +AZURE_CLIENT_SECRET="" +AZURE_TENANT_ID="" + +# Variables needed for samples to work. +# Start by uploading GeoJSON and DWG ZIP file using Data API to get proper IDs. +CREATOR_GEOJSON_UDID="" +CREATOR_DWG_ZIP_UDID="" +CREATOR_CONVERSION_ID="" +CREATOR_DATASET_ID="" +CREATOR_STATESET_ID="" diff --git a/sdk/maps/maps-creator/samples/v1/javascript/spatial.js b/sdk/maps/maps-creator/samples/v1/javascript/spatial.js new file mode 100644 index 000000000000..04e31435565d --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/spatial.js @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Spatial API usage. Simple queries are performed. + */ + +const fs = require("fs"); +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const spatial = new CreatorClient(credential).spatial; + + const filePathForPostSpatialBuffer = "../../resources/spatial_buffer_request_body.json"; + const filePathForPostSpatialClosestPoint = "../../resources/spatial_closest_point_request_body.json"; + const filePathForPostSpatialGeofence = "../../resources/spatial_geofence_request_body.json"; + const filePathForPostSpatialPointInPolygon = "../../resources/spatial_point_in_polygon_request_body.json"; + + // TO USE need to have some GeoJson Data uploaded already - please use env CREATOR_GEOJSON_UDID + const udid = process.env.CREATOR_GEOJSON_UDID; + if ((typeof udid !== "string") || (udid.length != 36)) { + throw "This sample needs some GeoJson Data uploaded"; + } + + console.log(" --- Get buffer:"); + const res = await spatial.getBuffer("json", udid, "176.3", operationOptions); + console.log(res); + console.log(res.result?.features); + + console.log(" --- Get closest point:"); + console.log(await spatial.getClosestPoint("json", udid, 47.622942, -122.316456, operationOptions)); + + console.log(" --- Get geofence:"); + const spatialGeofenceParams = { + "searchBuffer": 50, + "userTime": new Date("2017-07-21T17:32:28Z"), + "mode": "EnterAndExit" + }; + console.log(await spatial.getGeofence("json", "unique_device_name_under_account", udid, 48.36, -124.63, { ...spatialGeofenceParams, ...operationOptions })); + + console.log(" --- Get great circle distance:"); + console.log(await spatial.getGreatCircleDistance("json", "47.622942,-122.316456:47.610378,-122.200676", operationOptions)); + + /* TODO: use udid with some Polygon as a "geometry" of the Feature + console.log(" --- Get point in polygon:"); + console.log(await spatial.getPointInPolygon("json", udid, 47.622942, -122.316456, operationOptions));*/ + + console.log(" --- Post buffer:"); + const postSpatialBufferPayload = JSON.parse(fs.readFileSync(filePathForPostSpatialBuffer, "utf8")); + console.log(await spatial.postBuffer("json", postSpatialBufferPayload, operationOptions)); + + console.log(" --- Post closest point:"); + const postSpatialClosestPointPayload = JSON.parse(fs.readFileSync(filePathForPostSpatialClosestPoint, "utf8")); + console.log(await spatial.postClosestPoint("json", 47.622942, -122.316456, postSpatialClosestPointPayload, operationOptions)); + + console.log(" --- Post geofence:"); + const postSpatialGeofencePayload = JSON.parse(fs.readFileSync(filePathForPostSpatialGeofence, "utf8")); + console.log(await spatial.postGeofence("json", "unique_device_name_under_account", 48.36, -124.63, postSpatialGeofencePayload, { ...spatialGeofenceParams, ...operationOptions })); + + console.log(" --- Post point in polygon:"); + const postSpatialPointInPolygonPayload = JSON.parse(fs.readFileSync(filePathForPostSpatialPointInPolygon, "utf8")); + console.log(await spatial.postPointInPolygon("json", 48.36, -124.63, postSpatialPointInPolygonPayload, operationOptions)); + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/tileset.js b/sdk/maps/maps-creator/samples/v1/javascript/tileset.js new file mode 100644 index 000000000000..2b4666e7aaab --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/tileset.js @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Tileset API usage. Simple queries are performed. + */ + +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +const wait = (ms) => new Promise(res => setTimeout(res, ms)); + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +async function pollUntilOperationIsDone(operation) { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + const operationError = operationResponse.error; + if ((operationError !== null) && (operationError !== void 0)) { + console.log(operationError.details); + if (operationError.details) + console.log(operationError.details[0].details); + } + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceLocation = operationResponse.resourceLocation; + if ((resourceLocation === null) || (resourceLocation === void 0)) + return Promise.resolve(void 0); + const resourceId = resourceLocation.match("[0-9A-Fa-f\-]{36}"); + if ((resourceId === null) || (resourceId === void 0)) + return Promise.resolve(void 0); + return Promise.resolve(resourceId.join()); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const tileset = new CreatorClient(credential).tileset; + + // TO USE need to have some Dataset created already - please use env CREATOR_DATASET_ID + const datasetId = process.env.CREATOR_DATASET_ID; + if ((typeof datasetId !== "string") || (datasetId.length != 36)) { + throw "This sample needs some Dataset created"; + } + + console.log(" --- Create Tileset:"); + const createResult = await tileset.beginCreateAndWait(datasetId, operationOptions); + console.log(createResult); + const tilesetId = await pollUntilOperationIsDone(() => tileset.getOperation(createResult.operationId, operationOptions)); + + console.log(" --- Get details about the created Tileset:"); + console.log(await tileset.get(tilesetId, operationOptions)); + + console.log(" --- Delete the created Tileset:"); + await tileset.delete(tilesetId, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Tilesets:"); + for await (const tileSet of tileset.list(operationOptions)) { + console.log(tileSet); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/javascript/wfs.js b/sdk/maps/maps-creator/samples/v1/javascript/wfs.js new file mode 100644 index 000000000000..459f95fe64d5 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/javascript/wfs.js @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates WFS API usage. Simple queries are performed. + */ + +const { DefaultAzureCredential } = require("@azure/identity"); +const { CreatorClient } = require("@azure/maps-creator"); +require("dotenv").config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential { + async getToken(_scopes, _options) { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential; + let operationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = new DefaultAzureCredential(); + } + + const wfs = new CreatorClient(credential).wfs; + + // TO USE need to have some Dataset created already - please use env CREATOR_DATASET_ID + const datasetId = process.env.CREATOR_DATASET_ID; + if ((typeof datasetId !== "string") || (datasetId.length != 36)) { + throw "This sample needs some Dataset created"; + } + + console.log(" --- Get conformance of the dataset:"); + console.log(await wfs.getConformance(datasetId, operationOptions)); + + console.log(" --- Get landing page of the dataset:"); + console.log(await wfs.getLandingPage(datasetId, operationOptions)); + + console.log(" --- Get collections:"); + console.log(await wfs.getCollections(datasetId, operationOptions)); + + console.log(" --- Get collection:"); + console.log(await wfs.getCollection(datasetId, "facility", operationOptions)); + + console.log(" --- Get collection definition:"); + console.log(await wfs.getCollectionDefinition(datasetId, "facility", operationOptions)); + + console.log(" --- Get features of the collection:"); + const collectionFeatures = await wfs.getFeatures(datasetId, "facility", operationOptions); + console.log(collectionFeatures); + const featureId = collectionFeatures.features[0].id; + + console.log(" --- Get details of the feature of the collection:"); + console.log(await wfs.getFeature(datasetId, "facility", featureId, operationOptions)); + + /* This code works as expected however it would remove the feature and require to create the dataset once again. + console.log(" --- Remove the feature:"); + await wfs.deleteFeature(datasetId, "facility", featureId, operationOptions); + console.log("Done (no response body)");*/ + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/README.md b/sdk/maps/maps-creator/samples/v1/typescript/README.md new file mode 100644 index 000000000000..ad0314eac490 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/README.md @@ -0,0 +1,81 @@ +--- +page_type: sample +languages: + - typescript +products: + - azure +urlFragment: maps-creator-typescript +--- + +# Azure Maps Creator client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for Azure Maps Creator in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| [alias.ts][alias] | Manages aliases of the data uploaded using [Data API][data]. | +| [conversion.ts][conversion] | Converts DWG ZIP packages uploaded using [Data API][data]. | +| [data.ts][data] | Uploads both GeoJSON files for [Spatial API][spatial] and DWG ZIP packages for [Conversion][conversion] and [Dataset][dataset] APIs. | +| [dataset.ts][dataset] | Creates dataset from converted DWG ZIP file. | +| [featurestate.ts][featurestate] | Manages states of the features of the given dataset. | +| [spatial.ts][spatial] | Operations for geospatial calculations. | +| [tileset.ts][tileset] | Manages tileset used for rendering the dataset. | +| [wfs.ts][wfs] | The Web Feature Service API that manages features and feature collections within the dataset. | + +## Prerequisites + +The sample programs are compatible with Node.js >=12.0.0. + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/data.ts +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env MAPS_SUBSCRIPTION_KEY="" node dist/data.js +``` + +[alias]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/alias.ts +[conversion]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/conversion.ts +[data]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/data.ts +[dataset]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/dataset.ts +[featurestate]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/featurestate.ts +[spatial]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/spatial.ts +[tileset]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/tileset.ts +[wfs]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/maps/maps-creator/samples/v1/typescript/src/wfs.ts +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/maps/maps-creator/samples/v1/typescript/package.json b/sdk/maps/maps-creator/samples/v1/typescript/package.json new file mode 100644 index 000000000000..799b0d955aa0 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/package.json @@ -0,0 +1,36 @@ +{ + "name": "azure-maps-creator-samples-ts", + "private": true, + "version": "1.0.0", + "description": "Azure Maps Creator client library samples for TypeScript", + "engine": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/maps/maps-creator" + }, + "keywords": [ + "Azure", + "cloud" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/maps/maps-creator", + "dependencies": { + "@azure/maps-creator": "next", + "dotenv": "latest" + }, + "devDependencies": { + "typescript": "~4.2.0", + "rimraf": "latest" + } +} diff --git a/sdk/maps/maps-creator/samples/v1/typescript/sample.env b/sdk/maps/maps-creator/samples/v1/typescript/sample.env new file mode 100644 index 000000000000..e7ee18aa8ede --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/sample.env @@ -0,0 +1,15 @@ +# Maps subscription key when using AzureKey authentication +MAPS_SUBSCRIPTION_KEY="" + +# Maps Azure AD authentication +AZURE_CLIENT_ID="" +AZURE_CLIENT_SECRET="" +AZURE_TENANT_ID="" + +# Variables needed for samples to work. +# Start by uploading GeoJSON and DWG ZIP file using Data API to get proper IDs. +CREATOR_GEOJSON_UDID="" +CREATOR_DWG_ZIP_UDID="" +CREATOR_CONVERSION_ID="" +CREATOR_DATASET_ID="" +CREATOR_STATESET_ID="" diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/alias.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/alias.ts new file mode 100644 index 000000000000..b2d606aa914f --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/alias.ts @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Alias API usage. Simple CRUD operations are performed. + */ + +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const alias = new CreatorClient(credential).alias; + + console.log(" --- Create Alias:"); + const aliasCreateResponse = await alias.create(operationOptions); + console.log(aliasCreateResponse); + const aliasId = aliasCreateResponse.aliasId; + + // TO USE need to have some data uploaded already - please use env CREATOR_DWG_ZIP_UDID or CREATOR_GEOJSON_UDID + const udid = process.env.CREATOR_DWG_ZIP_UDID; + if ((typeof udid === "string") && (udid.length == 36)) { + console.log(" --- Assign the aliasId to some Creator's udid:"); + console.log(await alias.assign(aliasId!, udid!, operationOptions)); + } + + console.log(" --- Get details about the created Alias:"); + console.log(await alias.getDetails(aliasId!, operationOptions)); + + console.log(" --- Delete the created Alias:"); + await alias.delete(aliasId!, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the created Aliases:"); + for await (const aliasItem of alias.list(operationOptions)) { + console.log(aliasItem); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/conversion.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/conversion.ts new file mode 100644 index 000000000000..39ae973719f6 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/conversion.ts @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Conversion API usage. Simple CRUD operations are performed. + */ + +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient, LongRunningOperationResult } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +const wait = (ms: number) => new Promise(res => setTimeout(res, ms)); + +declare type LongRunningOperationResponse = LongRunningOperationResult & { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +}; + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +export async function pollUntilOperationIsDone(operation: (...args: any[]) => Promise): Promise { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + console.log(operationResponse.error?.details); + if (operationResponse.error?.details) + console.log(operationResponse.error?.details[0].details); + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceId = operationResponse.resourceLocation?.match("[0-9A-Fa-f\-]{36}")?.join(); + + return Promise.resolve(resourceId!); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const conversion = new CreatorClient(credential).conversion; + + // TO USE need to have some DWG data uploaded already - please use env CREATOR_DWG_ZIP_UDID + const udid = process.env.CREATOR_DWG_ZIP_UDID; + if ((typeof udid !== "string") || (udid.length != 36)) { + throw "This sample needs some DWG data uploaded"; + } + + console.log(" --- Begin the Conversion:"); + const convertResult = await conversion.beginConvertAndWait(udid, "facility-2.0", operationOptions); + console.log(convertResult); + const conversionId = await pollUntilOperationIsDone(() => conversion.getOperation(convertResult.operationId!, operationOptions)); + + // ! you can use the converted data in the Dataset API - please put in env CREATOR_CONVERSION_ID + + console.log(" --- Get details about the created Conversion:"); + console.log(await conversion.get(conversionId!, operationOptions)); + + console.log(" --- Delete the created Conversion:"); + await conversion.delete(conversionId!, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Conversions:"); + for await (const conversionItem of conversion.list(operationOptions)) { + console.log(conversionItem); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/data.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/data.ts new file mode 100644 index 000000000000..b85137e82d89 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/data.ts @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Data API usage. Simple CRUD operations are performed. + */ + +import fs from "fs"; +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient, LongRunningOperationResult } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +const wait = (ms: number) => new Promise(res => setTimeout(res, ms)); + +declare type LongRunningOperationResponse = LongRunningOperationResult & { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +}; + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +export async function pollUntilOperationIsDone(operation: (...args: any[]) => Promise): Promise { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + console.log(operationResponse.error?.details); + if (operationResponse.error?.details) + console.log(operationResponse.error?.details[0].details); + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceId = operationResponse.resourceLocation?.match("[0-9A-Fa-f\-]{36}")?.join(); + + return Promise.resolve(resourceId!); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const data = new CreatorClient(credential).data; + + const filePathForUpload = "../../resources/data_sample_upload.json"; + const filePathForZipUpload = "../../resources/data_sample_upload.zip" + const filePathForUpdate = "../../resources/data_sample_update.json"; + + + // This will upload new resource for Creator returning unique ID (udid) that might be used for other + // Creator's services: Alias, Conversion, etc. Please put it in the env CREATOR_DWG_ZIP_UDID or CREATOR_GEOJSON_UDID. + + // Upload GeoJson: + + const geoJsonUpload = JSON.parse(fs.readFileSync(filePathForUpload, "utf8")); + + console.log(" --- Begin the upload Data (single JSON file):"); + const uploadResult = await data.beginUploadPreviewAndWait("geojson", "application/json", geoJsonUpload, operationOptions); + console.log(uploadResult); + const udid = await pollUntilOperationIsDone(() => data.getOperationPreview(uploadResult.operationId!, operationOptions)); + + console.log(" --- Download the uploaded Data:"); + let result = await data.downloadPreview(udid!, operationOptions); + console.log("Done (content type: " + result.contentType + ")"); + // use result.blobBody for Browser, readableStreamBody for Node.js: + console.log("Matches input? " + (JSON.stringify(geoJsonUpload) == result.readableStreamBody?.read().toString())); + + // Update GeoJson: + + const geoJsonUpdate = JSON.parse(fs.readFileSync(filePathForUpdate, "utf8")); + + console.log(" --- Begin the update Data (single JSON file):"); + const updateResult = await data.beginUpdatePreviewAndWait(udid, geoJsonUpdate, operationOptions); + console.log(updateResult); + await pollUntilOperationIsDone(() => data.getOperationPreview(updateResult.operationId!, operationOptions)); + + console.log(" --- Download the updated Data:"); + result = await data.downloadPreview(udid!, operationOptions); + console.log("Done (content type: " + result.contentType + ")"); + // use result.blobBody for Browser, readableStreamBody for Node.js: + console.log("Matches input? " + (JSON.stringify(geoJsonUpdate) == result.readableStreamBody?.read().toString())); + + // Delete the data (cleanup) + + console.log(" --- Delete the created Data item:"); + await data.deletePreview(udid, operationOptions); + console.log("Done (no response body)"); + + + // Upload ZIP with DWG files: + + console.log(" --- Begin the upload Data (single ZIP file):"); + const uploadZipResult = await data.beginUploadPreviewAndWait("dwgzippackage", "application/octet-stream", fs.readFileSync(filePathForZipUpload), operationOptions); + console.log(uploadZipResult); + const zipUdid = await pollUntilOperationIsDone(() => data.getOperationPreview(uploadZipResult.operationId!, operationOptions)); + + if (!fs.existsSync("tmp")) + fs.mkdirSync("tmp"); + console.log(" --- Download the uploaded Data:"); + let zipResult = await data.downloadPreview(zipUdid!, operationOptions); + console.log("Done (content type: " + zipResult.contentType + ")"); + // use result.blobBody for Browser, readableStreamBody for Node.js: + zipResult.readableStreamBody?.pipe(fs.createWriteStream("tmp/Data_uploaded.zip")); + + // Delete the data (cleanup) + + console.log(" --- Delete the created Data item:"); + await data.deletePreview(zipUdid, operationOptions); + console.log("Done (no response body)"); + + + // List all the data + + console.log(" --- List all the Data uploaded:"); + (await data.listPreview(operationOptions)).mapDataList?.forEach((dataItem) => { console.log(dataItem); }); + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/dataset.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/dataset.ts new file mode 100644 index 000000000000..1da556145ad1 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/dataset.ts @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Dataset API usage. Simple CRUD operations are performed. + */ + +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient, LongRunningOperationResult } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +const wait = (ms: number) => new Promise(res => setTimeout(res, ms)); + +declare type LongRunningOperationResponse = LongRunningOperationResult & { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +}; + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +export async function pollUntilOperationIsDone(operation: (...args: any[]) => Promise): Promise { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + console.log(operationResponse.error?.details); + if (operationResponse.error?.details) + console.log(operationResponse.error?.details[0].details); + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceId = operationResponse.resourceLocation?.match("[0-9A-Fa-f\-]{36}")?.join(); + + return Promise.resolve(resourceId!); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const dataset = new CreatorClient(credential).dataset; + + // TO USE need to have some DWG Conversion done already - please use env CREATOR_CONVERSION_ID + const conversionId = process.env.CREATOR_CONVERSION_ID; + if ((typeof conversionId !== "string") || (conversionId.length != 36)) { + throw "This sample needs some DWG Conversion done"; + } + + console.log(" --- Create Dataset:"); + const createResult = await dataset.beginCreateAndWait(conversionId, operationOptions); + console.log(createResult); + const datasetId = await pollUntilOperationIsDone(() => dataset.getOperation(createResult.operationId!, operationOptions)); + + // ! you can use the created dataset in the Tileset API - please put in env CREATOR_DATASET_ID + + console.log(" --- Get details about the created Dataset:"); + console.log(await dataset.get(datasetId!, operationOptions)); + + console.log(" --- Delete the created Dataset:"); + await dataset.delete(datasetId!, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Datasets:"); + for await (const datasetItem of dataset.list(operationOptions)) { + console.log(datasetItem); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/featurestate.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/featurestate.ts new file mode 100644 index 000000000000..bab4692f69fe --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/featurestate.ts @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Feature State API usage. Simple CRUD operations are performed. + */ + +import fs from "fs"; +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const featureState = new CreatorClient(credential).featureState; + + const filePathForCreate = "../../s/featurestate_sample_create.json"; + const filePathForUpdate = "../../resources/featurestate_sample_put.json"; + const filePathForUpdateStates = "../../resources/featurestate_sample_update_states.json"; + + // TO USE need to have some Dataset created already - please use env CREATOR_DATASET_ID + const datasetId = process.env.CREATOR_DATASET_ID; + if ((typeof datasetId !== "string") || (datasetId.length != 36)) { + throw "This sample needs some Dataset created"; + } + const featureId = "FCL13"; // this is taken from WFS GetFeatures call with "facility" as a collection + + const featureStateSetCreate = JSON.parse(fs.readFileSync(filePathForCreate, "utf8")); + + console.log(" --- Create Feature State Set:"); + const createResult = await featureState.createStateset(datasetId, featureStateSetCreate, operationOptions); + console.log(createResult); + const statesetId = createResult.statesetId; + + console.log(" --- Get Feature State Set:"); + console.log(await featureState.getStateset(statesetId!, operationOptions)); + + const featureStateSetUpdateStates = JSON.parse(fs.readFileSync(filePathForUpdateStates, "utf8")); + + console.log(" --- Update states of the Feature State set:"); + console.log(await featureState.updateStates(statesetId!, featureId, featureStateSetUpdateStates, operationOptions)); + + console.log(" --- Get states of the Feature State set:"); + console.log(await featureState.getStates(statesetId!, featureId, operationOptions)); + + const featureStateSetUpdate = JSON.parse(fs.readFileSync(filePathForUpdate, "utf8")); + + console.log(" --- Update Feature State set:"); + console.log(await featureState.putStateset(statesetId!, featureStateSetUpdate, operationOptions)); + + console.log(" --- Get states of the Feature State set:"); + console.log(await featureState.getStates(statesetId!, featureId, operationOptions)); + + console.log(" --- Delete state of the Feature State set:"); + console.log(await featureState.deleteState(statesetId!, featureId, "s2", operationOptions)); + + console.log(" --- Get states of the Feature State set:"); + console.log(await featureState.getStates(statesetId!, featureId, operationOptions)); + + console.log(" --- Delete the created Feature State set:"); + await featureState.deleteStateset(statesetId!, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Feature State sets:"); + for await (const featureStateSet of featureState.listStateset(operationOptions)) { + console.log(featureStateSet); + } +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/spatial.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/spatial.ts new file mode 100644 index 000000000000..4a249c0f42dc --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/spatial.ts @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Spatial API usage. Simple queries are performed. + */ + +import fs from "fs"; +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const spatial = new CreatorClient(credential).spatial; + + const filePathForPostSpatialBuffer = "../../resources/spatial_buffer_request_body.json"; + const filePathForPostSpatialClosestPoint = "../../resources/spatial_closest_point_request_body.json"; + const filePathForPostSpatialGeofence = "../../resources/spatial_geofence_request_body.json"; + const filePathForPostSpatialPointInPolygon = "../../resources/spatial_point_in_polygon_request_body.json"; + + // TO USE need to have some GeoJson Data uploaded already - please use env CREATOR_GEOJSON_UDID + const udid = process.env.CREATOR_GEOJSON_UDID; + if ((typeof udid !== "string") || (udid.length != 36)) { + throw "This sample needs some GeoJson Data uploaded"; + } + + console.log(" --- Get buffer:"); + const res = await spatial.getBuffer("json", udid, "176.3", operationOptions); + console.log(res); + console.log(res.result?.features); + + console.log(" --- Get closest point:"); + console.log(await spatial.getClosestPoint("json", udid, 47.622942, -122.316456, operationOptions)); + + console.log(" --- Get geofence:"); + const spatialGeofenceParams = { + "searchBuffer": 50, + "userTime": new Date("2017-07-21T17:32:28Z"), + "mode": "EnterAndExit" + }; + console.log(await spatial.getGeofence("json", "unique_device_name_under_account", udid, 48.36, -124.63, { ...spatialGeofenceParams, ...operationOptions })); + + console.log(" --- Get great circle distance:"); + console.log(await spatial.getGreatCircleDistance("json", "47.622942,-122.316456:47.610378,-122.200676", operationOptions)); + + /* TODO: use udid with some Polygon as a "geometry" of the Feature + console.log(" --- Get point in polygon:"); + console.log(await spatial.getPointInPolygon("json", udid, 47.622942, -122.316456, operationOptions));*/ + + console.log(" --- Post buffer:"); + const postSpatialBufferPayload = JSON.parse(fs.readFileSync(filePathForPostSpatialBuffer, "utf8")); + console.log(await spatial.postBuffer("json", postSpatialBufferPayload, operationOptions)); + + console.log(" --- Post closest point:"); + const postSpatialClosestPointPayload = JSON.parse(fs.readFileSync(filePathForPostSpatialClosestPoint, "utf8")); + console.log(await spatial.postClosestPoint("json", 47.622942, -122.316456, postSpatialClosestPointPayload, operationOptions)); + + console.log(" --- Post geofence:"); + const postSpatialGeofencePayload = JSON.parse(fs.readFileSync(filePathForPostSpatialGeofence, "utf8")); + console.log(await spatial.postGeofence("json", "unique_device_name_under_account", 48.36, -124.63, postSpatialGeofencePayload, { ...spatialGeofenceParams, ...operationOptions })); + + console.log(" --- Post point in polygon:"); + const postSpatialPointInPolygonPayload = JSON.parse(fs.readFileSync(filePathForPostSpatialPointInPolygon, "utf8")); + console.log(await spatial.postPointInPolygon("json", 48.36, -124.63, postSpatialPointInPolygonPayload, operationOptions)); + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/tileset.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/tileset.ts new file mode 100644 index 000000000000..882f3900a9ca --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/tileset.ts @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates Tileset API usage. Simple queries are performed. + */ + +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient, LongRunningOperationResult } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +const wait = (ms: number) => new Promise(res => setTimeout(res, ms)); + +declare type LongRunningOperationResponse = LongRunningOperationResult & { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +}; + +/** + * This method is used for LROs (long running operations) in the Azure Maps API. + * Since Maps API is not 100% compatible with Azure LROs it needs to be used. + * + * @param operation The operation that would be polled for the status. + */ +export async function pollUntilOperationIsDone(operation: (...args: any[]) => Promise): Promise { + let operationResponse = await operation(); + console.log(operationResponse); + while ((operationResponse.status == "NotStarted") || (operationResponse.status == "Running")) { + console.log(" --> operation status: " + operationResponse.status); + await wait(5000); // wait for 5 seconds between each poll + operationResponse = await operation(); + console.log(operationResponse); + } + if (operationResponse.status == "Failed") { + console.log(operationResponse.error?.details); + if (operationResponse.error?.details) + console.log(operationResponse.error?.details[0].details); + throw "Failed operation!"; + } + + // get resource ID from the response header "Resource-Location" + const resourceId = operationResponse.resourceLocation?.match("[0-9A-Fa-f\-]{36}")?.join(); + + return Promise.resolve(resourceId!); +} + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const tileset = new CreatorClient(credential).tileset; + + // TO USE need to have some Dataset created already - please use env CREATOR_DATASET_ID + const datasetId = process.env.CREATOR_DATASET_ID; + if ((typeof datasetId !== "string") || (datasetId.length != 36)) { + throw "This sample needs some Dataset created"; + } + + console.log(" --- Create Tileset:"); + const createResult = await tileset.beginCreateAndWait(datasetId, operationOptions); + console.log(createResult); + const tilesetId = await pollUntilOperationIsDone(() => tileset.getOperation(createResult.operationId!, operationOptions)); + + console.log(" --- Get details about the created Tileset:"); + console.log(await tileset.get(tilesetId!, operationOptions)); + + console.log(" --- Delete the created Tileset:"); + await tileset.delete(tilesetId!, operationOptions); + console.log("Done (no response body)"); + + console.log(" --- List all the Tilesets:"); + for await (const tileSet of tileset.list(operationOptions)) { + console.log(tileSet); + } + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/src/wfs.ts b/sdk/maps/maps-creator/samples/v1/typescript/src/wfs.ts new file mode 100644 index 000000000000..c3aa1572c4fb --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/src/wfs.ts @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Demonstrates WFS API usage. Simple queries are performed. + */ + +import { getDefaultAzureCredential } from "@azure/identity"; +import * as coreAuth from "@azure/core-auth"; +import * as coreClient from "@azure/core-client"; +import { CreatorClient } from "@azure/maps-creator"; +import * as dotenv from "dotenv"; +dotenv.config(); + +/** + * Azure Maps supports two ways to authenticate requests: + * - Shared Key authentication (subscription-key) + * - Azure Active Directory (Azure AD) authentication + * + * In this sample you can put MAPS_SUBSCRIPTION_KEY into .env file to use the first approach or populate + * the three AZURE_CLIENT_ID, AZURE_CLIENT_SECRET & AZURE_TENANT_ID variables for trying out AAD auth. + * + * More info is available at https://docs.microsoft.com/en-us/azure/azure-maps/azure-maps-authentication. + */ + + +/** + * Empty token class definition. To be used with AzureKey credentials. + */ +class EmptyTokenCredential implements coreAuth.TokenCredential { + async getToken( + _scopes: string | string[], + _options?: coreAuth.GetTokenOptions + ): Promise { + return { + token: "token", + expiresOnTimestamp: Date.now() + 60 * 60 * 1000 + }; + } +} + + +async function main() { + let credential: coreAuth.TokenCredential; + let operationOptions: coreClient.OperationOptions = {}; + + if (process.env.MAPS_SUBSCRIPTION_KEY) { + // Use subscription key authentication + credential = new EmptyTokenCredential(); + operationOptions.requestOptions = { customHeaders: { "subscription-key": process.env.MAPS_SUBSCRIPTION_KEY } }; + } + else { + // Use Azure AD authentication + credential = getDefaultAzureCredential(); + } + + const wfs = new CreatorClient(credential).wfs; + + // TO USE need to have some Dataset created already - please use env CREATOR_DATASET_ID + const datasetId = process.env.CREATOR_DATASET_ID; + if ((typeof datasetId !== "string") || (datasetId.length != 36)) { + throw "This sample needs some Dataset created"; + } + + console.log(" --- Get conformance of the dataset:"); + console.log(await wfs.getConformance(datasetId, operationOptions)); + + console.log(" --- Get landing page of the dataset:"); + console.log(await wfs.getLandingPage(datasetId, operationOptions)); + + console.log(" --- Get collections:"); + console.log(await wfs.getCollections(datasetId, operationOptions)); + + console.log(" --- Get collection:"); + console.log(await wfs.getCollection(datasetId, "facility", operationOptions)); + + console.log(" --- Get collection definition:"); + console.log(await wfs.getCollectionDefinition(datasetId, "facility", operationOptions)); + + console.log(" --- Get features of the collection:"); + const collectionFeatures = await wfs.getFeatures(datasetId, "facility", operationOptions); + console.log(collectionFeatures); + const featureId = collectionFeatures.features[0].id; + + console.log(" --- Get details of the feature of the collection:"); + console.log(await wfs.getFeature(datasetId, "facility", featureId!, operationOptions)); + + /* This code works as expected however it would remove the feature and require to create the dataset once again. + console.log(" --- Remove the feature:"); + await wfs.deleteFeature(datasetId, "facility", featureId!, operationOptions); + console.log("Done (no response body)");*/ + +} + +main(); diff --git a/sdk/maps/maps-creator/samples/v1/typescript/tsconfig.json b/sdk/maps/maps-creator/samples/v1/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/maps/maps-creator/samples/v1/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/maps/maps-creator/src/creatorClient.ts b/sdk/maps/maps-creator/src/creatorClient.ts new file mode 100644 index 000000000000..8fe9a573fd76 --- /dev/null +++ b/sdk/maps/maps-creator/src/creatorClient.ts @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreAuth from "@azure/core-auth"; +import { + AliasImpl, + DataImpl, + DatasetImpl, + ConversionImpl, + FeatureStateImpl, + SpatialImpl, + TilesetImpl, + WfsImpl +} from "./operations"; +import { + Alias, + Data, + Dataset, + Conversion, + FeatureState, + Spatial, + Tileset, + Wfs +} from "./operationsInterfaces"; +import { CreatorClientContext } from "./creatorClientContext"; +import { CreatorClientOptionalParams } from "./models"; + +export class CreatorClient extends CreatorClientContext { + /** + * Initializes a new instance of the CreatorClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + options?: CreatorClientOptionalParams + ) { + super(credentials, options); + this.alias = new AliasImpl(this); + this.data = new DataImpl(this); + this.dataset = new DatasetImpl(this); + this.conversion = new ConversionImpl(this); + this.featureState = new FeatureStateImpl(this); + this.spatial = new SpatialImpl(this); + this.tileset = new TilesetImpl(this); + this.wfs = new WfsImpl(this); + } + + alias: Alias; + data: Data; + dataset: Dataset; + conversion: Conversion; + featureState: FeatureState; + spatial: Spatial; + tileset: Tileset; + wfs: Wfs; +} diff --git a/sdk/maps/maps-creator/src/creatorClientContext.ts b/sdk/maps/maps-creator/src/creatorClientContext.ts new file mode 100644 index 000000000000..1104fd9ec7fd --- /dev/null +++ b/sdk/maps/maps-creator/src/creatorClientContext.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { Geography, CreatorClientOptionalParams } from "./models"; + +export class CreatorClientContext extends coreClient.ServiceClient { + geography: Geography; + xMsClientId?: string; + + /** + * Initializes a new instance of the CreatorClientContext class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + options?: CreatorClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: CreatorClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-maps-creator/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://atlas.microsoft.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://{geography}.atlas.microsoft.com" + }; + super(optionsWithDefaults); + + // Assigning values to Constant parameters + this.geography = options.geography || "us"; + } +} diff --git a/sdk/maps/maps-creator/src/index.ts b/sdk/maps/maps-creator/src/index.ts new file mode 100644 index 000000000000..049d1a85b48c --- /dev/null +++ b/sdk/maps/maps-creator/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { CreatorClient } from "./creatorClient"; +export { CreatorClientContext } from "./creatorClientContext"; +export * from "./operationsInterfaces"; diff --git a/sdk/maps/maps-creator/src/lro/azureAsyncPolling.ts b/sdk/maps/maps-creator/src/lro/azureAsyncPolling.ts new file mode 100644 index 000000000000..0d63c54f6026 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/azureAsyncPolling.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { FullOperationResponse } from "@azure/core-client"; +import { FinalStateVia, LROResult } from "./models"; +import { failureStates, LROState, successStates } from "./stateMachine"; + +function getResponseStatus(rawResponse: FullOperationResponse): string { + const { status } = + rawResponse.parsedBody ?? + (rawResponse.bodyAsText ? JSON.parse(rawResponse.bodyAsText) : {}); + return status?.toLowerCase() ?? "succeeded"; +} + +function isAzureAsyncPollingDone(rawResponse: FullOperationResponse) { + const state = getResponseStatus(rawResponse); + if (failureStates.includes(state)) { + throw new Error(`Operation status: ${state}`); + } + return successStates.includes(state); +} + +export function processAzureAsyncOperationResult( + restrieveResource: (path?: string) => Promise>, + resourceLocation?: string, + finalStateVia?: FinalStateVia +): ( + rawResponse: FullOperationResponse, + flatResponse: TResult +) => LROState { + return ( + rawResponse: FullOperationResponse, + flatResponse: TResult + ): LROState => { + if (isAzureAsyncPollingDone(rawResponse)) { + if (resourceLocation === undefined) { + return { rawResponse, flatResponse, done: true }; + } else { + return { + rawResponse, + flatResponse, + done: false, + next: async () => { + async function sendFinalRequest(): Promise< + LROResult | undefined + > { + switch (finalStateVia) { + case "original-uri": + return restrieveResource(); + case "azure-async-operation": + return Promise.resolve(undefined); + case "location": + default: + return restrieveResource(resourceLocation); + } + } + const finalResponse = await sendFinalRequest(); + return { + ...(finalResponse ?? { + rawResponse, + flatResponse + }), + done: true + }; + } + }; + } + } + return { + rawResponse, + flatResponse, + done: false + }; + }; +} diff --git a/sdk/maps/maps-creator/src/lro/bodyPolling.ts b/sdk/maps/maps-creator/src/lro/bodyPolling.ts new file mode 100644 index 000000000000..269d8e6799a1 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/bodyPolling.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { FullOperationResponse } from "@azure/core-client"; +import { failureStates, LROState, successStates } from "./stateMachine"; + +function getProvisioningState(rawResponse: FullOperationResponse): string { + const { properties, provisioningState } = + rawResponse.parsedBody ?? + (rawResponse.bodyAsText ? JSON.parse(rawResponse.bodyAsText) : {}); + const state: string | undefined = + properties?.provisioningState ?? provisioningState; + return state?.toLowerCase() ?? "succeeded"; +} + +export function isBodyPollingDone(rawResponse: FullOperationResponse) { + const state = getProvisioningState(rawResponse); + if (failureStates.includes(state)) { + throw new Error(`Provisioning state: ${state}`); + } + return successStates.includes(state); +} + +/** + * Creates a polling strategy based on BodyPolling which uses the provisioning state + * from the result to determine the current operation state + */ +export function processBodyPollingOperationResult( + rawResponse: FullOperationResponse, + flatResponse: TResult +): LROState { + return { + rawResponse, + flatResponse, + done: isBodyPollingDone(rawResponse) + }; +} diff --git a/sdk/maps/maps-creator/src/lro/index.ts b/sdk/maps/maps-creator/src/lro/index.ts new file mode 100644 index 000000000000..85c2187669e7 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { shouldDeserializeLRO } from "./requestUtils"; +export { LROPoller } from "./lroPoller"; diff --git a/sdk/maps/maps-creator/src/lro/locationPolling.ts b/sdk/maps/maps-creator/src/lro/locationPolling.ts new file mode 100644 index 000000000000..6fef61938419 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/locationPolling.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { FullOperationResponse } from "@azure/core-client"; +import { LROState } from "./stateMachine"; + +function isLocationPollingDone(rawResponse: FullOperationResponse) { + const code = rawResponse.status; + if (![202, 200].includes(code)) { + throw new Error(`Operation failed`); + } + return code !== 202; +} + +export function processLocationPollingOperationResult( + rawResponse: FullOperationResponse, + flatResponse: TResult +): LROState { + return { + rawResponse, + flatResponse, + done: isLocationPollingDone(rawResponse) + }; +} diff --git a/sdk/maps/maps-creator/src/lro/lroPoller.ts b/sdk/maps/maps-creator/src/lro/lroPoller.ts new file mode 100644 index 000000000000..cd1cd64fe813 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/lroPoller.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Poller, PollOperationState } from "@azure/core-lro"; +import { OperationArguments, OperationSpec } from "@azure/core-client"; +import { FinalStateVia, SendOperationFn } from "./models"; +import { GenericPollOperation } from "./operation"; + +export interface LROPollerOptions { + /** + * Defines how much time the poller is going to wait before making a new request to the service. + */ + intervalInMs?: number; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + resumeFrom?: string; +} + +export class LROPoller extends Poller< + PollOperationState, + TResult +> { + private intervalInMs: number; + + constructor( + { intervalInMs = 2000, resumeFrom }: LROPollerOptions, + initialOperationArguments: OperationArguments, + initialOperationSpec: OperationSpec, + sendOperation: SendOperationFn, + finalStateVia?: FinalStateVia + ) { + const state: PollOperationState = resumeFrom + ? JSON.parse(resumeFrom).state + : {}; + + const operation = new GenericPollOperation( + state, + initialOperationArguments, + initialOperationSpec, + sendOperation, + finalStateVia + ); + super(operation); + + this.intervalInMs = intervalInMs; + operation.setPollerConfig(this as any); + } + + /** + * The method used by the poller to wait before attempting to update its operation. + */ + delay(): Promise { + return new Promise((resolve) => + setTimeout(() => resolve(), this.intervalInMs) + ); + } +} diff --git a/sdk/maps/maps-creator/src/lro/models.ts b/sdk/maps/maps-creator/src/lro/models.ts new file mode 100644 index 000000000000..a4a5a5abd6c2 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/models.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + FullOperationResponse, + OperationArguments, + OperationSpec +} from "@azure/core-client"; +import { PollOperationState } from "@azure/core-lro"; + +export type FinalStateVia = + | "azure-async-operation" + | "location" + | "original-uri"; + +export interface LROResult { + flatResponse: T; + rawResponse: FullOperationResponse; +} + +export type LROMode = "AzureAsync" | "Location" | "Body"; + +export interface LROConfig { + mode?: LROMode; + resourceLocation?: string; +} + +export type SendOperationFn = ( + args: OperationArguments, + spec: OperationSpec +) => Promise>; + +/** + * Type of a polling operation state that can actually be resumed. + */ +export type ResumablePollOperationState = PollOperationState & { + initialRawResponse?: FullOperationResponse; + config?: LROConfig; + pollingURL?: string; +}; + +export interface PollerConfig { + intervalInMs: number; +} diff --git a/sdk/maps/maps-creator/src/lro/operation.ts b/sdk/maps/maps-creator/src/lro/operation.ts new file mode 100644 index 000000000000..801d03e7203a --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/operation.ts @@ -0,0 +1,132 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AbortSignalLike } from "@azure/abort-controller"; +import { OperationArguments, OperationSpec } from "@azure/core-client"; +import { PollOperation, PollOperationState } from "@azure/core-lro"; +import { + FinalStateVia, + PollerConfig, + ResumablePollOperationState, + SendOperationFn +} from "./models"; +import { getPollingURL } from "./requestUtils"; +import { createGetLROState, initializeState, LROState } from "./stateMachine"; + +export class GenericPollOperation + implements PollOperation, TResult> { + private getLROState?: ( + pollingURL: string, + pollerConfig: PollerConfig + ) => Promise>; + private pollerConfig?: PollerConfig; + constructor( + public state: PollOperationState, + private initialOperationArguments: OperationArguments, + private initialOperationSpec: OperationSpec, + private sendOperation: SendOperationFn, + private finalStateVia?: FinalStateVia + ) {} + + public setPollerConfig(pollerConfig: PollerConfig) { + this.pollerConfig = pollerConfig; + } + + /** + * General update function for LROPoller, the general process is as follows + * 1. Check initial operation result to determine the strategy to use + * - Strategies: Location, Azure-AsyncOperation, Original Uri + * 2. Check if the operation result has a terminal state + * - Terminal state will be determined by each strategy + * 2.1 If it is terminal state Check if a final GET request is required, if so + * send final GET request and return result from operation. If no final GET + * is required, just return the result from operation. + * - Determining what to call for final request is responsibility of each strategy + * 2.2 If it is not terminal state, call the polling operation and go to step 1 + * - Determining what to call for polling is responsibility of each strategy + * - Strategies will always use the latest URI for polling if provided otherwise + * the last known one + */ + async update(options?: { + abortSignal?: AbortSignalLike | undefined; + fireProgress?: ((state: PollOperationState) => void) | undefined; + }): Promise, TResult>> { + const state = this.state as ResumablePollOperationState; + const { onResponse, ...restOptions } = + this.initialOperationArguments.options || {}; + if (!state.isStarted) { + await this.sendOperation( + { + ...this.initialOperationArguments, + options: { + ...restOptions, + onResponse: initializeState( + state, + this.initialOperationSpec, + onResponse + ) + } + }, + this.initialOperationSpec + ); + } + + if (!state.isCompleted) { + if (this.getLROState === undefined) { + if (state.config === undefined) { + throw new Error("Bad state: LRO mode is undefined"); + } + this.getLROState = createGetLROState( + this.sendOperation, + this.initialOperationArguments, + this.initialOperationSpec, + state.config, + this.finalStateVia + ); + } + if (state.pollingURL === undefined) { + throw new Error("Bad state: polling URL is undefined"); + } + const currentState = await this.getLROState( + state.pollingURL, + this.pollerConfig! + ); + if (currentState.done) { + state.result = currentState.flatResponse; + state.isCompleted = true; + } else { + this.getLROState = currentState.next ?? this.getLROState; + state.pollingURL = getPollingURL( + currentState.rawResponse, + state.pollingURL + ); + } + } + if (options?.fireProgress !== undefined) { + options.fireProgress(state); + } + return this; + } + + async cancel(): Promise, TResult>> { + this.state.isCancelled = true; + return this; + } + + /** + * Serializes the Poller operation. + */ + public toString(): string { + return JSON.stringify({ + state: this.state + }); + } +} diff --git a/sdk/maps/maps-creator/src/lro/passthrough.ts b/sdk/maps/maps-creator/src/lro/passthrough.ts new file mode 100644 index 000000000000..64c10380c1b2 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/passthrough.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { FullOperationResponse } from "@azure/core-client"; +import { LROState } from "./stateMachine"; + +export function processPassthroughOperationResult( + rawResponse: FullOperationResponse, + flatResponse: TResult +): LROState { + return { + rawResponse, + flatResponse, + done: true + }; +} diff --git a/sdk/maps/maps-creator/src/lro/pollingMethod.ts b/sdk/maps/maps-creator/src/lro/pollingMethod.ts new file mode 100644 index 000000000000..cb6482bbdea9 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/pollingMethod.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + OperationArguments, + OperationSpec, + OperationResponseMap +} from "@azure/core-client"; +import { LROMode, LROResult, SendOperationFn } from "./models"; + +export function createPollingMethod( + sendOperationFn: SendOperationFn, + args: OperationArguments, + spec: OperationSpec, + mode?: LROMode +): (path?: string) => Promise> { + /** + * Polling calls will always return a status object i.e. {"status": "success"} + * these intermediate responses are not described in the swagger so we need to + * pass custom mappers at runtime. + * This function replaces all the existing mappers to be able to deserialize a status object + * @param responses Original set of responses defined in the operation + */ + function getCompositeMappers(responses: { + [responseCode: string]: OperationResponseMap; + }): { + [responseCode: string]: OperationResponseMap; + } { + return Object.keys(responses).reduce((acc, statusCode) => { + return { + ...acc, + [statusCode]: { + ...responses[statusCode], + bodyMapper: { + type: { + name: "Composite", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } + } + } + }; + }, {} as { [responseCode: string]: OperationResponseMap }); + } + // Make sure we don't send any body to the get request + const { requestBody, responses, ...restSpec } = spec; + if (mode === "AzureAsync") { + return async (path?: string) => { + return sendOperationFn(args, { + ...restSpec, + responses: getCompositeMappers(responses), + httpMethod: "GET", + ...(path && { path }) + }); + }; + } + return async (path?: string) => { + return sendOperationFn(args, { + ...restSpec, + responses: responses, + httpMethod: "GET", + ...(path && { path }) + }); + }; +} + +export function createRetrieveAzureAsyncResource( + sendOperationFn: SendOperationFn, + args: OperationArguments, + spec: OperationSpec +): (path?: string) => Promise> { + const updatedArgs = { ...args }; + if (updatedArgs.options) { + (updatedArgs.options as any).shouldDeserialize = true; + } + return createPollingMethod(sendOperationFn, updatedArgs, spec); +} diff --git a/sdk/maps/maps-creator/src/lro/requestUtils.ts b/sdk/maps/maps-creator/src/lro/requestUtils.ts new file mode 100644 index 000000000000..9162f6633905 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/requestUtils.ts @@ -0,0 +1,194 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { FullOperationResponse, OperationSpec } from "@azure/core-client"; +import { LROConfig } from "./models"; +import { terminalStates } from "./stateMachine"; + +/** + * We need to selectively deserialize our responses, only deserializing if we + * are in a final LRO response, not deserializing any polling non-terminal responses + */ +export function shouldDeserializeLRO(finalStateVia?: string) { + let initialOperationInfo: LROResponseInfo | undefined; + let isInitialRequest = true; + + return (response: FullOperationResponse) => { + if (response.status < 200 || response.status >= 300) { + return true; + } + + if (!initialOperationInfo) { + initialOperationInfo = getLROData(response); + } else { + isInitialRequest = false; + } + + if ( + initialOperationInfo.azureAsyncOperation || + initialOperationInfo.operationLocation + ) { + return ( + !isInitialRequest && + isAsyncOperationFinalResponse( + response, + initialOperationInfo, + finalStateVia + ) + ); + } + + if (initialOperationInfo.location) { + return isLocationFinalResponse(response); + } + + if (initialOperationInfo.requestMethod === "PUT") { + return isBodyPollingFinalResponse(response); + } + + return true; + }; +} + +function isAsyncOperationFinalResponse( + response: FullOperationResponse, + initialOperationInfo: LROResponseInfo, + finalStateVia?: string +): boolean { + const status: string = response.parsedBody?.status || "Succeeded"; + if (!terminalStates.includes(status.toLowerCase())) { + return false; + } + + if (initialOperationInfo.requestMethod === "DELETE") { + return true; + } + + if ( + initialOperationInfo.requestMethod === "PUT" && + finalStateVia && + finalStateVia.toLowerCase() === "azure-asyncoperation" + ) { + return true; + } + + if ( + initialOperationInfo.requestMethod !== "PUT" && + !initialOperationInfo.location + ) { + return true; + } + + return false; +} + +function isLocationFinalResponse(response: FullOperationResponse): boolean { + return response.status !== 202; +} + +function isBodyPollingFinalResponse(response: FullOperationResponse): boolean { + const provisioningState: string = + response.parsedBody?.properties?.provisioningState || "Succeeded"; + + if (terminalStates.includes(provisioningState.toLowerCase())) { + return true; + } + + return false; +} + +interface LROResponseInfo { + requestMethod: string; + azureAsyncOperation?: string; + operationLocation?: string; + location?: string; +} + +function getLROData(result: FullOperationResponse): LROResponseInfo { + return { + azureAsyncOperation: result.headers.get("azure-asyncoperation"), + operationLocation: result.headers.get("operation-location"), + location: result.headers.get("location"), + requestMethod: result.request.method + }; +} + +/** + * Detects where the continuation token is and returns it. Notice that azure-asyncoperation + * must be checked first before the other location headers because there are scenarios + * where both azure-asyncoperation and location could be present in the same response but + * azure-asyncoperation should be the one to use for polling. + */ +export function getPollingURL( + rawResponse: FullOperationResponse, + defaultPath: string +): string { + return ( + getAzureAsyncoperation(rawResponse) ?? + getLocation(rawResponse) ?? + getOperationLocation(rawResponse) ?? + defaultPath + ); +} + +function getLocation(rawResponse: FullOperationResponse): string | undefined { + return rawResponse.headers?.get("location"); +} + +function getOperationLocation( + rawResponse: FullOperationResponse +): string | undefined { + return rawResponse.headers?.get("operation-location"); +} + +function getAzureAsyncoperation( + rawResponse: FullOperationResponse +): string | undefined { + return rawResponse.headers?.get("azure-asyncoperation"); +} + +export function inferLROMode( + spec: OperationSpec, + rawResponse: FullOperationResponse +): LROConfig { + const requestMethod = spec.httpMethod; + if (getAzureAsyncoperation(rawResponse) !== undefined) { + return { + mode: "AzureAsync", + resourceLocation: + requestMethod === "PUT" + ? spec.path + : requestMethod === "POST" + ? getLocation(rawResponse) + : undefined + }; + } else if ( + getLocation(rawResponse) !== undefined || + getOperationLocation(rawResponse) !== undefined + ) { + return { + mode: "Location" + }; + } else if (["PUT", "PATCH"].includes(requestMethod)) { + return { + mode: "Body" + }; + } + return {}; +} + +export function getSpecPath(spec: OperationSpec): string { + if (spec.path) { + return spec.path; + } else { + throw Error("Bad spec: request path is not found!"); + } +} diff --git a/sdk/maps/maps-creator/src/lro/stateMachine.ts b/sdk/maps/maps-creator/src/lro/stateMachine.ts new file mode 100644 index 000000000000..b2a69b554601 --- /dev/null +++ b/sdk/maps/maps-creator/src/lro/stateMachine.ts @@ -0,0 +1,216 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + FullOperationResponse, + OperationArguments, + OperationSpec, + RawResponseCallback +} from "@azure/core-client"; +import { processAzureAsyncOperationResult } from "./azureAsyncPolling"; +import { + isBodyPollingDone, + processBodyPollingOperationResult +} from "./bodyPolling"; +import { processLocationPollingOperationResult } from "./locationPolling"; +import { + FinalStateVia, + LROConfig, + LROResult, + PollerConfig, + ResumablePollOperationState, + SendOperationFn +} from "./models"; +import { processPassthroughOperationResult } from "./passthrough"; +import { + createPollingMethod, + createRetrieveAzureAsyncResource +} from "./pollingMethod"; +import { getPollingURL, getSpecPath, inferLROMode } from "./requestUtils"; + +export const successStates = ["succeeded"]; +export const failureStates = ["failed", "canceled", "cancelled"]; +export const terminalStates = successStates.concat(failureStates); + +/** + * The type of a terminal state of an LRO. + */ +interface LROTerminalState extends LROResult { + /** + * Whether the operation has finished. + */ + done: true; +} + +/** + * The type of an in-progress state of an LRO. + */ +interface LROInProgressState extends LROResult { + /** + * Whether the operation has finished. + */ + done: false; + /** + * The request to be sent next if it is different from the standard polling one. + * Notice that it will disregard any polling URLs provided to it. + */ + next?: () => Promise>; +} + +/** + * The type of an LRO state which is a tagged union of terminal and in-progress states. + */ +export type LROState = LROTerminalState | LROInProgressState; + +/** + * creates a stepping function that maps an LRO state to another. + */ +function createTransition( + sendOperationFn: SendOperationFn, + args: OperationArguments, + spec: OperationSpec, + config: LROConfig, + finalStateVia?: FinalStateVia +): ( + rawResponse: FullOperationResponse, + flatResponse: TResult +) => LROState { + switch (config.mode) { + case "AzureAsync": { + return processAzureAsyncOperationResult( + createRetrieveAzureAsyncResource(sendOperationFn, args, spec), + config.resourceLocation, + finalStateVia + ); + } + case "Location": { + return processLocationPollingOperationResult; + } + case "Body": { + return processBodyPollingOperationResult; + } + default: { + return processPassthroughOperationResult; + } + } +} + +/** + * Creates a polling operation that returns a LRO state. + */ +export function createGetLROState( + sendOperationFn: SendOperationFn, + args: OperationArguments, + spec: OperationSpec, + config: LROConfig, + finalStateVia?: FinalStateVia +): ( + pollingURL: string, + pollerConfig: PollerConfig +) => Promise> { + const step = createTransition( + sendOperationFn, + args, + spec, + config, + finalStateVia + ); + const customerCallback = args?.options?.onResponse; + let response: LROState | undefined = undefined; + let retryAfter: string | undefined = undefined; + const poll = createPollingMethod( + sendOperationFn, + { + ...args, + options: { + ...args.options, + onResponse: ( + rawResponse: FullOperationResponse, + flatResponse: unknown + ): void => { + response = step(rawResponse, flatResponse as TResult); + retryAfter = rawResponse.headers.get("Retry-After"); + if (response.done) { + customerCallback?.(rawResponse, flatResponse); + } + } + } + }, + spec, + config.mode + ); + return async ( + path: string, + pollerConfig: PollerConfig + ): Promise> => { + await poll(path); + if (retryAfter !== undefined) { + const retryAfterInMs = parseInt(retryAfter); + pollerConfig.intervalInMs = isNaN(retryAfterInMs) + ? calculatePollingIntervalFromDate( + new Date(retryAfter), + pollerConfig.intervalInMs + ) + : retryAfterInMs; + } + return response!; + }; +} + +function calculatePollingIntervalFromDate( + retryAfterDate: Date, + defaultIntervalInMs: number +): number { + const timeNow = Math.floor(new Date().getTime()); + const retryAfterTime = retryAfterDate.getTime(); + if (timeNow < retryAfterTime) { + return retryAfterTime - timeNow; + } + return defaultIntervalInMs; +} + +/** + * Creates a callback to be used to initialize the polling operation state. + * @param state of the polling operation + * @param operationSpec of the LRO + * @param callback callback to be called when the operation is done + * @returns callback that initializes the state of the polling operation + */ +export function initializeState( + state: ResumablePollOperationState, + operationSpec: OperationSpec, + callback?: RawResponseCallback +): (rawResponse: FullOperationResponse, flatResponse: unknown) => void { + return (rawResponse: FullOperationResponse, flatResponse: unknown) => { + state.initialRawResponse = rawResponse; + state.isStarted = true; + state.pollingURL = getPollingURL( + state.initialRawResponse, + getSpecPath(operationSpec) + ); + state.config = inferLROMode(operationSpec, state.initialRawResponse); + /** short circuit polling if body polling is done in the initial request */ + if ( + state.config.mode === undefined || + (state.config.mode === "Body" && + isBodyPollingDone(state.initialRawResponse)) + ) { + state.result = flatResponse as TResult; + state.isCompleted = true; + /** + * We need to check if the LRO operation is finished inside the + * call back so that we can call the customer-provided callback + * on that result. + */ + callback?.(rawResponse, flatResponse); + } + }; +} diff --git a/sdk/maps/maps-creator/src/models/index.ts b/sdk/maps/maps-creator/src/models/index.ts new file mode 100644 index 000000000000..f6cc2baded75 --- /dev/null +++ b/sdk/maps/maps-creator/src/models/index.ts @@ -0,0 +1,1742 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export type StyleObjectUnion = + | StyleObject + | BooleanTypeStyleRule + | NumberTypeStyleRule + | StringTypeStyleRule; +export type GeoJsonObjectUnion = + | GeoJsonObject + | GeoJsonGeometryUnion + | GeoJsonFeature + | GeoJsonFeatureCollectionUnion; +export type GeoJsonGeometryUnion = + | GeoJsonGeometry + | GeoJsonPoint + | GeoJsonMultiPoint + | GeoJsonLineString + | GeoJsonMultiLineString + | GeoJsonPolygon + | GeoJsonMultiPolygon + | GeoJsonGeometryCollection; +export type GeoJsonFeatureCollectionUnion = + | GeoJsonFeatureCollection + | ExtendedGeoJsonFeatureCollection; + +/** The response model for the Alias Create API for the case when the alias was successfully created. */ +export interface AliasesCreateResponse { + /** + * The created timestamp for the alias. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdTimestamp?: string; + /** + * The id for the alias. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly aliasId?: string; + /** + * The id for the creator data item that this alias references (could be null if the alias has not been assigned). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly creatorDataItemId?: string; + /** + * The timestamp of the last time the alias was assigned. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The response model for the List API. Returns a list of all the previously created aliases. */ +export interface AliasListResponse { + /** + * A list of all the previously created aliases. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly aliases?: AliasListItem[]; + /** + * If present, the location of the next page of data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Detailed information for the alias. */ +export interface AliasListItem { + /** + * The created timestamp for the alias. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdTimestamp?: string; + /** + * The id for the alias. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly aliasId?: string; + /** + * The id for the creator data item that this alias references (could be null if the alias has not been assigned). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly creatorDataItemId?: string | null; + /** + * The timestamp of the last time the alias was assigned. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: string; +} + +/** The response model for a Long-Running Operations API. */ +export interface LongRunningOperationResult { + /** The Id for this long-running operation. */ + operationId?: string; + /** + * The status state of the request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: LroStatus; + /** + * The created timestamp. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly created?: string; + /** The error detail. */ + error?: ErrorDetail; + /** The error detail. */ + warning?: ErrorDetail; +} + +/** The response model for the Data List API. Returns a list of all the previously uploaded data. */ +export interface MapDataListResponse { + /** + * A list of all the previously uploaded data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly mapDataList?: MapDataDetailInfo[]; +} + +/** Detail information for the data. */ +export interface MapDataDetailInfo { + /** + * The unique data id for the data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly udid?: string; + /** + * The location of the data. Execute a HTTP `GET` on this location to download the data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly location?: string; + /** + * The size of the content in bytes. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sizeInBytes?: number; + /** + * The current upload status of the content. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uploadStatus?: string; + /** + * The current data format. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dataFormat?: string; + /** + * The current description. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** The response model for the Dataset List API. The response body will contain a list of all the previously created datasets. */ +export interface DatasetListResponse { + /** + * A list of all the previously created datasets. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly datasets?: DatasetDetailInfo[]; + /** + * If present, the location of the next page of data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Detail information for the dataset. */ +export interface DatasetDetailInfo { + /** + * The created timestamp for the dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly created?: string; + /** + * The id for the dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly datasetId?: string; + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** + * The description for the dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** Information about the details of the create request for the dataset. */ + datasetSources?: DatasetSources; + /** + * The feature counts for the dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly featureCounts?: Record; +} + +/** Information about the details of the create request for the dataset. */ +export interface DatasetSources { + /** + * The list of `conversionId` that were used to create the dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly conversionIds?: string[]; + /** + * The dataset that was appended to to create the current dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly appendDatasetId?: string; +} + +/** The response model for the Conversion List API. */ +export interface ConversionListResponse { + /** + * A list of all the previously submitted conversion requests. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly conversions?: ConversionListDetailInfo[]; + /** + * If present, the location of the next page of data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Detail information for the conversion requests. */ +export interface ConversionListDetailInfo { + /** + * A unique id that represents the artifact of a _successfully_ completed conversion process. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly conversionId?: string; + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** + * The unique id of the content provided to create this conversion. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly udid?: string; + /** + * The date and time of this conversion. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly created?: string; + /** + * User provided description of the content being converted. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** + * A summary of feature counts in this conversion. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly featureCounts?: Record; +} + +/** The styles model. */ +export interface StylesObject { + /** An array of stateset styles. The style rule could be a numeric or string or a boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject definitions [here](https://aka.ms/AzureMapsStatesetStylesObject). */ + styles?: StyleObjectUnion[]; +} + +/** The stateset style model. The style rule could be a numeric type style rule or a boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject definitions [here](https://aka.ms/AzureMapsStatesetStylesObject). */ +export interface StyleObject { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "boolean" | "number" | "string"; + /** Stateset style key name. Key names are random strings but they should be unique inside style array. */ + keyName: string; +} + +/** The response model for the successful Stateset Create API. */ +export interface StatesetCreatedResponse { + /** + * The ID for the new stateset created. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly statesetId?: string; +} + +/** The response model for the successful Stateset List API. */ +export interface StatesetListResponse { + /** A list of statesets information. */ + statesets?: StatesetInfoObject[]; + /** + * If present, the location of the next page of data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The stateset information detail. */ +export interface StatesetInfoObject { + /** The stateset ID of this stateset. */ + statesetId?: string; + /** + * Description associated with the stateset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** Dataset ID associated with the stateset. */ + datasetIds?: string[]; + /** The styles model. */ + statesetStyle?: StylesObject; +} + +/** The response model for the successful Stateset Get API. */ +export interface StatesetGetResponse { + /** + * Description associated with the stateset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** Dataset ID associated with the stateset. */ + datasetIds?: string[]; + /** The styles model. */ + statesetStyle?: StylesObject; +} + +/** The feature states model for a feature. */ +export interface FeatureStatesStructure { + /** The feature states array. */ + states?: FeatureStateObject[]; +} + +/** Single feature state model. */ +export interface FeatureStateObject { + /** Feature state Keyname. Maximum length allowed is 1000. */ + keyName?: string; + /** Value for the feature state. Type should comply with the style definition attached to the featurestate. Maximum length allowed for string type is 1024. */ + value?: string; + /** Valid Timestamp when the feature state was captured. */ + eventTimestamp?: string; +} + +/** This object is returned from a geofence proximity call. */ +export interface GeofenceResponse { + /** + * Lists the fence geometries that contain the coordinate position or overlap the searchBuffer around the position. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly geometries?: GeofenceGeometry[]; + /** + * Lists of the geometry ID of the geofence which is expired relative to the user time in the request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiredGeofenceGeometryId?: string[]; + /** + * Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly invalidPeriodGeofenceGeometryId?: string[]; + /** + * True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. This will only be presented in response when 'isAsync' query parameter is set to true. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isEventPublished?: boolean; +} + +/** The geofencing geometry. */ +export interface GeofenceGeometry { + /** + * ID of the device. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deviceId?: string; + /** + * The unique id returned from [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid GeoJSON FeatureCollection object. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly udId?: string; + /** + * The unique id identifies a geometry. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly geometryId?: string; + /** + * Distance from the coordinate to the closest border of the geofence. Positive means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more than the value of searchBuffer away from the closest geofence border, then the value is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside the polygon, but more than the value of searchBuffer away from the closest geofencing border, then the value is -999. A value of 999 means that there is great confidence the coordinate is well outside the geofence. A value of -999 means that there is great confidence the coordinate is well within the geofence. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly distance?: number; + /** + * Latitude of the nearest point of the geometry. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nearestLat?: number; + /** + * Longitude of the nearest point of the geometry. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nearestLon?: number; + /** + * Sea level in meter of the nearest point on the 2D extrusion geometry. This will only be presented in response when value is provided for 'zInMeter' in the request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nearestZ?: number; +} + +/** An object with a FeatureCollection and a list of distances. All the feature's properties should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. */ +export interface BufferRequestBody { + /** A valid `GeoJSON FeatureCollection` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. */ + geometries?: Record; + /** List of the distances to compute the buffer for, one-to-one per Feature in the collection, or one for all Features in the collection. */ + distances?: number[]; +} + +/** This object is returned from a successful Spatial Buffer call. */ +export interface BufferResponse { + /** + * Summary of the call. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly summary?: BufferResponseSummary; + /** The FeatureCollection of buffers for the input. */ + result?: GeoJsonFeatureCollectionUnion; +} + +/** Summary of the call. */ +export interface BufferResponseSummary { + /** + * The udid for the user data if one exists + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly udid?: string; + /** + * The information about what happened during the call. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly information?: string; +} + +/** A valid `GeoJSON` object. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3) for details. */ +export interface GeoJsonObject { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: + | "GeoJsonGeometry" + | "Feature" + | "FeatureCollection" + | "FeatureCollection" + | "Point" + | "MultiPoint" + | "LineString" + | "MultiLineString" + | "Polygon" + | "MultiPolygon" + | "GeometryCollection"; +} + +export interface GeoJsonFeatureCollectionData { + /** Contains a list of valid `GeoJSON Feature` objects. */ + features: GeoJsonFeature[]; +} + +export interface GeoJsonFeatureData { + /** A valid `GeoJSON` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1) for details. */ + geometry: GeoJsonGeometryUnion; + /** Properties can contain any additional metadata about the `Feature`. Value can be any JSON object or a JSON null value */ + properties?: Record; + /** Identifier for the feature. */ + id?: string; + /** The type of the feature. The value depends on the data model the current feature is part of. Some data models may have an empty value. */ + featureType?: string; +} + +/** This object is returned from a successful Spatial Closest Point call */ +export interface ClosestPointResponse { + /** + * Closest Point Summary object + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly summary?: ClosestPointSummary; + /** Closest Point Result Array */ + result?: ClosestPointResultEntry[]; +} + +/** Closest Point Summary object */ +export interface ClosestPointSummary { + /** A location represented as a latitude and longitude */ + sourcePoint?: SpatialCoordinate; + /** + * A unique data id (udid) for the uploaded content + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly udid?: string; + /** + * Processing information + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly information?: string; +} + +/** A location represented as a latitude and longitude */ +export interface SpatialCoordinate { + /** + * Latitude property + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lat?: number; + /** + * Longitude property + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lon?: number; +} + +/** Closest Point Result Entry Object */ +export interface ClosestPointResultEntry { + /** + * The distance in meters from the source point to the closest point + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly distanceInMeters?: number; + /** A location represented as a latitude and longitude */ + position?: SpatialCoordinate; + /** + * The unique id identifies a geometry + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly geometryId?: string; +} + +/** Returns true if point is within the polygon, false otherwise */ +export interface PointInPolygonResponse { + /** + * Point In Polygon Summary object + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly summary?: PointInPolygonSummary; + /** Point In Polygon Result Object */ + result?: PointInPolygonResult; +} + +/** Point In Polygon Summary object */ +export interface PointInPolygonSummary { + /** A location represented as a latitude and longitude */ + sourcePoint?: SpatialCoordinate; + /** + * A unique data id (udid) for the uploaded content. Udid is not applicable for POST spatial operations(set to null) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly udid?: string; + /** + * Processing information + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly information?: string; +} + +/** Point In Polygon Result Object */ +export interface PointInPolygonResult { + /** + * Point In Polygons Property + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly pointInPolygons?: boolean; + /** + * Geometries array + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly intersectingGeometries?: string[]; +} + +/** This object is returned from a successful Great Circle Distance call */ +export interface GreatCircleDistanceResponse { + /** + * Summary object + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly summary?: GreatCircleDistanceResponseSummary; + /** + * Result Object + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly result?: GreatCircleDistanceResponseResult; +} + +/** Summary object */ +export interface GreatCircleDistanceResponseSummary { + /** A location represented as a latitude and longitude */ + sourcePoint?: SpatialCoordinate; + /** A location represented as a latitude and longitude */ + targetPoint?: SpatialCoordinate; +} + +/** Result Object */ +export interface GreatCircleDistanceResponseResult { + /** + * The great circle distance in meters from the source point to the target point + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly distanceInMeters?: number; +} + +/** The response model for the Tileset List API. Returns a list of all tilesets. */ +export interface TilesetListResponse { + /** + * A list of all tilesets. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tilesets?: TilesetDetailInfo[]; + /** + * If present, the location of the next page of data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Detail information for the data. */ +export interface TilesetDetailInfo { + /** + * The unique tileset id for the tileset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tilesetId?: string; + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** + * The unique dataset Id used to create the tileset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly datasetId?: string; + /** + * The description the caller provided when creating the tileset. Maximum length 1024 characters. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** + * The lowest tile zoom level tile generated for the tileset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly minZoom?: number; + /** + * The highest tile zoom level tile generated for the tileset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly maxZoom?: number; + /** + * Bounding box which all features of the tileset lay within. Projection used - EPSG:3857. Format : 'minLon, minLat, maxLon, maxLat'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bbox?: number[]; +} + +export interface LandingPageResponse { + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** Links to other WFS endpoints. */ + links: WfsEndpointLink[]; +} + +/** Links to other WFS endpoints */ +export interface WfsEndpointLink { + /** The link target. */ + href: string; + /** The relation type. */ + rel?: string; + /** A hint indicating what the media type of the result of dereferencing the link should be. */ + type?: string; + /** A hint indicating what the language of the result of dereferencing the link should be. */ + hreflang?: string; + /** Used to label the destination of a link such that it can be used as a human-readable identifier (e.g., a menu entry) in the language indicated by the Content-Language header field (if present). */ + title?: string; +} + +export interface ConformanceResponse { + /** List of requirements classes that the server conforms to. */ + conformsTo: string[]; +} + +export interface CollectionsResponse { + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** Links to other WFS endpoints. */ + links: WfsEndpointLink[]; + /** All the collections in a given dataset. */ + collections: CollectionInfo[]; +} + +export interface CollectionInfo { + /** identifier of the collection used, for example, in URIs */ + name: string; + /** human readable title of the collection */ + title?: string; + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** a description of the features in the collection */ + description?: string; + /** Links to other WFS endpoints. */ + links: WfsEndpointLink[]; +} + +/** collection of GeoJSON features */ +export interface CollectionDefinitionResponse { + /** describes the collection */ + description?: string; + /** prefix of the collection used */ + idPrefix: string; + /** identifier of the collection used, for example, in URIs */ + name: string; + /** title of collection */ + title?: string; + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** type of geometry returned */ + geometryType: GeoJsonGeometryType; + /** type of features returned */ + featureTypes: string[]; + /** attributes of the collection used */ + properties?: DefinitionProperties[]; + /** Links to other WFS endpoints. */ + links?: WfsEndpointLink[]; +} + +export interface DefinitionProperties { + /** name of attribute */ + name: string; + /** is attribute required */ + required: boolean; + /** type of attribute */ + type: Record; +} + +export interface ExtendedGeoJsonFeatureCollectionData { + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** Number of returned features. */ + numberReturned?: number; + /** Links to other WFS endpoints. */ + links?: WfsEndpointLink[]; +} + +export interface FeatureResponse { + /** + * The ontology version of this dataset. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ontology?: string; + /** A valid `GeoJSON Feature` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.2) for details. */ + feature: GeoJsonFeature; + /** Links to other WFS endpoints. */ + links?: WfsEndpointLink[]; +} + +/** The numeric rule. The color is selected from the first range it falls into. */ +export interface NumberRuleObject { + /** The numeric value range for this style rule. If the value is in the range, all the conditions must hold true. */ + range?: RangeObject; + /** The color when value is within the range. Color is a JSON string in a variety of permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML colors names, like yellow and blue, are also permitted. */ + color?: string; +} + +/** The numeric value range for this style rule. If the value is in the range, all the conditions must hold true. */ +export interface RangeObject { + /** All the number x that x ≥ minimum. */ + minimum?: number; + /** All the number x that x ≤ maximum. */ + maximum?: number; + /** All the number x that x > exclusiveMinimum. */ + exclusiveMinimum?: number; + /** All the number x that x < exclusiveMaximum. */ + exclusiveMaximum?: number; +} + +/** The boolean rule. The color is selected based on the logic value of the key. */ +export interface BooleanRuleObject { + /** The color when value is true. Color is a JSON string in a variety of permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML colors names, like yellow and blue, are also permitted. */ + true?: string; + /** The color when value is false. Color is a JSON string in a variety of permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML colors names, like yellow and blue, are also permitted. */ + false?: string; +} + +/** Data contained by a `GeoJson Point`. */ +export interface GeoJsonPointData { + /** A `Position` is an array of numbers with two or more elements. The first two elements are _longitude_ and _latitude_, precisely in that order. _Altitude/Elevation_ is an optional third element. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.1) for details. */ + coordinates: number[]; +} + +/** Data contained by a `GeoJson MultiPoint`. */ +export interface GeoJsonMultiPointData { + /** Coordinates for the `GeoJson MultiPoint` geometry. */ + coordinates: number[][]; +} + +export interface GeoJsonLineStringData { + /** Coordinates for the `GeoJson LineString` geometry. */ + coordinates: number[][]; +} + +export interface GeoJsonMultiLineStringData { + /** Coordinates for the `GeoJson MultiLineString` geometry. */ + coordinates: number[][][]; +} + +export interface GeoJsonPolygonData { + /** Coordinates for the `GeoJson Polygon` geometry type. */ + coordinates: number[][][]; +} + +export interface GeoJsonMultiPolygonData { + /** Contains a list of valid `GeoJSON Polygon` objects. **Note** that coordinates in GeoJSON are in x, y order (longitude, latitude). */ + coordinates: number[][][][]; +} + +export interface GeoJsonGeometryCollectionData { + /** Contains a list of valid `GeoJSON` geometry objects. **Note** that coordinates in GeoJSON are in x, y order (longitude, latitude). */ + geometries: GeoJsonGeometryUnion[]; +} + +/** The boolean type style rule object. */ +export type BooleanTypeStyleRule = StyleObject & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "boolean"; + /** Boolean style rules. */ + rules: BooleanRuleObject[]; +}; + +/** The numeric type style rule object. */ +export type NumberTypeStyleRule = StyleObject & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "number"; + /** Numeric style rules. */ + rules: NumberRuleObject[]; +}; + +/** The string type style rule object. */ +export type StringTypeStyleRule = StyleObject & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "string"; + /** String style rules. */ + rules: { [propertyName: string]: string }[]; +}; + +/** A valid `GeoJSON` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1) for details. */ +export type GeoJsonGeometry = GeoJsonObject & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: + | "GeoJsonGeometry" + | "Point" + | "MultiPoint" + | "LineString" + | "MultiLineString" + | "Polygon" + | "MultiPolygon" + | "GeometryCollection"; +}; + +/** A valid `GeoJSON Feature` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.2) for details. */ +export type GeoJsonFeature = GeoJsonObject & + GeoJsonFeatureData & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "Feature"; + }; + +/** A valid `GeoJSON FeatureCollection` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. */ +export type GeoJsonFeatureCollection = GeoJsonObject & + GeoJsonFeatureCollectionData & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + type: "FeatureCollection" | "FeatureCollection"; + }; + +/** A valid `GeoJSON FeatureCollection` object type extended with numberReturned and links array. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. */ +export type ExtendedGeoJsonFeatureCollection = GeoJsonFeatureCollection & + ExtendedGeoJsonFeatureCollectionData & {}; + +/** A valid `GeoJSON Point` geometry type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.2) for details. */ +export type GeoJsonPoint = GeoJsonGeometry & GeoJsonPointData & {}; + +/** A valid `GeoJSON MultiPoint` geometry type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.3) for details. */ +export type GeoJsonMultiPoint = GeoJsonGeometry & GeoJsonMultiPointData & {}; + +/** A valid `GeoJSON LineString` geometry type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.4) for details. */ +export type GeoJsonLineString = GeoJsonGeometry & GeoJsonLineStringData & {}; + +/** A valid `GeoJSON MultiLineString` geometry type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.5) for details. */ +export type GeoJsonMultiLineString = GeoJsonGeometry & + GeoJsonMultiLineStringData & {}; + +/** A valid `GeoJSON Polygon` geometry type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.6) for details. */ +export type GeoJsonPolygon = GeoJsonGeometry & GeoJsonPolygonData & {}; + +/** A valid `GeoJSON MultiPolygon` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.7) for details. */ +export type GeoJsonMultiPolygon = GeoJsonGeometry & + GeoJsonMultiPolygonData & {}; + +/** A valid `GeoJSON GeometryCollection` object type. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1.8) for details. */ +export type GeoJsonGeometryCollection = GeoJsonGeometry & + GeoJsonGeometryCollectionData & {}; + +/** Defines headers for Alias_create operation. */ +export interface AliasCreateHeaders { + /** The list of response headers that can be read by the client. */ + accessControlExposeHeaders?: string; +} + +/** Defines headers for Data_uploadPreview operation. */ +export interface DataUploadPreviewHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Data_updatePreview operation. */ +export interface DataUpdatePreviewHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Data_downloadPreview operation. */ +export interface DataDownloadPreviewHeaders { + /** The content-type for the Download API response. */ + contentType?: string; +} + +/** Defines headers for Data_getOperationPreview operation. */ +export interface DataGetOperationPreviewHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Dataset_create operation. */ +export interface DatasetCreateHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Dataset_getOperation operation. */ +export interface DatasetGetOperationHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Conversion_convert operation. */ +export interface ConversionConvertHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Conversion_getOperation operation. */ +export interface ConversionGetOperationHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Spatial_getGeofence operation. */ +export interface SpatialGetGeofenceHeaders { + /** Value present in an async call's response and the Event Grid event data. It helps correlate the async call’s response with the corresponding Event Grid event. */ + xCorrelationId?: string; +} + +/** Defines headers for Spatial_postGeofence operation. */ +export interface SpatialPostGeofenceHeaders { + /** Value present in an async call's response and the Event Grid event data. It helps correlate the async call’s response with the corresponding Event Grid event. */ + xCorrelationId?: string; +} + +/** Defines headers for Tileset_create operation. */ +export interface TilesetCreateHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Defines headers for Tileset_getOperation operation. */ +export interface TilesetGetOperationHeaders { + /** If successful, a URI where details on the newly created resource can be found. */ + resourceLocation?: string; +} + +/** Known values of {@link Geography} that the service accepts. */ +export const enum KnownGeography { + Us = "us", + Eu = "eu" +} + +/** + * Defines values for Geography. \ + * {@link KnownGeography} can be used interchangeably with Geography, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **us** \ + * **eu** + */ +export type Geography = string; + +/** Known values of {@link UploadDataFormat} that the service accepts. */ +export const enum KnownUploadDataFormat { + /** [GeoJSON](https://tools.ietf.org/html/rfc7946) is a JSON based geospatial data interchange format. */ + Geojson = "geojson", + /** Compressed data format. */ + Zip = "zip", + /** ZIP package containing DWG file. */ + Dwgzippackage = "dwgzippackage" +} + +/** + * Defines values for UploadDataFormat. \ + * {@link KnownUploadDataFormat} can be used interchangeably with UploadDataFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **geojson**: [GeoJSON](https:\/\/tools.ietf.org\/html\/rfc7946) is a JSON based geospatial data interchange format. \ + * **zip**: Compressed data format. \ + * **dwgzippackage**: ZIP package containing DWG file. + */ +export type UploadDataFormat = string; + +/** Known values of {@link LroStatus} that the service accepts. */ +export const enum KnownLroStatus { + /** The request has not started processing yet. */ + NotStarted = "NotStarted", + /** The request has started processing. */ + Running = "Running", + /** The request has one or more failures. */ + Failed = "Failed", + /** The request has successfully completed. */ + Succeeded = "Succeeded" +} + +/** + * Defines values for LroStatus. \ + * {@link KnownLroStatus} can be used interchangeably with LroStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotStarted**: The request has not started processing yet. \ + * **Running**: The request has started processing. \ + * **Failed**: The request has one or more failures. \ + * **Succeeded**: The request has successfully completed. + */ +export type LroStatus = string; + +/** Known values of {@link StyleObjectType} that the service accepts. */ +export const enum KnownStyleObjectType { + /** Boolean type of stateset style. */ + BooleanTypeStyleRule = "boolean", + /** Number type of stateset style. */ + NumberTypeStyleRule = "number", + /** String type of stateset style. */ + StringTypeStyleRule = "string" +} + +/** + * Defines values for StyleObjectType. \ + * {@link KnownStyleObjectType} can be used interchangeably with StyleObjectType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **boolean**: Boolean type of stateset style. \ + * **number**: Number type of stateset style. \ + * **string**: String type of stateset style. + */ +export type StyleObjectType = string; + +/** Known values of {@link ResponseFormat} that the service accepts. */ +export const enum KnownResponseFormat { + /** [The JavaScript Object Notation Data Interchange Format](https://tools.ietf.org/html/rfc8259) */ + Json = "json" +} + +/** + * Defines values for ResponseFormat. \ + * {@link KnownResponseFormat} can be used interchangeably with ResponseFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **json**: [The JavaScript Object Notation Data Interchange Format](https:\/\/tools.ietf.org\/html\/rfc8259) + */ +export type ResponseFormat = string; + +/** Known values of {@link GeofenceMode} that the service accepts. */ +export const enum KnownGeofenceMode { + /** Publish all the query results to Azure Maps account event subscription. */ + All = "All", + /** Only publish result when user location is considered as crossing geofencing boarder. */ + EnterAndExit = "EnterAndExit" +} + +/** + * Defines values for GeofenceMode. \ + * {@link KnownGeofenceMode} can be used interchangeably with GeofenceMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **All**: Publish all the query results to Azure Maps account event subscription. \ + * **EnterAndExit**: Only publish result when user location is considered as crossing geofencing boarder. + */ +export type GeofenceMode = string; + +/** Known values of {@link GeoJsonObjectType} that the service accepts. */ +export const enum KnownGeoJsonObjectType { + /** `GeoJSON Point` geometry. */ + GeoJsonPoint = "Point", + /** `GeoJSON MultiPoint` geometry. */ + GeoJsonMultiPoint = "MultiPoint", + /** `GeoJSON LineString` geometry. */ + GeoJsonLineString = "LineString", + /** `GeoJSON MultiLineString` geometry. */ + GeoJsonMultiLineString = "MultiLineString", + /** `GeoJSON Polygon` geometry. */ + GeoJsonPolygon = "Polygon", + /** `GeoJSON MultiPolygon` geometry. */ + GeoJsonMultiPolygon = "MultiPolygon", + /** `GeoJSON GeometryCollection` geometry. */ + GeoJsonGeometryCollection = "GeometryCollection", + /** `GeoJSON Feature` object. */ + GeoJsonFeature = "Feature", + /** `GeoJSON FeatureCollection` object. */ + GeoJsonFeatureCollection = "FeatureCollection" +} + +/** + * Defines values for GeoJsonObjectType. \ + * {@link KnownGeoJsonObjectType} can be used interchangeably with GeoJsonObjectType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Point**: `GeoJSON Point` geometry. \ + * **MultiPoint**: `GeoJSON MultiPoint` geometry. \ + * **LineString**: `GeoJSON LineString` geometry. \ + * **MultiLineString**: `GeoJSON MultiLineString` geometry. \ + * **Polygon**: `GeoJSON Polygon` geometry. \ + * **MultiPolygon**: `GeoJSON MultiPolygon` geometry. \ + * **GeometryCollection**: `GeoJSON GeometryCollection` geometry. \ + * **Feature**: `GeoJSON Feature` object. \ + * **FeatureCollection**: `GeoJSON FeatureCollection` object. + */ +export type GeoJsonObjectType = string; + +/** Known values of {@link GeoJsonGeometryType} that the service accepts. */ +export const enum KnownGeoJsonGeometryType { + /** `GeoJSON Point` geometry. */ + GeoJsonPoint = "Point", + /** `GeoJSON MultiPoint` geometry. */ + GeoJsonMultiPoint = "MultiPoint", + /** `GeoJSON LineString` geometry. */ + GeoJsonLineString = "LineString", + /** `GeoJSON MultiLineString` geometry. */ + GeoJsonMultiLineString = "MultiLineString", + /** `GeoJSON Polygon` geometry. */ + GeoJsonPolygon = "Polygon", + /** `GeoJSON MultiPolygon` geometry. */ + GeoJsonMultiPolygon = "MultiPolygon", + /** `GeoJSON GeometryCollection` geometry. */ + GeoJsonGeometryCollection = "GeometryCollection" +} + +/** + * Defines values for GeoJsonGeometryType. \ + * {@link KnownGeoJsonGeometryType} can be used interchangeably with GeoJsonGeometryType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Point**: `GeoJSON Point` geometry. \ + * **MultiPoint**: `GeoJSON MultiPoint` geometry. \ + * **LineString**: `GeoJSON LineString` geometry. \ + * **MultiLineString**: `GeoJSON MultiLineString` geometry. \ + * **Polygon**: `GeoJSON Polygon` geometry. \ + * **MultiPolygon**: `GeoJSON MultiPolygon` geometry. \ + * **GeometryCollection**: `GeoJSON GeometryCollection` geometry. + */ +export type GeoJsonGeometryType = string; + +/** Known values of {@link GeographicResourceLocation} that the service accepts. */ +export const enum KnownGeographicResourceLocation { + /** Used to access an Azure Maps Creator resource in the United States */ + Us = "us", + /** Used to access an Azure Maps Creator resource in Europe */ + Eu = "eu" +} + +/** + * Defines values for GeographicResourceLocation. \ + * {@link KnownGeographicResourceLocation} can be used interchangeably with GeographicResourceLocation, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **us**: Used to access an Azure Maps Creator resource in the United States \ + * **eu**: Used to access an Azure Maps Creator resource in Europe + */ +export type GeographicResourceLocation = string; + +/** Optional parameters. */ +export interface AliasCreateOptionalParams extends coreClient.OperationOptions { + /** The unique id that references a creator data item to be aliased. */ + creatorDataItemId?: string; +} + +/** Contains response data for the create operation. */ +export type AliasCreateResponse = AliasCreateHeaders & AliasesCreateResponse; + +/** Optional parameters. */ +export interface AliasListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AliasListOperationResponse = AliasListResponse; + +/** Optional parameters. */ +export interface AliasAssignOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the assign operation. */ +export type AliasAssignResponse = AliasListItem; + +/** Optional parameters. */ +export interface AliasDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface AliasGetDetailsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDetails operation. */ +export type AliasGetDetailsResponse = AliasListItem; + +/** Optional parameters. */ +export interface AliasListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AliasListNextResponse = AliasListResponse; + +/** Optional parameters. */ +export interface DataUploadPreview$binaryOptionalParams + extends coreClient.OperationOptions { + /** The description to be given to the upload. */ + uploadDataDescription?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface DataUploadPreview$jsonOptionalParams + extends coreClient.OperationOptions { + /** The description to be given to the upload. */ + uploadDataDescription?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the uploadPreview operation. */ +export type DataUploadPreviewResponse = DataUploadPreviewHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface DataListPreviewOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listPreview operation. */ +export type DataListPreviewResponse = MapDataListResponse; + +/** Optional parameters. */ +export interface DataUpdatePreviewOptionalParams + extends coreClient.OperationOptions { + /** The description to be given to the upload. */ + uploadDataDescription?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the updatePreview operation. */ +export type DataUpdatePreviewResponse = DataUpdatePreviewHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface DataDownloadPreviewOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the downloadPreview operation. */ +export type DataDownloadPreviewResponse = DataDownloadPreviewHeaders & { + /** + * BROWSER ONLY + * + * The response body as a browser Blob. + * Always `undefined` in node.js. + */ + blobBody?: Promise; + /** + * NODEJS ONLY + * + * The response body as a node.js Readable stream. + * Always `undefined` in the browser. + */ + readableStreamBody?: NodeJS.ReadableStream; +}; + +/** Optional parameters. */ +export interface DataDeletePreviewOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DataGetOperationPreviewOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getOperationPreview operation. */ +export type DataGetOperationPreviewResponse = DataGetOperationPreviewHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface DatasetCreateOptionalParams + extends coreClient.OperationOptions { + /** The ID for the dataset to append with. The dataset must originate from a previous dataset creation call that matches the datasetId */ + datasetId?: string; + /** The description to be given to the dataset. */ + descriptionDataset?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type DatasetCreateResponse = DatasetCreateHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface DatasetListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type DatasetListOperationResponse = DatasetListResponse; + +/** Optional parameters. */ +export interface DatasetGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DatasetGetResponse = DatasetDetailInfo; + +/** Optional parameters. */ +export interface DatasetDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DatasetGetOperationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getOperation operation. */ +export type DatasetGetOperationResponse = DatasetGetOperationHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface DatasetListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type DatasetListNextResponse = DatasetListResponse; + +/** Optional parameters. */ +export interface ConversionConvertOptionalParams + extends coreClient.OperationOptions { + /** User provided description of the content being converted. */ + description?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the convert operation. */ +export type ConversionConvertResponse = ConversionConvertHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface ConversionListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ConversionListOperationResponse = ConversionListResponse; + +/** Optional parameters. */ +export interface ConversionGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ConversionGetResponse = ConversionListDetailInfo; + +/** Optional parameters. */ +export interface ConversionDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ConversionGetOperationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getOperation operation. */ +export type ConversionGetOperationResponse = ConversionGetOperationHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface ConversionListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ConversionListNextResponse = ConversionListResponse; + +/** Optional parameters. */ +export interface FeatureStateCreateStatesetOptionalParams + extends coreClient.OperationOptions { + /** Description for the stateset. Max length allowed is 1000. */ + description?: string; +} + +/** Contains response data for the createStateset operation. */ +export type FeatureStateCreateStatesetResponse = StatesetCreatedResponse; + +/** Optional parameters. */ +export interface FeatureStateListStatesetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listStateset operation. */ +export type FeatureStateListStatesetResponse = StatesetListResponse; + +/** Optional parameters. */ +export interface FeatureStatePutStatesetOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FeatureStateDeleteStatesetOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FeatureStateGetStatesetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getStateset operation. */ +export type FeatureStateGetStatesetResponse = StatesetGetResponse; + +/** Optional parameters. */ +export interface FeatureStateUpdateStatesOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FeatureStateDeleteStateOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FeatureStateGetStatesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getStates operation. */ +export type FeatureStateGetStatesResponse = FeatureStatesStructure; + +/** Optional parameters. */ +export interface FeatureStateListStatesetNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listStatesetNext operation. */ +export type FeatureStateListStatesetNextResponse = StatesetListResponse; + +/** Optional parameters. */ +export interface SpatialGetGeofenceOptionalParams + extends coreClient.OperationOptions { + /** The sea level in meter of the location being passed. If this parameter is presented, 2D extrusion is used. Example: 200. */ + z?: number; + /** The user request time. If not presented in the request, the default value is DateTime.Now. */ + userTime?: Date; + /** The radius of the buffer around the geofence in meters that defines how far to search inside and outside the border of the fence against the coordinate that was provided when calculating the result. The minimum value is 0, and the maximum is 500. The default value is 50. */ + searchBuffer?: number; + /** If true, the request will use async event mechanism; if false, the request will be synchronized and do not trigger any event. The default value is false. */ + isAsync?: boolean; + /** Mode of the geofencing async event mechanism. */ + mode?: GeofenceMode; +} + +/** Contains response data for the getGeofence operation. */ +export type SpatialGetGeofenceResponse = SpatialGetGeofenceHeaders & + GeofenceResponse; + +/** Optional parameters. */ +export interface SpatialPostGeofenceOptionalParams + extends coreClient.OperationOptions { + /** The sea level in meter of the location being passed. If this parameter is presented, 2D extrusion geofencing is applied. Example: 200. */ + z?: number; + /** The user request time. If not presented in the request, the default value is DateTime.UtcNow. */ + userTime?: Date; + /** The radius of the buffer around the geofence in meters that defines how far to search inside and outside the border of the fence against the coordinate that was provided when calculating the result. The minimum value is 0, and the maximum is 500. The default value is 50. */ + searchBuffer?: number; + /** If true, the request will use async event mechanism; if false, the request will be synchronized and do not trigger any event. The default value is false. */ + isAsync?: boolean; + /** Mode of the geofencing async event mechanism. */ + mode?: GeofenceMode; +} + +/** Contains response data for the postGeofence operation. */ +export type SpatialPostGeofenceResponse = SpatialPostGeofenceHeaders & + GeofenceResponse; + +/** Optional parameters. */ +export interface SpatialPostBufferOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the postBuffer operation. */ +export type SpatialPostBufferResponse = BufferResponse; + +/** Optional parameters. */ +export interface SpatialGetBufferOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getBuffer operation. */ +export type SpatialGetBufferResponse = BufferResponse; + +/** Optional parameters. */ +export interface SpatialPostClosestPointOptionalParams + extends coreClient.OperationOptions { + /** The number of closest points expected from response. Default: 1, minimum: 1 and maximum: 50 */ + numberOfClosestPoints?: number; +} + +/** Contains response data for the postClosestPoint operation. */ +export type SpatialPostClosestPointResponse = ClosestPointResponse; + +/** Optional parameters. */ +export interface SpatialGetClosestPointOptionalParams + extends coreClient.OperationOptions { + /** The number of closest points expected from response. Default: 1, minimum: 1 and maximum: 50 */ + numberOfClosestPoints?: number; +} + +/** Contains response data for the getClosestPoint operation. */ +export type SpatialGetClosestPointResponse = ClosestPointResponse; + +/** Optional parameters. */ +export interface SpatialPostPointInPolygonOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the postPointInPolygon operation. */ +export type SpatialPostPointInPolygonResponse = PointInPolygonResponse; + +/** Optional parameters. */ +export interface SpatialGetPointInPolygonOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getPointInPolygon operation. */ +export type SpatialGetPointInPolygonResponse = PointInPolygonResponse; + +/** Optional parameters. */ +export interface SpatialGetGreatCircleDistanceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getGreatCircleDistance operation. */ +export type SpatialGetGreatCircleDistanceResponse = GreatCircleDistanceResponse; + +/** Optional parameters. */ +export interface TilesetCreateOptionalParams + extends coreClient.OperationOptions { + /** User provided description of the tileset. */ + description?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type TilesetCreateResponse = TilesetCreateHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface TilesetListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type TilesetListOperationResponse = TilesetListResponse; + +/** Optional parameters. */ +export interface TilesetGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type TilesetGetResponse = TilesetDetailInfo; + +/** Optional parameters. */ +export interface TilesetDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface TilesetGetOperationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getOperation operation. */ +export type TilesetGetOperationResponse = TilesetGetOperationHeaders & + LongRunningOperationResult; + +/** Optional parameters. */ +export interface TilesetListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type TilesetListNextResponse = TilesetListResponse; + +/** Optional parameters. */ +export interface WfsGetLandingPageOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getLandingPage operation. */ +export type WfsGetLandingPageResponse = LandingPageResponse; + +/** Optional parameters. */ +export interface WfsGetConformanceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getConformance operation. */ +export type WfsGetConformanceResponse = ConformanceResponse; + +/** Optional parameters. */ +export interface WfsGetCollectionsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getCollections operation. */ +export type WfsGetCollectionsResponse = CollectionsResponse; + +/** Optional parameters. */ +export interface WfsGetCollectionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getCollection operation. */ +export type WfsGetCollectionResponse = CollectionInfo; + +/** Optional parameters. */ +export interface WfsGetCollectionDefinitionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getCollectionDefinition operation. */ +export type WfsGetCollectionDefinitionResponse = CollectionDefinitionResponse; + +/** Optional parameters. */ +export interface WfsGetFeaturesOptionalParams + extends coreClient.OperationOptions { + /** + * The optional limit parameter limits the number of features that are presented in the response document. + * Only features that are on the first level of the collection in the response document are counted. Nested objects contained within the explicitly requested features shall not be counted. + * * Minimum = 1 * Maximum = 50 * Default = 10 + */ + limit?: number; + /** + * Only features that have a geometry that intersects the supplied bounding box are selected. + * * Lower left corner, coordinate axis 1 * Lower left corner, coordinate axis 2 * Upper right corner, coordinate axis 1 * Upper right corner, coordinate axis 2 + * The coordinate reference system of the values is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system is specified in the parameter `bbox-crs`. + * For WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans the antimeridian the first value (west-most box edge) is larger than the third value (east-most box edge). + */ + bbox?: string; + /** + * Filter expression to search for features with specific property values in a given collection. Only feature properties of scalar type and equals operator are supported. + * This is a special parameter where the parameter name is a case sensitive property name. The scheme for this parameter is {property name}={property value}. Unless "filter" is one of the property names in the collection, "filter" should not be used as a parameter name. To search for features with "name" property value "21N13", use "name=21N13". + * Multiple filters are supported and should be represented as multiple query parameters. E.g., =&= String values are case sensitive. + */ + filter?: string; +} + +/** Contains response data for the getFeatures operation. */ +export type WfsGetFeaturesResponse = ExtendedGeoJsonFeatureCollection; + +/** Optional parameters. */ +export interface WfsGetFeatureOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getFeature operation. */ +export type WfsGetFeatureResponse = FeatureResponse; + +/** Optional parameters. */ +export interface WfsDeleteFeatureOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface CreatorClientOptionalParams + extends coreClient.ServiceClientOptions { + /** This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. */ + geography?: Geography; + /** Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following [articles](https://aka.ms/amauthdetails) for guidance. */ + xMsClientId?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/maps/maps-creator/src/models/mappers.ts b/sdk/maps/maps-creator/src/models/mappers.ts new file mode 100644 index 000000000000..4bb4e8bbca34 --- /dev/null +++ b/sdk/maps/maps-creator/src/models/mappers.ts @@ -0,0 +1,2429 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const AliasesCreateResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AliasesCreateResponse", + modelProperties: { + createdTimestamp: { + serializedName: "createdTimestamp", + readOnly: true, + type: { + name: "String" + } + }, + aliasId: { + serializedName: "aliasId", + readOnly: true, + type: { + name: "String" + } + }, + creatorDataItemId: { + serializedName: "creatorDataItemId", + readOnly: true, + type: { + name: "String" + } + }, + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const AliasListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AliasListResponse", + modelProperties: { + aliases: { + serializedName: "aliases", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AliasListItem" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AliasListItem: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AliasListItem", + modelProperties: { + createdTimestamp: { + serializedName: "createdTimestamp", + readOnly: true, + type: { + name: "String" + } + }, + aliasId: { + serializedName: "aliasId", + readOnly: true, + type: { + name: "String" + } + }, + creatorDataItemId: { + serializedName: "creatorDataItemId", + readOnly: true, + nullable: true, + type: { + name: "String" + } + }, + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const LongRunningOperationResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LongRunningOperationResult", + modelProperties: { + operationId: { + serializedName: "operationId", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + }, + created: { + serializedName: "created", + readOnly: true, + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + }, + warning: { + serializedName: "warning", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const MapDataListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MapDataListResponse", + modelProperties: { + mapDataList: { + serializedName: "mapDataList", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MapDataDetailInfo" + } + } + } + } + } + } +}; + +export const MapDataDetailInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MapDataDetailInfo", + modelProperties: { + udid: { + serializedName: "udid", + readOnly: true, + type: { + name: "String" + } + }, + location: { + serializedName: "location", + readOnly: true, + type: { + name: "String" + } + }, + sizeInBytes: { + serializedName: "sizeInBytes", + readOnly: true, + type: { + name: "Number" + } + }, + uploadStatus: { + serializedName: "uploadStatus", + readOnly: true, + type: { + name: "String" + } + }, + dataFormat: { + serializedName: "dataFormat", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatasetListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatasetListResponse", + modelProperties: { + datasets: { + serializedName: "datasets", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DatasetDetailInfo" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DatasetDetailInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatasetDetailInfo", + modelProperties: { + created: { + serializedName: "created", + readOnly: true, + type: { + name: "String" + } + }, + datasetId: { + serializedName: "datasetId", + readOnly: true, + type: { + name: "String" + } + }, + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + datasetSources: { + serializedName: "datasetSources", + type: { + name: "Composite", + className: "DatasetSources" + } + }, + featureCounts: { + serializedName: "featureCounts", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const DatasetSources: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatasetSources", + modelProperties: { + conversionIds: { + serializedName: "conversionIds", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + appendDatasetId: { + serializedName: "appendDatasetId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ConversionListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConversionListResponse", + modelProperties: { + conversions: { + serializedName: "conversions", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ConversionListDetailInfo" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ConversionListDetailInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConversionListDetailInfo", + modelProperties: { + conversionId: { + serializedName: "conversionId", + readOnly: true, + type: { + name: "String" + } + }, + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + udid: { + serializedName: "udid", + readOnly: true, + type: { + name: "String" + } + }, + created: { + serializedName: "created", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + featureCounts: { + serializedName: "featureCounts", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const StylesObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StylesObject", + modelProperties: { + styles: { + serializedName: "styles", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StyleObject" + } + } + } + } + } + } +}; + +export const StyleObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StyleObject", + uberParent: "StyleObject", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + keyName: { + serializedName: "keyName", + required: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const StatesetCreatedResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StatesetCreatedResponse", + modelProperties: { + statesetId: { + serializedName: "statesetId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StatesetListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StatesetListResponse", + modelProperties: { + statesets: { + serializedName: "statesets", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StatesetInfoObject" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StatesetInfoObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StatesetInfoObject", + modelProperties: { + statesetId: { + serializedName: "statesetId", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + datasetIds: { + serializedName: "datasetIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + statesetStyle: { + serializedName: "statesetStyle", + type: { + name: "Composite", + className: "StylesObject" + } + } + } + } +}; + +export const StatesetGetResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StatesetGetResponse", + modelProperties: { + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + datasetIds: { + serializedName: "datasetIds", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + statesetStyle: { + serializedName: "statesetStyle", + type: { + name: "Composite", + className: "StylesObject" + } + } + } + } +}; + +export const FeatureStatesStructure: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FeatureStatesStructure", + modelProperties: { + states: { + serializedName: "states", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FeatureStateObject" + } + } + } + } + } + } +}; + +export const FeatureStateObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FeatureStateObject", + modelProperties: { + keyName: { + serializedName: "keyName", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + eventTimestamp: { + serializedName: "eventTimestamp", + type: { + name: "String" + } + } + } + } +}; + +export const GeofenceResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeofenceResponse", + modelProperties: { + geometries: { + serializedName: "geometries", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GeofenceGeometry" + } + } + } + }, + expiredGeofenceGeometryId: { + serializedName: "expiredGeofenceGeometryId", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + invalidPeriodGeofenceGeometryId: { + serializedName: "invalidPeriodGeofenceGeometryId", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + isEventPublished: { + serializedName: "isEventPublished", + readOnly: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const GeofenceGeometry: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeofenceGeometry", + modelProperties: { + deviceId: { + serializedName: "deviceId", + readOnly: true, + type: { + name: "String" + } + }, + udId: { + serializedName: "udId", + readOnly: true, + type: { + name: "String" + } + }, + geometryId: { + serializedName: "geometryId", + readOnly: true, + type: { + name: "String" + } + }, + distance: { + serializedName: "distance", + readOnly: true, + type: { + name: "Number" + } + }, + nearestLat: { + serializedName: "nearestLat", + readOnly: true, + type: { + name: "Number" + } + }, + nearestLon: { + serializedName: "nearestLon", + readOnly: true, + type: { + name: "Number" + } + }, + nearestZ: { + serializedName: "nearestZ", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const BufferRequestBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BufferRequestBody", + modelProperties: { + geometries: { + serializedName: "geometries", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + distances: { + serializedName: "distances", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } +}; + +export const BufferResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BufferResponse", + modelProperties: { + summary: { + serializedName: "summary", + type: { + name: "Composite", + className: "BufferResponseSummary" + } + }, + result: { + serializedName: "result", + type: { + name: "Composite", + className: "GeoJsonFeatureCollection" + } + } + } + } +}; + +export const BufferResponseSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BufferResponseSummary", + modelProperties: { + udid: { + serializedName: "udid", + readOnly: true, + type: { + name: "String" + } + }, + information: { + serializedName: "information", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const GeoJsonObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonObject", + uberParent: "GeoJsonObject", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const GeoJsonFeatureCollectionData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonFeatureCollectionData", + modelProperties: { + features: { + serializedName: "features", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GeoJsonFeature" + } + } + } + } + } + } +}; + +export const GeoJsonFeatureData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonFeatureData", + modelProperties: { + geometry: { + serializedName: "geometry", + type: { + name: "Composite", + className: "GeoJsonGeometry" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + featureType: { + serializedName: "featureType", + type: { + name: "String" + } + } + } + } +}; + +export const ClosestPointResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClosestPointResponse", + modelProperties: { + summary: { + serializedName: "summary", + type: { + name: "Composite", + className: "ClosestPointSummary" + } + }, + result: { + serializedName: "result", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClosestPointResultEntry" + } + } + } + } + } + } +}; + +export const ClosestPointSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClosestPointSummary", + modelProperties: { + sourcePoint: { + serializedName: "sourcePoint", + type: { + name: "Composite", + className: "SpatialCoordinate" + } + }, + udid: { + serializedName: "udid", + readOnly: true, + type: { + name: "String" + } + }, + information: { + serializedName: "information", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SpatialCoordinate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SpatialCoordinate", + modelProperties: { + lat: { + serializedName: "lat", + readOnly: true, + type: { + name: "Number" + } + }, + lon: { + serializedName: "lon", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ClosestPointResultEntry: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClosestPointResultEntry", + modelProperties: { + distanceInMeters: { + serializedName: "distanceInMeters", + readOnly: true, + type: { + name: "Number" + } + }, + position: { + serializedName: "position", + type: { + name: "Composite", + className: "SpatialCoordinate" + } + }, + geometryId: { + serializedName: "geometryId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PointInPolygonResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PointInPolygonResponse", + modelProperties: { + summary: { + serializedName: "summary", + type: { + name: "Composite", + className: "PointInPolygonSummary" + } + }, + result: { + serializedName: "result", + type: { + name: "Composite", + className: "PointInPolygonResult" + } + } + } + } +}; + +export const PointInPolygonSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PointInPolygonSummary", + modelProperties: { + sourcePoint: { + serializedName: "sourcePoint", + type: { + name: "Composite", + className: "SpatialCoordinate" + } + }, + udid: { + serializedName: "udid", + readOnly: true, + type: { + name: "String" + } + }, + information: { + serializedName: "information", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PointInPolygonResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PointInPolygonResult", + modelProperties: { + pointInPolygons: { + serializedName: "pointInPolygons", + readOnly: true, + type: { + name: "Boolean" + } + }, + intersectingGeometries: { + serializedName: "intersectingGeometries", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const GreatCircleDistanceResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GreatCircleDistanceResponse", + modelProperties: { + summary: { + serializedName: "summary", + type: { + name: "Composite", + className: "GreatCircleDistanceResponseSummary" + } + }, + result: { + serializedName: "result", + type: { + name: "Composite", + className: "GreatCircleDistanceResponseResult" + } + } + } + } +}; + +export const GreatCircleDistanceResponseSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GreatCircleDistanceResponseSummary", + modelProperties: { + sourcePoint: { + serializedName: "sourcePoint", + type: { + name: "Composite", + className: "SpatialCoordinate" + } + }, + targetPoint: { + serializedName: "targetPoint", + type: { + name: "Composite", + className: "SpatialCoordinate" + } + } + } + } +}; + +export const GreatCircleDistanceResponseResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GreatCircleDistanceResponseResult", + modelProperties: { + distanceInMeters: { + serializedName: "distanceInMeters", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const TilesetListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TilesetListResponse", + modelProperties: { + tilesets: { + serializedName: "tilesets", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TilesetDetailInfo" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TilesetDetailInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TilesetDetailInfo", + modelProperties: { + tilesetId: { + serializedName: "tilesetId", + readOnly: true, + type: { + name: "String" + } + }, + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + datasetId: { + serializedName: "datasetId", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + minZoom: { + serializedName: "minZoom", + readOnly: true, + type: { + name: "Number" + } + }, + maxZoom: { + serializedName: "maxZoom", + readOnly: true, + type: { + name: "Number" + } + }, + bbox: { + serializedName: "bbox", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } +}; + +export const LandingPageResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LandingPageResponse", + modelProperties: { + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + links: { + serializedName: "links", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WfsEndpointLink" + } + } + } + } + } + } +}; + +export const WfsEndpointLink: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WfsEndpointLink", + modelProperties: { + href: { + serializedName: "href", + required: true, + type: { + name: "String" + } + }, + rel: { + serializedName: "rel", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + hreflang: { + serializedName: "hreflang", + type: { + name: "String" + } + }, + title: { + serializedName: "title", + type: { + name: "String" + } + } + } + } +}; + +export const ConformanceResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConformanceResponse", + modelProperties: { + conformsTo: { + serializedName: "conformsTo", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const CollectionsResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CollectionsResponse", + modelProperties: { + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + links: { + serializedName: "links", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WfsEndpointLink" + } + } + } + }, + collections: { + serializedName: "collections", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CollectionInfo" + } + } + } + } + } + } +}; + +export const CollectionInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CollectionInfo", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + title: { + serializedName: "title", + type: { + name: "String" + } + }, + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + links: { + serializedName: "links", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WfsEndpointLink" + } + } + } + } + } + } +}; + +export const CollectionDefinitionResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CollectionDefinitionResponse", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + }, + idPrefix: { + serializedName: "idPrefix", + required: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + title: { + serializedName: "title", + type: { + name: "String" + } + }, + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + geometryType: { + serializedName: "geometryType", + required: true, + type: { + name: "String" + } + }, + featureTypes: { + serializedName: "featureTypes", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + properties: { + serializedName: "properties", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DefinitionProperties" + } + } + } + }, + links: { + serializedName: "links", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WfsEndpointLink" + } + } + } + } + } + } +}; + +export const DefinitionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DefinitionProperties", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + required: { + serializedName: "required", + required: true, + type: { + name: "Boolean" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const ExtendedGeoJsonFeatureCollectionData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExtendedGeoJsonFeatureCollectionData", + modelProperties: { + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + numberReturned: { + serializedName: "numberReturned", + type: { + name: "Number" + } + }, + links: { + serializedName: "links", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WfsEndpointLink" + } + } + } + } + } + } +}; + +export const FeatureResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FeatureResponse", + modelProperties: { + ontology: { + serializedName: "ontology", + readOnly: true, + type: { + name: "String" + } + }, + feature: { + serializedName: "feature", + type: { + name: "Composite", + className: "GeoJsonFeature" + } + }, + links: { + serializedName: "links", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WfsEndpointLink" + } + } + } + } + } + } +}; + +export const NumberRuleObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NumberRuleObject", + modelProperties: { + range: { + serializedName: "range", + type: { + name: "Composite", + className: "RangeObject" + } + }, + color: { + serializedName: "color", + type: { + name: "String" + } + } + } + } +}; + +export const RangeObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RangeObject", + modelProperties: { + minimum: { + serializedName: "minimum", + type: { + name: "Number" + } + }, + maximum: { + serializedName: "maximum", + type: { + name: "Number" + } + }, + exclusiveMinimum: { + serializedName: "exclusiveMinimum", + type: { + name: "Number" + } + }, + exclusiveMaximum: { + serializedName: "exclusiveMaximum", + type: { + name: "Number" + } + } + } + } +}; + +export const BooleanRuleObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BooleanRuleObject", + modelProperties: { + true: { + serializedName: "true", + type: { + name: "String" + } + }, + false: { + serializedName: "false", + type: { + name: "String" + } + } + } + } +}; + +export const GeoJsonPointData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonPointData", + modelProperties: { + coordinates: { + serializedName: "coordinates", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } +}; + +export const GeoJsonMultiPointData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonMultiPointData", + modelProperties: { + coordinates: { + serializedName: "coordinates", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } + } + } +}; + +export const GeoJsonLineStringData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonLineStringData", + modelProperties: { + coordinates: { + serializedName: "coordinates", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } + } + } +}; + +export const GeoJsonMultiLineStringData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonMultiLineStringData", + modelProperties: { + coordinates: { + serializedName: "coordinates", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } + } + } + } + } +}; + +export const GeoJsonPolygonData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonPolygonData", + modelProperties: { + coordinates: { + serializedName: "coordinates", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } + } + } + } + } +}; + +export const GeoJsonMultiPolygonData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonMultiPolygonData", + modelProperties: { + coordinates: { + serializedName: "coordinates", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + } + } + } + } + } + } + } + } + } +}; + +export const GeoJsonGeometryCollectionData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GeoJsonGeometryCollectionData", + modelProperties: { + geometries: { + serializedName: "geometries", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "GeoJsonGeometry" + } + } + } + } + } + } +}; + +export const BooleanTypeStyleRule: coreClient.CompositeMapper = { + serializedName: "boolean", + type: { + name: "Composite", + className: "BooleanTypeStyleRule", + uberParent: "StyleObject", + polymorphicDiscriminator: StyleObject.type.polymorphicDiscriminator, + modelProperties: { + ...StyleObject.type.modelProperties, + rules: { + serializedName: "rules", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BooleanRuleObject" + } + } + } + } + } + } +}; + +export const NumberTypeStyleRule: coreClient.CompositeMapper = { + serializedName: "number", + type: { + name: "Composite", + className: "NumberTypeStyleRule", + uberParent: "StyleObject", + polymorphicDiscriminator: StyleObject.type.polymorphicDiscriminator, + modelProperties: { + ...StyleObject.type.modelProperties, + rules: { + serializedName: "rules", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NumberRuleObject" + } + } + } + } + } + } +}; + +export const StringTypeStyleRule: coreClient.CompositeMapper = { + serializedName: "string", + type: { + name: "Composite", + className: "StringTypeStyleRule", + uberParent: "StyleObject", + polymorphicDiscriminator: StyleObject.type.polymorphicDiscriminator, + modelProperties: { + ...StyleObject.type.modelProperties, + rules: { + serializedName: "rules", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } + } + } +}; + +export const GeoJsonGeometry: coreClient.CompositeMapper = { + serializedName: "GeoJsonGeometry", + type: { + name: "Composite", + className: "GeoJsonGeometry", + uberParent: "GeoJsonObject", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + ...GeoJsonObject.type.modelProperties + } + } +}; + +export const GeoJsonFeature: coreClient.CompositeMapper = { + serializedName: "Feature", + type: { + name: "Composite", + className: "GeoJsonFeature", + uberParent: "GeoJsonObject", + polymorphicDiscriminator: GeoJsonObject.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonObject.type.modelProperties, + ...GeoJsonFeatureData.type.modelProperties + } + } +}; + +export const GeoJsonFeatureCollection: coreClient.CompositeMapper = { + serializedName: "FeatureCollection", + type: { + name: "Composite", + className: "GeoJsonFeatureCollection", + uberParent: "GeoJsonObject", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + modelProperties: { + ...GeoJsonObject.type.modelProperties, + ...GeoJsonFeatureCollectionData.type.modelProperties + } + } +}; + +export const ExtendedGeoJsonFeatureCollection: coreClient.CompositeMapper = { + serializedName: "FeatureCollection", + type: { + name: "Composite", + className: "ExtendedGeoJsonFeatureCollection", + uberParent: "ExtendedGeoJsonFeatureCollectionData", + polymorphicDiscriminator: + ExtendedGeoJsonFeatureCollectionData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonFeatureCollection.type.modelProperties, + ...ExtendedGeoJsonFeatureCollectionData.type.modelProperties + } + } +}; + +export const GeoJsonPoint: coreClient.CompositeMapper = { + serializedName: "Point", + type: { + name: "Composite", + className: "GeoJsonPoint", + uberParent: "GeoJsonPointData", + polymorphicDiscriminator: GeoJsonPointData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonPointData.type.modelProperties + } + } +}; + +export const GeoJsonMultiPoint: coreClient.CompositeMapper = { + serializedName: "MultiPoint", + type: { + name: "Composite", + className: "GeoJsonMultiPoint", + uberParent: "GeoJsonMultiPointData", + polymorphicDiscriminator: + GeoJsonMultiPointData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonMultiPointData.type.modelProperties + } + } +}; + +export const GeoJsonLineString: coreClient.CompositeMapper = { + serializedName: "LineString", + type: { + name: "Composite", + className: "GeoJsonLineString", + uberParent: "GeoJsonLineStringData", + polymorphicDiscriminator: + GeoJsonLineStringData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonLineStringData.type.modelProperties + } + } +}; + +export const GeoJsonMultiLineString: coreClient.CompositeMapper = { + serializedName: "MultiLineString", + type: { + name: "Composite", + className: "GeoJsonMultiLineString", + uberParent: "GeoJsonMultiLineStringData", + polymorphicDiscriminator: + GeoJsonMultiLineStringData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonMultiLineStringData.type.modelProperties + } + } +}; + +export const GeoJsonPolygon: coreClient.CompositeMapper = { + serializedName: "Polygon", + type: { + name: "Composite", + className: "GeoJsonPolygon", + uberParent: "GeoJsonPolygonData", + polymorphicDiscriminator: GeoJsonPolygonData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonPolygonData.type.modelProperties + } + } +}; + +export const GeoJsonMultiPolygon: coreClient.CompositeMapper = { + serializedName: "MultiPolygon", + type: { + name: "Composite", + className: "GeoJsonMultiPolygon", + uberParent: "GeoJsonMultiPolygonData", + polymorphicDiscriminator: + GeoJsonMultiPolygonData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonMultiPolygonData.type.modelProperties + } + } +}; + +export const GeoJsonGeometryCollection: coreClient.CompositeMapper = { + serializedName: "GeometryCollection", + type: { + name: "Composite", + className: "GeoJsonGeometryCollection", + uberParent: "GeoJsonGeometryCollectionData", + polymorphicDiscriminator: + GeoJsonGeometryCollectionData.type.polymorphicDiscriminator, + modelProperties: { + ...GeoJsonGeometry.type.modelProperties, + ...GeoJsonGeometryCollectionData.type.modelProperties + } + } +}; + +export const AliasCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AliasCreateHeaders", + modelProperties: { + accessControlExposeHeaders: { + serializedName: "access-control-expose-headers", + type: { + name: "String" + } + } + } + } +}; + +export const DataUploadPreviewHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DataUploadPreviewHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const DataUpdatePreviewHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DataUpdatePreviewHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const DataDownloadPreviewHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DataDownloadPreviewHeaders", + modelProperties: { + contentType: { + serializedName: "content-type", + type: { + name: "String" + } + } + } + } +}; + +export const DataGetOperationPreviewHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DataGetOperationPreviewHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const DatasetCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatasetCreateHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const DatasetGetOperationHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatasetGetOperationHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const ConversionConvertHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConversionConvertHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const ConversionGetOperationHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConversionGetOperationHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const SpatialGetGeofenceHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SpatialGetGeofenceHeaders", + modelProperties: { + xCorrelationId: { + serializedName: "x-correlation-id", + type: { + name: "String" + } + } + } + } +}; + +export const SpatialPostGeofenceHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SpatialPostGeofenceHeaders", + modelProperties: { + xCorrelationId: { + serializedName: "x-correlation-id", + type: { + name: "String" + } + } + } + } +}; + +export const TilesetCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TilesetCreateHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export const TilesetGetOperationHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TilesetGetOperationHeaders", + modelProperties: { + resourceLocation: { + serializedName: "resource-location", + type: { + name: "String" + } + } + } + } +}; + +export let discriminators = { + StyleObject: StyleObject, + GeoJsonObject: GeoJsonObject, + "StyleObject.boolean": BooleanTypeStyleRule, + "StyleObject.number": NumberTypeStyleRule, + "StyleObject.string": StringTypeStyleRule, + "GeoJsonObject.GeoJsonGeometry": GeoJsonGeometry, + "GeoJsonObject.Feature": GeoJsonFeature, + "GeoJsonObject.FeatureCollection": GeoJsonFeatureCollection, + "ExtendedGeoJsonFeatureCollectionData.FeatureCollection": ExtendedGeoJsonFeatureCollection, + "GeoJsonPointData.Point": GeoJsonPoint, + "GeoJsonMultiPointData.MultiPoint": GeoJsonMultiPoint, + "GeoJsonLineStringData.LineString": GeoJsonLineString, + "GeoJsonMultiLineStringData.MultiLineString": GeoJsonMultiLineString, + "GeoJsonPolygonData.Polygon": GeoJsonPolygon, + "GeoJsonMultiPolygonData.MultiPolygon": GeoJsonMultiPolygon, + "GeoJsonGeometryCollectionData.GeometryCollection": GeoJsonGeometryCollection +}; diff --git a/sdk/maps/maps-creator/src/models/parameters.ts b/sdk/maps/maps-creator/src/models/parameters.ts new file mode 100644 index 000000000000..e1b3aa342168 --- /dev/null +++ b/sdk/maps/maps-creator/src/models/parameters.ts @@ -0,0 +1,629 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + StylesObject as StylesObjectMapper, + FeatureStatesStructure as FeatureStatesStructureMapper, + BufferRequestBody as BufferRequestBodyMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const geography: OperationURLParameter = { + parameterPath: "geography", + mapper: { + serializedName: "geography", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2.0", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const creatorDataItemId: OperationQueryParameter = { + parameterPath: ["options", "creatorDataItemId"], + mapper: { + serializedName: "creatorDataItemId", + type: { + name: "String" + } + } +}; + +export const aliasId: OperationURLParameter = { + parameterPath: "aliasId", + mapper: { + serializedName: "aliasId", + required: true, + type: { + name: "String" + } + } +}; + +export const creatorDataItemId1: OperationQueryParameter = { + parameterPath: "creatorDataItemId", + mapper: { + serializedName: "creatorDataItemId", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: "contentType", + mapper: { + defaultValue: "application/octet-stream", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const uploadContent: OperationParameter = { + parameterPath: "uploadContent", + mapper: { + serializedName: "uploadContent", + required: true, + type: { + name: "Stream" + } + } +}; + +export const accept1: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const contentType1: OperationParameter = { + parameterPath: "contentType", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const uploadContent1: OperationParameter = { + parameterPath: "uploadContent", + mapper: { + serializedName: "uploadContent", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } +}; + +export const xMsClientId: OperationParameter = { + parameterPath: "xMsClientId", + mapper: { + serializedName: "x-ms-client-id", + type: { + name: "String" + } + } +}; + +export const uploadDataDescription: OperationQueryParameter = { + parameterPath: ["options", "uploadDataDescription"], + mapper: { + serializedName: "description", + type: { + name: "String" + } + } +}; + +export const uploadDataFormat: OperationQueryParameter = { + parameterPath: "uploadDataFormat", + mapper: { + serializedName: "dataFormat", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType2: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const updateContent: OperationParameter = { + parameterPath: "updateContent", + mapper: { + serializedName: "updateContent", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } +}; + +export const uniqueDataId: OperationURLParameter = { + parameterPath: "uniqueDataId", + mapper: { + serializedName: "udid", + required: true, + type: { + name: "String" + } + } +}; + +export const accept2: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: + "application/json, application/vnd.geo+json, application/octet-stream", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const operationId: OperationURLParameter = { + parameterPath: "operationId", + mapper: { + serializedName: "operationId", + required: true, + type: { + name: "String" + } + } +}; + +export const conversionId: OperationQueryParameter = { + parameterPath: "conversionId", + mapper: { + serializedName: "conversionId", + required: true, + type: { + name: "String" + } + } +}; + +export const datasetId: OperationQueryParameter = { + parameterPath: ["options", "datasetId"], + mapper: { + serializedName: "datasetId", + type: { + name: "String" + } + } +}; + +export const descriptionDataset: OperationQueryParameter = { + parameterPath: ["options", "descriptionDataset"], + mapper: { + serializedName: "description", + type: { + name: "String" + } + } +}; + +export const datasetId1: OperationURLParameter = { + parameterPath: "datasetId", + mapper: { + serializedName: "datasetId", + required: true, + type: { + name: "String" + } + } +}; + +export const udid: OperationQueryParameter = { + parameterPath: "udid", + mapper: { + serializedName: "udid", + required: true, + type: { + name: "String" + } + } +}; + +export const outputOntology: OperationQueryParameter = { + parameterPath: "outputOntology", + mapper: { + serializedName: "outputOntology", + required: true, + type: { + name: "String" + } + } +}; + +export const description: OperationQueryParameter = { + parameterPath: ["options", "description"], + mapper: { + serializedName: "description", + type: { + name: "String" + } + } +}; + +export const conversionId1: OperationURLParameter = { + parameterPath: "conversionId", + mapper: { + serializedName: "conversionId", + required: true, + type: { + name: "String" + } + } +}; + +export const statesetCreateRequestBody: OperationParameter = { + parameterPath: "statesetCreateRequestBody", + mapper: StylesObjectMapper +}; + +export const datasetId2: OperationQueryParameter = { + parameterPath: "datasetId", + mapper: { + serializedName: "datasetId", + required: true, + type: { + name: "String" + } + } +}; + +export const statesetStyleUpdateRequestBody: OperationParameter = { + parameterPath: "statesetStyleUpdateRequestBody", + mapper: StylesObjectMapper +}; + +export const statesetId: OperationURLParameter = { + parameterPath: "statesetId", + mapper: { + serializedName: "statesetId", + required: true, + type: { + name: "String" + } + } +}; + +export const featureStateUpdateRequestBody: OperationParameter = { + parameterPath: "featureStateUpdateRequestBody", + mapper: FeatureStatesStructureMapper +}; + +export const featureId: OperationURLParameter = { + parameterPath: "featureId", + mapper: { + serializedName: "featureId", + required: true, + type: { + name: "String" + } + } +}; + +export const stateKeyName: OperationQueryParameter = { + parameterPath: "stateKeyName", + mapper: { + serializedName: "stateKeyName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion1: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "1.0", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const format: OperationURLParameter = { + parameterPath: "format", + mapper: { + serializedName: "format", + required: true, + type: { + name: "String" + } + } +}; + +export const deviceId: OperationQueryParameter = { + parameterPath: "deviceId", + mapper: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + } +}; + +export const latitude: OperationQueryParameter = { + parameterPath: "latitude", + mapper: { + serializedName: "lat", + required: true, + type: { + name: "Number" + } + } +}; + +export const longitude: OperationQueryParameter = { + parameterPath: "longitude", + mapper: { + serializedName: "lon", + required: true, + type: { + name: "Number" + } + } +}; + +export const z: OperationQueryParameter = { + parameterPath: ["options", "z"], + mapper: { + serializedName: "z", + type: { + name: "Number" + } + } +}; + +export const userTime: OperationQueryParameter = { + parameterPath: ["options", "userTime"], + mapper: { + serializedName: "userTime", + type: { + name: "DateTime" + } + } +}; + +export const searchBuffer: OperationQueryParameter = { + parameterPath: ["options", "searchBuffer"], + mapper: { + constraints: { + InclusiveMaximum: 500, + InclusiveMinimum: 0 + }, + serializedName: "searchBuffer", + type: { + name: "Number" + } + } +}; + +export const isAsync: OperationQueryParameter = { + parameterPath: ["options", "isAsync"], + mapper: { + serializedName: "isAsync", + type: { + name: "Boolean" + } + } +}; + +export const mode: OperationQueryParameter = { + parameterPath: ["options", "mode"], + mapper: { + serializedName: "mode", + type: { + name: "String" + } + } +}; + +export const searchGeofenceRequestBody: OperationParameter = { + parameterPath: "searchGeofenceRequestBody", + mapper: { + serializedName: "searchGeofenceRequestBody", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } +}; + +export const bufferRequestBody: OperationParameter = { + parameterPath: "bufferRequestBody", + mapper: BufferRequestBodyMapper +}; + +export const distances: OperationQueryParameter = { + parameterPath: "distances", + mapper: { + serializedName: "distances", + required: true, + type: { + name: "String" + } + } +}; + +export const closestPointRequestBody: OperationParameter = { + parameterPath: "closestPointRequestBody", + mapper: { + serializedName: "closestPointRequestBody", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } +}; + +export const numberOfClosestPoints: OperationQueryParameter = { + parameterPath: ["options", "numberOfClosestPoints"], + mapper: { + serializedName: "numberOfClosestPoints", + type: { + name: "Number" + } + } +}; + +export const pointInPolygonRequestBody: OperationParameter = { + parameterPath: "pointInPolygonRequestBody", + mapper: { + serializedName: "pointInPolygonRequestBody", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } +}; + +export const query: OperationQueryParameter = { + parameterPath: "query", + mapper: { + serializedName: "query", + required: true, + type: { + name: "String" + } + } +}; + +export const tilesetId: OperationURLParameter = { + parameterPath: "tilesetId", + mapper: { + serializedName: "tilesetId", + required: true, + type: { + name: "String" + } + } +}; + +export const collectionId: OperationURLParameter = { + parameterPath: "collectionId", + mapper: { + serializedName: "collectionId", + required: true, + type: { + name: "String" + } + } +}; + +export const limit: OperationQueryParameter = { + parameterPath: ["options", "limit"], + mapper: { + constraints: { + InclusiveMaximum: 50, + InclusiveMinimum: 1 + }, + serializedName: "limit", + type: { + name: "Number" + } + } +}; + +export const bbox: OperationQueryParameter = { + parameterPath: ["options", "bbox"], + mapper: { + serializedName: "bbox", + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "filter", + type: { + name: "String" + } + } +}; diff --git a/sdk/maps/maps-creator/src/operations/alias.ts b/sdk/maps/maps-creator/src/operations/alias.ts new file mode 100644 index 000000000000..5d9606015fc4 --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/alias.ts @@ -0,0 +1,445 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Alias } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { + AliasListItem, + AliasListNextOptionalParams, + AliasListOptionalParams, + AliasCreateOptionalParams, + AliasCreateResponse, + AliasListOperationResponse, + AliasAssignOptionalParams, + AliasAssignResponse, + AliasDeleteOptionalParams, + AliasGetDetailsOptionalParams, + AliasGetDetailsResponse, + AliasListNextResponse +} from "../models"; + +/// +/** Class representing a Alias. */ +export class AliasImpl implements Alias { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Alias class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created aliases. + * + * ### Submit List Request + * + * To list all your aliases, you will issue a `GET` request with no additional parameters. + * + * ### List Data Response + * + * The List API returns the complete list of all aliases in `json` format. The response contains the + * following details for each alias resource: + * > createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + * > aliasId - The id for the alias. + * > creatorDataItemId - The id for the creator data item that this alias references (could be null + * if the alias has not been assigned). + * > lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + * yyyy-MM-ddTHH:mm:ss.sssZ + * + * A sample response returning 2 alias resources: + * + * ```json + * { + * "aliases": [ + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * }, + * { + * "createdTimestamp": "2020-02-18T19:53:33.123Z", + * "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + * "creatorDataItemId": null, + * "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + * } + * ] + * } + * ``` + * @param options The options parameters. + */ + public list( + options?: AliasListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: AliasListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.aliases || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.aliases || []; + } + } + + private async *listPagingAll( + options?: AliasListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to create an alias. You can also assign the alias during the create + * request. An alias can reference an ID generated by a creator service, but cannot reference another + * alias ID. + * + * ### Submit Create Request + * + * To create your alias, you will use a `POST` request. If you would like to assign the alias during + * the creation, you will pass the `resourceId` query parameter. + * + * ### Create Alias Response + * + * The Create API returns a HTTP `201 Created` response with the alias resource in the body. + * + * A sample response from creating an alias: + * + * ```json + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * } + * ``` + * @param options The options parameters. + */ + create(options?: AliasCreateOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, createOperationSpec); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created aliases. + * + * ### Submit List Request + * + * To list all your aliases, you will issue a `GET` request with no additional parameters. + * + * ### List Data Response + * + * The List API returns the complete list of all aliases in `json` format. The response contains the + * following details for each alias resource: + * > createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + * > aliasId - The id for the alias. + * > creatorDataItemId - The id for the creator data item that this alias references (could be null + * if the alias has not been assigned). + * > lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + * yyyy-MM-ddTHH:mm:ss.sssZ + * + * A sample response returning 2 alias resources: + * + * ```json + * { + * "aliases": [ + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * }, + * { + * "createdTimestamp": "2020-02-18T19:53:33.123Z", + * "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + * "creatorDataItemId": null, + * "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + * } + * ] + * } + * ``` + * @param options The options parameters. + */ + private _list( + options?: AliasListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to assign an alias to reference a resource. + * + * ### Submit Assign Request + * + * To assign your alias to a resource, you will use a `PUT` request with the `aliasId` in the path and + * the `creatorDataItemId` passed as a query parameter. + * + * ### Assign Alias Response + * + * The Assign API returns a HTTP `200 OK` response with the updated alias resource in the body, if the + * alias was assigned successfully. A sample of the assign response is + * + * ```json + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * } + * ``` + * @param aliasId The unique id that references an existing alias. + * @param creatorDataItemId The unique id that references a creator data item to be aliased. + * @param options The options parameters. + */ + assign( + aliasId: string, + creatorDataItemId: string, + options?: AliasAssignOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { aliasId, creatorDataItemId, options }, + assignOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to delete a previously created alias. You can also use this API to delete + * old/unused aliases to create space for new content.This API does not delete the references resource, + * only the alias referencing the resource. + * + * ### Submit Delete Request + * + * To delete your alias you will issue a `DELETE` request where the path will contain the `aliasId` of + * the alias to delete. + * + * ### Delete Alias Response + * + * The Delete API returns a HTTP `204 No Content` response with an empty body, if the alias was deleted + * successfully. + * @param aliasId The unique id that references an existing alias. + * @param options The options parameters. + */ + delete(aliasId: string, options?: AliasDeleteOptionalParams): Promise { + return this.client.sendOperationRequest( + { aliasId, options }, + deleteOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch the details of a previously created alias. + * + * ### Submit Get Details Request + * + * To get the details of your alias, you will issue a `GET` request with the `aliasId` in the path. + * + * ### Get Details Response + * + * The Get Details API returns the previously created alias in `json` format. The response contains the + * following details for the alias resource: + * > createdTimestamp - The timestamp that the alias was created. + * > aliasId - The id for the alias. + * > creatorDataItemId - The id for the creator data item that this alias references (could be null + * if the alias has not been assigned). + * > lastUpdatedTimestamp - The last time the alias was assigned to a resource. + * + * Here's a sample response: + * ```json + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * } + * ``` + * @param aliasId The unique id that references an existing alias. + * @param options The options parameters. + */ + getDetails( + aliasId: string, + options?: AliasGetDetailsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { aliasId, options }, + getDetailsOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: AliasListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/aliases", + httpMethod: "POST", + responses: { + 201: { + bodyMapper: Mappers.AliasesCreateResponse, + headersMapper: Mappers.AliasCreateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.creatorDataItemId], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/aliases", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AliasListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept], + serializer +}; +const assignOperationSpec: coreClient.OperationSpec = { + path: "/aliases/{aliasId}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.AliasListItem + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.creatorDataItemId1], + urlParameters: [Parameters.geography, Parameters.aliasId], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/aliases/{aliasId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.aliasId], + headerParameters: [Parameters.accept], + serializer +}; +const getDetailsOperationSpec: coreClient.OperationSpec = { + path: "/aliases/{aliasId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AliasListItem + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.aliasId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AliasListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/conversion.ts b/sdk/maps/maps-creator/src/operations/conversion.ts new file mode 100644 index 000000000000..ea3eb40775eb --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/conversion.ts @@ -0,0 +1,593 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Conversion } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ConversionListDetailInfo, + ConversionListNextOptionalParams, + ConversionListOptionalParams, + ConversionConvertOptionalParams, + ConversionConvertResponse, + ConversionListOperationResponse, + ConversionGetOptionalParams, + ConversionGetResponse, + ConversionDeleteOptionalParams, + ConversionGetOperationOptionalParams, + ConversionGetOperationResponse, + ConversionListNextResponse +} from "../models"; + +/// +/** Class representing a Conversion. */ +export class ConversionImpl implements Conversion { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Conversion class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all successful data conversions submitted previously + * using the [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * + * ### Submit List Request + * + * To list all successful conversions you will issue a `GET` request with no additional parameters. + * + * ### List Data Response + * + * The Conversion List API returns the complete list of all conversion details in `json` format.
+ * + * Here is a sample response returning the details of two successful conversion requests: + * + *
+ * + * ```json + * { + * "conversions": + * [ + * { + * "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + * "udid": "31838736-8b84-11ea-bc55-0242ac130003", + * "created": "5/19/2020 9:00:00 AM +00:00", + * "description": "User provided description.", + * "featureCounts": { + * "DIR": 1, + * "LVL": 3, + * "FCL": 1, + * "UNIT": 150, + * "CTG": 8, + * "AEL": 0, + * "OPN": 10 + * } + * }, + * { + * "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + * "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + * "created": "5/19/2020 9:00:00 AM +00:00", + * "description": "User provided description.", + * "featureCounts": { + * "DIR": 1, + * "LVL": 3, + * "FCL": 1, + * "UNIT": 150, + * "CTG": 8, + * "AEL": 0, + * "OPN": 10 + * } + * } + * ] + * } + * ``` + * + *
+ * @param options The options parameters. + */ + public list( + options?: ConversionListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: ConversionListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.conversions || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.conversions || []; + } + } + + private async *listPagingAll( + options?: ConversionListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Conversion API lets the caller import a set of DWG design files as a zipped [Drawing + * Package](https://aka.ms/am-drawing-package) into Azure Maps. The [Drawing + * Package](https://aka.ms/am-drawing-package) should first be uploaded using the [Azure Maps Data + * Service](https://docs.microsoft.com/rest/api/maps/data). Once uploaded, use the `udid` returned by + * the [Data Upload API](https://docs.microsoft.com/rest/api/maps/data/uploadpreview) to call this + * Conversion API. + * + * ## Convert DWG package + * + * The Conversion API performs a [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Debug DWG package issues + * + * + * During the Conversion process, if there are any issues with the DWG package [errors and + * warnings](https://aka.ms/am-conversion-errors) are provided in the response along with a *diagnostic + * package* to visualize and diagnose these issues. In case any issues are encountered with your DWG + * package, the Conversion operation status process as detailed + * [here](https://aka.ms/am-creator-lrt-v2) returns the location of the *diagnostic package* that can + * be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + * package* location can be found in the properties section of the conversion operation status response + * and looks like the following: + * + * ```json + * { + * "properties": { + * "diagnosticPackageLocation": + * "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + * } + * } + * ``` + * + * The *diagnostic package* can be downloaded by executing a `HTTP GET` request on the + * `diagnosticPackageLocation`. + * For more details on how to use the tool to visualize and diagnose all the errors and warnings see + * [Drawing Error Visualizer](https://aka.ms/am-drawing-errors-visualizer).
+ * + * A conversion operation will be marked as *success* if there are zero or more warnings but will be + * marked as *failed* if any errors are encountered. + * @param udid The unique data id for the content. The `udid` must have been obtained from a successful + * [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) call. + * @param outputOntology Output ontology version. "facility-2.0" is the only supported value at this + * time. Please refer to this + * [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) for more + * information about Azure Maps Creator ontologies. + * @param options The options parameters. + */ + async beginConvert( + udid: string, + outputOntology: string, + options?: ConversionConvertOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ConversionConvertResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { flatResponse, rawResponse: currentRawResponse! }; + }; + + return new LROPoller( + { intervalInMs: options?.updateIntervalInMs }, + { udid, outputOntology, options }, + convertOperationSpec, + sendOperation, + "location" + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Conversion API lets the caller import a set of DWG design files as a zipped [Drawing + * Package](https://aka.ms/am-drawing-package) into Azure Maps. The [Drawing + * Package](https://aka.ms/am-drawing-package) should first be uploaded using the [Azure Maps Data + * Service](https://docs.microsoft.com/rest/api/maps/data). Once uploaded, use the `udid` returned by + * the [Data Upload API](https://docs.microsoft.com/rest/api/maps/data/uploadpreview) to call this + * Conversion API. + * + * ## Convert DWG package + * + * The Conversion API performs a [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Debug DWG package issues + * + * + * During the Conversion process, if there are any issues with the DWG package [errors and + * warnings](https://aka.ms/am-conversion-errors) are provided in the response along with a *diagnostic + * package* to visualize and diagnose these issues. In case any issues are encountered with your DWG + * package, the Conversion operation status process as detailed + * [here](https://aka.ms/am-creator-lrt-v2) returns the location of the *diagnostic package* that can + * be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + * package* location can be found in the properties section of the conversion operation status response + * and looks like the following: + * + * ```json + * { + * "properties": { + * "diagnosticPackageLocation": + * "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + * } + * } + * ``` + * + * The *diagnostic package* can be downloaded by executing a `HTTP GET` request on the + * `diagnosticPackageLocation`. + * For more details on how to use the tool to visualize and diagnose all the errors and warnings see + * [Drawing Error Visualizer](https://aka.ms/am-drawing-errors-visualizer).
+ * + * A conversion operation will be marked as *success* if there are zero or more warnings but will be + * marked as *failed* if any errors are encountered. + * @param udid The unique data id for the content. The `udid` must have been obtained from a successful + * [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) call. + * @param outputOntology Output ontology version. "facility-2.0" is the only supported value at this + * time. Please refer to this + * [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) for more + * information about Azure Maps Creator ontologies. + * @param options The options parameters. + */ + async beginConvertAndWait( + udid: string, + outputOntology: string, + options?: ConversionConvertOptionalParams + ): Promise { + const poller = await this.beginConvert(udid, outputOntology, options); + return poller.pollUntilDone(); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all successful data conversions submitted previously + * using the [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * + * ### Submit List Request + * + * To list all successful conversions you will issue a `GET` request with no additional parameters. + * + * ### List Data Response + * + * The Conversion List API returns the complete list of all conversion details in `json` format.
+ * + * Here is a sample response returning the details of two successful conversion requests: + * + *
+ * + * ```json + * { + * "conversions": + * [ + * { + * "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + * "udid": "31838736-8b84-11ea-bc55-0242ac130003", + * "created": "5/19/2020 9:00:00 AM +00:00", + * "description": "User provided description.", + * "featureCounts": { + * "DIR": 1, + * "LVL": 3, + * "FCL": 1, + * "UNIT": 150, + * "CTG": 8, + * "AEL": 0, + * "OPN": 10 + * } + * }, + * { + * "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + * "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + * "created": "5/19/2020 9:00:00 AM +00:00", + * "description": "User provided description.", + * "featureCounts": { + * "DIR": 1, + * "LVL": 3, + * "FCL": 1, + * "UNIT": 150, + * "CTG": 8, + * "AEL": 0, + * "OPN": 10 + * } + * } + * ] + * } + * ``` + * + *
+ * @param options The options parameters. + */ + private _list( + options?: ConversionListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a successful data conversion submitted previously using the + * [Conversion API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * @param conversionId The conversion id for the content. The `conversionId` must have been obtained + * from a successful [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) call. + * @param options The options parameters. + */ + get( + conversionId: string, + options?: ConversionGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { conversionId, options }, + getOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to delete any data conversions created previously using the [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * + * ### Submit Delete Request + * + * To delete your conversion data you will issue a `DELETE` request where the path will contain the + * `conversionId` of the data to delete. + * + * ### Conversion Delete Response + * + * The Conversion Delete API returns a HTTP `204 No Content` response with an empty body, if the + * converted data resources were deleted successfully.
+ * A HTTP `400 Bad Request` error response will be returned if no resource associated with the + * passed-in `conversionId` is found. + * @param conversionId The conversion id for the content. The `conversionId` must have been obtained + * from a successful [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) call. + * @param options The options parameters. + */ + delete( + conversionId: string, + options?: ConversionDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { conversionId, options }, + deleteOperationSpec + ); + } + + /** + * This path will be obtained from a call to POST /conversions. While in progress, an http200 will be + * returned with no extra headers - followed by an http200 with Resource-Location header once + * successfully completed. + * @param operationId The ID to query the status for the dataset create/import request. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: ConversionGetOperationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getOperationOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: ConversionListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const convertOperationSpec: coreClient.OperationSpec = { + path: "/conversions", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.ConversionConvertHeaders + }, + 201: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.ConversionConvertHeaders + }, + 202: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.ConversionConvertHeaders + }, + 204: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.ConversionConvertHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.udid, + Parameters.outputOntology, + Parameters.description + ], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/conversions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConversionListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/conversions/{conversionId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConversionListDetailInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.conversionId1], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/conversions/{conversionId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.conversionId1], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getOperationOperationSpec: coreClient.OperationSpec = { + path: "/conversions/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.ConversionGetOperationHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.operationId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConversionListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.nextLink], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/data.ts b/sdk/maps/maps-creator/src/operations/data.ts new file mode 100644 index 000000000000..33033f61a396 --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/data.ts @@ -0,0 +1,1051 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { Data } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + UploadDataFormat, + DataUploadPreview$binaryOptionalParams, + DataUploadPreview$jsonOptionalParams, + DataUploadPreviewResponse, + DataListPreviewOptionalParams, + DataListPreviewResponse, + DataUpdatePreviewOptionalParams, + DataUpdatePreviewResponse, + DataDownloadPreviewOptionalParams, + DataDownloadPreviewResponse, + DataDeletePreviewOptionalParams, + DataGetOperationPreviewOptionalParams, + DataGetOperationPreviewResponse +} from "../models"; + +/** Class representing a Data. */ +export class DataImpl implements Data { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Data class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Upload API allows the caller to upload data content to the Azure Maps service. + * You can use this API in a scenario like uploading a collection of Geofences in `GeoJSON` + * format, for use in our [Azure Maps Geofencing + * Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * ## Submit Upload Request + * + * To upload your content you will use a `POST` request. The request body will contain the data to + * upload. The + * `dataFormat` query parameter will contain the format for the data, the `dataSharingLevel` query + * parameter + * can contain the sharing level for the data. The `Content-Type` header will be set to the content + * type of the + * data. + * + * For example, to upload a collection of geofences in `GeoJSON` format, set the request body to the + * geofence + * content. Set the `dataFormat` query parameter to _geojson_, and set the `Content-Type` header to + * either one + * of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for uploading a simple Geofence represented as a circle geometry using + * a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The Data Upload API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Upload Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param uploadDataFormat Data format of the content being uploaded. + * @param contentType Upload file type + * @param uploadContent The content to upload. + * @param options The options parameters. + */ + beginUploadPreview( + uploadDataFormat: UploadDataFormat, + contentType: "application/octet-stream", + uploadContent: coreRestPipeline.RequestBodyType, + options?: DataUploadPreview$binaryOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DataUploadPreviewResponse + > + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Upload API allows the caller to upload data content to the Azure Maps service. + * You can use this API in a scenario like uploading a collection of Geofences in `GeoJSON` + * format, for use in our [Azure Maps Geofencing + * Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * ## Submit Upload Request + * + * To upload your content you will use a `POST` request. The request body will contain the data to + * upload. The + * `dataFormat` query parameter will contain the format for the data, the `dataSharingLevel` query + * parameter + * can contain the sharing level for the data. The `Content-Type` header will be set to the content + * type of the + * data. + * + * For example, to upload a collection of geofences in `GeoJSON` format, set the request body to the + * geofence + * content. Set the `dataFormat` query parameter to _geojson_, and set the `Content-Type` header to + * either one + * of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for uploading a simple Geofence represented as a circle geometry using + * a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The Data Upload API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Upload Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param uploadDataFormat Data format of the content being uploaded. + * @param contentType Body Parameter content-type + * @param uploadContent The content to upload. + * @param options The options parameters. + */ + beginUploadPreview( + uploadDataFormat: UploadDataFormat, + contentType: "application/json", + uploadContent: Record, + options?: DataUploadPreview$jsonOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DataUploadPreviewResponse + > + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Upload API allows the caller to upload data content to the Azure Maps service. + * You can use this API in a scenario like uploading a collection of Geofences in `GeoJSON` + * format, for use in our [Azure Maps Geofencing + * Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * ## Submit Upload Request + * + * To upload your content you will use a `POST` request. The request body will contain the data to + * upload. The + * `dataFormat` query parameter will contain the format for the data, the `dataSharingLevel` query + * parameter + * can contain the sharing level for the data. The `Content-Type` header will be set to the content + * type of the + * data. + * + * For example, to upload a collection of geofences in `GeoJSON` format, set the request body to the + * geofence + * content. Set the `dataFormat` query parameter to _geojson_, and set the `Content-Type` header to + * either one + * of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for uploading a simple Geofence represented as a circle geometry using + * a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The Data Upload API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Upload Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param args Includes all the parameters for this operation. + */ + async beginUploadPreview( + ...args: + | [ + UploadDataFormat, + "application/octet-stream", + coreRestPipeline.RequestBodyType, + DataUploadPreview$binaryOptionalParams? + ] + | [ + UploadDataFormat, + "application/json", + Record, + DataUploadPreview$jsonOptionalParams? + ] + ): Promise< + PollerLike< + PollOperationState, + DataUploadPreviewResponse + > + > { + let operationSpec: coreClient.OperationSpec; + let operationArguments: coreClient.OperationArguments; + let options; + if (args[1] === "application/octet-stream") { + operationSpec = uploadPreview$binaryOperationSpec; + operationArguments = { + uploadDataFormat: args[0], + contentType: args[1], + uploadContent: args[2], + options: args[3] + }; + options = args[3]; + } else if (args[1] === "application/json") { + operationSpec = uploadPreview$jsonOperationSpec; + operationArguments = { + uploadDataFormat: args[0], + contentType: args[1], + uploadContent: args[2], + options: args[3] + }; + options = args[3]; + } else { + throw new TypeError( + `"contentType" must be a valid value but instead was "${args[1]}".` + ); + } + operationArguments.options = this.getOperationOptions(options, "location"); + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { flatResponse, rawResponse: currentRawResponse! }; + }; + + return new LROPoller( + { intervalInMs: options?.updateIntervalInMs }, + operationArguments, + operationSpec, + sendOperation, + "location" + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Upload API allows the caller to upload data content to the Azure Maps service. + * You can use this API in a scenario like uploading a collection of Geofences in `GeoJSON` + * format, for use in our [Azure Maps Geofencing + * Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * ## Submit Upload Request + * + * To upload your content you will use a `POST` request. The request body will contain the data to + * upload. The + * `dataFormat` query parameter will contain the format for the data, the `dataSharingLevel` query + * parameter + * can contain the sharing level for the data. The `Content-Type` header will be set to the content + * type of the + * data. + * + * For example, to upload a collection of geofences in `GeoJSON` format, set the request body to the + * geofence + * content. Set the `dataFormat` query parameter to _geojson_, and set the `Content-Type` header to + * either one + * of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for uploading a simple Geofence represented as a circle geometry using + * a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The Data Upload API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Upload Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param args Includes all the parameters for this operation. + */ + async beginUploadPreviewAndWait( + ...args: + | [ + UploadDataFormat, + "application/octet-stream", + coreRestPipeline.RequestBodyType, + DataUploadPreview$binaryOptionalParams? + ] + | [ + UploadDataFormat, + "application/json", + Record, + DataUploadPreview$jsonOptionalParams? + ] + ): Promise { + if (args[1] === "application/octet-stream") { + const poller = await this.beginUploadPreview(...args); + return poller.pollUntilDone(); + } else if (args[1] === "application/json") { + const poller = await this.beginUploadPreview(...args); + return poller.pollUntilDone(); + } + throw new Error("Impossible case"); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * This API allows the caller to fetch a list of all content uploaded previously using the [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview). + * + * + * ### Submit List Request + * + * To list all your map data content you will issue a `GET` request with no additional parameters. + * + * + * ### List Data Response + * + * The Data List API returns the complete list of all data in `json` format. The response contains the + * following details for each data resource: + * + * > udid - The unique data id for the data resource. + * + * > location - The location of the data resource. Execute a HTTP `GET` on this location to download + * the data. + * + * + * Here's a sample response returning the `udid` and `location` of 3 data resources: + * + *
+ * + * ```json + * { + * "mapDataList": + * [ + * { + * "udid": "9a1288fa-1858-4a3b-b68d-13a8j5af7d7c", + * "location": + * "https://us.atlas.microsoft.com/mapData/9a1288fa-1858-4a3b-b68d-13a8j5af7d7c?api-version=1.0", + * "sizeInBytes": 29920, + * "uploadStatus": "Completed" + * }, + * { + * "udid": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + * "location": + * "https://us.atlas.microsoft.com/mapData/8b1288fa-1958-4a2b-b68e-13a7i5af7d7c?api-version=1.0", + * "sizeInBytes": 1339, + * "uploadStatus": "Completed" + * }, + * { + * "udid": "7c1288fa-2058-4a1b-b68f-13a6h5af7d7c", + * "location": + * "https://us.atlas.microsoft.com/mapData/7c1288fa-2058-4a1b-b68f-13a6h5af7d7c?api-version=1.0", + * "sizeInBytes": 1650, + * "uploadStatus": "Pending" + * }] + * } + * ``` + * + *
+ * @param options The options parameters. + */ + listPreview( + options?: DataListPreviewOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listPreviewOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Update API allows the caller to update a previously uploaded data content. + * + * You can use this API in a scenario like adding or removing geofences to or from an existing + * collection of geofences. + * Geofences are uploaded using the [Data Upload + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/uploadpreview), for + * use in the [Azure Maps Geofencing Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * Please note that the Update API will *replace* and *override* the existing data content. + * + * ## Submit Update Request + * + * To update your content you will use a `PUT` request. The request body will contain the new data that + * will replace + * the existing data. The `Content-Type` header will be set to the content type of the data, and the + * path will contain + * the `udid` of the data to be update. + * + * For example, to update a collection of geofences that were previously uploaded using the Upload API, + * place the new + * geofence content in the request body. Set the `udid` parameter in the path to the `udid` of the data + * received + * previously in the upload API response. And set the `Content-Type` header to one of the following + * media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for updating a simple Geofence. It's represented as a circle geometry + * using a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The previously uploaded geofence had a radius of 100m. The above request will update it to 500m. + * + * The Data Update API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Update Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param updateContent The new content that will update/replace the previously uploaded content. + * @param options The options parameters. + */ + async beginUpdatePreview( + uniqueDataId: string, + updateContent: Record, + options?: DataUpdatePreviewOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DataUpdatePreviewResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { flatResponse, rawResponse: currentRawResponse! }; + }; + + return new LROPoller( + { intervalInMs: options?.updateIntervalInMs }, + { uniqueDataId, updateContent, options }, + updatePreviewOperationSpec, + sendOperation, + "location" + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Update API allows the caller to update a previously uploaded data content. + * + * You can use this API in a scenario like adding or removing geofences to or from an existing + * collection of geofences. + * Geofences are uploaded using the [Data Upload + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/uploadpreview), for + * use in the [Azure Maps Geofencing Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * Please note that the Update API will *replace* and *override* the existing data content. + * + * ## Submit Update Request + * + * To update your content you will use a `PUT` request. The request body will contain the new data that + * will replace + * the existing data. The `Content-Type` header will be set to the content type of the data, and the + * path will contain + * the `udid` of the data to be update. + * + * For example, to update a collection of geofences that were previously uploaded using the Upload API, + * place the new + * geofence content in the request body. Set the `udid` parameter in the path to the `udid` of the data + * received + * previously in the upload API response. And set the `Content-Type` header to one of the following + * media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for updating a simple Geofence. It's represented as a circle geometry + * using a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The previously uploaded geofence had a radius of 100m. The above request will update it to 500m. + * + * The Data Update API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Update Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param updateContent The new content that will update/replace the previously uploaded content. + * @param options The options parameters. + */ + async beginUpdatePreviewAndWait( + uniqueDataId: string, + updateContent: Record, + options?: DataUpdatePreviewOptionalParams + ): Promise { + const poller = await this.beginUpdatePreview( + uniqueDataId, + updateContent, + options + ); + return poller.pollUntilDone(); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * This API allows the caller to download a previously uploaded data content.
+ * You can use this API in a scenario like downloading an existing collection of geofences uploaded + * previously using the [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) for use in our [Azure + * Maps Geofencing Service](https://docs.microsoft.com/en-us/rest/api/maps/spatial). + * + * + * ### Submit Download Request + * + * To download your content you will use a `GET` request where the path will contain the `udid` of the + * data to download. Optionally, you can also pass in an `Accept` header to specify a preference for + * the `Content-Type` of the data response.
+ * For example, to download a collection of geofences previously uploaded using the Upload API, set the + * `udid` parameter in the path to the `udid` of the data received previously in the upload API + * response and set the `Accept` header to either one of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * + * ### Download Data Response + * + * The Download API will return a HTTP `200 OK` response if the data resource with the passed-in `udid` + * is found, where the response body will contain the content of the data resource.
+ * A HTTP `400 Bad Request` error response will be returned if the data resource with the passed-in + * `udid` is not found.
+ * + * Here's a sample response body for a simple geofence represented in `GeoJSON` uploaded previously + * using the Upload API: + *
+ * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param options The options parameters. + */ + downloadPreview( + uniqueDataId: string, + options?: DataDownloadPreviewOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { uniqueDataId, options }, + downloadPreviewOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * This API allows the caller to delete a previously uploaded data content.
+ * You can use this API in a scenario like removing geofences previously uploaded using the [Data + * Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) for use in our + * [Azure Maps Geofencing Service](https://docs.microsoft.com/en-us/rest/api/maps/spatial). You can + * also use this API to delete old/unused uploaded content and create space for new content. + * + * + * ### Submit Delete Request + * + * To delete your content you will issue a `DELETE` request where the path will contain the `udid` of + * the data to delete.
+ * For example, to delete a collection of geofences previously uploaded using the Upload API, set the + * `udid` parameter in the path to the `udid` of the data received previously in the upload API + * response. + * + * + * ### Delete Data Response + * + * The Data Delete API returns a HTTP `204 No Content` response with an empty body, if the data + * resource was deleted successfully.
+ * A HTTP `400 Bad Request` error response will be returned if the data resource with the passed-in + * `udid` is not found. + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param options The options parameters. + */ + deletePreview( + uniqueDataId: string, + options?: DataDeletePreviewOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { uniqueDataId, options }, + deletePreviewOperationSpec + ); + } + + /** + * This path will be obtained from a call to POST /mapData. While in progress, an http200 will be + * returned with no extra headers - followed by an http200 with Resource-Location header once + * completed. + * @param operationId The ID to query the status for the data upload request. + * @param options The options parameters. + */ + getOperationPreview( + operationId: string, + options?: DataGetOperationPreviewOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getOperationPreviewOperationSpec + ); + } + + private getOperationOptions( + options: TOptions | undefined, + finalStateVia?: string + ): coreClient.OperationOptions { + const operationOptions: coreClient.OperationOptions = options || {}; + operationOptions.requestOptions = { + ...operationOptions.requestOptions, + shouldDeserialize: shouldDeserializeLRO(finalStateVia) + }; + return operationOptions; + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const uploadPreview$binaryOperationSpec: coreClient.OperationSpec = { + path: "/mapData", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 201: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 202: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 204: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 409: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.uploadContent, + queryParameters: [ + Parameters.apiVersion, + Parameters.uploadDataDescription, + Parameters.uploadDataFormat + ], + urlParameters: [Parameters.geography], + headerParameters: [ + Parameters.accept, + Parameters.contentType, + Parameters.accept1, + Parameters.xMsClientId + ], + mediaType: "binary", + serializer +}; +const uploadPreview$jsonOperationSpec: coreClient.OperationSpec = { + path: "/mapData", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 201: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 202: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 204: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUploadPreviewHeaders + }, + 409: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.uploadContent1, + queryParameters: [ + Parameters.apiVersion, + Parameters.uploadDataDescription, + Parameters.uploadDataFormat + ], + urlParameters: [Parameters.geography], + headerParameters: [ + Parameters.accept, + Parameters.contentType1, + Parameters.xMsClientId + ], + mediaType: "json", + serializer +}; +const listPreviewOperationSpec: coreClient.OperationSpec = { + path: "/mapData", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MapDataListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const updatePreviewOperationSpec: coreClient.OperationSpec = { + path: "/mapData/{udid}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUpdatePreviewHeaders + }, + 201: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUpdatePreviewHeaders + }, + 202: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUpdatePreviewHeaders + }, + 204: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataUpdatePreviewHeaders + }, + 409: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.updateContent, + queryParameters: [Parameters.apiVersion, Parameters.uploadDataDescription], + urlParameters: [Parameters.geography, Parameters.uniqueDataId], + headerParameters: [ + Parameters.accept, + Parameters.xMsClientId, + Parameters.contentType2 + ], + mediaType: "json", + serializer +}; +const downloadPreviewOperationSpec: coreClient.OperationSpec = { + path: "/mapData/{udid}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: { + type: { name: "Stream" }, + serializedName: "parsedResponse" + }, + headersMapper: Mappers.DataDownloadPreviewHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.uniqueDataId], + headerParameters: [Parameters.xMsClientId, Parameters.accept2], + serializer +}; +const deletePreviewOperationSpec: coreClient.OperationSpec = { + path: "/mapData/{udid}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.uniqueDataId], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getOperationPreviewOperationSpec: coreClient.OperationSpec = { + path: "/mapData/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DataGetOperationPreviewHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.operationId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/dataset.ts b/sdk/maps/maps-creator/src/operations/dataset.ts new file mode 100644 index 000000000000..acd9b8307ed2 --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/dataset.ts @@ -0,0 +1,635 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Dataset } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DatasetDetailInfo, + DatasetListNextOptionalParams, + DatasetListOptionalParams, + DatasetCreateOptionalParams, + DatasetCreateResponse, + DatasetListOperationResponse, + DatasetGetOptionalParams, + DatasetGetResponse, + DatasetDeleteOptionalParams, + DatasetGetOperationOptionalParams, + DatasetGetOperationResponse, + DatasetListNextResponse +} from "../models"; + +/// +/** Class representing a Dataset. */ +export class DatasetImpl implements Dataset { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Dataset class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created datasets. + * + * ### Submit List Request + * + * To list all your datasets, you will issue a `GET` request with no additional parameters. + * + * + * ### List Data Response + * + * The List API returns the complete list of all datasets in `json` format. The response contains the + * following fields (if they are not null or empty): + * > created - The timestamp the dataset was created. + * > datasetId - The id for the dataset. + * > description - The description for the dataset. + * > datasetSources - The source data that was used when the create request was issued. + * > ontology - The source + * [ontology](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) that was + * used in the conversion service for the input data.
+ * + * The `datasetSources` describes the source data that was used when the create request was issued and + * contains the following elements (if they are not null or empty): + * + * > conversionIds - The list of `conversionId` (null if none were provided). + * > appendDatasetId - The `datasetId` that was used for an append operation (null if none was used). + * >featureCounts - The counts for each feature type in the dataset.
+ * + * Here's a sample response returning the `timestamp`, `datasetId`, `description`, `datasetSources`, + * and `ontology` of 3 dataset resources: + * + * + * ```json + * { + * "datasets": [ + * { + * "timestamp": "2020-01-01T22:50:48.123Z", + * "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + * "description": "Some description or comment for the dataset.", + * "datasetSources": { + * "conversionIds": [ + * "15d21452-c9bb-27b6-5e79-743ca5c3205d" + * ], }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * }, + * { + * "timestamp": "2020-01-01T22:57:53.123Z", + * "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + * "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + * "datasetSources": { + * "conversionIds": [ + * "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + * ], + * "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + * }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * } + * ] + * } + * ``` + * @param options The options parameters. + */ + public list( + options?: DatasetListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: DatasetListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.datasets || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.datasets || []; + } + } + + private async *listPagingAll( + options?: DatasetListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to create a dataset from data that was uploaded to the Azure Maps Data + * Service and converted using the Azure Maps Conversion Service. + * + * You can use this API in a scenario like uploading a DWG zip package for a building, converting the + * zip package using the Azure Maps Conversion Service, and creating a dataset from the converted zip + * package. The created dataset can be used to create tilesets using the Azure Maps Tileset Service and + * can be queried via the Azure Maps WFS Service. + * + * ### Submit Create Request + * + * To create your dataset, you will use a `POST` request where the `conversionId` query parameter is an + * ID that represents the converted DWG zip package, the `datasetId` parameter will be the ID of a + * previously created dataset to append with the current dataset and, optionally, the `description` + * query parameter will contain a description (if description is not provided a default description + * will be given). + * + * The Create API is a [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param conversionId The unique ID used to create the dataset. The `conversionId` must have been + * obtained from a successful call to the Conversion Service Convert API and may be provided with + * multiple query parameters with same name (if more than one is provided). + * @param options The options parameters. + */ + async beginCreate( + conversionId: string, + options?: DatasetCreateOptionalParams + ): Promise< + PollerLike, DatasetCreateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { flatResponse, rawResponse: currentRawResponse! }; + }; + + return new LROPoller( + { intervalInMs: options?.updateIntervalInMs }, + { conversionId, options }, + createOperationSpec, + sendOperation, + "location" + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to create a dataset from data that was uploaded to the Azure Maps Data + * Service and converted using the Azure Maps Conversion Service. + * + * You can use this API in a scenario like uploading a DWG zip package for a building, converting the + * zip package using the Azure Maps Conversion Service, and creating a dataset from the converted zip + * package. The created dataset can be used to create tilesets using the Azure Maps Tileset Service and + * can be queried via the Azure Maps WFS Service. + * + * ### Submit Create Request + * + * To create your dataset, you will use a `POST` request where the `conversionId` query parameter is an + * ID that represents the converted DWG zip package, the `datasetId` parameter will be the ID of a + * previously created dataset to append with the current dataset and, optionally, the `description` + * query parameter will contain a description (if description is not provided a default description + * will be given). + * + * The Create API is a [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param conversionId The unique ID used to create the dataset. The `conversionId` must have been + * obtained from a successful call to the Conversion Service Convert API and may be provided with + * multiple query parameters with same name (if more than one is provided). + * @param options The options parameters. + */ + async beginCreateAndWait( + conversionId: string, + options?: DatasetCreateOptionalParams + ): Promise { + const poller = await this.beginCreate(conversionId, options); + return poller.pollUntilDone(); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created datasets. + * + * ### Submit List Request + * + * To list all your datasets, you will issue a `GET` request with no additional parameters. + * + * + * ### List Data Response + * + * The List API returns the complete list of all datasets in `json` format. The response contains the + * following fields (if they are not null or empty): + * > created - The timestamp the dataset was created. + * > datasetId - The id for the dataset. + * > description - The description for the dataset. + * > datasetSources - The source data that was used when the create request was issued. + * > ontology - The source + * [ontology](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) that was + * used in the conversion service for the input data.
+ * + * The `datasetSources` describes the source data that was used when the create request was issued and + * contains the following elements (if they are not null or empty): + * + * > conversionIds - The list of `conversionId` (null if none were provided). + * > appendDatasetId - The `datasetId` that was used for an append operation (null if none was used). + * >featureCounts - The counts for each feature type in the dataset.
+ * + * Here's a sample response returning the `timestamp`, `datasetId`, `description`, `datasetSources`, + * and `ontology` of 3 dataset resources: + * + * + * ```json + * { + * "datasets": [ + * { + * "timestamp": "2020-01-01T22:50:48.123Z", + * "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + * "description": "Some description or comment for the dataset.", + * "datasetSources": { + * "conversionIds": [ + * "15d21452-c9bb-27b6-5e79-743ca5c3205d" + * ], }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * }, + * { + * "timestamp": "2020-01-01T22:57:53.123Z", + * "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + * "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + * "datasetSources": { + * "conversionIds": [ + * "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + * ], + * "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + * }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * } + * ] + * } + * ``` + * @param options The options parameters. + */ + private _list( + options?: DatasetListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a previously successfully created dataset. + * + * ### Submit Get Details Request + * + * To get the details for a previously created dataset, you will issue a `GET` request with the + * `datasetId` in the path. + * + * ### Get Details Response + * + * The Get Details API returns the details for a dataset in `json` format. The response contains the + * following fields (if they are not null or empty): + * > created - The timestamp the dataset was created. + * > datasetId - The id for the dataset. + * > description - The description for the dataset. + * > datasetSources - The source data that was used when the create request was issued. + * > ontology - The source + * [ontology](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) that was + * used in the conversion service for the input data.
+ * + * The `datasetSources` describes the source data that was used when the create request was issued and + * contains the following elements (if they are not null or empty): + * > conversionIds - The list of `conversionId` (null if none were provided). + * > appendDatasetId - The `datasetId` that was used for an append operation (null if none was used). + * >featureCounts - The counts for each feature type in the dataset.
+ * + * Here's a sample response returning the `timestamp`, `datasetId`, `description`, `datasetSources`, + * and `ontology` of a dataset resource: + * + * ```json + * { + * "timestamp": "2020-01-01T22:50:48.123Z", + * "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + * "description": "Some description or comment for the dataset.", + * "datasetSources": { + * "conversionIds": [ + * "15d21452-c9bb-27b6-5e79-743ca5c3205d" + * ], + * }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * } + * ``` + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + get( + datasetId: string, + options?: DatasetGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, options }, + getOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * You can also use this API to delete old/unused datasets to create space for new Creator content. + * + * ### Submit Delete Request + * + * To delete your content you will issue a `DELETE` request where the path will contain the `datasetId` + * of the dataset to delete. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + delete( + datasetId: string, + options?: DatasetDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, options }, + deleteOperationSpec + ); + } + + /** + * This API allows the caller to view the current progress of a dataset operation and the path is + * obtained from a call to the Create API. + * + * ### Submit Operations Request + * + * To view the current progress of a dataset operation, you will use a `GET` request where the + * `operationId` given the path is the ID that represents the operation. + * + * ### Operation Response + * + * While in progress, a `200-OK` http status code will be returned with no extra headers. If the + * operation succeeds, a `200-OK` http status code with Resource-Location header will be returned. + * @param operationId The ID to query the status for the dataset create/import request. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: DatasetGetOperationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getOperationOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: DatasetListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/datasets", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DatasetCreateHeaders + }, + 201: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DatasetCreateHeaders + }, + 202: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DatasetCreateHeaders + }, + 204: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DatasetCreateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.conversionId, + Parameters.datasetId, + Parameters.descriptionDataset + ], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/datasets", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatasetListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/datasets/{datasetId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatasetDetailInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.datasetId1], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/datasets/{datasetId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.datasetId1], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationOperationSpec: coreClient.OperationSpec = { + path: "/datasets/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.DatasetGetOperationHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.operationId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DatasetListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/featureState.ts b/sdk/maps/maps-creator/src/operations/featureState.ts new file mode 100644 index 000000000000..28c406988606 --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/featureState.ts @@ -0,0 +1,484 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { FeatureState } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { + StatesetInfoObject, + FeatureStateListStatesetNextOptionalParams, + FeatureStateListStatesetOptionalParams, + StylesObject, + FeatureStateCreateStatesetOptionalParams, + FeatureStateCreateStatesetResponse, + FeatureStateListStatesetResponse, + FeatureStatePutStatesetOptionalParams, + FeatureStateDeleteStatesetOptionalParams, + FeatureStateGetStatesetOptionalParams, + FeatureStateGetStatesetResponse, + FeatureStatesStructure, + FeatureStateUpdateStatesOptionalParams, + FeatureStateDeleteStateOptionalParams, + FeatureStateGetStatesOptionalParams, + FeatureStateGetStatesResponse, + FeatureStateListStatesetNextResponse +} from "../models"; + +/// +/** Class representing a FeatureState. */ +export class FeatureStateImpl implements FeatureState { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class FeatureState class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created statesets. + * @param options The options parameters. + */ + public listStateset( + options?: FeatureStateListStatesetOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listStatesetPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listStatesetPagingPage(options); + } + }; + } + + private async *listStatesetPagingPage( + options?: FeatureStateListStatesetOptionalParams + ): AsyncIterableIterator { + let result = await this._listStateset(options); + yield result.statesets || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listStatesetNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.statesets || []; + } + } + + private async *listStatesetPagingAll( + options?: FeatureStateListStatesetOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listStatesetPagingPage(options)) { + yield* page; + } + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This POST API allows the user to create a new Stateset and define stateset style using request body. + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. The Feature State API is part of Creator. + * + * The Feature State service allows the user to update the states of a feature and query them to be + * used in other services. The dynamic properties of a feature that don't belong to the dataset are + * referred to as *states* here. + * + * This Feature State service pivot on the Stateset. Like Tileset, Stateset encapsulates the storage + * mechanism for feature states for a dataset. + * + * Once the stateset is created, users can use that statesetId to post feature state updates and + * retrieve the current feature states. A feature can have only one state at a given point in time. + * + * Feature state is defined by the key name, value and the timestamp. When a feature state update is + * posted to Azure Maps, the state value gets updated only if the provided state’s timestamp is later + * than the stored timestamp. + * + * Azure Maps MapControl provides a way to use these feature states to style the features. Please refer + * to the State Tile documentation for more information. + * @param datasetId The datasetId must have been obtained from a successful [Dataset Create + * API](https://docs.microsoft.com/en-us/rest/api/maps/v2/dataset/create) call. + * @param statesetCreateRequestBody The stateset style JSON data. + * @param options The options parameters. + */ + createStateset( + datasetId: string, + statesetCreateRequestBody: StylesObject, + options?: FeatureStateCreateStatesetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, statesetCreateRequestBody, options }, + createStatesetOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created statesets. + * @param options The options parameters. + */ + private _listStateset( + options?: FeatureStateListStatesetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listStatesetOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This PUT API allows the user to update the stateset style rules. + * @param statesetId The stateset id that was created. + * @param statesetStyleUpdateRequestBody The stateset style JSON data. Only style rules are allowed to + * be updated, update on keyname and type is not allowed. + * @param options The options parameters. + */ + putStateset( + statesetId: string, + statesetStyleUpdateRequestBody: StylesObject, + options?: FeatureStatePutStatesetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { statesetId, statesetStyleUpdateRequestBody, options }, + putStatesetOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This DELETE API allows the user to delete the stateset and the associated data. + * @param statesetId The stateset id that was created. + * @param options The options parameters. + */ + deleteStateset( + statesetId: string, + options?: FeatureStateDeleteStatesetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { statesetId, options }, + deleteStatesetOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This GET API allows the user to get the stateset Information. + * + * The stateset Information includes the datasetId associated to the stateset, and the styles of that + * stateset. + * @param statesetId The stateset id that was created. + * @param options The options parameters. + */ + getStateset( + statesetId: string, + options?: FeatureStateGetStatesetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { statesetId, options }, + getStatesetOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This PUT API allows the user to update the state of the given feature in the given stateset. + * @param statesetId The stateset id that was created. + * @param featureId The id of a feature in the given dataset. If the featureId is not present in the + * dataset, Bad Request response will be returned. + * @param featureStateUpdateRequestBody The feature state JSON data. A feature can have only one state + * at a given point in time. The specified state keyname must have been defined during the stateset + * creation. + * @param options The options parameters. + */ + updateStates( + statesetId: string, + featureId: string, + featureStateUpdateRequestBody: FeatureStatesStructure, + options?: FeatureStateUpdateStatesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { statesetId, featureId, featureStateUpdateRequestBody, options }, + updateStatesOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API deletes the state information identified by the StateKeyName parameter for the feature + * identified by the FeatureId parameter in the the stateset. + * @param statesetId The stateset id that was created. + * @param featureId The id of a feature in the given stateset. If no state was set for the featureId in + * the stateset earlier, Bad Request response will be returned. + * @param stateKeyName The Name of the state to be deleted. + * @param options The options parameters. + */ + deleteState( + statesetId: string, + featureId: string, + stateKeyName: string, + options?: FeatureStateDeleteStateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { statesetId, featureId, stateKeyName, options }, + deleteStateOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API returns the current state information associated with the given feature in the given + * stateset. + * @param statesetId The stateset id that was created. + * @param featureId The id of a feature in the given stateset. If no state was set for the featureId in + * the stateset earlier, Bad Request response will be returned. + * @param options The options parameters. + */ + getStates( + statesetId: string, + featureId: string, + options?: FeatureStateGetStatesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { statesetId, featureId, options }, + getStatesOperationSpec + ); + } + + /** + * ListStatesetNext + * @param nextLink The nextLink from the previous successful call to the ListStateset method. + * @param options The options parameters. + */ + private _listStatesetNext( + nextLink: string, + options?: FeatureStateListStatesetNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listStatesetNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createStatesetOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.StatesetCreatedResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.statesetCreateRequestBody, + queryParameters: [ + Parameters.apiVersion, + Parameters.description, + Parameters.datasetId2 + ], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept, Parameters.contentType2], + mediaType: "json", + serializer +}; +const listStatesetOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StatesetListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept], + serializer +}; +const putStatesetOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets/{statesetId}", + httpMethod: "PUT", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.statesetStyleUpdateRequestBody, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.statesetId], + headerParameters: [Parameters.accept, Parameters.contentType2], + mediaType: "json", + serializer +}; +const deleteStatesetOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets/{statesetId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.statesetId], + headerParameters: [Parameters.accept], + serializer +}; +const getStatesetOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets/{statesetId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StatesetGetResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.statesetId], + headerParameters: [Parameters.accept], + serializer +}; +const updateStatesOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets/{statesetId}/featureStates/{featureId}", + httpMethod: "PUT", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.featureStateUpdateRequestBody, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.geography, + Parameters.statesetId, + Parameters.featureId + ], + headerParameters: [Parameters.accept, Parameters.contentType2], + mediaType: "json", + serializer +}; +const deleteStateOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets/{statesetId}/featureStates/{featureId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.stateKeyName], + urlParameters: [ + Parameters.geography, + Parameters.statesetId, + Parameters.featureId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getStatesOperationSpec: coreClient.OperationSpec = { + path: "/featureStateSets/{statesetId}/featureStates/{featureId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FeatureStatesStructure + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.geography, + Parameters.statesetId, + Parameters.featureId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listStatesetNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StatesetListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/index.ts b/sdk/maps/maps-creator/src/operations/index.ts new file mode 100644 index 000000000000..7fe2a1f1d8c6 --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./alias"; +export * from "./data"; +export * from "./dataset"; +export * from "./conversion"; +export * from "./featureState"; +export * from "./spatial"; +export * from "./tileset"; +export * from "./wfs"; diff --git a/sdk/maps/maps-creator/src/operations/spatial.ts b/sdk/maps/maps-creator/src/operations/spatial.ts new file mode 100644 index 000000000000..b5ca4ec871ba --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/spatial.ts @@ -0,0 +1,631 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { Spatial } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { + ResponseFormat, + SpatialGetGeofenceOptionalParams, + SpatialGetGeofenceResponse, + SpatialPostGeofenceOptionalParams, + SpatialPostGeofenceResponse, + BufferRequestBody, + SpatialPostBufferOptionalParams, + SpatialPostBufferResponse, + SpatialGetBufferOptionalParams, + SpatialGetBufferResponse, + SpatialPostClosestPointOptionalParams, + SpatialPostClosestPointResponse, + SpatialGetClosestPointOptionalParams, + SpatialGetClosestPointResponse, + SpatialPostPointInPolygonOptionalParams, + SpatialPostPointInPolygonResponse, + SpatialGetPointInPolygonOptionalParams, + SpatialGetPointInPolygonResponse, + SpatialGetGreatCircleDistanceOptionalParams, + SpatialGetGreatCircleDistanceResponse +} from "../models"; + +/** Class representing a Spatial. */ +export class SpatialImpl implements Spatial { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Spatial class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Search Geofence Get API** + * + * **Applies to:** S1 Pricing tier. + * + * The Geofence Get API allows you to retrieve the proximity of a coordinate to a + * geofence that has been uploaded to the Data service. You can use the + * [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) to upload + * a geofence or set of fences. See [Geofencing GeoJSON + * data](https://docs.microsoft.com/en-us/azure/azure-maps/geofence-geojson) + * for more details on the geofence data format. To query the proximity of a coordinate, you supply the + * location of the object you are tracking as well + * as the ID for the fence or set of fences, and the response will contain information about + * the distance from the outer edge of the geofence. A negative value signifies that the + * coordinate is inside of the fence while a positive value means that it is outside of the + * fence.

This API can be used for a variety of scenarios that include things like asset + * tracking, fleet management, or setting up alerts for moving objects. + * + * The API supports [integration with Event + * Grid](https://docs.microsoft.com/azure/azure-maps/azure-maps-event-grid-integration). The isAsync + * parameter is used to enable integration with Event Grid (disabled by default). + * To test this API, you can upload the sample data from Post Geofence API examples(Request Body) via + * Data Upload API and replace the [udid] from the sample request below with the udid returned by Data + * Upload API. + * + * + * ### Geofencing InnerError code + * + * In geofencing response error contract, `innererror` is an object containing service specific + * information about the error. `code` is a property in `innererror` which can map to a specific + * geofencing error type. The table belows shows the code mapping between all the known client error + * type to the corresponding geofencing error `message`. + * + * innererror.code | error.message + * ---------------------------- | -------------------------------------- + * NullDeviceId | Device Id should not be null. + * NullUdid | Udid should not be null. + * UdidWrongFormat| Udid should be acquired from user data ingestion API. + * InvalidUserTime| Usertime is invalid. + * InvalidSearchBuffer| Searchbuffer is invalid. + * InvalidSearchRange| The value range of searchbuffer should be from 0 to 500 meters. + * InvalidLatLon| Lat and/or lon parameters are invalid. + * InvalidIsAsyncValue| The IsAsync parameter is invalid. + * InvalidModeValue| The mode parameter invalid. + * InvalidJson| Geofencing data is not a valid json file. + * NotSupportedGeoJson| Geofencing data can't be read as a Feature or FeatureCollections. + * InvalidGeoJson| Geofencing data is invalid. + * NoUserDataWithAccountOrSubscription| Can't find user geofencing data with provided account-id and/or + * subscription-id. + * NoUserDataWithUdid| Can't find user geofencing data with provided udid. + * @param format Desired format of the response. Only `json` format is supported. + * @param deviceId ID of the device + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param options The options parameters. + */ + getGeofence( + format: ResponseFormat, + deviceId: string, + udid: string, + latitude: number, + longitude: number, + options?: SpatialGetGeofenceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, deviceId, udid, latitude, longitude, options }, + getGeofenceOperationSpec + ); + } + + /** + * **Search Geofence Post API** + * **Applies to:** S1 Pricing tier. + * The Geofence Post API allows you to retrieve the proximity of a coordinate to a provided geofence + * or set of fences. With POST call, you do not have to upload the fence data in advance, instead you + * supply the location of the object you are tracking in query parameters as well as the fence or set + * of fences data in post request body. See [Geofencing GeoJSON + * data](https://docs.microsoft.com/en-us/azure/azure-maps/geofence-geojson) for more details on the + * geofence data format. The response will contain information about the distance from the outer edge + * of the geofence. A negative value signifies that the coordinate is inside of the fence while a + * positive value means that it is outside of the fence.

This API can be used for a variety of + * scenarios that include things like asset tracking, fleet management, or setting up alerts for + * moving objects. + * + * The API supports [integration with Event + * Grid](https://docs.microsoft.com/azure/azure-maps/azure-maps-event-grid-integration). The isAsync + * parameter is used to enable integration with Event Grid (disabled by default). + * @param format Desired format of the response. Only `json` format is supported. + * @param deviceId ID of the device + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param searchGeofenceRequestBody The geofencing GeoJSON data. + * @param options The options parameters. + */ + postGeofence( + format: ResponseFormat, + deviceId: string, + latitude: number, + longitude: number, + searchGeofenceRequestBody: Record, + options?: SpatialPostGeofenceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + format, + deviceId, + latitude, + longitude, + searchGeofenceRequestBody, + options + }, + postGeofenceOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a FeatureCollection where each Feature is a buffer around the corresponding indexed + * Feature of the input. The buffer could be either on the outside or the inside of the provided + * Feature, depending on the distance provided in the input. There must be either one distance provided + * per Feature in the FeatureCollection input, or if only one distance is provided, then that distance + * is applied to every Feature in the collection. The positive (or negative) buffer of a geometry is + * defined as the Minkowski sum (or difference) of the geometry with a circle of radius equal to the + * absolute value of the buffer distance. The buffer API always returns a polygonal result. The + * negative or zero-distance buffer of lines and points is always an empty polygon. The input may + * contain a collection of Point, MultiPoint, Polygon, MultiPolygon, LineString and MultiLineString. + * GeometryCollection will be ignored if provided. + * @param format Desired format of the response. Only `json` format is supported. + * @param bufferRequestBody The FeatureCollection and the list of distances (one per feature or one for + * all features). + * @param options The options parameters. + */ + postBuffer( + format: ResponseFormat, + bufferRequestBody: BufferRequestBody, + options?: SpatialPostBufferOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, bufferRequestBody, options }, + postBufferOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a FeatureCollection where each Feature is a buffer around the corresponding indexed + * Feature of the input. The buffer could be either on the outside or the inside of the provided + * Feature, depending on the distance provided in the input. There must be either one distance provided + * per Feature in the FeatureCollection input, or if only one distance is provided, then that distance + * is applied to every Feature in the collection. The positive (or negative) buffer of a geometry is + * defined as the Minkowski sum (or difference) of the geometry with a circle of radius equal to the + * absolute value of the buffer distance. The buffer API always returns a polygonal result. The + * negative or zero-distance buffer of lines and points is always an empty polygon. The input features + * are provided by a GeoJSON file which is uploaded via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and referenced by a unique + * udid. The GeoJSON file may contain a collection of Point, MultiPoint, Polygon, MultiPolygon, + * LineString and MultiLineString. GeometryCollection will be ignored if provided. + * + * To test this API, you can upload the sample data from [Post Buffer + * API](https://docs.microsoft.com/en-us/rest/api/maps/spatial/postbuffer#examples) examples(Request + * Body without distances array) via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and replace the [udid] from + * the [sample request + * below](https://docs.microsoft.com/en-us/rest/api/maps/spatial/getbuffer#examples) with the udid + * returned by Data Upload API. + * @param format Desired format of the response. Only `json` format is supported. + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param distances The list of distances (one per feature or one for all features), delimited by + * semicolons. For example, 12.34;-56.78. Positive distance will generate a buffer outside of the + * feature, whereas negative distance will generate a buffer inside of the feature. If the negative + * distance larger than the geometry itself, an empty polygon will be returned. + * @param options The options parameters. + */ + getBuffer( + format: ResponseFormat, + udid: string, + distances: string, + options?: SpatialGetBufferOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, udid, distances, options }, + getBufferOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API returns the closest point between a base point and a given set of target points. The set of + * target points is provided by user data in post request body. The user data may only contain a + * collection of Point geometry. MultiPoint or other geometries will be ignored if provided. The + * algorithm does not take into account routing or traffic. The maximum number of points accepted is + * 100,000. Information returned includes closest point latitude, longitude, and distance in meters + * from the closest point. + * @param format Desired format of the response. Only `json` format is supported. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param closestPointRequestBody The FeatureCollection of Point geometries from which closest point to + * source point should be determined. All the feature's properties should contain `geometryId`, which + * is used for identifying the geometry and is case-sensitive. + * @param options The options parameters. + */ + postClosestPoint( + format: ResponseFormat, + latitude: number, + longitude: number, + closestPointRequestBody: Record, + options?: SpatialPostClosestPointOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, latitude, longitude, closestPointRequestBody, options }, + postClosestPointOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API returns the closest point between a base point and a given set of points in the user + * uploaded data set identified by udid. The set of target points is provided by a GeoJSON file which + * is uploaded via [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) + * and referenced by a unique udid. The GeoJSON file may only contain a collection of Point geometry. + * MultiPoint or other geometries will be ignored if provided. The maximum number of points accepted is + * 100,000. The algorithm does not take into account routing or traffic. Information returned includes + * closest point latitude, longitude, and distance in meters from the closest point. + * + * To test this API, you can upload the sample data from [Post Closest Point + * API](https://docs.microsoft.com/en-us/rest/api/maps/spatial/postclosestpoint#examples) + * examples(Request Body) via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and replace the [udid] from + * the [sample request + * below](https://docs.microsoft.com/en-us/rest/api/maps/spatial/getclosestpoint#examples) with the + * udid returned by Data Upload API. + * @param format Desired format of the response. Only `json` format is supported. + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param options The options parameters. + */ + getClosestPoint( + format: ResponseFormat, + udid: string, + latitude: number, + longitude: number, + options?: SpatialGetClosestPointOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, udid, latitude, longitude, options }, + getClosestPointOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a boolean value indicating whether a point is inside a set of polygons. The user + * data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if provided. + * If the point is inside or on the boundary of one of these polygons, the value returned is true. In + * all other cases, the value returned is false. When the point is inside multiple polygons, the result + * will give intersecting geometries section to show all valid geometries (referenced by geometryId) in + * user data. The maximum number of vertices accepted to form a Polygon is 10,000. + * @param format Desired format of the response. Only `json` format is supported. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param pointInPolygonRequestBody A FeatureCollection with a set of Polygon/MultiPolygon geometries. + * The maximum number of vertices accepted to form a Polygon is 10,000. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param options The options parameters. + */ + postPointInPolygon( + format: ResponseFormat, + latitude: number, + longitude: number, + pointInPolygonRequestBody: Record, + options?: SpatialPostPointInPolygonOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, latitude, longitude, pointInPolygonRequestBody, options }, + postPointInPolygonOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a boolean value indicating whether a point is inside a set of polygons. The set of + * polygons is provided by a GeoJSON file which is uploaded via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and referenced by a unique + * udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries will be + * ignored if provided. If the point is inside or on the boundary of one of these polygons, the value + * returned is true. In all other cases, the value returned is false. When the point is inside multiple + * polygons, the result will give intersecting geometries section to show all valid + * geometries(referenced by geometryId) in user data. The maximum number of vertices accepted to form a + * Polygon is 10,000. + * + * + * To test this API, you can upload the sample data from [Post Point In Polygon + * API](https://docs.microsoft.com/en-us/rest/api/maps/spatial/postpointinpolygon#examples) + * examples(Request Body) via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and replace the [udid] from + * the [sample request + * below](https://docs.microsoft.com/en-us/rest/api/maps/spatial/getpointinpolygon#examples) with the + * udid returned by Data Upload API. + * @param format Desired format of the response. Only `json` format is supported. + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param options The options parameters. + */ + getPointInPolygon( + format: ResponseFormat, + udid: string, + latitude: number, + longitude: number, + options?: SpatialGetPointInPolygonOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, udid, latitude, longitude, options }, + getPointInPolygonOperationSpec + ); + } + + /** + * **Applies to**: S1 pricing tier. + * + * This API will return the great-circle or shortest distance between two points on the surface of a + * sphere, measured along the surface of the sphere. This differs from calculating a straight line + * through the sphere's interior. This method is helpful for estimating travel distances for airplanes + * by calculating the shortest distance between airports. + * @param format Desired format of the response. Only `json` format is supported. + * @param query The Coordinates through which the distance is calculated, delimited by a colon. Two + * coordinates are required. The first one is the source point coordinate and the last is the target + * point coordinate. For example, 47.622942,122.316456:57.673988,127.121513 + * @param options The options parameters. + */ + getGreatCircleDistance( + format: ResponseFormat, + query: string, + options?: SpatialGetGreatCircleDistanceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { format, query, options }, + getGreatCircleDistanceOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getGeofenceOperationSpec: coreClient.OperationSpec = { + path: "/spatial/geofence/{format}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GeofenceResponse, + headersMapper: Mappers.SpatialGetGeofenceHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.udid, + Parameters.apiVersion1, + Parameters.deviceId, + Parameters.latitude, + Parameters.longitude, + Parameters.z, + Parameters.userTime, + Parameters.searchBuffer, + Parameters.isAsync, + Parameters.mode + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const postGeofenceOperationSpec: coreClient.OperationSpec = { + path: "/spatial/geofence/{format}", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.GeofenceResponse, + headersMapper: Mappers.SpatialPostGeofenceHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.searchGeofenceRequestBody, + queryParameters: [ + Parameters.apiVersion1, + Parameters.deviceId, + Parameters.latitude, + Parameters.longitude, + Parameters.z, + Parameters.userTime, + Parameters.searchBuffer, + Parameters.isAsync, + Parameters.mode + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [ + Parameters.accept, + Parameters.xMsClientId, + Parameters.contentType2 + ], + mediaType: "json", + serializer +}; +const postBufferOperationSpec: coreClient.OperationSpec = { + path: "/spatial/buffer/{format}", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.BufferResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.bufferRequestBody, + queryParameters: [Parameters.apiVersion1], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [ + Parameters.accept, + Parameters.xMsClientId, + Parameters.contentType2 + ], + mediaType: "json", + serializer +}; +const getBufferOperationSpec: coreClient.OperationSpec = { + path: "/spatial/buffer/{format}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BufferResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.udid, + Parameters.apiVersion1, + Parameters.distances + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const postClosestPointOperationSpec: coreClient.OperationSpec = { + path: "/spatial/closestPoint/{format}", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ClosestPointResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.closestPointRequestBody, + queryParameters: [ + Parameters.apiVersion1, + Parameters.latitude, + Parameters.longitude, + Parameters.numberOfClosestPoints + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [ + Parameters.accept, + Parameters.xMsClientId, + Parameters.contentType2 + ], + mediaType: "json", + serializer +}; +const getClosestPointOperationSpec: coreClient.OperationSpec = { + path: "/spatial/closestPoint/{format}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ClosestPointResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.udid, + Parameters.apiVersion1, + Parameters.latitude, + Parameters.longitude, + Parameters.numberOfClosestPoints + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const postPointInPolygonOperationSpec: coreClient.OperationSpec = { + path: "/spatial/pointInPolygon/{format}", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.PointInPolygonResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.pointInPolygonRequestBody, + queryParameters: [ + Parameters.apiVersion1, + Parameters.latitude, + Parameters.longitude + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [ + Parameters.accept, + Parameters.xMsClientId, + Parameters.contentType2 + ], + mediaType: "json", + serializer +}; +const getPointInPolygonOperationSpec: coreClient.OperationSpec = { + path: "/spatial/pointInPolygon/{format}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PointInPolygonResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.udid, + Parameters.apiVersion1, + Parameters.latitude, + Parameters.longitude + ], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getGreatCircleDistanceOperationSpec: coreClient.OperationSpec = { + path: "/spatial/greatCircleDistance/{format}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GreatCircleDistanceResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion1, Parameters.query], + urlParameters: [Parameters.geography, Parameters.format], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/tileset.ts b/sdk/maps/maps-creator/src/operations/tileset.ts new file mode 100644 index 000000000000..79d99c31c082 --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/tileset.ts @@ -0,0 +1,442 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Tileset } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { LROPoller, shouldDeserializeLRO } from "../lro"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + TilesetDetailInfo, + TilesetListNextOptionalParams, + TilesetListOptionalParams, + TilesetCreateOptionalParams, + TilesetCreateResponse, + TilesetListOperationResponse, + TilesetGetOptionalParams, + TilesetGetResponse, + TilesetDeleteOptionalParams, + TilesetGetOperationOptionalParams, + TilesetGetOperationResponse, + TilesetListNextResponse +} from "../models"; + +/// +/** Class representing a Tileset. */ +export class TilesetImpl implements Tileset { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Tileset class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all tilesets created. + *
+ * @param options The options parameters. + */ + public list( + options?: TilesetListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: TilesetListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.tilesets || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.tilesets || []; + } + } + + private async *listPagingAll( + options?: TilesetListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * [This](https://docs.microsoft.com/en-us/azure/azure-maps/creator-indoor-maps) article introduces + * concepts and tools that apply to Azure Maps Creator. + * + * The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains a + * set of tiles that can be consumed + * from the [Get Map Tile](/rest/api/maps/render/getmaptile) to retrieve custom tiles. To make a + * dataset, use the + * [DataSet Create API](/rest/api/maps/dataset/createpreview). + * + * ## Submit Create Request + * + * To create your tileset you will make a `POST` request with an empty body. The `datasetId` query + * parameter will be + * used as the source of the tileset data. + * + * The Create Tileset API is a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param datasetId The unique `datasetId` that the tileset create API uses to retrieve features to + * generate tiles. The `datasetId` must have been obtained from a successful [Dataset Create + * API](/en-us/rest/api/maps/dataset/createpreview) call. + * @param options The options parameters. + */ + async beginCreate( + datasetId: string, + options?: TilesetCreateOptionalParams + ): Promise< + PollerLike, TilesetCreateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { flatResponse, rawResponse: currentRawResponse! }; + }; + + return new LROPoller( + { intervalInMs: options?.updateIntervalInMs }, + { datasetId, options }, + createOperationSpec, + sendOperation, + "location" + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * [This](https://docs.microsoft.com/en-us/azure/azure-maps/creator-indoor-maps) article introduces + * concepts and tools that apply to Azure Maps Creator. + * + * The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains a + * set of tiles that can be consumed + * from the [Get Map Tile](/rest/api/maps/render/getmaptile) to retrieve custom tiles. To make a + * dataset, use the + * [DataSet Create API](/rest/api/maps/dataset/createpreview). + * + * ## Submit Create Request + * + * To create your tileset you will make a `POST` request with an empty body. The `datasetId` query + * parameter will be + * used as the source of the tileset data. + * + * The Create Tileset API is a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param datasetId The unique `datasetId` that the tileset create API uses to retrieve features to + * generate tiles. The `datasetId` must have been obtained from a successful [Dataset Create + * API](/en-us/rest/api/maps/dataset/createpreview) call. + * @param options The options parameters. + */ + async beginCreateAndWait( + datasetId: string, + options?: TilesetCreateOptionalParams + ): Promise { + const poller = await this.beginCreate(datasetId, options); + return poller.pollUntilDone(); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all tilesets created. + *
+ * @param options The options parameters. + */ + private _list( + options?: TilesetListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a tileset. + * @param tilesetId The Tileset Id + * @param options The options parameters. + */ + get( + tilesetId: string, + options?: TilesetGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { tilesetId, options }, + getOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to delete a created tileset.
+ * You can use this API if a tileset is no longer needed. + * + * ### Submit Delete Request + * + * To delete your content you will issue a `DELETE` request where the path will contain the `tilesetId` + * of the tileset to delete.
+ * + * #### Delete request "Successful" + * + * The Tileset Delete API returns a HTTP `204 No Content` response with an empty body, if the tileset + * was deleted successfully.
+ * + * #### Delete request "Failed" + * + * A HTTP `400 Bad Request` error response will be returned if the tileset with the passed-in + * `tilesetId` is not found. + * + * Here is a sample error response: + * + *
+ * + * ```json + * { + * "error": { + * "code": "400 BadRequest", + * "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce does not exist." + * } + * } + * ``` + * @param tilesetId The Tileset Id + * @param options The options parameters. + */ + delete( + tilesetId: string, + options?: TilesetDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { tilesetId, options }, + deleteOperationSpec + ); + } + + /** + * This path will be obtained from a call to /tilesets/create. While in progress, an http200 will be + * returned with no extra headers - followed by an http200 with Resource-Location header once + * successfully completed. + * @param operationId The ID to query the status for the dataset create/import request. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: TilesetGetOperationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getOperationOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: TilesetListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: "/tilesets", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.TilesetCreateHeaders + }, + 201: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.TilesetCreateHeaders + }, + 202: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.TilesetCreateHeaders + }, + 204: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.TilesetCreateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.description, + Parameters.datasetId2 + ], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: "/tilesets", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TilesetListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/tilesets/{tilesetId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TilesetDetailInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.tilesetId], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/tilesets/{tilesetId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.tilesetId], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getOperationOperationSpec: coreClient.OperationSpec = { + path: "/tilesets/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LongRunningOperationResult, + headersMapper: Mappers.TilesetGetOperationHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.operationId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TilesetListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.nextLink], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operations/wfs.ts b/sdk/maps/maps-creator/src/operations/wfs.ts new file mode 100644 index 000000000000..0840d999bc6d --- /dev/null +++ b/sdk/maps/maps-creator/src/operations/wfs.ts @@ -0,0 +1,431 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { Wfs } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { CreatorClientContext } from "../creatorClientContext"; +import { + WfsGetLandingPageOptionalParams, + WfsGetLandingPageResponse, + WfsGetConformanceOptionalParams, + WfsGetConformanceResponse, + WfsGetCollectionsOptionalParams, + WfsGetCollectionsResponse, + WfsGetCollectionOptionalParams, + WfsGetCollectionResponse, + WfsGetCollectionDefinitionOptionalParams, + WfsGetCollectionDefinitionResponse, + WfsGetFeaturesOptionalParams, + WfsGetFeaturesResponse, + WfsGetFeatureOptionalParams, + WfsGetFeatureResponse, + WfsDeleteFeatureOptionalParams +} from "../models"; + +/** Class representing a Wfs. */ +export class WfsImpl implements Wfs { + private readonly client: CreatorClientContext; + + /** + * Initialize a new instance of the class Wfs class. + * @param client Reference to the service client + */ + constructor(client: CreatorClientContext) { + this.client = client; + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Landing Page API provides links to the API definition, the Conformance statements and the + * metadata about the feature data in this dataset. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + getLandingPage( + datasetId: string, + options?: WfsGetLandingPageOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, options }, + getLandingPageOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Requirements Classes lists all requirements classes specified in the standard that the + * server conforms to. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + getConformance( + datasetId: string, + options?: WfsGetConformanceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, options }, + getConformanceOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Collections Description API provides descriptions of all the collections in a given dataset. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + getCollections( + datasetId: string, + options?: WfsGetCollectionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, options }, + getCollectionsOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * + * The Collection Description API provides the description of a given collection. It includes the links + * to the operations that can be performed on the collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param options The options parameters. + */ + getCollection( + datasetId: string, + collectionId: string, + options?: WfsGetCollectionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, collectionId, options }, + getCollectionOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * [This](https://docs.microsoft.com/en-us/azure/azure-maps/creator-indoor-maps) article introduces + * concepts and tools that apply to Azure Maps Creator. WFS API follows the [Open Geospatial Consortium + * API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to query + * [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * + * The Collection Definition API provides the detailed data model of a given collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param options The options parameters. + */ + getCollectionDefinition( + datasetId: string, + collectionId: string, + options?: WfsGetCollectionDefinitionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, collectionId, options }, + getCollectionDefinitionOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Features API returns the list of features in the given collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param options The options parameters. + */ + getFeatures( + datasetId: string, + collectionId: string, + options?: WfsGetFeaturesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, collectionId, options }, + getFeaturesOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Feature API returns the feature identified by the provided id in the given collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param featureId Local identifier of a specific feature + * @param options The options parameters. + */ + getFeature( + datasetId: string, + collectionId: string, + featureId: string, + options?: WfsGetFeatureOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, collectionId, featureId, options }, + getFeatureOperationSpec + ); + } + + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Delete Feature API deletes the feature identified by the provided id in the given collection. At + * this point this API supports only facility features. Deleting a facility feature deletes all the + * child features of that facility recursively. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param featureId Local identifier of a specific feature + * @param options The options parameters. + */ + deleteFeature( + datasetId: string, + collectionId: string, + featureId: string, + options?: WfsDeleteFeatureOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { datasetId, collectionId, featureId, options }, + deleteFeatureOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getLandingPageOperationSpec: coreClient.OperationSpec = { + path: "/wfs/datasets/{datasetId}/", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LandingPageResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.datasetId1], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getConformanceOperationSpec: coreClient.OperationSpec = { + path: "/wfs/datasets/{datasetId}/conformance", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConformanceResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.datasetId1], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getCollectionsOperationSpec: coreClient.OperationSpec = { + path: "/wfs/datasets/{datasetId}/collections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CollectionsResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.geography, Parameters.datasetId1], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getCollectionOperationSpec: coreClient.OperationSpec = { + path: "/wfs/datasets/{datasetId}/collections/{collectionId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CollectionInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.geography, + Parameters.datasetId1, + Parameters.collectionId + ], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getCollectionDefinitionOperationSpec: coreClient.OperationSpec = { + path: "/wfs/datasets/{datasetId}/collections/{collectionId}/definition", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CollectionDefinitionResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.geography, + Parameters.datasetId1, + Parameters.collectionId + ], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getFeaturesOperationSpec: coreClient.OperationSpec = { + path: "/wfs/datasets/{datasetId}/collections/{collectionId}/items", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ExtendedGeoJsonFeatureCollection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.limit, + Parameters.bbox, + Parameters.filter + ], + urlParameters: [ + Parameters.geography, + Parameters.datasetId1, + Parameters.collectionId + ], + headerParameters: [Parameters.accept, Parameters.xMsClientId], + serializer +}; +const getFeatureOperationSpec: coreClient.OperationSpec = { + path: + "/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FeatureResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.geography, + Parameters.datasetId1, + Parameters.featureId, + Parameters.collectionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteFeatureOperationSpec: coreClient.OperationSpec = { + path: + "/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.geography, + Parameters.datasetId1, + Parameters.featureId, + Parameters.collectionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/alias.ts b/sdk/maps/maps-creator/src/operationsInterfaces/alias.ts new file mode 100644 index 000000000000..469956ab0d8b --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/alias.ts @@ -0,0 +1,207 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + AliasListItem, + AliasListOptionalParams, + AliasCreateOptionalParams, + AliasCreateResponse, + AliasAssignOptionalParams, + AliasAssignResponse, + AliasDeleteOptionalParams, + AliasGetDetailsOptionalParams, + AliasGetDetailsResponse +} from "../models"; + +/// +/** Interface representing a Alias. */ +export interface Alias { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created aliases. + * + * ### Submit List Request + * + * To list all your aliases, you will issue a `GET` request with no additional parameters. + * + * ### List Data Response + * + * The List API returns the complete list of all aliases in `json` format. The response contains the + * following details for each alias resource: + * > createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + * > aliasId - The id for the alias. + * > creatorDataItemId - The id for the creator data item that this alias references (could be null + * if the alias has not been assigned). + * > lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + * yyyy-MM-ddTHH:mm:ss.sssZ + * + * A sample response returning 2 alias resources: + * + * ```json + * { + * "aliases": [ + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * }, + * { + * "createdTimestamp": "2020-02-18T19:53:33.123Z", + * "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + * "creatorDataItemId": null, + * "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + * } + * ] + * } + * ``` + * @param options The options parameters. + */ + list( + options?: AliasListOptionalParams + ): PagedAsyncIterableIterator; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to create an alias. You can also assign the alias during the create + * request. An alias can reference an ID generated by a creator service, but cannot reference another + * alias ID. + * + * ### Submit Create Request + * + * To create your alias, you will use a `POST` request. If you would like to assign the alias during + * the creation, you will pass the `resourceId` query parameter. + * + * ### Create Alias Response + * + * The Create API returns a HTTP `201 Created` response with the alias resource in the body. + * + * A sample response from creating an alias: + * + * ```json + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * } + * ``` + * @param options The options parameters. + */ + create(options?: AliasCreateOptionalParams): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to assign an alias to reference a resource. + * + * ### Submit Assign Request + * + * To assign your alias to a resource, you will use a `PUT` request with the `aliasId` in the path and + * the `creatorDataItemId` passed as a query parameter. + * + * ### Assign Alias Response + * + * The Assign API returns a HTTP `200 OK` response with the updated alias resource in the body, if the + * alias was assigned successfully. A sample of the assign response is + * + * ```json + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * } + * ``` + * @param aliasId The unique id that references an existing alias. + * @param creatorDataItemId The unique id that references a creator data item to be aliased. + * @param options The options parameters. + */ + assign( + aliasId: string, + creatorDataItemId: string, + options?: AliasAssignOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to delete a previously created alias. You can also use this API to delete + * old/unused aliases to create space for new content.This API does not delete the references resource, + * only the alias referencing the resource. + * + * ### Submit Delete Request + * + * To delete your alias you will issue a `DELETE` request where the path will contain the `aliasId` of + * the alias to delete. + * + * ### Delete Alias Response + * + * The Delete API returns a HTTP `204 No Content` response with an empty body, if the alias was deleted + * successfully. + * @param aliasId The unique id that references an existing alias. + * @param options The options parameters. + */ + delete(aliasId: string, options?: AliasDeleteOptionalParams): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch the details of a previously created alias. + * + * ### Submit Get Details Request + * + * To get the details of your alias, you will issue a `GET` request with the `aliasId` in the path. + * + * ### Get Details Response + * + * The Get Details API returns the previously created alias in `json` format. The response contains the + * following details for the alias resource: + * > createdTimestamp - The timestamp that the alias was created. + * > aliasId - The id for the alias. + * > creatorDataItemId - The id for the creator data item that this alias references (could be null + * if the alias has not been assigned). + * > lastUpdatedTimestamp - The last time the alias was assigned to a resource. + * + * Here's a sample response: + * ```json + * { + * "createdTimestamp": "2020-02-13T21:19:11.123Z", + * "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + * "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + * "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + * } + * ``` + * @param aliasId The unique id that references an existing alias. + * @param options The options parameters. + */ + getDetails( + aliasId: string, + options?: AliasGetDetailsOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/conversion.ts b/sdk/maps/maps-creator/src/operationsInterfaces/conversion.ts new file mode 100644 index 000000000000..938dad939d14 --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/conversion.ts @@ -0,0 +1,276 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ConversionListDetailInfo, + ConversionListOptionalParams, + ConversionConvertOptionalParams, + ConversionConvertResponse, + ConversionGetOptionalParams, + ConversionGetResponse, + ConversionDeleteOptionalParams, + ConversionGetOperationOptionalParams, + ConversionGetOperationResponse +} from "../models"; + +/// +/** Interface representing a Conversion. */ +export interface Conversion { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all successful data conversions submitted previously + * using the [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * + * ### Submit List Request + * + * To list all successful conversions you will issue a `GET` request with no additional parameters. + * + * ### List Data Response + * + * The Conversion List API returns the complete list of all conversion details in `json` format.
+ * + * Here is a sample response returning the details of two successful conversion requests: + * + *
+ * + * ```json + * { + * "conversions": + * [ + * { + * "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + * "udid": "31838736-8b84-11ea-bc55-0242ac130003", + * "created": "5/19/2020 9:00:00 AM +00:00", + * "description": "User provided description.", + * "featureCounts": { + * "DIR": 1, + * "LVL": 3, + * "FCL": 1, + * "UNIT": 150, + * "CTG": 8, + * "AEL": 0, + * "OPN": 10 + * } + * }, + * { + * "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + * "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + * "created": "5/19/2020 9:00:00 AM +00:00", + * "description": "User provided description.", + * "featureCounts": { + * "DIR": 1, + * "LVL": 3, + * "FCL": 1, + * "UNIT": 150, + * "CTG": 8, + * "AEL": 0, + * "OPN": 10 + * } + * } + * ] + * } + * ``` + * + *
+ * @param options The options parameters. + */ + list( + options?: ConversionListOptionalParams + ): PagedAsyncIterableIterator; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Conversion API lets the caller import a set of DWG design files as a zipped [Drawing + * Package](https://aka.ms/am-drawing-package) into Azure Maps. The [Drawing + * Package](https://aka.ms/am-drawing-package) should first be uploaded using the [Azure Maps Data + * Service](https://docs.microsoft.com/rest/api/maps/data). Once uploaded, use the `udid` returned by + * the [Data Upload API](https://docs.microsoft.com/rest/api/maps/data/uploadpreview) to call this + * Conversion API. + * + * ## Convert DWG package + * + * The Conversion API performs a [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Debug DWG package issues + * + * + * During the Conversion process, if there are any issues with the DWG package [errors and + * warnings](https://aka.ms/am-conversion-errors) are provided in the response along with a *diagnostic + * package* to visualize and diagnose these issues. In case any issues are encountered with your DWG + * package, the Conversion operation status process as detailed + * [here](https://aka.ms/am-creator-lrt-v2) returns the location of the *diagnostic package* that can + * be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + * package* location can be found in the properties section of the conversion operation status response + * and looks like the following: + * + * ```json + * { + * "properties": { + * "diagnosticPackageLocation": + * "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + * } + * } + * ``` + * + * The *diagnostic package* can be downloaded by executing a `HTTP GET` request on the + * `diagnosticPackageLocation`. + * For more details on how to use the tool to visualize and diagnose all the errors and warnings see + * [Drawing Error Visualizer](https://aka.ms/am-drawing-errors-visualizer).
+ * + * A conversion operation will be marked as *success* if there are zero or more warnings but will be + * marked as *failed* if any errors are encountered. + * @param udid The unique data id for the content. The `udid` must have been obtained from a successful + * [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) call. + * @param outputOntology Output ontology version. "facility-2.0" is the only supported value at this + * time. Please refer to this + * [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) for more + * information about Azure Maps Creator ontologies. + * @param options The options parameters. + */ + beginConvert( + udid: string, + outputOntology: string, + options?: ConversionConvertOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ConversionConvertResponse + > + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Conversion API lets the caller import a set of DWG design files as a zipped [Drawing + * Package](https://aka.ms/am-drawing-package) into Azure Maps. The [Drawing + * Package](https://aka.ms/am-drawing-package) should first be uploaded using the [Azure Maps Data + * Service](https://docs.microsoft.com/rest/api/maps/data). Once uploaded, use the `udid` returned by + * the [Data Upload API](https://docs.microsoft.com/rest/api/maps/data/uploadpreview) to call this + * Conversion API. + * + * ## Convert DWG package + * + * The Conversion API performs a [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Debug DWG package issues + * + * + * During the Conversion process, if there are any issues with the DWG package [errors and + * warnings](https://aka.ms/am-conversion-errors) are provided in the response along with a *diagnostic + * package* to visualize and diagnose these issues. In case any issues are encountered with your DWG + * package, the Conversion operation status process as detailed + * [here](https://aka.ms/am-creator-lrt-v2) returns the location of the *diagnostic package* that can + * be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + * package* location can be found in the properties section of the conversion operation status response + * and looks like the following: + * + * ```json + * { + * "properties": { + * "diagnosticPackageLocation": + * "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + * } + * } + * ``` + * + * The *diagnostic package* can be downloaded by executing a `HTTP GET` request on the + * `diagnosticPackageLocation`. + * For more details on how to use the tool to visualize and diagnose all the errors and warnings see + * [Drawing Error Visualizer](https://aka.ms/am-drawing-errors-visualizer).
+ * + * A conversion operation will be marked as *success* if there are zero or more warnings but will be + * marked as *failed* if any errors are encountered. + * @param udid The unique data id for the content. The `udid` must have been obtained from a successful + * [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) call. + * @param outputOntology Output ontology version. "facility-2.0" is the only supported value at this + * time. Please refer to this + * [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) for more + * information about Azure Maps Creator ontologies. + * @param options The options parameters. + */ + beginConvertAndWait( + udid: string, + outputOntology: string, + options?: ConversionConvertOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a successful data conversion submitted previously using the + * [Conversion API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * @param conversionId The conversion id for the content. The `conversionId` must have been obtained + * from a successful [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) call. + * @param options The options parameters. + */ + get( + conversionId: string, + options?: ConversionGetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to delete any data conversions created previously using the [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/conversion/convertpreview). + * + * ### Submit Delete Request + * + * To delete your conversion data you will issue a `DELETE` request where the path will contain the + * `conversionId` of the data to delete. + * + * ### Conversion Delete Response + * + * The Conversion Delete API returns a HTTP `204 No Content` response with an empty body, if the + * converted data resources were deleted successfully.
+ * A HTTP `400 Bad Request` error response will be returned if no resource associated with the + * passed-in `conversionId` is found. + * @param conversionId The conversion id for the content. The `conversionId` must have been obtained + * from a successful [Conversion + * API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) call. + * @param options The options parameters. + */ + delete( + conversionId: string, + options?: ConversionDeleteOptionalParams + ): Promise; + /** + * This path will be obtained from a call to POST /conversions. While in progress, an http200 will be + * returned with no extra headers - followed by an http200 with Resource-Location header once + * successfully completed. + * @param operationId The ID to query the status for the dataset create/import request. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: ConversionGetOperationOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/data.ts b/sdk/maps/maps-creator/src/operationsInterfaces/data.ts new file mode 100644 index 000000000000..8f51c0f0fa5a --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/data.ts @@ -0,0 +1,521 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + UploadDataFormat, + DataUploadPreview$binaryOptionalParams, + DataUploadPreview$jsonOptionalParams, + DataUploadPreviewResponse, + DataListPreviewOptionalParams, + DataListPreviewResponse, + DataUpdatePreviewOptionalParams, + DataUpdatePreviewResponse, + DataDownloadPreviewOptionalParams, + DataDownloadPreviewResponse, + DataDeletePreviewOptionalParams, + DataGetOperationPreviewOptionalParams, + DataGetOperationPreviewResponse +} from "../models"; + +/** Interface representing a Data. */ +export interface Data { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Upload API allows the caller to upload data content to the Azure Maps service. + * You can use this API in a scenario like uploading a collection of Geofences in `GeoJSON` + * format, for use in our [Azure Maps Geofencing + * Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * ## Submit Upload Request + * + * To upload your content you will use a `POST` request. The request body will contain the data to + * upload. The + * `dataFormat` query parameter will contain the format for the data, the `dataSharingLevel` query + * parameter + * can contain the sharing level for the data. The `Content-Type` header will be set to the content + * type of the + * data. + * + * For example, to upload a collection of geofences in `GeoJSON` format, set the request body to the + * geofence + * content. Set the `dataFormat` query parameter to _geojson_, and set the `Content-Type` header to + * either one + * of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for uploading a simple Geofence represented as a circle geometry using + * a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The Data Upload API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Upload Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param args Includes all the parameters for this operation. + */ + beginUploadPreview( + ...args: + | [ + UploadDataFormat, + "application/octet-stream", + coreRestPipeline.RequestBodyType, + DataUploadPreview$binaryOptionalParams? + ] + | [ + UploadDataFormat, + "application/json", + Record, + DataUploadPreview$jsonOptionalParams? + ] + ): Promise< + PollerLike< + PollOperationState, + DataUploadPreviewResponse + > + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Upload API allows the caller to upload data content to the Azure Maps service. + * You can use this API in a scenario like uploading a collection of Geofences in `GeoJSON` + * format, for use in our [Azure Maps Geofencing + * Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * ## Submit Upload Request + * + * To upload your content you will use a `POST` request. The request body will contain the data to + * upload. The + * `dataFormat` query parameter will contain the format for the data, the `dataSharingLevel` query + * parameter + * can contain the sharing level for the data. The `Content-Type` header will be set to the content + * type of the + * data. + * + * For example, to upload a collection of geofences in `GeoJSON` format, set the request body to the + * geofence + * content. Set the `dataFormat` query parameter to _geojson_, and set the `Content-Type` header to + * either one + * of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for uploading a simple Geofence represented as a circle geometry using + * a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The Data Upload API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Upload Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param args Includes all the parameters for this operation. + */ + beginUploadPreviewAndWait( + ...args: + | [ + UploadDataFormat, + "application/octet-stream", + coreRestPipeline.RequestBodyType, + DataUploadPreview$binaryOptionalParams? + ] + | [ + UploadDataFormat, + "application/json", + Record, + DataUploadPreview$jsonOptionalParams? + ] + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * This API allows the caller to fetch a list of all content uploaded previously using the [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview). + * + * + * ### Submit List Request + * + * To list all your map data content you will issue a `GET` request with no additional parameters. + * + * + * ### List Data Response + * + * The Data List API returns the complete list of all data in `json` format. The response contains the + * following details for each data resource: + * + * > udid - The unique data id for the data resource. + * + * > location - The location of the data resource. Execute a HTTP `GET` on this location to download + * the data. + * + * + * Here's a sample response returning the `udid` and `location` of 3 data resources: + * + *
+ * + * ```json + * { + * "mapDataList": + * [ + * { + * "udid": "9a1288fa-1858-4a3b-b68d-13a8j5af7d7c", + * "location": + * "https://us.atlas.microsoft.com/mapData/9a1288fa-1858-4a3b-b68d-13a8j5af7d7c?api-version=1.0", + * "sizeInBytes": 29920, + * "uploadStatus": "Completed" + * }, + * { + * "udid": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + * "location": + * "https://us.atlas.microsoft.com/mapData/8b1288fa-1958-4a2b-b68e-13a7i5af7d7c?api-version=1.0", + * "sizeInBytes": 1339, + * "uploadStatus": "Completed" + * }, + * { + * "udid": "7c1288fa-2058-4a1b-b68f-13a6h5af7d7c", + * "location": + * "https://us.atlas.microsoft.com/mapData/7c1288fa-2058-4a1b-b68f-13a6h5af7d7c?api-version=1.0", + * "sizeInBytes": 1650, + * "uploadStatus": "Pending" + * }] + * } + * ``` + * + *
+ * @param options The options parameters. + */ + listPreview( + options?: DataListPreviewOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Update API allows the caller to update a previously uploaded data content. + * + * You can use this API in a scenario like adding or removing geofences to or from an existing + * collection of geofences. + * Geofences are uploaded using the [Data Upload + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/uploadpreview), for + * use in the [Azure Maps Geofencing Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * Please note that the Update API will *replace* and *override* the existing data content. + * + * ## Submit Update Request + * + * To update your content you will use a `PUT` request. The request body will contain the new data that + * will replace + * the existing data. The `Content-Type` header will be set to the content type of the data, and the + * path will contain + * the `udid` of the data to be update. + * + * For example, to update a collection of geofences that were previously uploaded using the Upload API, + * place the new + * geofence content in the request body. Set the `udid` parameter in the path to the `udid` of the data + * received + * previously in the upload API response. And set the `Content-Type` header to one of the following + * media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for updating a simple Geofence. It's represented as a circle geometry + * using a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The previously uploaded geofence had a radius of 100m. The above request will update it to 500m. + * + * The Data Update API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Update Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param updateContent The new content that will update/replace the previously uploaded content. + * @param options The options parameters. + */ + beginUpdatePreview( + uniqueDataId: string, + updateContent: Record, + options?: DataUpdatePreviewOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DataUpdatePreviewResponse + > + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * The Data Update API allows the caller to update a previously uploaded data content. + * + * You can use this API in a scenario like adding or removing geofences to or from an existing + * collection of geofences. + * Geofences are uploaded using the [Data Upload + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/uploadpreview), for + * use in the [Azure Maps Geofencing Service](https://docs.microsoft.com/rest/api/maps/spatial). + * + * Please note that the Update API will *replace* and *override* the existing data content. + * + * ## Submit Update Request + * + * To update your content you will use a `PUT` request. The request body will contain the new data that + * will replace + * the existing data. The `Content-Type` header will be set to the content type of the data, and the + * path will contain + * the `udid` of the data to be update. + * + * For example, to update a collection of geofences that were previously uploaded using the Upload API, + * place the new + * geofence content in the request body. Set the `udid` parameter in the path to the `udid` of the data + * received + * previously in the upload API response. And set the `Content-Type` header to one of the following + * media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * Here's a sample request body for updating a simple Geofence. It's represented as a circle geometry + * using a center + * point and a radius. The sample below is in `GeoJSON`: + * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * + * The previously uploaded geofence had a radius of 100m. The above request will update it to 500m. + * + * The Data Update API performs a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * + * ## Data Update Limits + * + * Please, be aware that currently every Azure Maps account has a [data storage + * limit](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#azure-maps-limits). + * + * Once the storage limit is reached, all the new upload API calls will return a `409 Conflict` http + * error response. + * You can always use the [Data Delete + * API](https://docs.microsoft.com/rest/api/maps/data%20v2/deletepreview) to + * delete old/unused content and create space for new uploads. + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param updateContent The new content that will update/replace the previously uploaded content. + * @param options The options parameters. + */ + beginUpdatePreviewAndWait( + uniqueDataId: string, + updateContent: Record, + options?: DataUpdatePreviewOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * This API allows the caller to download a previously uploaded data content.
+ * You can use this API in a scenario like downloading an existing collection of geofences uploaded + * previously using the [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) for use in our [Azure + * Maps Geofencing Service](https://docs.microsoft.com/en-us/rest/api/maps/spatial). + * + * + * ### Submit Download Request + * + * To download your content you will use a `GET` request where the path will contain the `udid` of the + * data to download. Optionally, you can also pass in an `Accept` header to specify a preference for + * the `Content-Type` of the data response.
+ * For example, to download a collection of geofences previously uploaded using the Upload API, set the + * `udid` parameter in the path to the `udid` of the data received previously in the upload API + * response and set the `Accept` header to either one of the following media types: + * + * - `application/json` + * - `application/vnd.geo+json` + * - `application/octet-stream` + * + * + * ### Download Data Response + * + * The Download API will return a HTTP `200 OK` response if the data resource with the passed-in `udid` + * is found, where the response body will contain the content of the data resource.
+ * A HTTP `400 Bad Request` error response will be returned if the data resource with the passed-in + * `udid` is not found.
+ * + * Here's a sample response body for a simple geofence represented in `GeoJSON` uploaded previously + * using the Upload API: + *
+ * + * ```json + * { + * "type": "FeatureCollection", + * "features": [{ + * "type": "Feature", + * "geometry": { + * "type": "Point", + * "coordinates": [-122.126986, 47.639754] + * }, + * "properties": { + * "geometryId": "001", + * "radius": 500 + * } + * }] + * } + * ``` + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param options The options parameters. + */ + downloadPreview( + uniqueDataId: string, + options?: DataDownloadPreviewOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * This API allows the caller to delete a previously uploaded data content.
+ * You can use this API in a scenario like removing geofences previously uploaded using the [Data + * Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) for use in our + * [Azure Maps Geofencing Service](https://docs.microsoft.com/en-us/rest/api/maps/spatial). You can + * also use this API to delete old/unused uploaded content and create space for new content. + * + * + * ### Submit Delete Request + * + * To delete your content you will issue a `DELETE` request where the path will contain the `udid` of + * the data to delete.
+ * For example, to delete a collection of geofences previously uploaded using the Upload API, set the + * `udid` parameter in the path to the `udid` of the data received previously in the upload API + * response. + * + * + * ### Delete Data Response + * + * The Data Delete API returns a HTTP `204 No Content` response with an empty body, if the data + * resource was deleted successfully.
+ * A HTTP `400 Bad Request` error response will be returned if the data resource with the passed-in + * `udid` is not found. + * @param uniqueDataId The unique data id for the content. The `udid` must have been obtained from a + * successful [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data%20v2/uploadpreview) + * call. + * @param options The options parameters. + */ + deletePreview( + uniqueDataId: string, + options?: DataDeletePreviewOptionalParams + ): Promise; + /** + * This path will be obtained from a call to POST /mapData. While in progress, an http200 will be + * returned with no extra headers - followed by an http200 with Resource-Location header once + * completed. + * @param operationId The ID to query the status for the data upload request. + * @param options The options parameters. + */ + getOperationPreview( + operationId: string, + options?: DataGetOperationPreviewOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/dataset.ts b/sdk/maps/maps-creator/src/operationsInterfaces/dataset.ts new file mode 100644 index 000000000000..b957064d764b --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/dataset.ts @@ -0,0 +1,293 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DatasetDetailInfo, + DatasetListOptionalParams, + DatasetCreateOptionalParams, + DatasetCreateResponse, + DatasetGetOptionalParams, + DatasetGetResponse, + DatasetDeleteOptionalParams, + DatasetGetOperationOptionalParams, + DatasetGetOperationResponse +} from "../models"; + +/// +/** Interface representing a Dataset. */ +export interface Dataset { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created datasets. + * + * ### Submit List Request + * + * To list all your datasets, you will issue a `GET` request with no additional parameters. + * + * + * ### List Data Response + * + * The List API returns the complete list of all datasets in `json` format. The response contains the + * following fields (if they are not null or empty): + * > created - The timestamp the dataset was created. + * > datasetId - The id for the dataset. + * > description - The description for the dataset. + * > datasetSources - The source data that was used when the create request was issued. + * > ontology - The source + * [ontology](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) that was + * used in the conversion service for the input data.
+ * + * The `datasetSources` describes the source data that was used when the create request was issued and + * contains the following elements (if they are not null or empty): + * + * > conversionIds - The list of `conversionId` (null if none were provided). + * > appendDatasetId - The `datasetId` that was used for an append operation (null if none was used). + * >featureCounts - The counts for each feature type in the dataset.
+ * + * Here's a sample response returning the `timestamp`, `datasetId`, `description`, `datasetSources`, + * and `ontology` of 3 dataset resources: + * + * + * ```json + * { + * "datasets": [ + * { + * "timestamp": "2020-01-01T22:50:48.123Z", + * "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + * "description": "Some description or comment for the dataset.", + * "datasetSources": { + * "conversionIds": [ + * "15d21452-c9bb-27b6-5e79-743ca5c3205d" + * ], }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * }, + * { + * "timestamp": "2020-01-01T22:57:53.123Z", + * "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + * "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + * "datasetSources": { + * "conversionIds": [ + * "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + * ], + * "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + * }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * } + * ] + * } + * ``` + * @param options The options parameters. + */ + list( + options?: DatasetListOptionalParams + ): PagedAsyncIterableIterator; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to create a dataset from data that was uploaded to the Azure Maps Data + * Service and converted using the Azure Maps Conversion Service. + * + * You can use this API in a scenario like uploading a DWG zip package for a building, converting the + * zip package using the Azure Maps Conversion Service, and creating a dataset from the converted zip + * package. The created dataset can be used to create tilesets using the Azure Maps Tileset Service and + * can be queried via the Azure Maps WFS Service. + * + * ### Submit Create Request + * + * To create your dataset, you will use a `POST` request where the `conversionId` query parameter is an + * ID that represents the converted DWG zip package, the `datasetId` parameter will be the ID of a + * previously created dataset to append with the current dataset and, optionally, the `description` + * query parameter will contain a description (if description is not provided a default description + * will be given). + * + * The Create API is a [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param conversionId The unique ID used to create the dataset. The `conversionId` must have been + * obtained from a successful call to the Conversion Service Convert API and may be provided with + * multiple query parameters with same name (if more than one is provided). + * @param options The options parameters. + */ + beginCreate( + conversionId: string, + options?: DatasetCreateOptionalParams + ): Promise< + PollerLike, DatasetCreateResponse> + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to create a dataset from data that was uploaded to the Azure Maps Data + * Service and converted using the Azure Maps Conversion Service. + * + * You can use this API in a scenario like uploading a DWG zip package for a building, converting the + * zip package using the Azure Maps Conversion Service, and creating a dataset from the converted zip + * package. The created dataset can be used to create tilesets using the Azure Maps Tileset Service and + * can be queried via the Azure Maps WFS Service. + * + * ### Submit Create Request + * + * To create your dataset, you will use a `POST` request where the `conversionId` query parameter is an + * ID that represents the converted DWG zip package, the `datasetId` parameter will be the ID of a + * previously created dataset to append with the current dataset and, optionally, the `description` + * query parameter will contain a description (if description is not provided a default description + * will be given). + * + * The Create API is a [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param conversionId The unique ID used to create the dataset. The `conversionId` must have been + * obtained from a successful call to the Conversion Service Convert API and may be provided with + * multiple query parameters with same name (if more than one is provided). + * @param options The options parameters. + */ + beginCreateAndWait( + conversionId: string, + options?: DatasetCreateOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a previously successfully created dataset. + * + * ### Submit Get Details Request + * + * To get the details for a previously created dataset, you will issue a `GET` request with the + * `datasetId` in the path. + * + * ### Get Details Response + * + * The Get Details API returns the details for a dataset in `json` format. The response contains the + * following fields (if they are not null or empty): + * > created - The timestamp the dataset was created. + * > datasetId - The id for the dataset. + * > description - The description for the dataset. + * > datasetSources - The source data that was used when the create request was issued. + * > ontology - The source + * [ontology](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) that was + * used in the conversion service for the input data.
+ * + * The `datasetSources` describes the source data that was used when the create request was issued and + * contains the following elements (if they are not null or empty): + * > conversionIds - The list of `conversionId` (null if none were provided). + * > appendDatasetId - The `datasetId` that was used for an append operation (null if none was used). + * >featureCounts - The counts for each feature type in the dataset.
+ * + * Here's a sample response returning the `timestamp`, `datasetId`, `description`, `datasetSources`, + * and `ontology` of a dataset resource: + * + * ```json + * { + * "timestamp": "2020-01-01T22:50:48.123Z", + * "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + * "description": "Some description or comment for the dataset.", + * "datasetSources": { + * "conversionIds": [ + * "15d21452-c9bb-27b6-5e79-743ca5c3205d" + * ], + * }, + * "ontology": "facility-2.0", + * "featureCounts": { + * "directoryInfo": 2, + * "category": 10, + * "facility": 1, + * "level": 3, + * "unit": 183, + * "zone": 3, + * "verticalPenetration": 6, + * "opening": 48, + * "areaElement": 108 + * } + * } + * ``` + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + get( + datasetId: string, + options?: DatasetGetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * You can also use this API to delete old/unused datasets to create space for new Creator content. + * + * ### Submit Delete Request + * + * To delete your content you will issue a `DELETE` request where the path will contain the `datasetId` + * of the dataset to delete. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + delete( + datasetId: string, + options?: DatasetDeleteOptionalParams + ): Promise; + /** + * This API allows the caller to view the current progress of a dataset operation and the path is + * obtained from a call to the Create API. + * + * ### Submit Operations Request + * + * To view the current progress of a dataset operation, you will use a `GET` request where the + * `operationId` given the path is the ID that represents the operation. + * + * ### Operation Response + * + * While in progress, a `200-OK` http status code will be returned with no extra headers. If the + * operation succeeds, a `200-OK` http status code with Resource-Location header will be returned. + * @param operationId The ID to query the status for the dataset create/import request. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: DatasetGetOperationOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/featureState.ts b/sdk/maps/maps-creator/src/operationsInterfaces/featureState.ts new file mode 100644 index 000000000000..3369ef6123e4 --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/featureState.ts @@ -0,0 +1,195 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + StatesetInfoObject, + FeatureStateListStatesetOptionalParams, + StylesObject, + FeatureStateCreateStatesetOptionalParams, + FeatureStateCreateStatesetResponse, + FeatureStatePutStatesetOptionalParams, + FeatureStateDeleteStatesetOptionalParams, + FeatureStateGetStatesetOptionalParams, + FeatureStateGetStatesetResponse, + FeatureStatesStructure, + FeatureStateUpdateStatesOptionalParams, + FeatureStateDeleteStateOptionalParams, + FeatureStateGetStatesOptionalParams, + FeatureStateGetStatesResponse +} from "../models"; + +/// +/** Interface representing a FeatureState. */ +export interface FeatureState { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all previously successfully created statesets. + * @param options The options parameters. + */ + listStateset( + options?: FeatureStateListStatesetOptionalParams + ): PagedAsyncIterableIterator; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This POST API allows the user to create a new Stateset and define stateset style using request body. + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. The Feature State API is part of Creator. + * + * The Feature State service allows the user to update the states of a feature and query them to be + * used in other services. The dynamic properties of a feature that don't belong to the dataset are + * referred to as *states* here. + * + * This Feature State service pivot on the Stateset. Like Tileset, Stateset encapsulates the storage + * mechanism for feature states for a dataset. + * + * Once the stateset is created, users can use that statesetId to post feature state updates and + * retrieve the current feature states. A feature can have only one state at a given point in time. + * + * Feature state is defined by the key name, value and the timestamp. When a feature state update is + * posted to Azure Maps, the state value gets updated only if the provided state’s timestamp is later + * than the stored timestamp. + * + * Azure Maps MapControl provides a way to use these feature states to style the features. Please refer + * to the State Tile documentation for more information. + * @param datasetId The datasetId must have been obtained from a successful [Dataset Create + * API](https://docs.microsoft.com/en-us/rest/api/maps/v2/dataset/create) call. + * @param statesetCreateRequestBody The stateset style JSON data. + * @param options The options parameters. + */ + createStateset( + datasetId: string, + statesetCreateRequestBody: StylesObject, + options?: FeatureStateCreateStatesetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This PUT API allows the user to update the stateset style rules. + * @param statesetId The stateset id that was created. + * @param statesetStyleUpdateRequestBody The stateset style JSON data. Only style rules are allowed to + * be updated, update on keyname and type is not allowed. + * @param options The options parameters. + */ + putStateset( + statesetId: string, + statesetStyleUpdateRequestBody: StylesObject, + options?: FeatureStatePutStatesetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This DELETE API allows the user to delete the stateset and the associated data. + * @param statesetId The stateset id that was created. + * @param options The options parameters. + */ + deleteStateset( + statesetId: string, + options?: FeatureStateDeleteStatesetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This GET API allows the user to get the stateset Information. + * + * The stateset Information includes the datasetId associated to the stateset, and the styles of that + * stateset. + * @param statesetId The stateset id that was created. + * @param options The options parameters. + */ + getStateset( + statesetId: string, + options?: FeatureStateGetStatesetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This PUT API allows the user to update the state of the given feature in the given stateset. + * @param statesetId The stateset id that was created. + * @param featureId The id of a feature in the given dataset. If the featureId is not present in the + * dataset, Bad Request response will be returned. + * @param featureStateUpdateRequestBody The feature state JSON data. A feature can have only one state + * at a given point in time. The specified state keyname must have been defined during the stateset + * creation. + * @param options The options parameters. + */ + updateStates( + statesetId: string, + featureId: string, + featureStateUpdateRequestBody: FeatureStatesStructure, + options?: FeatureStateUpdateStatesOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API deletes the state information identified by the StateKeyName parameter for the feature + * identified by the FeatureId parameter in the the stateset. + * @param statesetId The stateset id that was created. + * @param featureId The id of a feature in the given stateset. If no state was set for the featureId in + * the stateset earlier, Bad Request response will be returned. + * @param stateKeyName The Name of the state to be deleted. + * @param options The options parameters. + */ + deleteState( + statesetId: string, + featureId: string, + stateKeyName: string, + options?: FeatureStateDeleteStateOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API returns the current state information associated with the given feature in the given + * stateset. + * @param statesetId The stateset id that was created. + * @param featureId The id of a feature in the given stateset. If no state was set for the featureId in + * the stateset earlier, Bad Request response will be returned. + * @param options The options parameters. + */ + getStates( + statesetId: string, + featureId: string, + options?: FeatureStateGetStatesOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/index.ts b/sdk/maps/maps-creator/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..7fe2a1f1d8c6 --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./alias"; +export * from "./data"; +export * from "./dataset"; +export * from "./conversion"; +export * from "./featureState"; +export * from "./spatial"; +export * from "./tileset"; +export * from "./wfs"; diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/spatial.ts b/sdk/maps/maps-creator/src/operationsInterfaces/spatial.ts new file mode 100644 index 000000000000..f8b9ea8d2108 --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/spatial.ts @@ -0,0 +1,338 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + ResponseFormat, + SpatialGetGeofenceOptionalParams, + SpatialGetGeofenceResponse, + SpatialPostGeofenceOptionalParams, + SpatialPostGeofenceResponse, + BufferRequestBody, + SpatialPostBufferOptionalParams, + SpatialPostBufferResponse, + SpatialGetBufferOptionalParams, + SpatialGetBufferResponse, + SpatialPostClosestPointOptionalParams, + SpatialPostClosestPointResponse, + SpatialGetClosestPointOptionalParams, + SpatialGetClosestPointResponse, + SpatialPostPointInPolygonOptionalParams, + SpatialPostPointInPolygonResponse, + SpatialGetPointInPolygonOptionalParams, + SpatialGetPointInPolygonResponse, + SpatialGetGreatCircleDistanceOptionalParams, + SpatialGetGreatCircleDistanceResponse +} from "../models"; + +/** Interface representing a Spatial. */ +export interface Spatial { + /** + * **Search Geofence Get API** + * + * **Applies to:** S1 Pricing tier. + * + * The Geofence Get API allows you to retrieve the proximity of a coordinate to a + * geofence that has been uploaded to the Data service. You can use the + * [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) to upload + * a geofence or set of fences. See [Geofencing GeoJSON + * data](https://docs.microsoft.com/en-us/azure/azure-maps/geofence-geojson) + * for more details on the geofence data format. To query the proximity of a coordinate, you supply the + * location of the object you are tracking as well + * as the ID for the fence or set of fences, and the response will contain information about + * the distance from the outer edge of the geofence. A negative value signifies that the + * coordinate is inside of the fence while a positive value means that it is outside of the + * fence.

This API can be used for a variety of scenarios that include things like asset + * tracking, fleet management, or setting up alerts for moving objects. + * + * The API supports [integration with Event + * Grid](https://docs.microsoft.com/azure/azure-maps/azure-maps-event-grid-integration). The isAsync + * parameter is used to enable integration with Event Grid (disabled by default). + * To test this API, you can upload the sample data from Post Geofence API examples(Request Body) via + * Data Upload API and replace the [udid] from the sample request below with the udid returned by Data + * Upload API. + * + * + * ### Geofencing InnerError code + * + * In geofencing response error contract, `innererror` is an object containing service specific + * information about the error. `code` is a property in `innererror` which can map to a specific + * geofencing error type. The table belows shows the code mapping between all the known client error + * type to the corresponding geofencing error `message`. + * + * innererror.code | error.message + * ---------------------------- | -------------------------------------- + * NullDeviceId | Device Id should not be null. + * NullUdid | Udid should not be null. + * UdidWrongFormat| Udid should be acquired from user data ingestion API. + * InvalidUserTime| Usertime is invalid. + * InvalidSearchBuffer| Searchbuffer is invalid. + * InvalidSearchRange| The value range of searchbuffer should be from 0 to 500 meters. + * InvalidLatLon| Lat and/or lon parameters are invalid. + * InvalidIsAsyncValue| The IsAsync parameter is invalid. + * InvalidModeValue| The mode parameter invalid. + * InvalidJson| Geofencing data is not a valid json file. + * NotSupportedGeoJson| Geofencing data can't be read as a Feature or FeatureCollections. + * InvalidGeoJson| Geofencing data is invalid. + * NoUserDataWithAccountOrSubscription| Can't find user geofencing data with provided account-id and/or + * subscription-id. + * NoUserDataWithUdid| Can't find user geofencing data with provided udid. + * @param format Desired format of the response. Only `json` format is supported. + * @param deviceId ID of the device + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param options The options parameters. + */ + getGeofence( + format: ResponseFormat, + deviceId: string, + udid: string, + latitude: number, + longitude: number, + options?: SpatialGetGeofenceOptionalParams + ): Promise; + /** + * **Search Geofence Post API** + * **Applies to:** S1 Pricing tier. + * The Geofence Post API allows you to retrieve the proximity of a coordinate to a provided geofence + * or set of fences. With POST call, you do not have to upload the fence data in advance, instead you + * supply the location of the object you are tracking in query parameters as well as the fence or set + * of fences data in post request body. See [Geofencing GeoJSON + * data](https://docs.microsoft.com/en-us/azure/azure-maps/geofence-geojson) for more details on the + * geofence data format. The response will contain information about the distance from the outer edge + * of the geofence. A negative value signifies that the coordinate is inside of the fence while a + * positive value means that it is outside of the fence.

This API can be used for a variety of + * scenarios that include things like asset tracking, fleet management, or setting up alerts for + * moving objects. + * + * The API supports [integration with Event + * Grid](https://docs.microsoft.com/azure/azure-maps/azure-maps-event-grid-integration). The isAsync + * parameter is used to enable integration with Event Grid (disabled by default). + * @param format Desired format of the response. Only `json` format is supported. + * @param deviceId ID of the device + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param searchGeofenceRequestBody The geofencing GeoJSON data. + * @param options The options parameters. + */ + postGeofence( + format: ResponseFormat, + deviceId: string, + latitude: number, + longitude: number, + searchGeofenceRequestBody: Record, + options?: SpatialPostGeofenceOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a FeatureCollection where each Feature is a buffer around the corresponding indexed + * Feature of the input. The buffer could be either on the outside or the inside of the provided + * Feature, depending on the distance provided in the input. There must be either one distance provided + * per Feature in the FeatureCollection input, or if only one distance is provided, then that distance + * is applied to every Feature in the collection. The positive (or negative) buffer of a geometry is + * defined as the Minkowski sum (or difference) of the geometry with a circle of radius equal to the + * absolute value of the buffer distance. The buffer API always returns a polygonal result. The + * negative or zero-distance buffer of lines and points is always an empty polygon. The input may + * contain a collection of Point, MultiPoint, Polygon, MultiPolygon, LineString and MultiLineString. + * GeometryCollection will be ignored if provided. + * @param format Desired format of the response. Only `json` format is supported. + * @param bufferRequestBody The FeatureCollection and the list of distances (one per feature or one for + * all features). + * @param options The options parameters. + */ + postBuffer( + format: ResponseFormat, + bufferRequestBody: BufferRequestBody, + options?: SpatialPostBufferOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a FeatureCollection where each Feature is a buffer around the corresponding indexed + * Feature of the input. The buffer could be either on the outside or the inside of the provided + * Feature, depending on the distance provided in the input. There must be either one distance provided + * per Feature in the FeatureCollection input, or if only one distance is provided, then that distance + * is applied to every Feature in the collection. The positive (or negative) buffer of a geometry is + * defined as the Minkowski sum (or difference) of the geometry with a circle of radius equal to the + * absolute value of the buffer distance. The buffer API always returns a polygonal result. The + * negative or zero-distance buffer of lines and points is always an empty polygon. The input features + * are provided by a GeoJSON file which is uploaded via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and referenced by a unique + * udid. The GeoJSON file may contain a collection of Point, MultiPoint, Polygon, MultiPolygon, + * LineString and MultiLineString. GeometryCollection will be ignored if provided. + * + * To test this API, you can upload the sample data from [Post Buffer + * API](https://docs.microsoft.com/en-us/rest/api/maps/spatial/postbuffer#examples) examples(Request + * Body without distances array) via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and replace the [udid] from + * the [sample request + * below](https://docs.microsoft.com/en-us/rest/api/maps/spatial/getbuffer#examples) with the udid + * returned by Data Upload API. + * @param format Desired format of the response. Only `json` format is supported. + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param distances The list of distances (one per feature or one for all features), delimited by + * semicolons. For example, 12.34;-56.78. Positive distance will generate a buffer outside of the + * feature, whereas negative distance will generate a buffer inside of the feature. If the negative + * distance larger than the geometry itself, an empty polygon will be returned. + * @param options The options parameters. + */ + getBuffer( + format: ResponseFormat, + udid: string, + distances: string, + options?: SpatialGetBufferOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API returns the closest point between a base point and a given set of target points. The set of + * target points is provided by user data in post request body. The user data may only contain a + * collection of Point geometry. MultiPoint or other geometries will be ignored if provided. The + * algorithm does not take into account routing or traffic. The maximum number of points accepted is + * 100,000. Information returned includes closest point latitude, longitude, and distance in meters + * from the closest point. + * @param format Desired format of the response. Only `json` format is supported. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param closestPointRequestBody The FeatureCollection of Point geometries from which closest point to + * source point should be determined. All the feature's properties should contain `geometryId`, which + * is used for identifying the geometry and is case-sensitive. + * @param options The options parameters. + */ + postClosestPoint( + format: ResponseFormat, + latitude: number, + longitude: number, + closestPointRequestBody: Record, + options?: SpatialPostClosestPointOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API returns the closest point between a base point and a given set of points in the user + * uploaded data set identified by udid. The set of target points is provided by a GeoJSON file which + * is uploaded via [Data Upload API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) + * and referenced by a unique udid. The GeoJSON file may only contain a collection of Point geometry. + * MultiPoint or other geometries will be ignored if provided. The maximum number of points accepted is + * 100,000. The algorithm does not take into account routing or traffic. Information returned includes + * closest point latitude, longitude, and distance in meters from the closest point. + * + * To test this API, you can upload the sample data from [Post Closest Point + * API](https://docs.microsoft.com/en-us/rest/api/maps/spatial/postclosestpoint#examples) + * examples(Request Body) via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and replace the [udid] from + * the [sample request + * below](https://docs.microsoft.com/en-us/rest/api/maps/spatial/getclosestpoint#examples) with the + * udid returned by Data Upload API. + * @param format Desired format of the response. Only `json` format is supported. + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param options The options parameters. + */ + getClosestPoint( + format: ResponseFormat, + udid: string, + latitude: number, + longitude: number, + options?: SpatialGetClosestPointOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a boolean value indicating whether a point is inside a set of polygons. The user + * data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if provided. + * If the point is inside or on the boundary of one of these polygons, the value returned is true. In + * all other cases, the value returned is false. When the point is inside multiple polygons, the result + * will give intersecting geometries section to show all valid geometries (referenced by geometryId) in + * user data. The maximum number of vertices accepted to form a Polygon is 10,000. + * @param format Desired format of the response. Only `json` format is supported. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param pointInPolygonRequestBody A FeatureCollection with a set of Polygon/MultiPolygon geometries. + * The maximum number of vertices accepted to form a Polygon is 10,000. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param options The options parameters. + */ + postPointInPolygon( + format: ResponseFormat, + latitude: number, + longitude: number, + pointInPolygonRequestBody: Record, + options?: SpatialPostPointInPolygonOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API returns a boolean value indicating whether a point is inside a set of polygons. The set of + * polygons is provided by a GeoJSON file which is uploaded via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and referenced by a unique + * udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries will be + * ignored if provided. If the point is inside or on the boundary of one of these polygons, the value + * returned is true. In all other cases, the value returned is false. When the point is inside multiple + * polygons, the result will give intersecting geometries section to show all valid + * geometries(referenced by geometryId) in user data. The maximum number of vertices accepted to form a + * Polygon is 10,000. + * + * + * To test this API, you can upload the sample data from [Post Point In Polygon + * API](https://docs.microsoft.com/en-us/rest/api/maps/spatial/postpointinpolygon#examples) + * examples(Request Body) via [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) and replace the [udid] from + * the [sample request + * below](https://docs.microsoft.com/en-us/rest/api/maps/spatial/getpointinpolygon#examples) with the + * udid returned by Data Upload API. + * @param format Desired format of the response. Only `json` format is supported. + * @param udid The unique id returned from [Data Upload + * API](https://docs.microsoft.com/en-us/rest/api/maps/data/uploadPreview) after uploading a valid + * GeoJSON FeatureCollection object. Please refer to [RFC + * 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. All the feature's properties + * should contain `geometryId`, which is used for identifying the geometry and is case-sensitive. + * @param latitude The latitude of the location being passed. Example: 48.36. + * @param longitude The longitude of the location being passed. Example: -124.63. + * @param options The options parameters. + */ + getPointInPolygon( + format: ResponseFormat, + udid: string, + latitude: number, + longitude: number, + options?: SpatialGetPointInPolygonOptionalParams + ): Promise; + /** + * **Applies to**: S1 pricing tier. + * + * This API will return the great-circle or shortest distance between two points on the surface of a + * sphere, measured along the surface of the sphere. This differs from calculating a straight line + * through the sphere's interior. This method is helpful for estimating travel distances for airplanes + * by calculating the shortest distance between airports. + * @param format Desired format of the response. Only `json` format is supported. + * @param query The Coordinates through which the distance is calculated, delimited by a colon. Two + * coordinates are required. The first one is the source point coordinate and the last is the target + * point coordinate. For example, 47.622942,122.316456:57.673988,127.121513 + * @param options The options parameters. + */ + getGreatCircleDistance( + format: ResponseFormat, + query: string, + options?: SpatialGetGreatCircleDistanceOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/tileset.ts b/sdk/maps/maps-creator/src/operationsInterfaces/tileset.ts new file mode 100644 index 000000000000..4cd641b7226b --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/tileset.ts @@ -0,0 +1,179 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + TilesetDetailInfo, + TilesetListOptionalParams, + TilesetCreateOptionalParams, + TilesetCreateResponse, + TilesetGetOptionalParams, + TilesetGetResponse, + TilesetDeleteOptionalParams, + TilesetGetOperationOptionalParams, + TilesetGetOperationResponse +} from "../models"; + +/// +/** Interface representing a Tileset. */ +export interface Tileset { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a list of all tilesets created. + *
+ * @param options The options parameters. + */ + list( + options?: TilesetListOptionalParams + ): PagedAsyncIterableIterator; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * [This](https://docs.microsoft.com/en-us/azure/azure-maps/creator-indoor-maps) article introduces + * concepts and tools that apply to Azure Maps Creator. + * + * The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains a + * set of tiles that can be consumed + * from the [Get Map Tile](/rest/api/maps/render/getmaptile) to retrieve custom tiles. To make a + * dataset, use the + * [DataSet Create API](/rest/api/maps/dataset/createpreview). + * + * ## Submit Create Request + * + * To create your tileset you will make a `POST` request with an empty body. The `datasetId` query + * parameter will be + * used as the source of the tileset data. + * + * The Create Tileset API is a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param datasetId The unique `datasetId` that the tileset create API uses to retrieve features to + * generate tiles. The `datasetId` must have been obtained from a successful [Dataset Create + * API](/en-us/rest/api/maps/dataset/createpreview) call. + * @param options The options parameters. + */ + beginCreate( + datasetId: string, + options?: TilesetCreateOptionalParams + ): Promise< + PollerLike, TilesetCreateResponse> + >; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * [This](https://docs.microsoft.com/en-us/azure/azure-maps/creator-indoor-maps) article introduces + * concepts and tools that apply to Azure Maps Creator. + * + * The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains a + * set of tiles that can be consumed + * from the [Get Map Tile](/rest/api/maps/render/getmaptile) to retrieve custom tiles. To make a + * dataset, use the + * [DataSet Create API](/rest/api/maps/dataset/createpreview). + * + * ## Submit Create Request + * + * To create your tileset you will make a `POST` request with an empty body. The `datasetId` query + * parameter will be + * used as the source of the tileset data. + * + * The Create Tileset API is a + * [long-running request](https://aka.ms/am-creator-lrt-v2). + * @param datasetId The unique `datasetId` that the tileset create API uses to retrieve features to + * generate tiles. The `datasetId` must have been obtained from a successful [Dataset Create + * API](/en-us/rest/api/maps/dataset/createpreview) call. + * @param options The options parameters. + */ + beginCreateAndWait( + datasetId: string, + options?: TilesetCreateOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to fetch a tileset. + * @param tilesetId The Tileset Id + * @param options The options parameters. + */ + get( + tilesetId: string, + options?: TilesetGetOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * This API allows the caller to delete a created tileset.
+ * You can use this API if a tileset is no longer needed. + * + * ### Submit Delete Request + * + * To delete your content you will issue a `DELETE` request where the path will contain the `tilesetId` + * of the tileset to delete.
+ * + * #### Delete request "Successful" + * + * The Tileset Delete API returns a HTTP `204 No Content` response with an empty body, if the tileset + * was deleted successfully.
+ * + * #### Delete request "Failed" + * + * A HTTP `400 Bad Request` error response will be returned if the tileset with the passed-in + * `tilesetId` is not found. + * + * Here is a sample error response: + * + *
+ * + * ```json + * { + * "error": { + * "code": "400 BadRequest", + * "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce does not exist." + * } + * } + * ``` + * @param tilesetId The Tileset Id + * @param options The options parameters. + */ + delete( + tilesetId: string, + options?: TilesetDeleteOptionalParams + ): Promise; + /** + * This path will be obtained from a call to /tilesets/create. While in progress, an http200 will be + * returned with no extra headers - followed by an http200 with Resource-Location header once + * successfully completed. + * @param operationId The ID to query the status for the dataset create/import request. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: TilesetGetOperationOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/src/operationsInterfaces/wfs.ts b/sdk/maps/maps-creator/src/operationsInterfaces/wfs.ts new file mode 100644 index 000000000000..2b75fedfc1d2 --- /dev/null +++ b/sdk/maps/maps-creator/src/operationsInterfaces/wfs.ts @@ -0,0 +1,211 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + WfsGetLandingPageOptionalParams, + WfsGetLandingPageResponse, + WfsGetConformanceOptionalParams, + WfsGetConformanceResponse, + WfsGetCollectionsOptionalParams, + WfsGetCollectionsResponse, + WfsGetCollectionOptionalParams, + WfsGetCollectionResponse, + WfsGetCollectionDefinitionOptionalParams, + WfsGetCollectionDefinitionResponse, + WfsGetFeaturesOptionalParams, + WfsGetFeaturesResponse, + WfsGetFeatureOptionalParams, + WfsGetFeatureResponse, + WfsDeleteFeatureOptionalParams +} from "../models"; + +/** Interface representing a Wfs. */ +export interface Wfs { + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Landing Page API provides links to the API definition, the Conformance statements and the + * metadata about the feature data in this dataset. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + getLandingPage( + datasetId: string, + options?: WfsGetLandingPageOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Requirements Classes lists all requirements classes specified in the standard that the + * server conforms to. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + getConformance( + datasetId: string, + options?: WfsGetConformanceOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Collections Description API provides descriptions of all the collections in a given dataset. + * @param datasetId The identifier for the dataset to query from. + * @param options The options parameters. + */ + getCollections( + datasetId: string, + options?: WfsGetCollectionsOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * + * The Collection Description API provides the description of a given collection. It includes the links + * to the operations that can be performed on the collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param options The options parameters. + */ + getCollection( + datasetId: string, + collectionId: string, + options?: WfsGetCollectionOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * [This](https://docs.microsoft.com/en-us/azure/azure-maps/creator-indoor-maps) article introduces + * concepts and tools that apply to Azure Maps Creator. WFS API follows the [Open Geospatial Consortium + * API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to query + * [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * + * The Collection Definition API provides the detailed data model of a given collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param options The options parameters. + */ + getCollectionDefinition( + datasetId: string, + collectionId: string, + options?: WfsGetCollectionDefinitionOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Features API returns the list of features in the given collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param options The options parameters. + */ + getFeatures( + datasetId: string, + collectionId: string, + options?: WfsGetFeaturesOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Get Feature API returns the feature identified by the provided id in the given collection. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param featureId Local identifier of a specific feature + * @param options The options parameters. + */ + getFeature( + datasetId: string, + collectionId: string, + featureId: string, + options?: WfsGetFeatureOptionalParams + ): Promise; + /** + * **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + * + * Creator makes it possible to develop applications based on your private indoor map data using Azure + * Maps API and SDK. [This](https://docs.microsoft.com/azure/azure-maps/creator-indoor-maps) article + * introduces concepts and tools that apply to Azure Maps Creator. + * + * The Web Feature Service (WFS) API is part of Creator. WFS API follows the [Open Geospatial + * Consortium API standard for Features](http://docs.opengeospatial.org/is/17-069r3/17-069r3.html) to + * query [Datasets](https://docs.microsoft.com/en-us/rest/api/maps/dataset/createpreview). + * A dataset consists of multiple feature collections. A feature collection is a collection of features + * of a similar type, based on a common schema. + * The Delete Feature API deletes the feature identified by the provided id in the given collection. At + * this point this API supports only facility features. Deleting a facility feature deletes all the + * child features of that facility recursively. + * @param datasetId The identifier for the dataset to query from. + * @param collectionId Identifier (name) of a specific collection + * @param featureId Local identifier of a specific feature + * @param options The options parameters. + */ + deleteFeature( + datasetId: string, + collectionId: string, + featureId: string, + options?: WfsDeleteFeatureOptionalParams + ): Promise; +} diff --git a/sdk/maps/maps-creator/tsconfig.json b/sdk/maps/maps-creator/tsconfig.json new file mode 100644 index 000000000000..0ec8659c8e83 --- /dev/null +++ b/sdk/maps/maps-creator/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "preserveConstEnums": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +}