From 8fc401ea6c5bb20beaca8a36153f6568d180503c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 26 Oct 2021 20:46:24 +0000 Subject: [PATCH] CodeGen from PR 16331 in Azure/azure-rest-api-specs Merge 93b4af56110ad6514cdb1ffc42aa670b2af9f399 into 5be67b415ccf8b1d7a0e62558c110c3e69d63e6c --- .../src/Generated/AliasOperations.cs | 1067 ++++++++ .../Generated/AliasOperationsExtensions.cs | 279 ++ .../src/Generated/ConversionOperations.cs | 1076 ++++++++ .../ConversionOperationsExtensions.cs | 277 ++ .../src/Generated/CreatorClient.cs | 270 ++ .../Azure.Maps.Creator/src/Generated/Data.cs | 1452 +++++++++++ .../src/Generated/DataExtensions.cs | 431 ++++ .../src/Generated/DatasetOperations.cs | 1145 +++++++++ .../Generated/DatasetOperationsExtensions.cs | 339 +++ .../src/Generated/FeatureStateOperations.cs | 1527 +++++++++++ .../FeatureStateOperationsExtensions.cs | 290 +++ .../src/Generated/IAliasOperations.cs | 308 +++ .../src/Generated/IConversionOperations.cs | 305 +++ .../src/Generated/ICreatorClient.cs | 100 + .../Azure.Maps.Creator/src/Generated/IData.cs | 461 ++++ .../src/Generated/IDatasetOperations.cs | 370 +++ .../src/Generated/IFeatureStateOperations.cs | 331 +++ .../src/Generated/ISpatial.cs | 549 ++++ .../src/Generated/ITilesetOperations.cs | 226 ++ .../Azure.Maps.Creator/src/Generated/IWFS.cs | 411 +++ .../src/Generated/Models/Alias.cs | 80 + .../Generated/Models/AliasCreateHeaders.cs | 53 + .../src/Generated/Models/AliasListResult.cs | 64 + .../src/Generated/Models/BooleanRule.cs | 80 + .../src/Generated/Models/BooleanStyleRule.cs | 72 + .../src/Generated/Models/BufferRequestBody.cs | 78 + .../src/Generated/Models/BufferResult.cs | 71 + .../src/Generated/Models/BufferSummary.cs | 57 + .../src/Generated/Models/ClosestPoint.cs | 68 + .../Generated/Models/ClosestPointResponse.cs | 59 + .../Generated/Models/ClosestPointSummary.cs | 66 + .../src/Generated/Models/Collection.cs | 111 + .../Generated/Models/CollectionDefinition.cs | 169 ++ .../Generated/Models/CollectionsResponse.cs | 103 + .../src/Generated/Models/ConformanceResult.cs | 66 + .../src/Generated/Models/Conversion.cs | 97 + .../Models/ConversionConvertHeaders.cs | 63 + .../Models/ConversionGetOperationHeaders.cs | 55 + .../Generated/Models/ConversionListResult.cs | 63 + .../Generated/Models/DataDownloadHeaders.cs | 52 + .../src/Generated/Models/DataFormat.cs | 33 + .../Models/DataGetOperationHeaders.cs | 53 + .../src/Generated/Models/DataUpdateHeaders.cs | 63 + .../src/Generated/Models/DataUploadHeaders.cs | 63 + .../src/Generated/Models/Dataset.cs | 89 + .../Generated/Models/DatasetCreateHeaders.cs | 63 + .../Models/DatasetGetOperationHeaders.cs | 53 + .../src/Generated/Models/DatasetListResult.cs | 64 + .../src/Generated/Models/DatasetSources.cs | 65 + .../Generated/Models/DefinitionProperty.cs | 82 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorDetail.cs | 85 + .../src/Generated/Models/ErrorResponse.cs | 56 + .../Models/ErrorResponseException.cs | 62 + .../ExtendedGeoJsonFeatureCollection.cs | 136 + .../ExtendedGeoJsonFeatureCollectionData.cs | 66 + .../src/Generated/Models/FeatureState.cs | 73 + .../Models/FeatureStatesStructure.cs | 53 + .../src/Generated/Models/GeoJsonFeature.cs | 117 + .../Models/GeoJsonFeatureCollection.cs | 101 + .../Models/GeoJsonFeatureCollectionData.cs | 77 + .../Generated/Models/GeoJsonFeatureData.cs | 91 + .../src/Generated/Models/GeoJsonGeometry.cs | 39 + .../Models/GeoJsonGeometryCollection.cs | 72 + .../Models/GeoJsonGeometryCollectionData.cs | 70 + .../Generated/Models/GeoJsonGeometryType.cs | 48 + .../src/Generated/Models/GeoJsonLineString.cs | 69 + .../Generated/Models/GeoJsonLineStringData.cs | 65 + .../Models/GeoJsonMultiLineString.cs | 70 + .../Models/GeoJsonMultiLineStringData.cs | 66 + .../src/Generated/Models/GeoJsonMultiPoint.cs | 69 + .../Generated/Models/GeoJsonMultiPointData.cs | 68 + .../Generated/Models/GeoJsonMultiPolygon.cs | 72 + .../Models/GeoJsonMultiPolygonData.cs | 68 + .../src/Generated/Models/GeoJsonObject.cs | 36 + .../src/Generated/Models/GeoJsonObjectType.cs | 129 + .../src/Generated/Models/GeoJsonPoint.cs | 66 + .../src/Generated/Models/GeoJsonPointData.cs | 65 + .../src/Generated/Models/GeoJsonPolygon.cs | 69 + .../Generated/Models/GeoJsonPolygonData.cs | 65 + .../src/Generated/Models/Geofence.cs | 93 + .../src/Generated/Models/GeofenceGeometry.cs | 139 + .../src/Generated/Models/GeofenceMode.cs | 30 + .../Models/GeographicResourceLocation.cs | 28 + .../src/Generated/Models/GetFeatureResult.cs | 90 + .../Generated/Models/GetLandingPageResult.cs | 80 + .../Models/GreatCircleDistanceResult.cs | 62 + .../Models/GreatCircleDistanceSummary.cs | 55 + .../Models/LatLongPairAbbreviated.cs | 60 + .../src/Generated/Models/ListTilesetResult.cs | 63 + .../Models/LongRunningOperationResult.cs | 83 + .../src/Generated/Models/LroStatus.cs | 36 + .../src/Generated/Models/MapData.cs | 97 + .../src/Generated/Models/MapDataListResult.cs | 55 + .../src/Generated/Models/NumberRule.cs | 68 + .../src/Generated/Models/NumberStyleRule.cs | 72 + .../Generated/Models/PointInPolygonResult.cs | 70 + .../Generated/Models/PointInPolygonSummary.cs | 68 + .../src/Generated/Models/Position.cs | 73 + .../src/Generated/Models/Range.cs | 78 + .../Models/SpatialGetGeofenceHeaders.cs | 56 + .../Models/SpatialPostGeofenceHeaders.cs | 56 + .../src/Generated/Models/Stateset.cs | 69 + .../Generated/Models/StatesetCreatedResult.cs | 52 + .../src/Generated/Models/StatesetInfo.cs | 58 + .../Generated/Models/StatesetListResult.cs | 62 + .../src/Generated/Models/StringStyleRule.cs | 72 + .../src/Generated/Models/StyleRule.cs | 70 + .../src/Generated/Models/StyleRules.cs | 59 + .../src/Generated/Models/Tileset.cs | 109 + .../Generated/Models/TilesetCreateHeaders.cs | 63 + .../Models/TilesetGetOperationHeaders.cs | 53 + .../src/Generated/Models/UploadStatus.cs | 75 + .../src/Generated/Models/WFSEndpointLink.cs | 107 + .../src/Generated/SdkInfo_CreatorClient.cs | 34 + .../src/Generated/Spatial.cs | 2238 +++++++++++++++++ .../src/Generated/SpatialExtensions.cs | 500 ++++ .../src/Generated/TilesetOperations.cs | 994 ++++++++ .../Generated/TilesetOperationsExtensions.cs | 201 ++ .../Azure.Maps.Creator/src/Generated/WFS.cs | 1642 ++++++++++++ .../src/Generated/WFSExtensions.cs | 366 +++ 121 files changed, 23887 insertions(+) create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperationsExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperationsExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/CreatorClient.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Data.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/DataExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperationsExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperationsExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/IAliasOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/IConversionOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/ICreatorClient.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/IData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/IDatasetOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/IFeatureStateOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/ISpatial.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/ITilesetOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/IWFS.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Alias.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasCreateHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRule.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanStyleRule.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferRequestBody.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferSummary.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPoint.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResponse.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointSummary.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Collection.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionDefinition.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionsResponse.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConformanceResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Conversion.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionConvertHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionGetOperationHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataDownloadHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataFormat.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataGetOperationHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUpdateHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUploadHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Dataset.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetCreateHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetGetOperationHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetListResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetSources.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/DefinitionProperty.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollection.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollectionData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureState.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureStatesStructure.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeature.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollection.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollectionData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometry.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollection.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollectionData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryType.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineString.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineStringData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineString.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineStringData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPoint.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPointData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygon.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygonData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObject.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObjectType.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPoint.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPointData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygon.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygonData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Geofence.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceGeometry.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceMode.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeographicResourceLocation.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetFeatureResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetLandingPageResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceSummary.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/LatLongPairAbbreviated.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/ListTilesetResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/LongRunningOperationResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/LroStatus.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapData.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataListResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberRule.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberStyleRule.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonSummary.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Position.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Range.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialGetGeofenceHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialPostGeofenceHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Stateset.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetCreatedResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfo.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResult.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/StringStyleRule.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRule.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRules.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/Tileset.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetCreateHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetGetOperationHeaders.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/UploadStatus.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Models/WFSEndpointLink.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/SdkInfo_CreatorClient.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/Spatial.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/SpatialExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperations.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperationsExtensions.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/WFS.cs create mode 100644 sdk/maps/Azure.Maps.Creator/src/Generated/WFSExtensions.cs diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperations.cs new file mode 100644 index 000000000000..fbee13f73ffc --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperations.cs @@ -0,0 +1,1067 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AliasOperations operations. + /// + public partial class AliasOperations : IServiceOperations, IAliasOperations + { + /// + /// Initializes a new instance of the AliasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public AliasOperations(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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" + /// } + /// ``` + /// + /// + /// The unique id that references a creator data item to be aliased. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string creatorDataItemId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("creatorDataItemId", creatorDataItemId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "aliases"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (creatorDataItemId != null) + { + _queryParameters.Add(string.Format("creatorDataItemId={0}", System.Uri.EscapeDataString(creatorDataItemId))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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" + /// } + /// ] + /// } + /// ``` + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "aliases"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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" + /// } + /// ``` + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The unique id that references a creator data item to be aliased. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> AssignWithHttpMessagesAsync(string aliasId, string creatorDataItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (aliasId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aliasId"); + } + if (creatorDataItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "creatorDataItemId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("aliasId", aliasId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("creatorDataItemId", creatorDataItemId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Assign", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "aliases/{aliasId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{aliasId}", System.Uri.EscapeDataString(aliasId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (creatorDataItemId != null) + { + _queryParameters.Add(string.Format("creatorDataItemId={0}", System.Uri.EscapeDataString(creatorDataItemId))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string aliasId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (aliasId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aliasId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("aliasId", aliasId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "aliases/{aliasId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{aliasId}", System.Uri.EscapeDataString(aliasId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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" + /// } + /// ``` + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string aliasId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (aliasId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aliasId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("aliasId", aliasId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "aliases/{aliasId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{aliasId}", System.Uri.EscapeDataString(aliasId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperationsExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperationsExtensions.cs new file mode 100644 index 000000000000..fe786e5e61e8 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/AliasOperationsExtensions.cs @@ -0,0 +1,279 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AliasOperations. + /// + public static partial class AliasOperationsExtensions + { + /// + /// **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" + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The unique id that references a creator data item to be aliased. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAliasOperations operations, string creatorDataItemId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(creatorDataItemId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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" + /// } + /// ] + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IAliasOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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" + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The unique id that references a creator data item to be aliased. + /// + /// + /// The cancellation token. + /// + public static async Task AssignAsync(this IAliasOperations operations, string aliasId, string creatorDataItemId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AssignWithHttpMessagesAsync(aliasId, creatorDataItemId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAliasOperations operations, string aliasId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(aliasId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// **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" + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAliasOperations operations, string aliasId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(aliasId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperations.cs new file mode 100644 index 000000000000..d94d121e85f3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperations.cs @@ -0,0 +1,1076 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ConversionOperations operations. + /// + public partial class ConversionOperations : IServiceOperations, IConversionOperations + { + /// + /// Initializes a new instance of the ConversionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ConversionOperations(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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-v2/upload-preview) 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). <br> + /// + /// 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. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// User provided description of the content being converted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ConvertWithHttpMessagesAsync(string udid, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + string apiVersion = "2.0"; + string outputOntology = "facility-2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("udid", udid); + tracingParameters.Add("outputOntology", outputOntology); + tracingParameters.Add("description", description); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Convert", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "conversions"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (udid != null) + { + _queryParameters.Add(string.Format("udid={0}", System.Uri.EscapeDataString(udid))); + } + if (outputOntology != null) + { + _queryParameters.Add(string.Format("outputOntology={0}", System.Uri.EscapeDataString(outputOntology))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/conversion/convert). + /// + /// ### 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.<br> + /// + /// Here is a sample response returning the details of two successful + /// conversion requests: + /// + /// <br> + /// + /// ```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 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// <br> + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "conversions"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/conversion/convert). + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string conversionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (conversionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "conversionId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("conversionId", conversionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "conversions/{conversionId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{conversionId}", System.Uri.EscapeDataString(conversionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/conversion/convert). + /// + /// ### 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if no resource + /// associated with the passed-in `conversionId` is found. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string conversionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (conversionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "conversionId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("conversionId", conversionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "conversions/{conversionId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{conversionId}", System.Uri.EscapeDataString(conversionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID to query the status for the Conversion create/import request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "conversions/operations/{operationId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperationsExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperationsExtensions.cs new file mode 100644 index 000000000000..85a204c508b1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionOperationsExtensions.cs @@ -0,0 +1,277 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ConversionOperations. + /// + public static partial class ConversionOperationsExtensions + { + /// + /// **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-v2/upload-preview) 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). <br> + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// User provided description of the content being converted. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertAsync(this IConversionOperations operations, string udid, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ConvertWithHttpMessagesAsync(udid, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/conversion/convert). + /// + /// ### 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.<br> + /// + /// Here is a sample response returning the details of two successful + /// conversion requests: + /// + /// <br> + /// + /// ```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 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// <br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IConversionOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/conversion/convert). + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IConversionOperations operations, string conversionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(conversionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/conversion/convert). + /// + /// ### 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if no resource + /// associated with the passed-in `conversionId` is found. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IConversionOperations operations, string conversionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(conversionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID to query the status for the Conversion create/import request. + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationAsync(this IConversionOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/CreatorClient.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/CreatorClient.cs new file mode 100644 index 000000000000..f713397ebe3e --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/CreatorClient.cs @@ -0,0 +1,270 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + public partial class CreatorClient : ServiceClient, ICreatorClient + { + /// + /// The base URI of the service. + /// + internal string BaseUri {get; set;} + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// 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. + /// + public string ClientId { get; set; } + + /// + /// This parameter specifies where the Azure Maps Creator resource is located. + /// Valid values are us and eu. Possible values include: 'us', 'eu' + /// + public string Geography { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the IAliasOperations. + /// + public virtual IAliasOperations Alias { get; private set; } + + /// + /// Gets the IData. + /// + public virtual IData Data { get; private set; } + + /// + /// Gets the IDatasetOperations. + /// + public virtual IDatasetOperations Dataset { get; private set; } + + /// + /// Gets the IConversionOperations. + /// + public virtual IConversionOperations Conversion { get; private set; } + + /// + /// Gets the IFeatureStateOperations. + /// + public virtual IFeatureStateOperations FeatureState { get; private set; } + + /// + /// Gets the ISpatial. + /// + public virtual ISpatial Spatial { get; private set; } + + /// + /// Gets the ITilesetOperations. + /// + public virtual ITilesetOperations Tileset { get; private set; } + + /// + /// Gets the IWFS. + /// + public virtual IWFS WFS { get; private set; } + + /// + /// Initializes a new instance of the CreatorClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling CreatorClient.Dispose(). False: will not dispose provided httpClient + protected CreatorClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CreatorClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected CreatorClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CreatorClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected CreatorClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CreatorClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CreatorClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CreatorClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling CreatorClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public CreatorClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CreatorClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CreatorClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Alias = new AliasOperations(this); + Data = new Data(this); + Dataset = new DatasetOperations(this); + Conversion = new ConversionOperations(this); + FeatureState = new FeatureStateOperations(this); + Spatial = new Spatial(this); + Tileset = new TilesetOperations(this); + WFS = new WFS(this); + BaseUri = "https://{geography}.atlas.microsoft.com"; + Geography = "us"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Data.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Data.cs new file mode 100644 index 000000000000..b61615100546 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Data.cs @@ -0,0 +1,1452 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Data operations. + /// + public partial class Data : IServiceOperations, IData + { + /// + /// Initializes a new instance of the Data class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Data(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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-v2/delete-preview) to + /// delete old/unused content and create space for new uploads. + /// + /// + /// Data format of the content being uploaded. Possible values include: + /// 'geojson', 'zip', 'dwgzippackage' + /// + /// + /// The content to upload. + /// + /// + /// The description to be given to the upload. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UploadWithHttpMessagesAsync(string dataFormat, object uploadContent, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (dataFormat == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataFormat"); + } + if (uploadContent == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "uploadContent"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("description", description); + tracingParameters.Add("dataFormat", dataFormat); + tracingParameters.Add("uploadContent", uploadContent); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Upload", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "mapData"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (dataFormat != null) + { + _queryParameters.Add(string.Format("dataFormat={0}", System.Uri.EscapeDataString(dataFormat))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(uploadContent != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(uploadContent, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 409) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 409) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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-v2/upload-preview). + /// + /// + /// ### 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: + /// + /// <br> + /// + /// ```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" + /// }] + /// } + /// ``` + /// + /// <br> + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "mapData"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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-v2/upload-preview), 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-v2/delete-preview) to + /// delete old/unused content and create space for new uploads. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The new content that will update/replace the previously uploaded content. + /// + /// + /// The description to be given to the upload. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string udid, object updateContent, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + if (updateContent == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateContent"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("udid", udid); + tracingParameters.Add("description", description); + tracingParameters.Add("updateContent", updateContent); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "mapData/{udid}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{udid}", System.Uri.EscapeDataString(udid)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(updateContent != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(updateContent, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 409) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 409) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + /// + /// This API allows the caller to download a previously uploaded data + /// content.<br> + /// 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-v2/upload-preview) + /// 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. <br> + /// 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if the data + /// resource with the passed-in `udid` is not found.<br> + /// + /// Here's a sample response body for a simple geofence represented in + /// `GeoJSON` uploaded previously using the Upload API: + /// <br> + /// + /// ```json + /// { + /// "type": "FeatureCollection", + /// "features": [{ + /// "type": "Feature", + /// "geometry": { + /// "type": "Point", + /// "coordinates": [-122.126986, 47.639754] + /// }, + /// "properties": { + /// "geometryId": "001", + /// "radius": 500 + /// } + /// }] + /// } + /// ``` + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DownloadWithHttpMessagesAsync(string udid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("udid", udid); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Download", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "mapData/{udid}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{udid}", System.Uri.EscapeDataString(udid)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + /// + /// This API allows the caller to delete a previously uploaded data + /// content.<br> + /// 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-v2/upload-preview) + /// 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.<br> + /// 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if the data + /// resource with the passed-in `udid` is not found. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string udid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("udid", udid); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "mapData/{udid}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{udid}", System.Uri.EscapeDataString(udid)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID to query the status for the data upload request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "mapData/operations/{operationId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/DataExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/DataExtensions.cs new file mode 100644 index 000000000000..37ce1f2d2f55 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/DataExtensions.cs @@ -0,0 +1,431 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Data. + /// + public static partial class DataExtensions + { + /// + /// **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-v2/delete-preview) to + /// delete old/unused content and create space for new uploads. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Data format of the content being uploaded. Possible values include: + /// 'geojson', 'zip', 'dwgzippackage' + /// + /// + /// The content to upload. + /// + /// + /// The description to be given to the upload. + /// + /// + /// The cancellation token. + /// + public static async Task UploadAsync(this IData operations, string dataFormat, object uploadContent, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UploadWithHttpMessagesAsync(dataFormat, uploadContent, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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-v2/upload-preview). + /// + /// + /// ### 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: + /// + /// <br> + /// + /// ```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" + /// }] + /// } + /// ``` + /// + /// <br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IData operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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-v2/upload-preview), 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-v2/delete-preview) to + /// delete old/unused content and create space for new uploads. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The new content that will update/replace the previously uploaded content. + /// + /// + /// The description to be given to the upload. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IData operations, string udid, object updateContent, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(udid, updateContent, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + /// + /// This API allows the caller to download a previously uploaded data + /// content.<br> + /// 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-v2/upload-preview) + /// 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. <br> + /// 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if the data + /// resource with the passed-in `udid` is not found.<br> + /// + /// Here's a sample response body for a simple geofence represented in + /// `GeoJSON` uploaded previously using the Upload API: + /// <br> + /// + /// ```json + /// { + /// "type": "FeatureCollection", + /// "features": [{ + /// "type": "Feature", + /// "geometry": { + /// "type": "Point", + /// "coordinates": [-122.126986, 47.639754] + /// }, + /// "properties": { + /// "geometryId": "001", + /// "radius": 500 + /// } + /// }] + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadAsync(this IData operations, string udid, CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.DownloadWithHttpMessagesAsync(udid, null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } + + /// + /// **Applies to:** see pricing [tiers](https://aka.ms/AzureMapsPricingTier). + /// + /// This API allows the caller to delete a previously uploaded data + /// content.<br> + /// 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-v2/upload-preview) + /// 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.<br> + /// 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if the data + /// resource with the passed-in `udid` is not found. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IData operations, string udid, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(udid, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID to query the status for the data upload request. + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationAsync(this IData operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperations.cs new file mode 100644 index 000000000000..11176bf867cc --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperations.cs @@ -0,0 +1,1145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatasetOperations operations. + /// + public partial class DatasetOperations : IServiceOperations, IDatasetOperations + { + /// + /// Initializes a new instance of the DatasetOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public DatasetOperations(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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). + /// + /// + /// The unique ID used to create the dataset. The `conversionId` must have been + /// obtained from a successful call to the Conversion Service [Convert + /// API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) + /// and may be provided with multiple query parameters with same name (if more + /// than one is provided). + /// + /// + /// The ID for the dataset to append with. The dataset must originate from a + /// previous dataset creation call that matches the datasetId + /// + /// + /// The description to be given to the dataset. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string conversionId, string datasetId = default(string), string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (conversionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "conversionId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("conversionId", conversionId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("description", description); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "datasets"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (conversionId != null) + { + _queryParameters.Add(string.Format("conversionId={0}", System.Uri.EscapeDataString(conversionId))); + } + if (datasetId != null) + { + _queryParameters.Add(string.Format("datasetId={0}", System.Uri.EscapeDataString(datasetId))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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.<br/> + /// + /// 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.<br/> + /// + /// 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" + /// ], }, + /// "": "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 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "datasets"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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.<br/> + /// + /// 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.<br/> + /// + /// 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 + /// } + /// } + /// ``` + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "datasets/{datasetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "datasets/{datasetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID to query the status for the dataset create/import request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "datasets/operations/{operationId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperationsExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperationsExtensions.cs new file mode 100644 index 000000000000..d76c8be7ebd5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatasetOperations. + /// + public static partial class DatasetOperationsExtensions + { + /// + /// **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). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The unique ID used to create the dataset. The `conversionId` must have been + /// obtained from a successful call to the Conversion Service [Convert + /// API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) + /// and may be provided with multiple query parameters with same name (if more + /// than one is provided). + /// + /// + /// The ID for the dataset to append with. The dataset must originate from a + /// previous dataset creation call that matches the datasetId + /// + /// + /// The description to be given to the dataset. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IDatasetOperations operations, string conversionId, string datasetId = default(string), string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(conversionId, datasetId, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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.<br/> + /// + /// 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.<br/> + /// + /// 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" + /// ], }, + /// "": "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 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IDatasetOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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.<br/> + /// + /// 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.<br/> + /// + /// 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 + /// } + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatasetOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDatasetOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID to query the status for the dataset create/import request. + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationAsync(this IDatasetOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperations.cs new file mode 100644 index 000000000000..433109494cd9 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperations.cs @@ -0,0 +1,1527 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FeatureStateOperations operations. + /// + public partial class FeatureStateOperations : IServiceOperations, IFeatureStateOperations + { + /// + /// Initializes a new instance of the FeatureStateOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public FeatureStateOperations(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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](https://docs.microsoft.com/en-us/rest/api/maps/render/get-map-state-tile-preview) + /// for more information. + /// + /// + /// 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. + /// + /// + /// The stateset style JSON data. + /// + /// + /// Description for the stateset. Max length allowed is 1000. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateStatesetWithHttpMessagesAsync(string datasetId, StyleRules styleRules, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (styleRules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "styleRules"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("description", description); + tracingParameters.Add("styleRules", styleRules); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateStateset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (datasetId != null) + { + _queryParameters.Add(string.Format("datasetId={0}", System.Uri.EscapeDataString(datasetId))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(styleRules != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(styleRules, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListStatesetsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListStatesets", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// The stateset style JSON data. Only style rules are allowed to be updated, + /// update on keyname and type is not allowed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateStatesetWithHttpMessagesAsync(string statesetId, StyleRules styleRules, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (statesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetId"); + } + if (styleRules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "styleRules"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statesetId", statesetId); + tracingParameters.Add("styleRules", styleRules); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateStateset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets/{statesetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{statesetId}", System.Uri.EscapeDataString(statesetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(styleRules != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(styleRules, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteStatesetWithHttpMessagesAsync(string statesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (statesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statesetId", statesetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteStateset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets/{statesetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{statesetId}", System.Uri.EscapeDataString(statesetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetStatesetWithHttpMessagesAsync(string statesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (statesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statesetId", statesetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetStateset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets/{statesetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{statesetId}", System.Uri.EscapeDataString(statesetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// The id of a feature in the given dataset. If the featureId is not present + /// in the dataset, Bad Request response will be returned. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateStatesWithHttpMessagesAsync(string statesetId, string featureId, FeatureStatesStructure featureStates, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (statesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetId"); + } + if (featureId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureId"); + } + if (featureStates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureStates"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statesetId", statesetId); + tracingParameters.Add("featureId", featureId); + tracingParameters.Add("featureStates", featureStates); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateStates", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets/{statesetId}/featureStates/{featureId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{statesetId}", System.Uri.EscapeDataString(statesetId)); + _url = _url.Replace("{featureId}", System.Uri.EscapeDataString(featureId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(featureStates != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(featureStates, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// 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. + /// + /// + /// The Name of the state to be deleted. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteStateWithHttpMessagesAsync(string statesetId, string featureId, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (statesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetId"); + } + if (featureId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureId"); + } + if (keyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statesetId", statesetId); + tracingParameters.Add("featureId", featureId); + tracingParameters.Add("keyName", keyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteState", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets/{statesetId}/featureStates/{featureId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{statesetId}", System.Uri.EscapeDataString(statesetId)); + _url = _url.Replace("{featureId}", System.Uri.EscapeDataString(featureId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (keyName != null) + { + _queryParameters.Add(string.Format("stateKeyName={0}", System.Uri.EscapeDataString(keyName))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListStatesWithHttpMessagesAsync(string statesetId, string featureId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (statesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetId"); + } + if (featureId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statesetId", statesetId); + tracingParameters.Add("featureId", featureId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListStates", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "featureStateSets/{statesetId}/featureStates/{featureId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{statesetId}", System.Uri.EscapeDataString(statesetId)); + _url = _url.Replace("{featureId}", System.Uri.EscapeDataString(featureId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperationsExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperationsExtensions.cs new file mode 100644 index 000000000000..d16ac8d2396b --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateOperationsExtensions.cs @@ -0,0 +1,290 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FeatureStateOperations. + /// + public static partial class FeatureStateOperationsExtensions + { + /// + /// **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](https://docs.microsoft.com/en-us/rest/api/maps/render/get-map-state-tile-preview) + /// for more information. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// The stateset style JSON data. + /// + /// + /// Description for the stateset. Max length allowed is 1000. + /// + /// + /// The cancellation token. + /// + public static async Task CreateStatesetAsync(this IFeatureStateOperations operations, string datasetId, StyleRules styleRules, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateStatesetWithHttpMessagesAsync(datasetId, styleRules, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListStatesetsAsync(this IFeatureStateOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListStatesetsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The stateset id that was created. + /// + /// + /// The stateset style JSON data. Only style rules are allowed to be updated, + /// update on keyname and type is not allowed. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateStatesetAsync(this IFeatureStateOperations operations, string statesetId, StyleRules styleRules, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateStatesetWithHttpMessagesAsync(statesetId, styleRules, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The stateset id that was created. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteStatesetAsync(this IFeatureStateOperations operations, string statesetId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteStatesetWithHttpMessagesAsync(statesetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The stateset id that was created. + /// + /// + /// The cancellation token. + /// + public static async Task GetStatesetAsync(this IFeatureStateOperations operations, string statesetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetStatesetWithHttpMessagesAsync(statesetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The stateset id that was created. + /// + /// + /// The id of a feature in the given dataset. If the featureId is not present + /// in the dataset, Bad Request response will be returned. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateStatesAsync(this IFeatureStateOperations operations, string statesetId, string featureId, FeatureStatesStructure featureStates, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateStatesWithHttpMessagesAsync(statesetId, featureId, featureStates, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The stateset id that was created. + /// + /// + /// 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. + /// + /// + /// The Name of the state to be deleted. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteStateAsync(this IFeatureStateOperations operations, string statesetId, string featureId, string keyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteStateWithHttpMessagesAsync(statesetId, featureId, keyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The stateset id that was created. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task ListStatesAsync(this IFeatureStateOperations operations, string statesetId, string featureId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListStatesWithHttpMessagesAsync(statesetId, featureId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IAliasOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IAliasOperations.cs new file mode 100644 index 000000000000..66ccc1b2c9d0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IAliasOperations.cs @@ -0,0 +1,308 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AliasOperations operations. + /// + public partial interface IAliasOperations + { + /// + /// **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" + /// } + /// ``` + /// + /// + /// The unique id that references a creator data item to be aliased. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string creatorDataItemId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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" + /// } + /// ] + /// } + /// ``` + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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" + /// } + /// ``` + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The unique id that references a creator data item to be aliased. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> AssignWithHttpMessagesAsync(string aliasId, string creatorDataItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string aliasId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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" + /// } + /// ``` + /// + /// + /// The unique id that references an existing alias. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string aliasId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IConversionOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IConversionOperations.cs new file mode 100644 index 000000000000..2967c493ffd4 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IConversionOperations.cs @@ -0,0 +1,305 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ConversionOperations operations. + /// + public partial interface IConversionOperations + { + /// + /// **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-v2/upload-preview) + /// 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). + /// <br> + /// + /// 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. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// User provided description of the content being converted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ConvertWithHttpMessagesAsync(string udid, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/conversion/convert). + /// + /// ### 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.<br> + /// + /// Here is a sample response returning the details of two successful + /// conversion requests: + /// + /// <br> + /// + /// ```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 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// <br> + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/conversion/convert). + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string conversionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/conversion/convert). + /// + /// ### 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if no + /// resource associated with the passed-in `conversionId` is found. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string conversionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID to query the status for the Conversion create/import + /// request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/ICreatorClient.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ICreatorClient.cs new file mode 100644 index 000000000000..34a102294b6f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ICreatorClient.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface ICreatorClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// 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. + /// + string ClientId { get; set; } + + /// + /// This parameter specifies where the Azure Maps Creator resource is + /// located. Valid values are us and eu. Possible values include: + /// 'us', 'eu' + /// + string Geography { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the IAliasOperations. + /// + IAliasOperations Alias { get; } + + /// + /// Gets the IData. + /// + IData Data { get; } + + /// + /// Gets the IDatasetOperations. + /// + IDatasetOperations Dataset { get; } + + /// + /// Gets the IConversionOperations. + /// + IConversionOperations Conversion { get; } + + /// + /// Gets the IFeatureStateOperations. + /// + IFeatureStateOperations FeatureState { get; } + + /// + /// Gets the ISpatial. + /// + ISpatial Spatial { get; } + + /// + /// Gets the ITilesetOperations. + /// + ITilesetOperations Tileset { get; } + + /// + /// Gets the IWFS. + /// + IWFS WFS { get; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IData.cs new file mode 100644 index 000000000000..8028b2bb3065 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IData.cs @@ -0,0 +1,461 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Data operations. + /// + public partial interface IData + { + /// + /// **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-v2/delete-preview) + /// to + /// delete old/unused content and create space for new uploads. + /// + /// + /// Data format of the content being uploaded. Possible values include: + /// 'geojson', 'zip', 'dwgzippackage' + /// + /// + /// The content to upload. + /// + /// + /// The description to be given to the upload. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UploadWithHttpMessagesAsync(string dataFormat, object uploadContent, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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-v2/upload-preview). + /// + /// + /// ### 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: + /// + /// <br> + /// + /// ```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" + /// }] + /// } + /// ``` + /// + /// <br> + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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-v2/upload-preview), + /// 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-v2/delete-preview) + /// to + /// delete old/unused content and create space for new uploads. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The new content that will update/replace the previously uploaded + /// content. + /// + /// + /// The description to be given to the upload. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string udid, object updateContent, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **Applies to:** see pricing + /// [tiers](https://aka.ms/AzureMapsPricingTier). + /// + /// This API allows the caller to download a previously uploaded data + /// content.<br> + /// 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-v2/upload-preview) + /// 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. <br> + /// 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if the + /// data resource with the passed-in `udid` is not found.<br> + /// + /// Here's a sample response body for a simple geofence represented in + /// `GeoJSON` uploaded previously using the Upload API: + /// <br> + /// + /// ```json + /// { + /// "type": "FeatureCollection", + /// "features": [{ + /// "type": "Feature", + /// "geometry": { + /// "type": "Point", + /// "coordinates": [-122.126986, 47.639754] + /// }, + /// "properties": { + /// "geometryId": "001", + /// "radius": 500 + /// } + /// }] + /// } + /// ``` + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DownloadWithHttpMessagesAsync(string udid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **Applies to:** see pricing + /// [tiers](https://aka.ms/AzureMapsPricingTier). + /// + /// This API allows the caller to delete a previously uploaded data + /// content.<br> + /// 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-v2/upload-preview) + /// 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.<br> + /// 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.<br> + /// A HTTP `400 Bad Request` error response will be returned if the + /// data resource with the passed-in `udid` is not found. + /// + /// + /// 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-v2/upload-preview) + /// call. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string udid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID to query the status for the data upload request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IDatasetOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IDatasetOperations.cs new file mode 100644 index 000000000000..af3196ec9338 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IDatasetOperations.cs @@ -0,0 +1,370 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatasetOperations operations. + /// + public partial interface IDatasetOperations + { + /// + /// **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). + /// + /// + /// The unique ID used to create the dataset. The `conversionId` must + /// have been obtained from a successful call to the Conversion Service + /// [Convert + /// API](https://docs.microsoft.com/en-us/rest/api/maps/v2/conversion/convert) + /// and may be provided with multiple query parameters with same name + /// (if more than one is provided). + /// + /// + /// The ID for the dataset to append with. The dataset must originate + /// from a previous dataset creation call that matches the datasetId + /// + /// + /// The description to be given to the dataset. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string conversionId, string datasetId = default(string), string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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.<br/> + /// + /// 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.<br/> + /// + /// 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" + /// ], }, + /// "": "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 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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.<br/> + /// + /// 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.<br/> + /// + /// 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 + /// } + /// } + /// ``` + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID to query the status for the dataset create/import request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IFeatureStateOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IFeatureStateOperations.cs new file mode 100644 index 000000000000..771a95603fab --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IFeatureStateOperations.cs @@ -0,0 +1,331 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FeatureStateOperations operations. + /// + public partial interface IFeatureStateOperations + { + /// + /// **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](https://docs.microsoft.com/en-us/rest/api/maps/render/get-map-state-tile-preview) + /// for more information. + /// + /// + /// 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. + /// + /// + /// The stateset style JSON data. + /// + /// + /// Description for the stateset. Max length allowed is 1000. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateStatesetWithHttpMessagesAsync(string datasetId, StyleRules styleRules, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListStatesetsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// The stateset style JSON data. Only style rules are allowed to be + /// updated, update on keyname and type is not allowed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateStatesetWithHttpMessagesAsync(string statesetId, StyleRules styleRules, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteStatesetWithHttpMessagesAsync(string statesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetStatesetWithHttpMessagesAsync(string statesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// The id of a feature in the given dataset. If the featureId is not + /// present in the dataset, Bad Request response will be returned. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateStatesWithHttpMessagesAsync(string statesetId, string featureId, FeatureStatesStructure featureStates, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// 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. + /// + /// + /// The Name of the state to be deleted. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteStateWithHttpMessagesAsync(string statesetId, string featureId, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The stateset id that was created. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListStatesWithHttpMessagesAsync(string statesetId, string featureId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/ISpatial.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ISpatial.cs new file mode 100644 index 000000000000..30d4e3c95455 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ISpatial.cs @@ -0,0 +1,549 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Spatial operations. + /// + public partial interface ISpatial + { + /// + /// **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.<br><br>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. + /// + /// + /// ID of the device + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The sea level in meter of the location being passed. If this + /// parameter is presented, 2D extrusion is used. Example: 200. + /// + /// + /// The user request time. If not presented in the request, the default + /// value is DateTime.Now. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Mode of the geofencing async event mechanism. Possible values + /// include: 'All', 'EnterAndExit' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetGeofenceWithHttpMessagesAsync(string deviceId, string udid, Position position, double? altitude = default(double?), System.DateTime? userTime = default(System.DateTime?), double? searchBufferInMeters = default(double?), bool? isAsync = default(bool?), string mode = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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.<br><br>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). + /// + /// + /// ID of the device + /// + /// + /// The geofencing GeoJSON data. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The sea level in meter of the location being passed. If this + /// parameter is presented, 2D extrusion geofencing is applied. + /// Example: 200. + /// + /// + /// The user request time. If not presented in the request, the default + /// value is DateTime.UtcNow. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Mode of the geofencing async event mechanism. Possible values + /// include: 'All', 'EnterAndExit' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostGeofenceWithHttpMessagesAsync(string deviceId, GeoJsonFeatureCollection searchGeofenceRequestBody, Position position, double? altitude = default(double?), System.DateTime? userTime = default(System.DateTime?), double? searchBuffer = default(double?), bool? isAsync = default(bool?), string mode = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The FeatureCollection and the list of distances (one per feature or + /// one for all features). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostBufferWithHttpMessagesAsync(BufferRequestBody bufferRequestBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetBufferWithHttpMessagesAsync(string udid, string distances, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The number of closest points expected from response. Default: 1, + /// minimum: 1 and maximum: 50 + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostClosestPointWithHttpMessagesAsync(GeoJsonFeatureCollection closestPointRequestBody, Position position, int? numberOfClosestPoints = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The number of closest points expected from response. Default: 1, + /// minimum: 1 and maximum: 50 + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetClosestPointWithHttpMessagesAsync(string udid, Position position, int? numberOfClosestPoints = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PostPointInPolygonWithHttpMessagesAsync(GeoJsonFeatureCollection pointInPolygonRequestBody, Position position, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> EvaluatePointInPolygonWithHttpMessagesAsync(string udid, Position position, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// 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 + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetGreatCircleDistanceWithHttpMessagesAsync(string query, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/ITilesetOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ITilesetOperations.cs new file mode 100644 index 000000000000..f64c4deb9bb2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ITilesetOperations.cs @@ -0,0 +1,226 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TilesetOperations operations. + /// + public partial interface ITilesetOperations + { + /// + /// **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). + /// + /// + /// 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](https://docs.microsoft.com/en-us/rest/api/maps/v2/dataset/create) + /// call. + /// + /// + /// User provided description of the tileset. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string datasetId, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// <br> + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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. + /// + /// + /// The Tileset Id + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string tilesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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.<br> + /// 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.<br> + /// + /// #### Delete request "Successful" + /// + /// The Tileset Delete API returns a HTTP `204 No Content` response + /// with an empty body, if the tileset was deleted + /// successfully.<br> + /// + /// #### 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: + /// + /// <br> + /// + /// ```json + /// { + /// "error": { + /// "code": "400 BadRequest", + /// "message": "Bad request - Tileset Id: + /// d85b5b27-5fc4-4599-8b50-47160e90f8ce does not exist." + /// } + /// } + /// ``` + /// + /// + /// The Tileset Id + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string tilesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID to query the status for the tileset create/import request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IWFS.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IWFS.cs new file mode 100644 index 000000000000..2db549476e60 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IWFS.cs @@ -0,0 +1,411 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WFS operations. + /// + public partial interface IWFS + { + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetLandingPageWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListConformanceWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetCollectionsWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetCollectionWithHttpMessagesAsync(string datasetId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetCollectionDefinitionWithHttpMessagesAsync(string datasetId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// 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 = 500 * Default = 10 + /// + /// + /// 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). + /// + /// + /// 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., + /// <property1>=<value1>&<property2>=<value2> + /// String values are case sensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetFeaturesWithHttpMessagesAsync(string datasetId, string collectionId, int? limit = default(int?), IList boundingBox = default(IList), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Local identifier of a specific feature + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetFeatureWithHttpMessagesAsync(string datasetId, string collectionId, string featureId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Local identifier of a specific feature + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteFeatureWithHttpMessagesAsync(string datasetId, string collectionId, string featureId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Alias.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Alias.cs new file mode 100644 index 000000000000..5653f75e3a3d --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Alias.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Detailed information for the alias. + /// + public partial class Alias + { + /// + /// Initializes a new instance of the Alias class. + /// + public Alias() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Alias class. + /// + /// The created timestamp for the + /// alias. + /// The id for the alias. + /// The id for the creator data item + /// that this alias references (could be null if the alias has not been + /// assigned). + /// The timestamp of the last time + /// the alias was assigned. + public Alias(System.DateTime? createdTimestamp = default(System.DateTime?), string aliasId = default(string), string creatorDataItemId = default(string), System.DateTime? lastUpdatedTimestamp = default(System.DateTime?)) + { + CreatedTimestamp = createdTimestamp; + AliasId = aliasId; + CreatorDataItemId = creatorDataItemId; + LastUpdatedTimestamp = lastUpdatedTimestamp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the created timestamp for the alias. + /// + [JsonProperty(PropertyName = "createdTimestamp")] + public System.DateTime? CreatedTimestamp { get; private set; } + + /// + /// Gets the id for the alias. + /// + [JsonProperty(PropertyName = "aliasId")] + public string AliasId { get; private set; } + + /// + /// Gets the id for the creator data item that this alias references + /// (could be null if the alias has not been assigned). + /// + [JsonProperty(PropertyName = "creatorDataItemId")] + public string CreatorDataItemId { get; private set; } + + /// + /// Gets the timestamp of the last time the alias was assigned. + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasCreateHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasCreateHeaders.cs new file mode 100644 index 000000000000..3eff8b8f7416 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasCreateHeaders.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class AliasCreateHeaders + { + /// + /// Initializes a new instance of the AliasCreateHeaders class. + /// + public AliasCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AliasCreateHeaders class. + /// + /// The list of response + /// headers that can be read by the client. + public AliasCreateHeaders(string accessControlExposeHeaders = default(string)) + { + AccessControlExposeHeaders = accessControlExposeHeaders; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of response headers that can be read by the + /// client. + /// + [JsonProperty(PropertyName = "Access-Control-Expose-Headers")] + public string AccessControlExposeHeaders { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResult.cs new file mode 100644 index 000000000000..019e00a601f5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResult.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the List API. Returns a list of all the + /// previously created aliases. + /// + public partial class AliasListResult + { + /// + /// Initializes a new instance of the AliasListResult class. + /// + public AliasListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AliasListResult class. + /// + /// A list of all the previously created + /// aliases. + /// If present, the location of the next page of + /// data. + public AliasListResult(IList aliases = default(IList), string nextLink = default(string)) + { + Aliases = aliases; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all the previously created aliases. + /// + [JsonProperty(PropertyName = "aliases")] + public IList Aliases { get; private set; } + + /// + /// Gets if present, the location of the next page of data. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRule.cs new file mode 100644 index 000000000000..1f18048c786f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRule.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The boolean rule. The color is selected based on the logic value of the + /// key. + /// + public partial class BooleanRule + { + /// + /// Initializes a new instance of the BooleanRule class. + /// + public BooleanRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BooleanRule class. + /// + /// 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. + /// 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. + public BooleanRule(string trueProperty = default(string), string falseProperty = default(string)) + { + TrueProperty = trueProperty; + FalseProperty = falseProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "true")] + public string TrueProperty { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "false")] + public string FalseProperty { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanStyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanStyleRule.cs new file mode 100644 index 000000000000..e6bb023e8649 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanStyleRule.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The boolean type style rule object. + /// + [Newtonsoft.Json.JsonObject("boolean")] + public partial class BooleanStyleRule : StyleRule + { + /// + /// Initializes a new instance of the BooleanStyleRule class. + /// + public BooleanStyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BooleanStyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + /// Boolean style rules. + public BooleanStyleRule(string keyName, IList rules) + : base(keyName) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets boolean style rules. + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Rules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferRequestBody.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferRequestBody.cs new file mode 100644 index 000000000000..1ba395b982ff --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferRequestBody.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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. + /// + public partial class BufferRequestBody + { + /// + /// Initializes a new instance of the BufferRequestBody class. + /// + public BufferRequestBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BufferRequestBody class. + /// + /// 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. + public BufferRequestBody(GeoJsonFeatureCollection geometries = default(GeoJsonFeatureCollection), IList distances = default(IList)) + { + Geometries = geometries; + Distances = distances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "geometries")] + public GeoJsonFeatureCollection Geometries { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "distances")] + public IList Distances { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Geometries != null) + { + Geometries.Validate(); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResult.cs new file mode 100644 index 000000000000..df1008a018fe --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResult.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This object is returned from a successful Spatial Buffer call. + /// + public partial class BufferResult + { + /// + /// Initializes a new instance of the BufferResult class. + /// + public BufferResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BufferResult class. + /// + /// The FeatureCollection of buffers for the + /// input. + public BufferResult(BufferSummary summary = default(BufferSummary), GeoJsonFeatureCollection features = default(GeoJsonFeatureCollection)) + { + Summary = summary; + Features = features; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "summary")] + public BufferSummary Summary { get; set; } + + /// + /// Gets or sets the FeatureCollection of buffers for the input. + /// + [JsonProperty(PropertyName = "result")] + public GeoJsonFeatureCollection Features { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Features != null) + { + Features.Validate(); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferSummary.cs new file mode 100644 index 000000000000..136c3468f1b4 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferSummary.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class BufferSummary + { + /// + /// Initializes a new instance of the BufferSummary class. + /// + public BufferSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BufferSummary class. + /// + /// The udid for the user data if one exists + /// The information about what happened + /// during the call. + public BufferSummary(string udid = default(string), string information = default(string)) + { + Udid = udid; + Information = information; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the udid for the user data if one exists + /// + [JsonProperty(PropertyName = "udid")] + public string Udid { get; private set; } + + /// + /// Gets the information about what happened during the call. + /// + [JsonProperty(PropertyName = "information")] + public string Information { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPoint.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPoint.cs new file mode 100644 index 000000000000..6f5069be8f21 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPoint.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Closest Point Result Entry Object + /// + public partial class ClosestPoint + { + /// + /// Initializes a new instance of the ClosestPoint class. + /// + public ClosestPoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClosestPoint class. + /// + /// The distance in meters from the + /// source point to the closest point + /// The unique id identifies a + /// geometry + public ClosestPoint(double? distanceInMeters = default(double?), LatLongPairAbbreviated position = default(LatLongPairAbbreviated), string geometryId = default(string)) + { + DistanceInMeters = distanceInMeters; + Position = position; + GeometryId = geometryId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the distance in meters from the source point to the closest + /// point + /// + [JsonProperty(PropertyName = "distanceInMeters")] + public double? DistanceInMeters { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "position")] + public LatLongPairAbbreviated Position { get; set; } + + /// + /// Gets the unique id identifies a geometry + /// + [JsonProperty(PropertyName = "geometryId")] + public string GeometryId { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResponse.cs new file mode 100644 index 000000000000..b0aacf5688e0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResponse.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This object is returned from a successful Spatial Closest Point call + /// + public partial class ClosestPointResponse + { + /// + /// Initializes a new instance of the ClosestPointResponse class. + /// + public ClosestPointResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClosestPointResponse class. + /// + /// Closest Point Result Array + public ClosestPointResponse(ClosestPointSummary summary = default(ClosestPointSummary), IList result = default(IList)) + { + Summary = summary; + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "summary")] + public ClosestPointSummary Summary { get; set; } + + /// + /// Gets or sets closest Point Result Array + /// + [JsonProperty(PropertyName = "result")] + public IList Result { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointSummary.cs new file mode 100644 index 000000000000..d2dad89d4032 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointSummary.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Closest Point Summary object + /// + public partial class ClosestPointSummary + { + /// + /// Initializes a new instance of the ClosestPointSummary class. + /// + public ClosestPointSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClosestPointSummary class. + /// + /// A unique data id (udid) for the uploaded + /// content + /// Processing information + public ClosestPointSummary(LatLongPairAbbreviated sourcePoint = default(LatLongPairAbbreviated), string udid = default(string), string information = default(string)) + { + SourcePoint = sourcePoint; + Udid = udid; + Information = information; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sourcePoint")] + public LatLongPairAbbreviated SourcePoint { get; set; } + + /// + /// Gets a unique data id (udid) for the uploaded content + /// + [JsonProperty(PropertyName = "udid")] + public string Udid { get; private set; } + + /// + /// Gets processing information + /// + [JsonProperty(PropertyName = "information")] + public string Information { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Collection.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Collection.cs new file mode 100644 index 000000000000..eb654ee2b519 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Collection.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class Collection + { + /// + /// Initializes a new instance of the Collection class. + /// + public Collection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Collection class. + /// + /// identifier of the collection used, for example, + /// in URIs + /// Links to other WFS endpoints. + /// human readable title of the collection + /// a description of the features in the + /// collection + public Collection(string name, IList links, string title = default(string), string ontology = default(string), string description = default(string)) + { + Name = name; + Title = title; + Ontology = ontology; + Description = description; + Links = links; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets identifier of the collection used, for example, in + /// URIs + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets human readable title of the collection + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets or sets a description of the features in the collection + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Links == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Links"); + } + if (Links != null) + { + foreach (var element in Links) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionDefinition.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionDefinition.cs new file mode 100644 index 000000000000..d93b6142d445 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionDefinition.cs @@ -0,0 +1,169 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// collection of GeoJSON features + /// + public partial class CollectionDefinition + { + /// + /// Initializes a new instance of the CollectionDefinition class. + /// + public CollectionDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CollectionDefinition class. + /// + /// prefix of the collection used + /// identifier of the collection used, for example, + /// in URIs + /// type of geometry returned. Possible + /// values include: 'GeoJsonPoint', 'GeoJsonMultiPoint', + /// 'GeoJsonLineString', 'GeoJsonMultiLineString', 'GeoJsonPolygon', + /// 'GeoJsonMultiPolygon', 'GeoJsonGeometryCollection' + /// type of features returned + /// describes the collection + /// title of collection + /// attributes of the collection used + /// Links to other WFS endpoints. + public CollectionDefinition(string idPrefix, string name, string geometryType, IList featureTypes, string description = default(string), string title = default(string), string ontology = default(string), IList properties = default(IList), IList links = default(IList)) + { + Description = description; + IdPrefix = idPrefix; + Name = name; + Title = title; + Ontology = ontology; + GeometryType = geometryType; + FeatureTypes = featureTypes; + Properties = properties; + Links = links; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the collection + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets prefix of the collection used + /// + [JsonProperty(PropertyName = "idPrefix")] + public string IdPrefix { get; set; } + + /// + /// Gets or sets identifier of the collection used, for example, in + /// URIs + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets title of collection + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets or sets type of geometry returned. Possible values include: + /// 'GeoJsonPoint', 'GeoJsonMultiPoint', 'GeoJsonLineString', + /// 'GeoJsonMultiLineString', 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection' + /// + [JsonProperty(PropertyName = "geometryType")] + public string GeometryType { get; set; } + + /// + /// Gets or sets type of features returned + /// + [JsonProperty(PropertyName = "featureTypes")] + public IList FeatureTypes { get; set; } + + /// + /// Gets or sets attributes of the collection used + /// + [JsonProperty(PropertyName = "properties")] + public IList Properties { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (IdPrefix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IdPrefix"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (GeometryType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "GeometryType"); + } + if (FeatureTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FeatureTypes"); + } + if (Properties != null) + { + foreach (var element in Properties) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Links != null) + { + foreach (var element1 in Links) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionsResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionsResponse.cs new file mode 100644 index 000000000000..fc6b39c37b9b --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionsResponse.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CollectionsResponse + { + /// + /// Initializes a new instance of the CollectionsResponse class. + /// + public CollectionsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CollectionsResponse class. + /// + /// Links to other WFS endpoints. + /// All the collections in a given + /// dataset. + public CollectionsResponse(IList links, IList collections, string ontology = default(string)) + { + Ontology = ontology; + Links = links; + Collections = collections; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + /// + /// Gets or sets all the collections in a given dataset. + /// + [JsonProperty(PropertyName = "collections")] + public IList Collections { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Links == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Links"); + } + if (Collections == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Collections"); + } + if (Links != null) + { + foreach (var element in Links) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Collections != null) + { + foreach (var element1 in Collections) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConformanceResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConformanceResult.cs new file mode 100644 index 000000000000..8ddc58ac0fa5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConformanceResult.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ConformanceResult + { + /// + /// Initializes a new instance of the ConformanceResult class. + /// + public ConformanceResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConformanceResult class. + /// + /// List of requirements classes that the + /// server conforms to. + public ConformanceResult(IList conformsTo) + { + ConformsTo = conformsTo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of requirements classes that the server conforms + /// to. + /// + [JsonProperty(PropertyName = "conformsTo")] + public IList ConformsTo { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ConformsTo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConformsTo"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Conversion.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Conversion.cs new file mode 100644 index 000000000000..ff2aab9eae0a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Conversion.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Detail information for the conversion requests. + /// + public partial class Conversion + { + /// + /// Initializes a new instance of the Conversion class. + /// + public Conversion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Conversion class. + /// + /// A unique id that represents the artifact + /// of a _successfully_ completed conversion process. + /// The unique id of the content provided to create + /// this conversion. + /// The date and time of this conversion. + /// User provided description of the content + /// being converted. + /// A summary of feature counts in this + /// conversion. + public Conversion(string conversionId = default(string), string ontology = default(string), string udid = default(string), string created = default(string), string description = default(string), IDictionary featureCounts = default(IDictionary)) + { + ConversionId = conversionId; + Ontology = ontology; + Udid = udid; + Created = created; + Description = description; + FeatureCounts = featureCounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a unique id that represents the artifact of a _successfully_ + /// completed conversion process. + /// + [JsonProperty(PropertyName = "conversionId")] + public string ConversionId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets the unique id of the content provided to create this + /// conversion. + /// + [JsonProperty(PropertyName = "udid")] + public string Udid { get; private set; } + + /// + /// Gets the date and time of this conversion. + /// + [JsonProperty(PropertyName = "created")] + public string Created { get; private set; } + + /// + /// Gets user provided description of the content being converted. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets a summary of feature counts in this conversion. + /// + [JsonProperty(PropertyName = "featureCounts")] + public IDictionary FeatureCounts { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionConvertHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionConvertHeaders.cs new file mode 100644 index 000000000000..5bacb86eab54 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionConvertHeaders.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Convert operation. + /// + public partial class ConversionConvertHeaders + { + /// + /// Initializes a new instance of the ConversionConvertHeaders class. + /// + public ConversionConvertHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConversionConvertHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + /// New URL to check for the results of + /// the long running process. + public ConversionConvertHeaders(string resourceLocation = default(string), string operationLocation = default(string)) + { + ResourceLocation = resourceLocation; + OperationLocation = operationLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets new URL to check for the results of the long running + /// process. + /// + [JsonProperty(PropertyName = "Operation-Location")] + public string OperationLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionGetOperationHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionGetOperationHeaders.cs new file mode 100644 index 000000000000..d41eb9019001 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionGetOperationHeaders.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetOperation operation. + /// + public partial class ConversionGetOperationHeaders + { + /// + /// Initializes a new instance of the ConversionGetOperationHeaders + /// class. + /// + public ConversionGetOperationHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConversionGetOperationHeaders + /// class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + public ConversionGetOperationHeaders(string resourceLocation = default(string)) + { + ResourceLocation = resourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResult.cs new file mode 100644 index 000000000000..9785d2f0699f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResult.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the Conversion List API. + /// + public partial class ConversionListResult + { + /// + /// Initializes a new instance of the ConversionListResult class. + /// + public ConversionListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConversionListResult class. + /// + /// A list of all the previously submitted + /// conversion requests. + /// If present, the location of the next page of + /// data. + public ConversionListResult(IList conversions = default(IList), string nextLink = default(string)) + { + Conversions = conversions; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all the previously submitted conversion requests. + /// + [JsonProperty(PropertyName = "conversions")] + public IList Conversions { get; private set; } + + /// + /// Gets if present, the location of the next page of data. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataDownloadHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataDownloadHeaders.cs new file mode 100644 index 000000000000..fc0aa7f706ca --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataDownloadHeaders.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Download operation. + /// + public partial class DataDownloadHeaders + { + /// + /// Initializes a new instance of the DataDownloadHeaders class. + /// + public DataDownloadHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDownloadHeaders class. + /// + /// The content-type for the Download API + /// response. + public DataDownloadHeaders(string contentType = default(string)) + { + ContentType = contentType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the content-type for the Download API response. + /// + [JsonProperty(PropertyName = "Content-Type")] + public string ContentType { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataFormat.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataFormat.cs new file mode 100644 index 000000000000..3f82b0ea43aa --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataFormat.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + + /// + /// Defines values for DataFormat. + /// + public static class DataFormat + { + /// + /// [GeoJSON](https://tools.ietf.org/html/rfc7946) is a JSON based + /// geospatial data interchange format. + /// + public const string Geojson = "geojson"; + /// + /// Compressed data format. + /// + public const string Zip = "zip"; + /// + /// ZIP package containing DWG file. + /// + public const string Dwgzippackage = "dwgzippackage"; + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataGetOperationHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataGetOperationHeaders.cs new file mode 100644 index 000000000000..f5244ab22b42 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataGetOperationHeaders.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetOperation operation. + /// + public partial class DataGetOperationHeaders + { + /// + /// Initializes a new instance of the DataGetOperationHeaders class. + /// + public DataGetOperationHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataGetOperationHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + public DataGetOperationHeaders(string resourceLocation = default(string)) + { + ResourceLocation = resourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUpdateHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUpdateHeaders.cs new file mode 100644 index 000000000000..23ced9168007 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUpdateHeaders.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class DataUpdateHeaders + { + /// + /// Initializes a new instance of the DataUpdateHeaders class. + /// + public DataUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataUpdateHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + /// New URL to check for the results of + /// the long running process. + public DataUpdateHeaders(string resourceLocation = default(string), string operationLocation = default(string)) + { + ResourceLocation = resourceLocation; + OperationLocation = operationLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets new URL to check for the results of the long running + /// process. + /// + [JsonProperty(PropertyName = "Operation-Location")] + public string OperationLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUploadHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUploadHeaders.cs new file mode 100644 index 000000000000..303209233a27 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUploadHeaders.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Upload operation. + /// + public partial class DataUploadHeaders + { + /// + /// Initializes a new instance of the DataUploadHeaders class. + /// + public DataUploadHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataUploadHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + /// New URL to check for the results of + /// the long running process. + public DataUploadHeaders(string resourceLocation = default(string), string operationLocation = default(string)) + { + ResourceLocation = resourceLocation; + OperationLocation = operationLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets new URL to check for the results of the long running + /// process. + /// + [JsonProperty(PropertyName = "Operation-Location")] + public string OperationLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Dataset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Dataset.cs new file mode 100644 index 000000000000..746cce1f0113 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Dataset.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Detail information for the dataset. + /// + public partial class Dataset + { + /// + /// Initializes a new instance of the Dataset class. + /// + public Dataset() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Dataset class. + /// + /// The created timestamp for the + /// dataset. + /// The id for the dataset. + /// The description for the dataset. + /// The feature counts for the + /// dataset. + public Dataset(System.DateTime? created = default(System.DateTime?), string datasetId = default(string), string ontology = default(string), string description = default(string), DatasetSources datasetSources = default(DatasetSources), object featureCounts = default(object)) + { + Created = created; + DatasetId = datasetId; + Ontology = ontology; + Description = description; + DatasetSources = datasetSources; + FeatureCounts = featureCounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the created timestamp for the dataset. + /// + [JsonProperty(PropertyName = "created")] + public System.DateTime? Created { get; private set; } + + /// + /// Gets the id for the dataset. + /// + [JsonProperty(PropertyName = "datasetId")] + public string DatasetId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets the description for the dataset. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "datasetSources")] + public DatasetSources DatasetSources { get; set; } + + /// + /// Gets the feature counts for the dataset. + /// + [JsonProperty(PropertyName = "featureCounts")] + public object FeatureCounts { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetCreateHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetCreateHeaders.cs new file mode 100644 index 000000000000..59e7d2218aa2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetCreateHeaders.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class DatasetCreateHeaders + { + /// + /// Initializes a new instance of the DatasetCreateHeaders class. + /// + public DatasetCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetCreateHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + /// New URL to check for the results of + /// the long running process. + public DatasetCreateHeaders(string resourceLocation = default(string), string operationLocation = default(string)) + { + ResourceLocation = resourceLocation; + OperationLocation = operationLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets new URL to check for the results of the long running + /// process. + /// + [JsonProperty(PropertyName = "Operation-Location")] + public string OperationLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetGetOperationHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetGetOperationHeaders.cs new file mode 100644 index 000000000000..90b9185af52a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetGetOperationHeaders.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetOperation operation. + /// + public partial class DatasetGetOperationHeaders + { + /// + /// Initializes a new instance of the DatasetGetOperationHeaders class. + /// + public DatasetGetOperationHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetGetOperationHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + public DatasetGetOperationHeaders(string resourceLocation = default(string)) + { + ResourceLocation = resourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetListResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetListResult.cs new file mode 100644 index 000000000000..68f29ccf7a3e --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetListResult.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the Dataset List API. The response body will + /// contain a list of all the previously created datasets. + /// + public partial class DatasetListResult + { + /// + /// Initializes a new instance of the DatasetListResult class. + /// + public DatasetListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetListResult class. + /// + /// A list of all the previously created + /// datasets. + /// If present, the location of the next page of + /// data. + public DatasetListResult(IList datasets = default(IList), string nextLink = default(string)) + { + Datasets = datasets; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all the previously created datasets. + /// + [JsonProperty(PropertyName = "datasets")] + public IList Datasets { get; private set; } + + /// + /// Gets if present, the location of the next page of data. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetSources.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetSources.cs new file mode 100644 index 000000000000..a6338eff3df7 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetSources.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information about the details of the create request for the dataset. + /// + public partial class DatasetSources + { + /// + /// Initializes a new instance of the DatasetSources class. + /// + public DatasetSources() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetSources class. + /// + /// The list of `conversionId` that were + /// used to create the dataset. + /// The dataset that was appended to to + /// create the current dataset. + public DatasetSources(IList conversionIds = default(IList), string appendDatasetId = default(string)) + { + ConversionIds = conversionIds; + AppendDatasetId = appendDatasetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the list of `conversionId` that were used to create the + /// dataset. + /// + [JsonProperty(PropertyName = "conversionIds")] + public IList ConversionIds { get; private set; } + + /// + /// Gets the dataset that was appended to to create the current + /// dataset. + /// + [JsonProperty(PropertyName = "appendDatasetId")] + public string AppendDatasetId { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DefinitionProperty.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DefinitionProperty.cs new file mode 100644 index 000000000000..d0abc5fd97e4 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DefinitionProperty.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class DefinitionProperty + { + /// + /// Initializes a new instance of the DefinitionProperty class. + /// + public DefinitionProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DefinitionProperty class. + /// + /// name of attribute + /// is attribute required + /// type of attribute + public DefinitionProperty(string name, bool required, object type) + { + Name = name; + Required = required; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of attribute + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets is attribute required + /// + [JsonProperty(PropertyName = "required")] + public bool Required { get; set; } + + /// + /// Gets or sets type of attribute + /// + [JsonProperty(PropertyName = "type")] + public object Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..681cca281040 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorDetail.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..7d21089e96d5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..38daf270baac --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponseException.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..3f653f9d63eb --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollection.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollection.cs new file mode 100644 index 000000000000..a2de34e54127 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollection.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// 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. + /// + public partial class ExtendedGeoJsonFeatureCollection + { + /// + /// Initializes a new instance of the ExtendedGeoJsonFeatureCollection + /// class. + /// + public ExtendedGeoJsonFeatureCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtendedGeoJsonFeatureCollection + /// class. + /// + /// Specifies the `GeoJSON` type. Must be one of the + /// nine valid GeoJSON object types - Point, MultiPoint, LineString, + /// MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature + /// and FeatureCollection. Possible values include: 'GeoJsonPoint', + /// 'GeoJsonMultiPoint', 'GeoJsonLineString', 'GeoJsonMultiLineString', + /// 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection', 'GeoJsonFeature', + /// 'GeoJsonFeatureCollection' + /// Contains a list of valid `GeoJSON Feature` + /// objects. + /// Number of returned features. + /// Links to other WFS endpoints. + public ExtendedGeoJsonFeatureCollection(GeoJsonObjectType type, IList features, string ontology = default(string), int? numberReturned = default(int?), IList links = default(IList)) + { + Type = type; + Features = features; + Ontology = ontology; + NumberReturned = numberReturned; + Links = links; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the `GeoJSON` type. Must be one of the nine + /// valid GeoJSON object types - Point, MultiPoint, LineString, + /// MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature + /// and FeatureCollection. Possible values include: 'GeoJsonPoint', + /// 'GeoJsonMultiPoint', 'GeoJsonLineString', 'GeoJsonMultiLineString', + /// 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection', 'GeoJsonFeature', + /// 'GeoJsonFeatureCollection' + /// + [JsonProperty(PropertyName = "type")] + public GeoJsonObjectType Type { get; set; } + + /// + /// Gets or sets contains a list of valid `GeoJSON Feature` objects. + /// + [JsonProperty(PropertyName = "features")] + public IList Features { get; set; } + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets or sets number of returned features. + /// + [JsonProperty(PropertyName = "numberReturned")] + public int? NumberReturned { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Features == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Features"); + } + if (Features != null) + { + foreach (var element in Features) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Links != null) + { + foreach (var element1 in Links) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollectionData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollectionData.cs new file mode 100644 index 000000000000..aff96a1ae8f5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollectionData.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ExtendedGeoJsonFeatureCollectionData + { + /// + /// Initializes a new instance of the + /// ExtendedGeoJsonFeatureCollectionData class. + /// + public ExtendedGeoJsonFeatureCollectionData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ExtendedGeoJsonFeatureCollectionData class. + /// + /// Number of returned features. + /// Links to other WFS endpoints. + public ExtendedGeoJsonFeatureCollectionData(string ontology = default(string), int? numberReturned = default(int?), IList links = default(IList)) + { + Ontology = ontology; + NumberReturned = numberReturned; + Links = links; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets or sets number of returned features. + /// + [JsonProperty(PropertyName = "numberReturned")] + public int? NumberReturned { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureState.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureState.cs new file mode 100644 index 000000000000..ce7f3590e713 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureState.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Single feature state model. + /// + public partial class FeatureState + { + /// + /// Initializes a new instance of the FeatureState class. + /// + public FeatureState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeatureState class. + /// + /// Feature state Keyname. Maximum length allowed + /// is 1000. + /// Value for the feature state. Type should comply + /// with the style definition attached to the featurestate. Maximum + /// length allowed for string type is 1024. + /// Valid Timestamp when the feature state + /// was captured. + public FeatureState(string keyName = default(string), string value = default(string), string eventTimestamp = default(string)) + { + KeyName = keyName; + Value = value; + EventTimestamp = eventTimestamp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets feature state Keyname. Maximum length allowed is 1000. + /// + [JsonProperty(PropertyName = "keyName")] + public string KeyName { get; set; } + + /// + /// Gets or sets value for the feature state. Type should comply with + /// the style definition attached to the featurestate. Maximum length + /// allowed for string type is 1024. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets valid Timestamp when the feature state was captured. + /// + [JsonProperty(PropertyName = "eventTimestamp")] + public string EventTimestamp { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureStatesStructure.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureStatesStructure.cs new file mode 100644 index 000000000000..261c2affcfc8 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureStatesStructure.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The feature states model for a feature. + /// + public partial class FeatureStatesStructure + { + /// + /// Initializes a new instance of the FeatureStatesStructure class. + /// + public FeatureStatesStructure() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeatureStatesStructure class. + /// + /// The feature states array. + public FeatureStatesStructure(IList states = default(IList)) + { + States = states; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the feature states array. + /// + [JsonProperty(PropertyName = "states")] + public IList States { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeature.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeature.cs new file mode 100644 index 000000000000..4552adf8a075 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeature.cs @@ -0,0 +1,117 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A valid `GeoJSON Feature` object type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.2) for details. + /// + public partial class GeoJsonFeature + { + /// + /// Initializes a new instance of the GeoJsonFeature class. + /// + public GeoJsonFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonFeature class. + /// + /// Specifies the `GeoJSON` type. Must be one of the + /// nine valid GeoJSON object types - Point, MultiPoint, LineString, + /// MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature + /// and FeatureCollection. Possible values include: 'GeoJsonPoint', + /// 'GeoJsonMultiPoint', 'GeoJsonLineString', 'GeoJsonMultiLineString', + /// 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection', 'GeoJsonFeature', + /// 'GeoJsonFeatureCollection' + /// Properties can contain any additional + /// metadata about the `Feature`. Value can be any JSON object or a + /// JSON null value + /// Identifier for the feature. + /// 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. + public GeoJsonFeature(GeoJsonObjectType type, GeoJsonGeometry geometry, object properties = default(object), string id = default(string), string featureType = default(string)) + { + Type = type; + Geometry = geometry; + Properties = properties; + Id = id; + FeatureType = featureType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the `GeoJSON` type. Must be one of the nine + /// valid GeoJSON object types - Point, MultiPoint, LineString, + /// MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature + /// and FeatureCollection. Possible values include: 'GeoJsonPoint', + /// 'GeoJsonMultiPoint', 'GeoJsonLineString', 'GeoJsonMultiLineString', + /// 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection', 'GeoJsonFeature', + /// 'GeoJsonFeatureCollection' + /// + [JsonProperty(PropertyName = "type")] + public GeoJsonObjectType Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "geometry")] + public GeoJsonGeometry Geometry { get; set; } + + /// + /// Gets or sets properties can contain any additional metadata about + /// the `Feature`. Value can be any JSON object or a JSON null value + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + /// + /// Gets or sets identifier for the feature. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "featureType")] + public string FeatureType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Geometry == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Geometry"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollection.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollection.cs new file mode 100644 index 000000000000..31fe7cabba59 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollection.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON FeatureCollection` object type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.3) for details. + /// + public partial class GeoJsonFeatureCollection + { + /// + /// Initializes a new instance of the GeoJsonFeatureCollection class. + /// + public GeoJsonFeatureCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonFeatureCollection class. + /// + /// Specifies the `GeoJSON` type. Must be one of the + /// nine valid GeoJSON object types - Point, MultiPoint, LineString, + /// MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature + /// and FeatureCollection. Possible values include: 'GeoJsonPoint', + /// 'GeoJsonMultiPoint', 'GeoJsonLineString', 'GeoJsonMultiLineString', + /// 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection', 'GeoJsonFeature', + /// 'GeoJsonFeatureCollection' + /// Contains a list of valid `GeoJSON Feature` + /// objects. + public GeoJsonFeatureCollection(GeoJsonObjectType type, IList features) + { + Type = type; + Features = features; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the `GeoJSON` type. Must be one of the nine + /// valid GeoJSON object types - Point, MultiPoint, LineString, + /// MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature + /// and FeatureCollection. Possible values include: 'GeoJsonPoint', + /// 'GeoJsonMultiPoint', 'GeoJsonLineString', 'GeoJsonMultiLineString', + /// 'GeoJsonPolygon', 'GeoJsonMultiPolygon', + /// 'GeoJsonGeometryCollection', 'GeoJsonFeature', + /// 'GeoJsonFeatureCollection' + /// + [JsonProperty(PropertyName = "type")] + public GeoJsonObjectType Type { get; set; } + + /// + /// Gets or sets contains a list of valid `GeoJSON Feature` objects. + /// + [JsonProperty(PropertyName = "features")] + public IList Features { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Features == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Features"); + } + if (Features != null) + { + foreach (var element in Features) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollectionData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollectionData.cs new file mode 100644 index 000000000000..74cb2bb9efde --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollectionData.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GeoJsonFeatureCollectionData + { + /// + /// Initializes a new instance of the GeoJsonFeatureCollectionData + /// class. + /// + public GeoJsonFeatureCollectionData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonFeatureCollectionData + /// class. + /// + /// Contains a list of valid `GeoJSON Feature` + /// objects. + public GeoJsonFeatureCollectionData(IList features) + { + Features = features; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets contains a list of valid `GeoJSON Feature` objects. + /// + [JsonProperty(PropertyName = "features")] + public IList Features { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Features == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Features"); + } + if (Features != null) + { + foreach (var element in Features) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureData.cs new file mode 100644 index 000000000000..a3dce85fe311 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureData.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class GeoJsonFeatureData + { + /// + /// Initializes a new instance of the GeoJsonFeatureData class. + /// + public GeoJsonFeatureData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonFeatureData class. + /// + /// Properties can contain any additional + /// metadata about the `Feature`. Value can be any JSON object or a + /// JSON null value + /// Identifier for the feature. + /// 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. + public GeoJsonFeatureData(GeoJsonGeometry geometry, object properties = default(object), string id = default(string), string featureType = default(string)) + { + Geometry = geometry; + Properties = properties; + Id = id; + FeatureType = featureType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "geometry")] + public GeoJsonGeometry Geometry { get; set; } + + /// + /// Gets or sets properties can contain any additional metadata about + /// the `Feature`. Value can be any JSON object or a JSON null value + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + /// + /// Gets or sets identifier for the feature. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "featureType")] + public string FeatureType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Geometry == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Geometry"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometry.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometry.cs new file mode 100644 index 000000000000..706b99d96414 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometry.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using System.Linq; + + /// + /// 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. + /// + public partial class GeoJsonGeometry : GeoJsonObject + { + /// + /// Initializes a new instance of the GeoJsonGeometry class. + /// + public GeoJsonGeometry() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollection.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollection.cs new file mode 100644 index 000000000000..aeececbf9b62 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollection.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON GeometryCollection` object type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.8) for details. + /// + public partial class GeoJsonGeometryCollection + { + /// + /// Initializes a new instance of the GeoJsonGeometryCollection class. + /// + public GeoJsonGeometryCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonGeometryCollection class. + /// + /// Contains a list of valid `GeoJSON` + /// geometry objects. **Note** that coordinates in GeoJSON are in x, y + /// order (longitude, latitude). + public GeoJsonGeometryCollection(IList geometries) + { + Geometries = geometries; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets contains a list of valid `GeoJSON` geometry objects. + /// **Note** that coordinates in GeoJSON are in x, y order (longitude, + /// latitude). + /// + [JsonProperty(PropertyName = "geometries")] + public IList Geometries { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Geometries == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Geometries"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollectionData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollectionData.cs new file mode 100644 index 000000000000..819f566d75af --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryCollectionData.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GeoJsonGeometryCollectionData + { + /// + /// Initializes a new instance of the GeoJsonGeometryCollectionData + /// class. + /// + public GeoJsonGeometryCollectionData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonGeometryCollectionData + /// class. + /// + /// Contains a list of valid `GeoJSON` + /// geometry objects. **Note** that coordinates in GeoJSON are in x, y + /// order (longitude, latitude). + public GeoJsonGeometryCollectionData(IList geometries) + { + Geometries = geometries; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets contains a list of valid `GeoJSON` geometry objects. + /// **Note** that coordinates in GeoJSON are in x, y order (longitude, + /// latitude). + /// + [JsonProperty(PropertyName = "geometries")] + public IList Geometries { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Geometries == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Geometries"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryType.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryType.cs new file mode 100644 index 000000000000..91ba65838eb0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonGeometryType.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + + /// + /// Defines values for GeoJsonGeometryType. + /// + public static class GeoJsonGeometryType + { + /// + /// `GeoJSON Point` geometry. + /// + public const string GeoJsonPoint = "Point"; + /// + /// `GeoJSON MultiPoint` geometry. + /// + public const string GeoJsonMultiPoint = "MultiPoint"; + /// + /// `GeoJSON LineString` geometry. + /// + public const string GeoJsonLineString = "LineString"; + /// + /// `GeoJSON MultiLineString` geometry. + /// + public const string GeoJsonMultiLineString = "MultiLineString"; + /// + /// `GeoJSON Polygon` geometry. + /// + public const string GeoJsonPolygon = "Polygon"; + /// + /// `GeoJSON MultiPolygon` geometry. + /// + public const string GeoJsonMultiPolygon = "MultiPolygon"; + /// + /// `GeoJSON GeometryCollection` geometry. + /// + public const string GeoJsonGeometryCollection = "GeometryCollection"; + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineString.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineString.cs new file mode 100644 index 000000000000..60fc6113eb5d --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineString.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON LineString` geometry type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.4) for details. + /// + public partial class GeoJsonLineString + { + /// + /// Initializes a new instance of the GeoJsonLineString class. + /// + public GeoJsonLineString() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonLineString class. + /// + /// Coordinates for the `GeoJson LineString` + /// geometry. + public GeoJsonLineString(IList> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson LineString` geometry. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineStringData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineStringData.cs new file mode 100644 index 000000000000..4a51f3d9bc7e --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonLineStringData.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GeoJsonLineStringData + { + /// + /// Initializes a new instance of the GeoJsonLineStringData class. + /// + public GeoJsonLineStringData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonLineStringData class. + /// + /// Coordinates for the `GeoJson LineString` + /// geometry. + public GeoJsonLineStringData(IList> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson LineString` geometry. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineString.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineString.cs new file mode 100644 index 000000000000..3c25b8b87937 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineString.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON MultiLineString` geometry type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.5) for details. + /// + public partial class GeoJsonMultiLineString + { + /// + /// Initializes a new instance of the GeoJsonMultiLineString class. + /// + public GeoJsonMultiLineString() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonMultiLineString class. + /// + /// Coordinates for the `GeoJson + /// MultiLineString` geometry. + public GeoJsonMultiLineString(IList>> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson MultiLineString` + /// geometry. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList>> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineStringData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineStringData.cs new file mode 100644 index 000000000000..346061383c2c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiLineStringData.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GeoJsonMultiLineStringData + { + /// + /// Initializes a new instance of the GeoJsonMultiLineStringData class. + /// + public GeoJsonMultiLineStringData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonMultiLineStringData class. + /// + /// Coordinates for the `GeoJson + /// MultiLineString` geometry. + public GeoJsonMultiLineStringData(IList>> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson MultiLineString` + /// geometry. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList>> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPoint.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPoint.cs new file mode 100644 index 000000000000..22d00dbe5f23 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPoint.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON MultiPoint` geometry type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.3) for details. + /// + public partial class GeoJsonMultiPoint + { + /// + /// Initializes a new instance of the GeoJsonMultiPoint class. + /// + public GeoJsonMultiPoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonMultiPoint class. + /// + /// Coordinates for the `GeoJson MultiPoint` + /// geometry. + public GeoJsonMultiPoint(IList> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson MultiPoint` geometry. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPointData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPointData.cs new file mode 100644 index 000000000000..d31505d6f536 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPointData.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Data contained by a `GeoJson MultiPoint`. + /// + public partial class GeoJsonMultiPointData + { + /// + /// Initializes a new instance of the GeoJsonMultiPointData class. + /// + public GeoJsonMultiPointData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonMultiPointData class. + /// + /// Coordinates for the `GeoJson MultiPoint` + /// geometry. + public GeoJsonMultiPointData(IList> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson MultiPoint` geometry. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygon.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygon.cs new file mode 100644 index 000000000000..e38fd7a86746 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygon.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON MultiPolygon` object type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.7) for details. + /// + public partial class GeoJsonMultiPolygon + { + /// + /// Initializes a new instance of the GeoJsonMultiPolygon class. + /// + public GeoJsonMultiPolygon() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonMultiPolygon class. + /// + /// Contains a list of valid `GeoJSON + /// Polygon` objects. **Note** that coordinates in GeoJSON are in x, y + /// order (longitude, latitude). + public GeoJsonMultiPolygon(IList>>> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets contains a list of valid `GeoJSON Polygon` objects. + /// **Note** that coordinates in GeoJSON are in x, y order (longitude, + /// latitude). + /// + [JsonProperty(PropertyName = "coordinates")] + public IList>>> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygonData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygonData.cs new file mode 100644 index 000000000000..23a3356b1f31 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonMultiPolygonData.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GeoJsonMultiPolygonData + { + /// + /// Initializes a new instance of the GeoJsonMultiPolygonData class. + /// + public GeoJsonMultiPolygonData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonMultiPolygonData class. + /// + /// Contains a list of valid `GeoJSON + /// Polygon` objects. **Note** that coordinates in GeoJSON are in x, y + /// order (longitude, latitude). + public GeoJsonMultiPolygonData(IList>>> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets contains a list of valid `GeoJSON Polygon` objects. + /// **Note** that coordinates in GeoJSON are in x, y order (longitude, + /// latitude). + /// + [JsonProperty(PropertyName = "coordinates")] + public IList>>> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObject.cs new file mode 100644 index 000000000000..f54e5b466603 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObject.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using System.Linq; + + /// + /// A valid `GeoJSON` object. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3) for details. + /// + public partial class GeoJsonObject + { + /// + /// Initializes a new instance of the GeoJsonObject class. + /// + public GeoJsonObject() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObjectType.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObjectType.cs new file mode 100644 index 000000000000..2241e6386a63 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObjectType.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for GeoJsonObjectType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum GeoJsonObjectType + { + /// + /// `GeoJSON Point` geometry. + /// + [EnumMember(Value = "Point")] + GeoJsonPoint, + /// + /// `GeoJSON MultiPoint` geometry. + /// + [EnumMember(Value = "MultiPoint")] + GeoJsonMultiPoint, + /// + /// `GeoJSON LineString` geometry. + /// + [EnumMember(Value = "LineString")] + GeoJsonLineString, + /// + /// `GeoJSON MultiLineString` geometry. + /// + [EnumMember(Value = "MultiLineString")] + GeoJsonMultiLineString, + /// + /// `GeoJSON Polygon` geometry. + /// + [EnumMember(Value = "Polygon")] + GeoJsonPolygon, + /// + /// `GeoJSON MultiPolygon` geometry. + /// + [EnumMember(Value = "MultiPolygon")] + GeoJsonMultiPolygon, + /// + /// `GeoJSON GeometryCollection` geometry. + /// + [EnumMember(Value = "GeometryCollection")] + GeoJsonGeometryCollection, + /// + /// `GeoJSON Feature` object. + /// + [EnumMember(Value = "Feature")] + GeoJsonFeature, + /// + /// `GeoJSON FeatureCollection` object. + /// + [EnumMember(Value = "FeatureCollection")] + GeoJsonFeatureCollection + } + internal static class GeoJsonObjectTypeEnumExtension + { + internal static string ToSerializedValue(this GeoJsonObjectType? value) + { + return value == null ? null : ((GeoJsonObjectType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this GeoJsonObjectType value) + { + switch( value ) + { + case GeoJsonObjectType.GeoJsonPoint: + return "Point"; + case GeoJsonObjectType.GeoJsonMultiPoint: + return "MultiPoint"; + case GeoJsonObjectType.GeoJsonLineString: + return "LineString"; + case GeoJsonObjectType.GeoJsonMultiLineString: + return "MultiLineString"; + case GeoJsonObjectType.GeoJsonPolygon: + return "Polygon"; + case GeoJsonObjectType.GeoJsonMultiPolygon: + return "MultiPolygon"; + case GeoJsonObjectType.GeoJsonGeometryCollection: + return "GeometryCollection"; + case GeoJsonObjectType.GeoJsonFeature: + return "Feature"; + case GeoJsonObjectType.GeoJsonFeatureCollection: + return "FeatureCollection"; + } + return null; + } + + internal static GeoJsonObjectType? ParseGeoJsonObjectType(this string value) + { + switch( value ) + { + case "Point": + return GeoJsonObjectType.GeoJsonPoint; + case "MultiPoint": + return GeoJsonObjectType.GeoJsonMultiPoint; + case "LineString": + return GeoJsonObjectType.GeoJsonLineString; + case "MultiLineString": + return GeoJsonObjectType.GeoJsonMultiLineString; + case "Polygon": + return GeoJsonObjectType.GeoJsonPolygon; + case "MultiPolygon": + return GeoJsonObjectType.GeoJsonMultiPolygon; + case "GeometryCollection": + return GeoJsonObjectType.GeoJsonGeometryCollection; + case "Feature": + return GeoJsonObjectType.GeoJsonFeature; + case "FeatureCollection": + return GeoJsonObjectType.GeoJsonFeatureCollection; + } + return null; + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPoint.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPoint.cs new file mode 100644 index 000000000000..9ef07737cdc3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPoint.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON Point` geometry type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.2) for details. + /// + public partial class GeoJsonPoint + { + /// + /// Initializes a new instance of the GeoJsonPoint class. + /// + public GeoJsonPoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonPoint class. + /// + public GeoJsonPoint(IList coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "coordinates")] + public IList Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPointData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPointData.cs new file mode 100644 index 000000000000..ddd426166eff --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPointData.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Data contained by a `GeoJson Point`. + /// + public partial class GeoJsonPointData + { + /// + /// Initializes a new instance of the GeoJsonPointData class. + /// + public GeoJsonPointData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonPointData class. + /// + public GeoJsonPointData(IList coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "coordinates")] + public IList Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygon.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygon.cs new file mode 100644 index 000000000000..b9796d296060 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygon.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A valid `GeoJSON Polygon` geometry type. Please refer to [RFC + /// 7946](https://tools.ietf.org/html/rfc7946#section-3.1.6) for details. + /// + public partial class GeoJsonPolygon + { + /// + /// Initializes a new instance of the GeoJsonPolygon class. + /// + public GeoJsonPolygon() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonPolygon class. + /// + /// Coordinates for the `GeoJson Polygon` + /// geometry type. + public GeoJsonPolygon(IList>> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson Polygon` geometry type. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList>> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygonData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygonData.cs new file mode 100644 index 000000000000..a49a66a51bec --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonPolygonData.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GeoJsonPolygonData + { + /// + /// Initializes a new instance of the GeoJsonPolygonData class. + /// + public GeoJsonPolygonData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoJsonPolygonData class. + /// + /// Coordinates for the `GeoJson Polygon` + /// geometry type. + public GeoJsonPolygonData(IList>> coordinates) + { + Coordinates = coordinates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets coordinates for the `GeoJson Polygon` geometry type. + /// + [JsonProperty(PropertyName = "coordinates")] + public IList>> Coordinates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Coordinates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Coordinates"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Geofence.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Geofence.cs new file mode 100644 index 000000000000..1f47443eb055 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Geofence.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This object is returned from a geofence proximity call. + /// + public partial class Geofence + { + /// + /// Initializes a new instance of the Geofence class. + /// + public Geofence() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Geofence class. + /// + /// Lists the fence geometries that contain + /// the coordinate position or overlap the searchBuffer around the + /// position. + /// Lists of the geometry ID of + /// the geofence which is expired relative to the user time in the + /// request. + /// Lists of the geometry + /// ID of the geofence which is in invalid period relative to the user + /// time in the request. + /// 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. + public Geofence(IList geometries = default(IList), IList expiredGeofenceGeometryId = default(IList), IList invalidPeriodGeofenceGeometryId = default(IList), bool? isEventPublished = default(bool?)) + { + Geometries = geometries; + ExpiredGeofenceGeometryId = expiredGeofenceGeometryId; + InvalidPeriodGeofenceGeometryId = invalidPeriodGeofenceGeometryId; + IsEventPublished = isEventPublished; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets lists the fence geometries that contain the coordinate + /// position or overlap the searchBuffer around the position. + /// + [JsonProperty(PropertyName = "geometries")] + public IList Geometries { get; private set; } + + /// + /// Gets lists of the geometry ID of the geofence which is expired + /// relative to the user time in the request. + /// + [JsonProperty(PropertyName = "expiredGeofenceGeometryId")] + public IList ExpiredGeofenceGeometryId { get; private set; } + + /// + /// Gets lists of the geometry ID of the geofence which is in invalid + /// period relative to the user time in the request. + /// + [JsonProperty(PropertyName = "invalidPeriodGeofenceGeometryId")] + public IList InvalidPeriodGeofenceGeometryId { get; private set; } + + /// + /// Gets 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. + /// + [JsonProperty(PropertyName = "isEventPublished")] + public bool? IsEventPublished { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceGeometry.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceGeometry.cs new file mode 100644 index 000000000000..d7caf94840c2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceGeometry.cs @@ -0,0 +1,139 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The geofencing geometry. + /// + public partial class GeofenceGeometry + { + /// + /// Initializes a new instance of the GeofenceGeometry class. + /// + public GeofenceGeometry() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeofenceGeometry class. + /// + /// ID of the device. + /// 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. + /// The unique id identifies a + /// geometry. + /// 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. + /// Latitude of the nearest point of the + /// geometry. + /// Longitude of the nearest point of the + /// geometry. + /// 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. + public GeofenceGeometry(string deviceId = default(string), string udid = default(string), string geometryId = default(string), double? distance = default(double?), double? nearestLat = default(double?), double? nearestLon = default(double?), double? nearestAltitude = default(double?)) + { + DeviceId = deviceId; + Udid = udid; + GeometryId = geometryId; + Distance = distance; + NearestLat = nearestLat; + NearestLon = nearestLon; + NearestAltitude = nearestAltitude; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets ID of the device. + /// + [JsonProperty(PropertyName = "deviceId")] + public string DeviceId { get; private set; } + + /// + /// Gets 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. + /// + [JsonProperty(PropertyName = "udId")] + public string Udid { get; private set; } + + /// + /// Gets the unique id identifies a geometry. + /// + [JsonProperty(PropertyName = "geometryId")] + public string GeometryId { get; private set; } + + /// + /// Gets 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. + /// + [JsonProperty(PropertyName = "distance")] + public double? Distance { get; private set; } + + /// + /// Gets latitude of the nearest point of the geometry. + /// + [JsonProperty(PropertyName = "nearestLat")] + public double? NearestLat { get; private set; } + + /// + /// Gets longitude of the nearest point of the geometry. + /// + [JsonProperty(PropertyName = "nearestLon")] + public double? NearestLon { get; private set; } + + /// + /// Gets 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. + /// + [JsonProperty(PropertyName = "nearestZ")] + public double? NearestAltitude { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceMode.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceMode.cs new file mode 100644 index 000000000000..633bc3495497 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceMode.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + + /// + /// Defines values for GeofenceMode. + /// + public static class GeofenceMode + { + /// + /// Publish all the query results to Azure Maps account event + /// subscription. + /// + public const string All = "All"; + /// + /// Only publish result when user location is considered as crossing + /// geofencing boarder. + /// + public const string EnterAndExit = "EnterAndExit"; + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeographicResourceLocation.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeographicResourceLocation.cs new file mode 100644 index 000000000000..f6ab322ab853 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeographicResourceLocation.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + + /// + /// Defines values for GeographicResourceLocation. + /// + public static class GeographicResourceLocation + { + /// + /// Used to access an Azure Maps Creator resource in the United States + /// + public const string Us = "us"; + /// + /// Used to access an Azure Maps Creator resource in Europe + /// + public const string Eu = "eu"; + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetFeatureResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetFeatureResult.cs new file mode 100644 index 000000000000..01e317a98e82 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetFeatureResult.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GetFeatureResult + { + /// + /// Initializes a new instance of the GetFeatureResult class. + /// + public GetFeatureResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetFeatureResult class. + /// + /// Links to other WFS endpoints. + public GetFeatureResult(GeoJsonFeature feature, string ontology = default(string), IList links = default(IList)) + { + Ontology = ontology; + Feature = feature; + Links = links; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// + [JsonProperty(PropertyName = "feature")] + public GeoJsonFeature Feature { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Feature == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Feature"); + } + if (Feature != null) + { + Feature.Validate(); + } + if (Links != null) + { + foreach (var element in Links) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetLandingPageResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetLandingPageResult.cs new file mode 100644 index 000000000000..b1f148f8df96 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GetLandingPageResult.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class GetLandingPageResult + { + /// + /// Initializes a new instance of the GetLandingPageResult class. + /// + public GetLandingPageResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetLandingPageResult class. + /// + /// Links to other WFS endpoints. + public GetLandingPageResult(IList links, string ontology = default(string)) + { + Ontology = ontology; + Links = links; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets or sets links to other WFS endpoints. + /// + [JsonProperty(PropertyName = "links")] + public IList Links { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Links == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Links"); + } + if (Links != null) + { + foreach (var element in Links) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResult.cs new file mode 100644 index 000000000000..dca6fcb50364 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResult.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// This object is returned from a successful Great Circle Distance call + /// + [JsonTransformation] + public partial class GreatCircleDistanceResult + { + /// + /// Initializes a new instance of the GreatCircleDistanceResult class. + /// + public GreatCircleDistanceResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GreatCircleDistanceResult class. + /// + /// The great circle distance in meters + /// from the source point to the target point + public GreatCircleDistanceResult(GreatCircleDistanceSummary summary = default(GreatCircleDistanceSummary), double? distanceInMeters = default(double?)) + { + Summary = summary; + DistanceInMeters = distanceInMeters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "summary")] + public GreatCircleDistanceSummary Summary { get; set; } + + /// + /// Gets the great circle distance in meters from the source point to + /// the target point + /// + [JsonProperty(PropertyName = "result.distanceInMeters")] + public double? DistanceInMeters { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceSummary.cs new file mode 100644 index 000000000000..d8e4425a6370 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceSummary.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Summary object + /// + public partial class GreatCircleDistanceSummary + { + /// + /// Initializes a new instance of the GreatCircleDistanceSummary class. + /// + public GreatCircleDistanceSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GreatCircleDistanceSummary class. + /// + public GreatCircleDistanceSummary(LatLongPairAbbreviated sourcePoint = default(LatLongPairAbbreviated), LatLongPairAbbreviated targetPoint = default(LatLongPairAbbreviated)) + { + SourcePoint = sourcePoint; + TargetPoint = targetPoint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sourcePoint")] + public LatLongPairAbbreviated SourcePoint { get; set; } + + /// + /// + [JsonProperty(PropertyName = "targetPoint")] + public LatLongPairAbbreviated TargetPoint { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LatLongPairAbbreviated.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LatLongPairAbbreviated.cs new file mode 100644 index 000000000000..f677cdf3641c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LatLongPairAbbreviated.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A location represented as a latitude and longitude using short names + /// 'lat' & 'lon'. + /// + public partial class LatLongPairAbbreviated + { + /// + /// Initializes a new instance of the LatLongPairAbbreviated class. + /// + public LatLongPairAbbreviated() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LatLongPairAbbreviated class. + /// + /// Latitude property + /// Longitude property + public LatLongPairAbbreviated(double? lat = default(double?), double? lon = default(double?)) + { + Lat = lat; + Lon = lon; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets latitude property + /// + [JsonProperty(PropertyName = "lat")] + public double? Lat { get; set; } + + /// + /// Gets or sets longitude property + /// + [JsonProperty(PropertyName = "lon")] + public double? Lon { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ListTilesetResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ListTilesetResult.cs new file mode 100644 index 000000000000..98799a8e35c3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ListTilesetResult.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the Tileset List API. Returns a list of all + /// tilesets. + /// + public partial class ListTilesetResult + { + /// + /// Initializes a new instance of the ListTilesetResult class. + /// + public ListTilesetResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListTilesetResult class. + /// + /// A list of all tilesets. + /// If present, the location of the next page of + /// data. + public ListTilesetResult(IList tilesets = default(IList), string nextLink = default(string)) + { + Tilesets = tilesets; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all tilesets. + /// + [JsonProperty(PropertyName = "tilesets")] + public IList Tilesets { get; private set; } + + /// + /// Gets if present, the location of the next page of data. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LongRunningOperationResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LongRunningOperationResult.cs new file mode 100644 index 000000000000..3d7144b32f96 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LongRunningOperationResult.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The response model for a Long-Running Operations API. + /// + public partial class LongRunningOperationResult + { + /// + /// Initializes a new instance of the LongRunningOperationResult class. + /// + public LongRunningOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LongRunningOperationResult class. + /// + /// The Id for this long-running + /// operation. + /// The status state of the request. Possible + /// values include: 'NotStarted', 'Running', 'Failed', + /// 'Succeeded' + /// The created timestamp. + public LongRunningOperationResult(string operationId = default(string), string status = default(string), System.DateTime? created = default(System.DateTime?), ErrorDetail error = default(ErrorDetail), ErrorDetail warning = default(ErrorDetail)) + { + OperationId = operationId; + Status = status; + Created = created; + Error = error; + Warning = warning; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Id for this long-running operation. + /// + [JsonProperty(PropertyName = "operationId")] + public string OperationId { get; set; } + + /// + /// Gets the status state of the request. Possible values include: + /// 'NotStarted', 'Running', 'Failed', 'Succeeded' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the created timestamp. + /// + [JsonProperty(PropertyName = "created")] + public System.DateTime? Created { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + /// + /// + [JsonProperty(PropertyName = "warning")] + public ErrorDetail Warning { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LroStatus.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LroStatus.cs new file mode 100644 index 000000000000..a64c6994776f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LroStatus.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + + /// + /// Defines values for LroStatus. + /// + public static class LroStatus + { + /// + /// The request has not started processing yet. + /// + public const string NotStarted = "NotStarted"; + /// + /// The request has started processing. + /// + public const string Running = "Running"; + /// + /// The request has one or more failures. + /// + public const string Failed = "Failed"; + /// + /// The request has successfully completed. + /// + public const string Succeeded = "Succeeded"; + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapData.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapData.cs new file mode 100644 index 000000000000..6154ff7a0e34 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapData.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Detail information for the data. + /// + public partial class MapData + { + /// + /// Initializes a new instance of the MapData class. + /// + public MapData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MapData class. + /// + /// The unique data id for the data. + /// The location of the data. Execute a HTTP + /// `GET` on this location to download the data. + /// The size of the content in bytes. + /// Possible values include: 'Pending', + /// 'Completed', 'Failed' + /// Possible values include: 'geojson', 'zip', + /// 'dwgzippackage' + /// The current description. + public MapData(string udid = default(string), string locationURL = default(string), long? sizeInBytes = default(long?), UploadStatus? uploadStatus = default(UploadStatus?), string dataFormat = default(string), string description = default(string)) + { + Udid = udid; + LocationURL = locationURL; + SizeInBytes = sizeInBytes; + UploadStatus = uploadStatus; + DataFormat = dataFormat; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique data id for the data. + /// + [JsonProperty(PropertyName = "udid")] + public string Udid { get; private set; } + + /// + /// Gets the location of the data. Execute a HTTP `GET` on this + /// location to download the data. + /// + [JsonProperty(PropertyName = "location")] + public string LocationURL { get; private set; } + + /// + /// Gets the size of the content in bytes. + /// + [JsonProperty(PropertyName = "sizeInBytes")] + public long? SizeInBytes { get; private set; } + + /// + /// Gets or sets possible values include: 'Pending', 'Completed', + /// 'Failed' + /// + [JsonProperty(PropertyName = "uploadStatus")] + public UploadStatus? UploadStatus { get; set; } + + /// + /// Gets or sets possible values include: 'geojson', 'zip', + /// 'dwgzippackage' + /// + [JsonProperty(PropertyName = "dataFormat")] + public string DataFormat { get; set; } + + /// + /// Gets the current description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataListResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataListResult.cs new file mode 100644 index 000000000000..2bf0c6c90c30 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataListResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the Data List API. Returns a list of all the + /// previously uploaded data. + /// + public partial class MapDataListResult + { + /// + /// Initializes a new instance of the MapDataListResult class. + /// + public MapDataListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MapDataListResult class. + /// + /// A list of all the previously uploaded + /// data. + public MapDataListResult(IList mapDataList = default(IList)) + { + MapDataList = mapDataList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of all the previously uploaded data. + /// + [JsonProperty(PropertyName = "mapDataList")] + public IList MapDataList { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberRule.cs new file mode 100644 index 000000000000..329e79da4315 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberRule.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The numeric rule. The color is selected from the first range it falls + /// into. + /// + public partial class NumberRule + { + /// + /// Initializes a new instance of the NumberRule class. + /// + public NumberRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NumberRule class. + /// + /// 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. + public NumberRule(Range range = default(Range), string color = default(string)) + { + Range = range; + Color = color; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "range")] + public Range Range { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "color")] + public string Color { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberStyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberStyleRule.cs new file mode 100644 index 000000000000..d9b0e5ad7a31 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberStyleRule.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The numeric type style rule object. + /// + [Newtonsoft.Json.JsonObject("number")] + public partial class NumberStyleRule : StyleRule + { + /// + /// Initializes a new instance of the NumberStyleRule class. + /// + public NumberStyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NumberStyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + /// Numeric style rules. + public NumberStyleRule(string keyName, IList rules) + : base(keyName) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets numeric style rules. + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Rules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResult.cs new file mode 100644 index 000000000000..a596a9e60064 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResult.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Returns true if point is within the polygon, false otherwise + /// + [JsonTransformation] + public partial class PointInPolygonResult + { + /// + /// Initializes a new instance of the PointInPolygonResult class. + /// + public PointInPolygonResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PointInPolygonResult class. + /// + /// Point In Polygons Property + /// Geometries array + public PointInPolygonResult(PointInPolygonSummary summary = default(PointInPolygonSummary), bool? isPointInPolygons = default(bool?), IList intersectingGeometries = default(IList)) + { + Summary = summary; + IsPointInPolygons = isPointInPolygons; + IntersectingGeometries = intersectingGeometries; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "summary")] + public PointInPolygonSummary Summary { get; set; } + + /// + /// Gets point In Polygons Property + /// + [JsonProperty(PropertyName = "result.pointInPolygons")] + public bool? IsPointInPolygons { get; private set; } + + /// + /// Gets geometries array + /// + [JsonProperty(PropertyName = "result.intersectingGeometries")] + public IList IntersectingGeometries { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonSummary.cs new file mode 100644 index 000000000000..f9b89998f172 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonSummary.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Point In Polygon Summary object + /// + public partial class PointInPolygonSummary + { + /// + /// Initializes a new instance of the PointInPolygonSummary class. + /// + public PointInPolygonSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PointInPolygonSummary class. + /// + /// A unique data id (udid) for the uploaded + /// content. Udid is not applicable for POST spatial operations(set to + /// null) + /// Processing information + public PointInPolygonSummary(LatLongPairAbbreviated sourcePoint = default(LatLongPairAbbreviated), string udid = default(string), string information = default(string)) + { + SourcePoint = sourcePoint; + Udid = udid; + Information = information; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sourcePoint")] + public LatLongPairAbbreviated SourcePoint { get; set; } + + /// + /// Gets a unique data id (udid) for the uploaded content. Udid is not + /// applicable for POST spatial operations(set to null) + /// + [JsonProperty(PropertyName = "udid")] + public string Udid { get; private set; } + + /// + /// Gets processing information + /// + [JsonProperty(PropertyName = "information")] + public string Information { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Position.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Position.cs new file mode 100644 index 000000000000..578cc8ae3cfd --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Position.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Additional parameters for a set of operations. + /// + public partial class Position + { + /// + /// Initializes a new instance of the Position class. + /// + public Position() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Position class. + /// + /// The latitude of the location being passed. + /// Example: 48.36. + /// The longitude of the location being passed. + /// Example: -124.63. + public Position(double latitude, double longitude) + { + Latitude = latitude; + Longitude = longitude; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the latitude of the location being passed. Example: + /// 48.36. + /// + [Newtonsoft.Json.JsonIgnore] + public double Latitude { get; set; } + + /// + /// Gets or sets the longitude of the location being passed. Example: + /// -124.63. + /// + [Newtonsoft.Json.JsonIgnore] + public double Longitude { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Range.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Range.cs new file mode 100644 index 000000000000..0e1657e7aa69 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Range.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The numeric value range for this style rule. If the value is in the + /// range, all the conditions must hold true. + /// + public partial class Range + { + /// + /// Initializes a new instance of the Range class. + /// + public Range() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Range class. + /// + /// All the number x that x ≥ minimum. + /// All the number x that x ≤ maximum. + /// All the number x that x > + /// exclusiveMinimum. + /// All the number x that x < + /// exclusiveMaximum. + public Range(string minimum = default(string), string maximum = default(string), string exclusiveMinimum = default(string), string exclusiveMaximum = default(string)) + { + Minimum = minimum; + Maximum = maximum; + ExclusiveMinimum = exclusiveMinimum; + ExclusiveMaximum = exclusiveMaximum; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets all the number x that x ≥ minimum. + /// + [JsonProperty(PropertyName = "minimum")] + public string Minimum { get; set; } + + /// + /// Gets or sets all the number x that x ≤ maximum. + /// + [JsonProperty(PropertyName = "maximum")] + public string Maximum { get; set; } + + /// + /// Gets or sets all the number x that x &gt; exclusiveMinimum. + /// + [JsonProperty(PropertyName = "exclusiveMinimum")] + public string ExclusiveMinimum { get; set; } + + /// + /// Gets or sets all the number x that x &lt; exclusiveMaximum. + /// + [JsonProperty(PropertyName = "exclusiveMaximum")] + public string ExclusiveMaximum { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialGetGeofenceHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialGetGeofenceHeaders.cs new file mode 100644 index 000000000000..a7f5ecc0a0ee --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialGetGeofenceHeaders.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetGeofence operation. + /// + public partial class SpatialGetGeofenceHeaders + { + /// + /// Initializes a new instance of the SpatialGetGeofenceHeaders class. + /// + public SpatialGetGeofenceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SpatialGetGeofenceHeaders class. + /// + /// 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. + public SpatialGetGeofenceHeaders(string xCorrelationId = default(string)) + { + XCorrelationId = xCorrelationId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "X-Correlation-id")] + public string XCorrelationId { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialPostGeofenceHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialPostGeofenceHeaders.cs new file mode 100644 index 000000000000..e2f56539a37b --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialPostGeofenceHeaders.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for PostGeofence operation. + /// + public partial class SpatialPostGeofenceHeaders + { + /// + /// Initializes a new instance of the SpatialPostGeofenceHeaders class. + /// + public SpatialPostGeofenceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SpatialPostGeofenceHeaders class. + /// + /// 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. + public SpatialPostGeofenceHeaders(string xCorrelationId = default(string)) + { + XCorrelationId = xCorrelationId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "X-Correlation-id")] + public string XCorrelationId { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Stateset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Stateset.cs new file mode 100644 index 000000000000..2f5cdd77307f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Stateset.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the successful Stateset Get API. + /// + public partial class Stateset + { + /// + /// Initializes a new instance of the Stateset class. + /// + public Stateset() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Stateset class. + /// + /// Description associated with the + /// stateset. + /// Dataset ID associated with the + /// stateset. + public Stateset(string description = default(string), IList datasetIds = default(IList), StyleRules styleRules = default(StyleRules)) + { + Description = description; + DatasetIds = datasetIds; + StyleRules = styleRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets description associated with the stateset. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets or sets dataset ID associated with the stateset. + /// + [JsonProperty(PropertyName = "datasetIds")] + public IList DatasetIds { get; set; } + + /// + /// + [JsonProperty(PropertyName = "statesetStyle")] + public StyleRules StyleRules { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetCreatedResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetCreatedResult.cs new file mode 100644 index 000000000000..745048fc502a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetCreatedResult.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The response model for the successful Stateset Create API. + /// + public partial class StatesetCreatedResult + { + /// + /// Initializes a new instance of the StatesetCreatedResult class. + /// + public StatesetCreatedResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetCreatedResult class. + /// + /// The ID for the new stateset + /// created. + public StatesetCreatedResult(string statesetId = default(string)) + { + StatesetId = statesetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ID for the new stateset created. + /// + [JsonProperty(PropertyName = "statesetId")] + public string StatesetId { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfo.cs new file mode 100644 index 000000000000..5b075388a2f1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfo.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The stateset information detail. + /// + public partial class StatesetInfo : Stateset + { + /// + /// Initializes a new instance of the StatesetInfo class. + /// + public StatesetInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetInfo class. + /// + /// Description associated with the + /// stateset. + /// Dataset ID associated with the + /// stateset. + /// The stateset ID of this stateset. + public StatesetInfo(string description = default(string), IList datasetIds = default(IList), StyleRules styleRules = default(StyleRules), string statesetId = default(string)) + : base(description, datasetIds, styleRules) + { + StatesetId = statesetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the stateset ID of this stateset. + /// + [JsonProperty(PropertyName = "statesetId")] + public string StatesetId { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResult.cs new file mode 100644 index 000000000000..28de5832d57a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResult.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the successful Stateset List API. + /// + public partial class StatesetListResult + { + /// + /// Initializes a new instance of the StatesetListResult class. + /// + public StatesetListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetListResult class. + /// + /// A list of statesets information. + /// If present, the location of the next page of + /// data. + public StatesetListResult(IList statesets = default(IList), string nextLink = default(string)) + { + Statesets = statesets; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of statesets information. + /// + [JsonProperty(PropertyName = "statesets")] + public IList Statesets { get; set; } + + /// + /// Gets if present, the location of the next page of data. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StringStyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StringStyleRule.cs new file mode 100644 index 000000000000..26980861df29 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StringStyleRule.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The string type style rule object. + /// + [Newtonsoft.Json.JsonObject("string")] + public partial class StringStyleRule : StyleRule + { + /// + /// Initializes a new instance of the StringStyleRule class. + /// + public StringStyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StringStyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + /// String style rules. + public StringStyleRule(string keyName, IList> rules) + : base(keyName) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets string style rules. + /// + [JsonProperty(PropertyName = "rules")] + public IList> Rules { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Rules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRule.cs new file mode 100644 index 000000000000..f0fb9b8b26fc --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRule.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The stateset style model. The style rule could be a numeric type style + /// rule or a boolean type style rule. Refer to NumberRule, + /// StringRuleObject and BooleanRule definitions + /// [here](https://aka.ms/AzureMapsStatesetStyles). + /// + public partial class StyleRule + { + /// + /// Initializes a new instance of the StyleRule class. + /// + public StyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + public StyleRule(string keyName) + { + KeyName = keyName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets stateset style key name. Key names are random strings + /// but they should be unique inside style array. + /// + [JsonProperty(PropertyName = "keyName")] + public string KeyName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyName"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRules.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRules.cs new file mode 100644 index 000000000000..0d1b07f9b04d --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleRules.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The styles model. + /// + public partial class StyleRules + { + /// + /// Initializes a new instance of the StyleRules class. + /// + public StyleRules() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StyleRules class. + /// + /// An array of stateset style rules. The + /// style rule could be a numeric or string or a boolean type style + /// rule. Refer to NumberRule, StringRule and BooleanRule definitions + /// [here](https://aka.ms/AzureMapsStatesetStyles). + public StyleRules(IList styleRules = default(IList)) + { + StyleRules = styleRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an array of stateset style rules. The style rule could + /// be a numeric or string or a boolean type style rule. Refer to + /// NumberRule, StringRule and BooleanRule definitions + /// [here](https://aka.ms/AzureMapsStatesetStyles). + /// + [JsonProperty(PropertyName = "styles")] + public IList StyleRules { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Tileset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Tileset.cs new file mode 100644 index 000000000000..e38d6843dd90 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/Tileset.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Detail information for the data. + /// + public partial class Tileset + { + /// + /// Initializes a new instance of the Tileset class. + /// + public Tileset() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Tileset class. + /// + /// The unique tileset id for the + /// tileset. + /// The unique dataset Id used to create the + /// tileset. + /// The description the caller provided when + /// creating the tileset. Maximum length 1024 characters. + /// The lowest tile zoom level tile generated for + /// the tileset. + /// The highest tile zoom level tile generated + /// for the tileset. + /// Bounding box which all features of the tileset + /// lay within. Projection used - EPSG:3857. Format : 'minLon, minLat, + /// maxLon, maxLat'. + public Tileset(string tilesetId = default(string), string ontology = default(string), string datasetId = default(string), string description = default(string), int? minZoom = default(int?), int? maxZoom = default(int?), IList bbox = default(IList)) + { + TilesetId = tilesetId; + Ontology = ontology; + DatasetId = datasetId; + Description = description; + MinZoom = minZoom; + MaxZoom = maxZoom; + Bbox = bbox; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique tileset id for the tileset. + /// + [JsonProperty(PropertyName = "tilesetId")] + public string TilesetId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "ontology")] + public string Ontology { get; set; } + + /// + /// Gets the unique dataset Id used to create the tileset. + /// + [JsonProperty(PropertyName = "datasetId")] + public string DatasetId { get; private set; } + + /// + /// Gets the description the caller provided when creating the tileset. + /// Maximum length 1024 characters. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets the lowest tile zoom level tile generated for the tileset. + /// + [JsonProperty(PropertyName = "minZoom")] + public int? MinZoom { get; private set; } + + /// + /// Gets the highest tile zoom level tile generated for the tileset. + /// + [JsonProperty(PropertyName = "maxZoom")] + public int? MaxZoom { get; private set; } + + /// + /// Gets or sets bounding box which all features of the tileset lay + /// within. Projection used - EPSG:3857. Format : 'minLon, minLat, + /// maxLon, maxLat'. + /// + [JsonProperty(PropertyName = "bbox")] + public IList Bbox { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetCreateHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetCreateHeaders.cs new file mode 100644 index 000000000000..4d53593e1860 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetCreateHeaders.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class TilesetCreateHeaders + { + /// + /// Initializes a new instance of the TilesetCreateHeaders class. + /// + public TilesetCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TilesetCreateHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + /// New URL to check for the results of + /// the long running process. + public TilesetCreateHeaders(string resourceLocation = default(string), string operationLocation = default(string)) + { + ResourceLocation = resourceLocation; + OperationLocation = operationLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets new URL to check for the results of the long running + /// process. + /// + [JsonProperty(PropertyName = "Operation-Location")] + public string OperationLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetGetOperationHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetGetOperationHeaders.cs new file mode 100644 index 000000000000..f480556e3c83 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetGetOperationHeaders.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetOperation operation. + /// + public partial class TilesetGetOperationHeaders + { + /// + /// Initializes a new instance of the TilesetGetOperationHeaders class. + /// + public TilesetGetOperationHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TilesetGetOperationHeaders class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + public TilesetGetOperationHeaders(string resourceLocation = default(string)) + { + ResourceLocation = resourceLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if successful, a URI where details on the newly + /// created resource can be found. + /// + [JsonProperty(PropertyName = "Resource-Location")] + public string ResourceLocation { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/UploadStatus.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/UploadStatus.cs new file mode 100644 index 000000000000..ad475746279a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/UploadStatus.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UploadStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UploadStatus + { + /// + /// Upload is processing + /// + [EnumMember(Value = "Pending")] + Pending, + /// + /// Upload validation and processing completed + /// + [EnumMember(Value = "Completed")] + Completed, + /// + /// Upload validation and/or processing failure + /// + [EnumMember(Value = "Failed")] + Failed + } + internal static class UploadStatusEnumExtension + { + internal static string ToSerializedValue(this UploadStatus? value) + { + return value == null ? null : ((UploadStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UploadStatus value) + { + switch( value ) + { + case UploadStatus.Pending: + return "Pending"; + case UploadStatus.Completed: + return "Completed"; + case UploadStatus.Failed: + return "Failed"; + } + return null; + } + + internal static UploadStatus? ParseUploadStatus(this string value) + { + switch( value ) + { + case "Pending": + return UploadStatus.Pending; + case "Completed": + return UploadStatus.Completed; + case "Failed": + return UploadStatus.Failed; + } + return null; + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/WFSEndpointLink.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/WFSEndpointLink.cs new file mode 100644 index 000000000000..0cfcaaa73305 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/WFSEndpointLink.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Links to other WFS endpoints + /// + public partial class WFSEndpointLink + { + /// + /// Initializes a new instance of the WFSEndpointLink class. + /// + public WFSEndpointLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WFSEndpointLink class. + /// + /// The link target. + /// The relation type. + /// A hint indicating what the media type of the + /// result of dereferencing the link should be. + /// A hint indicating what the language of the + /// result of dereferencing the link should be. + /// 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). + public WFSEndpointLink(string href, string rel = default(string), string type = default(string), string hrefLang = default(string), string title = default(string)) + { + Href = href; + Rel = rel; + Type = type; + HrefLang = hrefLang; + Title = title; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the link target. + /// + [JsonProperty(PropertyName = "href")] + public string Href { get; set; } + + /// + /// Gets or sets the relation type. + /// + [JsonProperty(PropertyName = "rel")] + public string Rel { get; set; } + + /// + /// Gets or sets a hint indicating what the media type of the result of + /// dereferencing the link should be. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets a hint indicating what the language of the result of + /// dereferencing the link should be. + /// + [JsonProperty(PropertyName = "hreflang")] + public string HrefLang { get; set; } + + /// + /// Gets or sets 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). + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Href == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Href"); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/SdkInfo_CreatorClient.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/SdkInfo_CreatorClient.cs new file mode 100644 index 000000000000..76ca077a8622 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/SdkInfo_CreatorClient.cs @@ -0,0 +1,34 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_CreatorClient + { + get + { + return new Tuple[] + { + new Tuple("CreatorClient", "Alias", "2.0"), + new Tuple("CreatorClient", "Conversion", "2.0"), + new Tuple("CreatorClient", "Data", "2.0"), + new Tuple("CreatorClient", "Dataset", "2.0"), + new Tuple("CreatorClient", "FeatureState", "2.0"), + new Tuple("CreatorClient", "Spatial", "1.0"), + new Tuple("CreatorClient", "Tileset", "2.0"), + new Tuple("CreatorClient", "WFS", "2.0"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Spatial.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Spatial.cs new file mode 100644 index 000000000000..96f6e3eac2f3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Spatial.cs @@ -0,0 +1,2238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Spatial operations. + /// + public partial class Spatial : IServiceOperations, ISpatial + { + /// + /// Initializes a new instance of the Spatial class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Spatial(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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.<br><br>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. + /// + /// + /// ID of the device + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The sea level in meter of the location being passed. If this parameter is + /// presented, 2D extrusion is used. Example: 200. + /// + /// + /// The user request time. If not presented in the request, the default value + /// is DateTime.Now. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Mode of the geofencing async event mechanism. Possible values include: + /// 'All', 'EnterAndExit' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetGeofenceWithHttpMessagesAsync(string deviceId, string udid, Position position, double? altitude = default(double?), System.DateTime? userTime = default(System.DateTime?), double? searchBufferInMeters = default(double?), bool? isAsync = default(bool?), string mode = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (deviceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceId"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + if (searchBufferInMeters > 500) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "searchBufferInMeters", 500); + } + if (searchBufferInMeters < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "searchBufferInMeters", 0); + } + if (position == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "position"); + } + if (position != null) + { + position.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + double latitude = default(double); + if (position != null) + { + latitude = position.Latitude; + } + double longitude = default(double); + if (position != null) + { + longitude = position.Longitude; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("deviceId", deviceId); + tracingParameters.Add("udid", udid); + tracingParameters.Add("altitude", altitude); + tracingParameters.Add("userTime", userTime); + tracingParameters.Add("searchBufferInMeters", searchBufferInMeters); + tracingParameters.Add("isAsync", isAsync); + tracingParameters.Add("mode", mode); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGeofence", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/geofence/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (deviceId != null) + { + _queryParameters.Add(string.Format("deviceId={0}", System.Uri.EscapeDataString(deviceId))); + } + if (udid != null) + { + _queryParameters.Add(string.Format("udid={0}", System.Uri.EscapeDataString(udid))); + } + if (altitude != null) + { + _queryParameters.Add(string.Format("z={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(altitude, Client.SerializationSettings).Trim('"')))); + } + if (userTime != null) + { + _queryParameters.Add(string.Format("userTime={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(userTime, Client.SerializationSettings).Trim('"')))); + } + if (searchBufferInMeters != null) + { + _queryParameters.Add(string.Format("searchBuffer={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(searchBufferInMeters, Client.SerializationSettings).Trim('"')))); + } + if (isAsync != null) + { + _queryParameters.Add(string.Format("isAsync={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(isAsync, Client.SerializationSettings).Trim('"')))); + } + if (mode != null) + { + _queryParameters.Add(string.Format("mode={0}", System.Uri.EscapeDataString(mode))); + } + _queryParameters.Add(string.Format("lat={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(latitude, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("lon={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(longitude, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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.<br><br>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). + /// + /// + /// ID of the device + /// + /// + /// The geofencing GeoJSON data. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The sea level in meter of the location being passed. If this parameter is + /// presented, 2D extrusion geofencing is applied. Example: 200. + /// + /// + /// The user request time. If not presented in the request, the default value + /// is DateTime.UtcNow. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Mode of the geofencing async event mechanism. Possible values include: + /// 'All', 'EnterAndExit' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostGeofenceWithHttpMessagesAsync(string deviceId, GeoJsonFeatureCollection searchGeofenceRequestBody, Position position, double? altitude = default(double?), System.DateTime? userTime = default(System.DateTime?), double? searchBuffer = default(double?), bool? isAsync = default(bool?), string mode = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (deviceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceId"); + } + if (searchBuffer > 500) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "searchBuffer", 500); + } + if (searchBuffer < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "searchBuffer", 0); + } + if (searchGeofenceRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "searchGeofenceRequestBody"); + } + if (searchGeofenceRequestBody != null) + { + searchGeofenceRequestBody.Validate(); + } + if (position == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "position"); + } + if (position != null) + { + position.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + double latitude = default(double); + if (position != null) + { + latitude = position.Latitude; + } + double longitude = default(double); + if (position != null) + { + longitude = position.Longitude; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("deviceId", deviceId); + tracingParameters.Add("altitude", altitude); + tracingParameters.Add("userTime", userTime); + tracingParameters.Add("searchBuffer", searchBuffer); + tracingParameters.Add("isAsync", isAsync); + tracingParameters.Add("mode", mode); + tracingParameters.Add("searchGeofenceRequestBody", searchGeofenceRequestBody); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostGeofence", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/geofence/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (deviceId != null) + { + _queryParameters.Add(string.Format("deviceId={0}", System.Uri.EscapeDataString(deviceId))); + } + if (altitude != null) + { + _queryParameters.Add(string.Format("z={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(altitude, Client.SerializationSettings).Trim('"')))); + } + if (userTime != null) + { + _queryParameters.Add(string.Format("userTime={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(userTime, Client.SerializationSettings).Trim('"')))); + } + if (searchBuffer != null) + { + _queryParameters.Add(string.Format("searchBuffer={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(searchBuffer, Client.SerializationSettings).Trim('"')))); + } + if (isAsync != null) + { + _queryParameters.Add(string.Format("isAsync={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(isAsync, Client.SerializationSettings).Trim('"')))); + } + if (mode != null) + { + _queryParameters.Add(string.Format("mode={0}", System.Uri.EscapeDataString(mode))); + } + _queryParameters.Add(string.Format("lat={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(latitude, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("lon={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(longitude, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(searchGeofenceRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(searchGeofenceRequestBody, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The FeatureCollection and the list of distances (one per feature or one for + /// all features). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostBufferWithHttpMessagesAsync(BufferRequestBody bufferRequestBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (bufferRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bufferRequestBody"); + } + if (bufferRequestBody != null) + { + bufferRequestBody.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("bufferRequestBody", bufferRequestBody); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostBuffer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/buffer/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(bufferRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bufferRequestBody, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetBufferWithHttpMessagesAsync(string udid, string distances, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + if (distances == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "distances"); + } + string apiVersion = "1.0"; + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("udid", udid); + tracingParameters.Add("distances", distances); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetBuffer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/buffer/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (udid != null) + { + _queryParameters.Add(string.Format("udid={0}", System.Uri.EscapeDataString(udid))); + } + if (distances != null) + { + _queryParameters.Add(string.Format("distances={0}", System.Uri.EscapeDataString(distances))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The number of closest points expected from response. Default: 1, minimum: 1 + /// and maximum: 50 + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostClosestPointWithHttpMessagesAsync(GeoJsonFeatureCollection closestPointRequestBody, Position position, int? numberOfClosestPoints = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (closestPointRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "closestPointRequestBody"); + } + if (closestPointRequestBody != null) + { + closestPointRequestBody.Validate(); + } + if (position == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "position"); + } + if (position != null) + { + position.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + double latitude = default(double); + if (position != null) + { + latitude = position.Latitude; + } + double longitude = default(double); + if (position != null) + { + longitude = position.Longitude; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("numberOfClosestPoints", numberOfClosestPoints); + tracingParameters.Add("closestPointRequestBody", closestPointRequestBody); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostClosestPoint", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/closestPoint/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (numberOfClosestPoints != null) + { + _queryParameters.Add(string.Format("numberOfClosestPoints={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(numberOfClosestPoints, Client.SerializationSettings).Trim('"')))); + } + _queryParameters.Add(string.Format("lat={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(latitude, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("lon={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(longitude, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(closestPointRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(closestPointRequestBody, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The number of closest points expected from response. Default: 1, minimum: 1 + /// and maximum: 50 + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetClosestPointWithHttpMessagesAsync(string udid, Position position, int? numberOfClosestPoints = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + if (position == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "position"); + } + if (position != null) + { + position.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + double latitude = default(double); + if (position != null) + { + latitude = position.Latitude; + } + double longitude = default(double); + if (position != null) + { + longitude = position.Longitude; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("udid", udid); + tracingParameters.Add("numberOfClosestPoints", numberOfClosestPoints); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetClosestPoint", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/closestPoint/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (udid != null) + { + _queryParameters.Add(string.Format("udid={0}", System.Uri.EscapeDataString(udid))); + } + if (numberOfClosestPoints != null) + { + _queryParameters.Add(string.Format("numberOfClosestPoints={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(numberOfClosestPoints, Client.SerializationSettings).Trim('"')))); + } + _queryParameters.Add(string.Format("lat={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(latitude, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("lon={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(longitude, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PostPointInPolygonWithHttpMessagesAsync(GeoJsonFeatureCollection pointInPolygonRequestBody, Position position, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (pointInPolygonRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "pointInPolygonRequestBody"); + } + if (pointInPolygonRequestBody != null) + { + pointInPolygonRequestBody.Validate(); + } + if (position == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "position"); + } + if (position != null) + { + position.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + double latitude = default(double); + if (position != null) + { + latitude = position.Latitude; + } + double longitude = default(double); + if (position != null) + { + longitude = position.Longitude; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("pointInPolygonRequestBody", pointInPolygonRequestBody); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostPointInPolygon", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/pointInPolygon/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + _queryParameters.Add(string.Format("lat={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(latitude, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("lon={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(longitude, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(pointInPolygonRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(pointInPolygonRequestBody, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> EvaluatePointInPolygonWithHttpMessagesAsync(string udid, Position position, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + if (position == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "position"); + } + if (position != null) + { + position.Validate(); + } + string apiVersion = "1.0"; + string format = "json"; + double latitude = default(double); + if (position != null) + { + latitude = position.Latitude; + } + double longitude = default(double); + if (position != null) + { + longitude = position.Longitude; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("udid", udid); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "EvaluatePointInPolygon", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/pointInPolygon/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (udid != null) + { + _queryParameters.Add(string.Format("udid={0}", System.Uri.EscapeDataString(udid))); + } + _queryParameters.Add(string.Format("lat={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(latitude, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("lon={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(longitude, Client.SerializationSettings).Trim('"')))); + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// 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 + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetGreatCircleDistanceWithHttpMessagesAsync(string query, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "query"); + } + string apiVersion = "1.0"; + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("format", format); + tracingParameters.Add("query", query); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGreatCircleDistance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "spatial/greatCircleDistance/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (query != null) + { + _queryParameters.Add(string.Format("query={0}", System.Uri.EscapeDataString(query))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/SpatialExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/SpatialExtensions.cs new file mode 100644 index 000000000000..7eea6a149e01 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/SpatialExtensions.cs @@ -0,0 +1,500 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Spatial. + /// + public static partial class SpatialExtensions + { + /// + /// **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.<br><br>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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// ID of the device + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The sea level in meter of the location being passed. If this parameter is + /// presented, 2D extrusion is used. Example: 200. + /// + /// + /// The user request time. If not presented in the request, the default value + /// is DateTime.Now. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Mode of the geofencing async event mechanism. Possible values include: + /// 'All', 'EnterAndExit' + /// + /// + /// The cancellation token. + /// + public static async Task GetGeofenceAsync(this ISpatial operations, string deviceId, string udid, Position position, double? altitude = default(double?), System.DateTime? userTime = default(System.DateTime?), double? searchBufferInMeters = default(double?), bool? isAsync = default(bool?), string mode = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGeofenceWithHttpMessagesAsync(deviceId, udid, position, altitude, userTime, searchBufferInMeters, isAsync, mode, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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.<br><br>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). + /// + /// + /// The operations group for this extension method. + /// + /// + /// ID of the device + /// + /// + /// The geofencing GeoJSON data. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The sea level in meter of the location being passed. If this parameter is + /// presented, 2D extrusion geofencing is applied. Example: 200. + /// + /// + /// The user request time. If not presented in the request, the default value + /// is DateTime.UtcNow. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Mode of the geofencing async event mechanism. Possible values include: + /// 'All', 'EnterAndExit' + /// + /// + /// The cancellation token. + /// + public static async Task PostGeofenceAsync(this ISpatial operations, string deviceId, GeoJsonFeatureCollection searchGeofenceRequestBody, Position position, double? altitude = default(double?), System.DateTime? userTime = default(System.DateTime?), double? searchBuffer = default(double?), bool? isAsync = default(bool?), string mode = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostGeofenceWithHttpMessagesAsync(deviceId, searchGeofenceRequestBody, position, altitude, userTime, searchBuffer, isAsync, mode, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The FeatureCollection and the list of distances (one per feature or one for + /// all features). + /// + /// + /// The cancellation token. + /// + public static async Task PostBufferAsync(this ISpatial operations, BufferRequestBody bufferRequestBody, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostBufferWithHttpMessagesAsync(bufferRequestBody, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task GetBufferAsync(this ISpatial operations, string udid, string distances, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetBufferWithHttpMessagesAsync(udid, distances, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The number of closest points expected from response. Default: 1, minimum: 1 + /// and maximum: 50 + /// + /// + /// The cancellation token. + /// + public static async Task PostClosestPointAsync(this ISpatial operations, GeoJsonFeatureCollection closestPointRequestBody, Position position, int? numberOfClosestPoints = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostClosestPointWithHttpMessagesAsync(closestPointRequestBody, position, numberOfClosestPoints, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The number of closest points expected from response. Default: 1, minimum: 1 + /// and maximum: 50 + /// + /// + /// The cancellation token. + /// + public static async Task GetClosestPointAsync(this ISpatial operations, string udid, Position position, int? numberOfClosestPoints = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetClosestPointWithHttpMessagesAsync(udid, position, numberOfClosestPoints, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The cancellation token. + /// + public static async Task PostPointInPolygonAsync(this ISpatial operations, GeoJsonFeatureCollection pointInPolygonRequestBody, Position position, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostPointInPolygonWithHttpMessagesAsync(pointInPolygonRequestBody, position, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The cancellation token. + /// + public static async Task EvaluatePointInPolygonAsync(this ISpatial operations, string udid, Position position, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.EvaluatePointInPolygonWithHttpMessagesAsync(udid, position, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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 + /// + /// + /// The cancellation token. + /// + public static async Task GetGreatCircleDistanceAsync(this ISpatial operations, string query, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGreatCircleDistanceWithHttpMessagesAsync(query, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperations.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperations.cs new file mode 100644 index 000000000000..c08e38ccc1d1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperations.cs @@ -0,0 +1,994 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TilesetOperations operations. + /// + public partial class TilesetOperations : IServiceOperations, ITilesetOperations + { + /// + /// Initializes a new instance of the TilesetOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public TilesetOperations(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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). + /// + /// + /// 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](https://docs.microsoft.com/en-us/rest/api/maps/v2/dataset/create) + /// call. + /// + /// + /// User provided description of the tileset. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string datasetId, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("description", description); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "tilesets"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (datasetId != null) + { + _queryParameters.Add(string.Format("datasetId={0}", System.Uri.EscapeDataString(datasetId))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// <br> + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "tilesets"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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. + /// + /// + /// The Tileset Id + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string tilesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (tilesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tilesetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tilesetId", tilesetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "tilesets/{tilesetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{tilesetId}", System.Uri.EscapeDataString(tilesetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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.<br> + /// 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.<br> + /// + /// #### Delete request "Successful" + /// + /// The Tileset Delete API returns a HTTP `204 No Content` response with an + /// empty body, if the tileset was deleted successfully.<br> + /// + /// #### 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: + /// + /// <br> + /// + /// ```json + /// { + /// "error": { + /// "code": "400 BadRequest", + /// "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce + /// does not exist." + /// } + /// } + /// ``` + /// + /// + /// The Tileset Id + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string tilesetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (tilesetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tilesetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tilesetId", tilesetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "tilesets/{tilesetId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{tilesetId}", System.Uri.EscapeDataString(tilesetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID to query the status for the tileset create/import request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOperationWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "tilesets/operations/{operationId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperationsExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperationsExtensions.cs new file mode 100644 index 000000000000..d2bb51534656 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetOperationsExtensions.cs @@ -0,0 +1,201 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TilesetOperations. + /// + public static partial class TilesetOperationsExtensions + { + /// + /// **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). + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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](https://docs.microsoft.com/en-us/rest/api/maps/v2/dataset/create) + /// call. + /// + /// + /// User provided description of the tileset. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ITilesetOperations operations, string datasetId, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(datasetId, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// <br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ITilesetOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Tileset Id + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITilesetOperations operations, string tilesetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(tilesetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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.<br> + /// 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.<br> + /// + /// #### Delete request "Successful" + /// + /// The Tileset Delete API returns a HTTP `204 No Content` response with an + /// empty body, if the tileset was deleted successfully.<br> + /// + /// #### 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: + /// + /// <br> + /// + /// ```json + /// { + /// "error": { + /// "code": "400 BadRequest", + /// "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce + /// does not exist." + /// } + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Tileset Id + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ITilesetOperations operations, string tilesetId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(tilesetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID to query the status for the tileset create/import request. + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationAsync(this ITilesetOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/WFS.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/WFS.cs new file mode 100644 index 000000000000..aeafd3278d8b --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/WFS.cs @@ -0,0 +1,1642 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WFS operations. + /// + public partial class WFS : IServiceOperations, IWFS + { + /// + /// Initializes a new instance of the WFS class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public WFS(CreatorClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CreatorClient + /// + public CreatorClient Client { get; private set; } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetLandingPageWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLandingPage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListConformanceWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListConformance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/conformance"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetCollectionsWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetCollections", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/collections"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetCollectionWithHttpMessagesAsync(string datasetId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetCollection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/collections/{collectionId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetCollectionDefinitionWithHttpMessagesAsync(string datasetId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetCollectionDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/collections/{collectionId}/definition"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// 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 = 500 * Default = 10 + /// + /// + /// 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). + /// + /// + /// 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., + /// <property1>=<value1>&<property2>=<value2> + /// String values are case sensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetFeaturesWithHttpMessagesAsync(string datasetId, string collectionId, int? limit = default(int?), IList boundingBox = default(IList), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } + if (limit > 500) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "limit", 500); + } + if (limit < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "limit", 1); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("limit", limit); + tracingParameters.Add("boundingBox", boundingBox); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetFeatures", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/collections/{collectionId}/items"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (limit != null) + { + _queryParameters.Add(string.Format("limit={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(limit, Client.SerializationSettings).Trim('"')))); + } + if (boundingBox != null) + { + _queryParameters.Add(string.Format("bbox={0}", System.Uri.EscapeDataString(string.Join(",", boundingBox)))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.ClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.ClientId); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Local identifier of a specific feature + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetFeatureWithHttpMessagesAsync(string datasetId, string collectionId, string featureId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } + if (featureId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("featureId", featureId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetFeature", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + _url = _url.Replace("{featureId}", System.Uri.EscapeDataString(featureId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Local identifier of a specific feature + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteFeatureWithHttpMessagesAsync(string datasetId, string collectionId, string featureId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } + if (featureId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureId"); + } + string apiVersion = "2.0"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("featureId", featureId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteFeature", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + _url = _url.Replace("{featureId}", System.Uri.EscapeDataString(featureId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/WFSExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/WFSExtensions.cs new file mode 100644 index 000000000000..4ecc58e50660 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/WFSExtensions.cs @@ -0,0 +1,366 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Creator +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WFS. + /// + public static partial class WFSExtensions + { + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The cancellation token. + /// + public static async Task GetLandingPageAsync(this IWFS operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLandingPageWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The cancellation token. + /// + public static async Task ListConformanceAsync(this IWFS operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListConformanceWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// The cancellation token. + /// + public static async Task GetCollectionsAsync(this IWFS operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCollectionsWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// The cancellation token. + /// + public static async Task GetCollectionAsync(this IWFS operations, string datasetId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCollectionWithHttpMessagesAsync(datasetId, collectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// The cancellation token. + /// + public static async Task GetCollectionDefinitionAsync(this IWFS operations, string datasetId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCollectionDefinitionWithHttpMessagesAsync(datasetId, collectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// 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 = 500 * Default = 10 + /// + /// + /// 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). + /// + /// + /// 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., + /// <property1>=<value1>&<property2>=<value2> + /// String values are case sensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetFeaturesAsync(this IWFS operations, string datasetId, string collectionId, int? limit = default(int?), IList boundingBox = default(IList), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetFeaturesWithHttpMessagesAsync(datasetId, collectionId, limit, boundingBox, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Local identifier of a specific feature + /// + /// + /// The cancellation token. + /// + public static async Task GetFeatureAsync(this IWFS operations, string datasetId, string collectionId, string featureId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetFeatureWithHttpMessagesAsync(datasetId, collectionId, featureId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// **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/v2/dataset/create). + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier for the dataset to query from. + /// + /// + /// Identifier (name) of a specific collection + /// + /// + /// Local identifier of a specific feature + /// + /// + /// The cancellation token. + /// + public static async Task DeleteFeatureAsync(this IWFS operations, string datasetId, string collectionId, string featureId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteFeatureWithHttpMessagesAsync(datasetId, collectionId, featureId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +}