diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Alias.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Alias.cs new file mode 100644 index 000000000000..f7afe8694b0c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Alias.cs @@ -0,0 +1,1027 @@ +// +// 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; + + /// + /// Alias operations. + /// + public partial class Alias : IServiceOperations, IAlias + { + /// + /// Initializes a new instance of the Alias class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Alias(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 (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 (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 (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 (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> GetDetailsWithHttpMessagesAsync(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, "GetDetails", 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 (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/AliasExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/AliasExtensions.cs new file mode 100644 index 000000000000..cf8be4cd1ac2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/AliasExtensions.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 Alias. + /// + public static partial class AliasExtensions + { + /// + /// **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 IAlias 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 IAlias 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 IAlias 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 IAlias 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 GetDetailsAsync(this IAlias operations, string aliasId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDetailsWithHttpMessagesAsync(aliasId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Conversion.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Conversion.cs new file mode 100644 index 000000000000..c129bd3bcce6 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Conversion.cs @@ -0,0 +1,1085 @@ +// +// 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; + + /// + /// Conversion operations. + /// + public partial class Conversion : IServiceOperations, IConversion + { + /// + /// Initializes a new instance of the Conversion class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Conversion(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. + /// + /// + /// Output ontology version. "facility-2.0" is the only supported value at this + /// time. Please refer to this + /// [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) + /// for more information about Azure Maps Creator ontologies. + /// + /// + /// 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 outputOntology, 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 (outputOntology == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "outputOntology"); + } + 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("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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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/ConversionExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionExtensions.cs new file mode 100644 index 000000000000..d1fc803b2d27 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ConversionExtensions.cs @@ -0,0 +1,283 @@ +// +// 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 Conversion. + /// + public static partial class ConversionExtensions + { + /// + /// **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. + /// + /// + /// Output ontology version. "facility-2.0" is the only supported value at this + /// time. Please refer to this + /// [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) + /// for more information about Azure Maps Creator ontologies. + /// + /// + /// User provided description of the content being converted. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertAsync(this IConversion operations, string udid, string outputOntology, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ConvertWithHttpMessagesAsync(udid, outputOntology, 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 IConversion 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 IConversion 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 IConversion 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 IConversion 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..192b7970efb1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/CreatorClient.cs @@ -0,0 +1,268 @@ +// +// 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; } + + /// + /// 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; } + + /// + /// 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 XMsClientId { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the IAlias. + /// + public virtual IAlias Alias { get; private set; } + + /// + /// Gets the IData. + /// + public virtual IData Data { get; private set; } + + /// + /// Gets the IDataset. + /// + public virtual IDataset Dataset { get; private set; } + + /// + /// Gets the IConversion. + /// + public virtual IConversion Conversion { get; private set; } + + /// + /// Gets the IFeatureState. + /// + public virtual IFeatureState FeatureState { get; private set; } + + /// + /// Gets the ISpatial. + /// + public virtual ISpatial Spatial { get; private set; } + + /// + /// Gets the ITileset. + /// + public virtual ITileset 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 Alias(this); + Data = new Data(this); + Dataset = new Dataset(this); + Conversion = new Conversion(this); + FeatureState = new FeatureState(this); + Spatial = new Spatial(this); + Tileset = new Tileset(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() + } + }; + 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(); + } + } +} 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..ea5e609dea14 --- /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> UploadPreviewWithHttpMessagesAsync(string uploadDataFormat, object uploadContent, string uploadDataDescription = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (uploadDataFormat == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "uploadDataFormat"); + } + 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("uploadDataDescription", uploadDataDescription); + tracingParameters.Add("uploadDataFormat", uploadDataFormat); + tracingParameters.Add("uploadContent", uploadContent); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UploadPreview", 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 (uploadDataDescription != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(uploadDataDescription))); + } + if (uploadDataFormat != null) + { + _queryParameters.Add(string.Format("dataFormat={0}", System.Uri.EscapeDataString(uploadDataFormat))); + } + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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> ListPreviewWithHttpMessagesAsync(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, "ListPreview", 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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> UpdatePreviewWithHttpMessagesAsync(string uniqueDataId, object updateContent, string uploadDataDescription = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (uniqueDataId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "uniqueDataId"); + } + 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("uniqueDataId", uniqueDataId); + tracingParameters.Add("uploadDataDescription", uploadDataDescription); + tracingParameters.Add("updateContent", updateContent); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdatePreview", 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(uniqueDataId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (uploadDataDescription != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(uploadDataDescription))); + } + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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> DownloadPreviewWithHttpMessagesAsync(string uniqueDataId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (uniqueDataId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "uniqueDataId"); + } + 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("uniqueDataId", uniqueDataId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DownloadPreview", 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(uniqueDataId)); + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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 DeletePreviewWithHttpMessagesAsync(string uniqueDataId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (uniqueDataId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "uniqueDataId"); + } + 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("uniqueDataId", uniqueDataId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeletePreview", 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(uniqueDataId)); + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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> GetOperationPreviewWithHttpMessagesAsync(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, "GetOperationPreview", 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..3fa75eff2ff9 --- /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 UploadPreviewAsync(this IData operations, string uploadDataFormat, object uploadContent, string uploadDataDescription = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UploadPreviewWithHttpMessagesAsync(uploadDataFormat, uploadContent, uploadDataDescription, 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 ListPreviewAsync(this IData operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPreviewWithHttpMessagesAsync(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 UpdatePreviewAsync(this IData operations, string uniqueDataId, object updateContent, string uploadDataDescription = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePreviewWithHttpMessagesAsync(uniqueDataId, updateContent, uploadDataDescription, 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 DownloadPreviewAsync(this IData operations, string uniqueDataId, CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.DownloadPreviewWithHttpMessagesAsync(uniqueDataId, 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 DeletePreviewAsync(this IData operations, string uniqueDataId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeletePreviewWithHttpMessagesAsync(uniqueDataId, 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 GetOperationPreviewAsync(this IData operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationPreviewWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Dataset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Dataset.cs new file mode 100644 index 000000000000..4daca12171f4 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Dataset.cs @@ -0,0 +1,1105 @@ +// +// 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; + + /// + /// Dataset operations. + /// + public partial class Dataset : IServiceOperations, IDataset + { + /// + /// Initializes a new instance of the Dataset class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Dataset(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 descriptionDataset = 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("descriptionDataset", descriptionDataset); + 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 (descriptionDataset != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(descriptionDataset))); + } + 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 (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" + /// ], }, + /// "ontology": "facility-2.0", + /// "featureCounts": { + /// "directoryInfo": 2, + /// "category": 10, + /// "facility": 1, + /// "level": 3, + /// "unit": 183, + /// "zone": 3, + /// "verticalPenetration": 6, + /// "opening": 48, + /// "areaElement": 108 + /// } + /// }, + /// { + /// "timestamp": "2020-01-01T22:57:53.123Z", + /// "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + /// "description": "Create from upload + /// '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + /// "datasetSources": { + /// "conversionIds": [ + /// "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + /// ], + /// "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + /// }, + /// "ontology": "facility-2.0", + /// "featureCounts": { + /// "directoryInfo": 2, + /// "category": 10, + /// "facility": 1, + /// "level": 3, + /// "unit": 183, + /// "zone": 3, + /// "verticalPenetration": 6, + /// "opening": 48, + /// "areaElement": 108 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// + /// 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 (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 (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 (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 (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/DatasetExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetExtensions.cs new file mode 100644 index 000000000000..00767a24032f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/DatasetExtensions.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 Dataset. + /// + public static partial class DatasetExtensions + { + /// + /// **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 IDataset operations, string conversionId, string datasetId = default(string), string descriptionDataset = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(conversionId, datasetId, descriptionDataset, 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" + /// ], }, + /// "ontology": "facility-2.0", + /// "featureCounts": { + /// "directoryInfo": 2, + /// "category": 10, + /// "facility": 1, + /// "level": 3, + /// "unit": 183, + /// "zone": 3, + /// "verticalPenetration": 6, + /// "opening": 48, + /// "areaElement": 108 + /// } + /// }, + /// { + /// "timestamp": "2020-01-01T22:57:53.123Z", + /// "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + /// "description": "Create from upload + /// '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + /// "datasetSources": { + /// "conversionIds": [ + /// "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + /// ], + /// "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + /// }, + /// "ontology": "facility-2.0", + /// "featureCounts": { + /// "directoryInfo": 2, + /// "category": 10, + /// "facility": 1, + /// "level": 3, + /// "unit": 183, + /// "zone": 3, + /// "verticalPenetration": 6, + /// "opening": 48, + /// "areaElement": 108 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IDataset 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 IDataset 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 IDataset 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 IDataset 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/FeatureState.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureState.cs new file mode 100644 index 000000000000..26e1731d9ab0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureState.cs @@ -0,0 +1,1463 @@ +// +// 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; + + /// + /// FeatureState operations. + /// + public partial class FeatureState : IServiceOperations, IFeatureState + { + /// + /// Initializes a new instance of the FeatureState class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public FeatureState(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, StylesObject statesetCreateRequestBody, 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 (statesetCreateRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetCreateRequestBody"); + } + 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("statesetCreateRequestBody", statesetCreateRequestBody); + 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 (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(statesetCreateRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(statesetCreateRequestBody, 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> ListStatesetWithHttpMessagesAsync(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, "ListStateset", 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 (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 PutStatesetWithHttpMessagesAsync(string statesetId, StylesObject statesetStyleUpdateRequestBody, 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 (statesetStyleUpdateRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "statesetStyleUpdateRequestBody"); + } + 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("statesetStyleUpdateRequestBody", statesetStyleUpdateRequestBody); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PutStateset", 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 (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(statesetStyleUpdateRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(statesetStyleUpdateRequestBody, 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 (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 (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 featureStateUpdateRequestBody, 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 (featureStateUpdateRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "featureStateUpdateRequestBody"); + } + 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("featureStateUpdateRequestBody", featureStateUpdateRequestBody); + 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 (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(featureStateUpdateRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(featureStateUpdateRequestBody, 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 stateKeyName, 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 (stateKeyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "stateKeyName"); + } + 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("stateKeyName", stateKeyName); + 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 (stateKeyName != null) + { + _queryParameters.Add(string.Format("stateKeyName={0}", System.Uri.EscapeDataString(stateKeyName))); + } + 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; + } + + /// + /// **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> GetStatesWithHttpMessagesAsync(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, "GetStates", 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 (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/FeatureStateExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateExtensions.cs new file mode 100644 index 000000000000..2604c8072bc5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/FeatureStateExtensions.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 FeatureState. + /// + public static partial class FeatureStateExtensions + { + /// + /// **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 IFeatureState operations, string datasetId, StylesObject statesetCreateRequestBody, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateStatesetWithHttpMessagesAsync(datasetId, statesetCreateRequestBody, 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 ListStatesetAsync(this IFeatureState operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListStatesetWithHttpMessagesAsync(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 PutStatesetAsync(this IFeatureState operations, string statesetId, StylesObject statesetStyleUpdateRequestBody, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PutStatesetWithHttpMessagesAsync(statesetId, statesetStyleUpdateRequestBody, 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 IFeatureState 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 IFeatureState 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 IFeatureState operations, string statesetId, string featureId, FeatureStatesStructure featureStateUpdateRequestBody, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateStatesWithHttpMessagesAsync(statesetId, featureId, featureStateUpdateRequestBody, 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 IFeatureState operations, string statesetId, string featureId, string stateKeyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteStateWithHttpMessagesAsync(statesetId, featureId, stateKeyName, 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 GetStatesAsync(this IFeatureState operations, string statesetId, string featureId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetStatesWithHttpMessagesAsync(statesetId, featureId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IAlias.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IAlias.cs new file mode 100644 index 000000000000..bd5ca871a4eb --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IAlias.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; + + /// + /// Alias operations. + /// + public partial interface IAlias + { + /// + /// **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> GetDetailsWithHttpMessagesAsync(string aliasId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IConversion.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IConversion.cs new file mode 100644 index 000000000000..323f12e3a419 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IConversion.cs @@ -0,0 +1,311 @@ +// +// 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; + + /// + /// Conversion operations. + /// + public partial interface IConversion + { + /// + /// **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. + /// + /// + /// Output ontology version. "facility-2.0" is the only supported value + /// at this time. Please refer to this + /// [article](https://docs.microsoft.com/en-us/azure/azure-maps/creator-facility-ontology) + /// for more information about Azure Maps Creator ontologies. + /// + /// + /// 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 outputOntology, 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..95c8c581193f --- /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; } + + /// + /// 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; } + + /// + /// 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 XMsClientId { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the IAlias. + /// + IAlias Alias { get; } + + /// + /// Gets the IData. + /// + IData Data { get; } + + /// + /// Gets the IDataset. + /// + IDataset Dataset { get; } + + /// + /// Gets the IConversion. + /// + IConversion Conversion { get; } + + /// + /// Gets the IFeatureState. + /// + IFeatureState FeatureState { get; } + + /// + /// Gets the ISpatial. + /// + ISpatial Spatial { get; } + + /// + /// Gets the ITileset. + /// + ITileset 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..389370aeddbf --- /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> UploadPreviewWithHttpMessagesAsync(string uploadDataFormat, object uploadContent, string uploadDataDescription = 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> ListPreviewWithHttpMessagesAsync(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> UpdatePreviewWithHttpMessagesAsync(string uniqueDataId, object updateContent, string uploadDataDescription = 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> DownloadPreviewWithHttpMessagesAsync(string uniqueDataId, 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 DeletePreviewWithHttpMessagesAsync(string uniqueDataId, 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> GetOperationPreviewWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/IDataset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IDataset.cs new file mode 100644 index 000000000000..4cd8737689d0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IDataset.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; + + /// + /// Dataset operations. + /// + public partial interface IDataset + { + /// + /// **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 descriptionDataset = 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" + /// ], }, + /// "ontology": "facility-2.0", + /// "featureCounts": { + /// "directoryInfo": 2, + /// "category": 10, + /// "facility": 1, + /// "level": 3, + /// "unit": 183, + /// "zone": 3, + /// "verticalPenetration": 6, + /// "opening": 48, + /// "areaElement": 108 + /// } + /// }, + /// { + /// "timestamp": "2020-01-01T22:57:53.123Z", + /// "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + /// "description": "Create from upload + /// '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + /// "datasetSources": { + /// "conversionIds": [ + /// "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + /// ], + /// "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + /// }, + /// "ontology": "facility-2.0", + /// "featureCounts": { + /// "directoryInfo": 2, + /// "category": 10, + /// "facility": 1, + /// "level": 3, + /// "unit": 183, + /// "zone": 3, + /// "verticalPenetration": 6, + /// "opening": 48, + /// "areaElement": 108 + /// } + /// } + /// ] + /// } + /// ``` + /// + /// + /// 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/IFeatureState.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/IFeatureState.cs new file mode 100644 index 000000000000..350c6f74519a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/IFeatureState.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; + + /// + /// FeatureState operations. + /// + public partial interface IFeatureState + { + /// + /// **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, StylesObject statesetCreateRequestBody, 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> ListStatesetWithHttpMessagesAsync(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 PutStatesetWithHttpMessagesAsync(string statesetId, StylesObject statesetStyleUpdateRequestBody, 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 featureStateUpdateRequestBody, 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 stateKeyName, 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> GetStatesWithHttpMessagesAsync(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..4cac9c679f6c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ISpatial.cs @@ -0,0 +1,567 @@ +// +// 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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, double latitude, double longitude, double? z = 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)); + /// + /// **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 latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// The geofencing GeoJSON data. + /// + /// + /// 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, double latitude, double longitude, GeoJsonFeatureCollection searchGeofenceRequestBody, double? z = 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 latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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. + /// + /// + /// 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(double latitude, double longitude, GeoJsonFeatureCollection closestPointRequestBody, 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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, double latitude, double longitude, 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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. + /// + /// + /// 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(double latitude, double longitude, GeoJsonFeatureCollection pointInPolygonRequestBody, 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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> GetPointInPolygonWithHttpMessagesAsync(string udid, double latitude, double longitude, 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/ITileset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/ITileset.cs new file mode 100644 index 000000000000..1ad0e7d6b9b1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/ITileset.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; + + /// + /// Tileset operations. + /// + public partial interface ITileset + { + /// + /// **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..ee92f9eff278 --- /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> GetConformanceWithHttpMessagesAsync(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 = 50 * 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?), string bbox = default(string), 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/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/AliasListItem.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListItem.cs new file mode 100644 index 000000000000..b7101a628dc2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListItem.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 AliasListItem + { + /// + /// Initializes a new instance of the AliasListItem class. + /// + public AliasListItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AliasListItem 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 AliasListItem(string createdTimestamp = default(string), string aliasId = default(string), string creatorDataItemId = default(string), string lastUpdatedTimestamp = default(string)) + { + 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 string 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 string LastUpdatedTimestamp { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResponse.cs new file mode 100644 index 000000000000..d3cdc52b2757 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasListResponse.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 AliasListResponse + { + /// + /// Initializes a new instance of the AliasListResponse class. + /// + public AliasListResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AliasListResponse class. + /// + /// A list of all the previously created + /// aliases. + /// If present, the location of the next page of + /// data. + public AliasListResponse(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/AliasesCreateResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasesCreateResponse.cs new file mode 100644 index 000000000000..8099a240ec01 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/AliasesCreateResponse.cs @@ -0,0 +1,81 @@ +// +// 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 Alias Create API for the case when the alias + /// was successfully created. + /// + public partial class AliasesCreateResponse + { + /// + /// Initializes a new instance of the AliasesCreateResponse class. + /// + public AliasesCreateResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AliasesCreateResponse 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 AliasesCreateResponse(string createdTimestamp = default(string), string aliasId = default(string), string creatorDataItemId = default(string), string lastUpdatedTimestamp = default(string)) + { + 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 string 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 string LastUpdatedTimestamp { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRuleObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRuleObject.cs new file mode 100644 index 000000000000..829fef39bf4a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanRuleObject.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 BooleanRuleObject + { + /// + /// Initializes a new instance of the BooleanRuleObject class. + /// + public BooleanRuleObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BooleanRuleObject 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 BooleanRuleObject(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/BooleanTypeStyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanTypeStyleRule.cs new file mode 100644 index 000000000000..a2fb9140c7b9 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BooleanTypeStyleRule.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 BooleanTypeStyleRule : StyleObject + { + /// + /// Initializes a new instance of the BooleanTypeStyleRule class. + /// + public BooleanTypeStyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BooleanTypeStyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + /// Boolean style rules. + public BooleanTypeStyleRule(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/BufferResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResponse.cs new file mode 100644 index 000000000000..7a76a823b2c8 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResponse.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; + + /// + /// This object is returned from a successful Spatial Buffer call. + /// + public partial class BufferResponse + { + /// + /// Initializes a new instance of the BufferResponse class. + /// + public BufferResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BufferResponse class. + /// + /// Summary of the call. + /// The FeatureCollection of buffers for the + /// input. + public BufferResponse(BufferResponseSummary summary = default(BufferResponseSummary), GeoJsonFeatureCollection result = default(GeoJsonFeatureCollection)) + { + Summary = summary; + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets summary of the call. + /// + [JsonProperty(PropertyName = "summary")] + public BufferResponseSummary Summary { get; private set; } + + /// + /// Gets or sets the FeatureCollection of buffers for the input. + /// + [JsonProperty(PropertyName = "result")] + public GeoJsonFeatureCollection Result { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Result != null) + { + Result.Validate(); + } + } + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResponseSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResponseSummary.cs new file mode 100644 index 000000000000..b11078cc3473 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/BufferResponseSummary.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; + + /// + /// Summary of the call. + /// + public partial class BufferResponseSummary + { + /// + /// Initializes a new instance of the BufferResponseSummary class. + /// + public BufferResponseSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BufferResponseSummary class. + /// + /// The udid for the user data if one exists + /// The information about what happened + /// during the call. + public BufferResponseSummary(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/ClosestPointResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResponse.cs new file mode 100644 index 000000000000..535ac77742ff --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResponse.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.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. + /// + 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; } + + /// + /// + [JsonProperty(PropertyName = "result")] + public IList Result { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResultEntry.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResultEntry.cs new file mode 100644 index 000000000000..8a8df2b5b488 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointResultEntry.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 ClosestPointResultEntry + { + /// + /// Initializes a new instance of the ClosestPointResultEntry class. + /// + public ClosestPointResultEntry() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClosestPointResultEntry class. + /// + /// The distance in meters from the + /// source point to the closest point + /// The unique id identifies a + /// geometry + public ClosestPointResultEntry(double? distanceInMeters = default(double?), SpatialCoordinate position = default(SpatialCoordinate), 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 SpatialCoordinate 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/ClosestPointSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ClosestPointSummary.cs new file mode 100644 index 000000000000..3b601c3b1ae7 --- /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(SpatialCoordinate sourcePoint = default(SpatialCoordinate), 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 SpatialCoordinate 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/CollectionDefinitionResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionDefinitionResponse.cs new file mode 100644 index 000000000000..2c0abd1c5b03 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionDefinitionResponse.cs @@ -0,0 +1,171 @@ +// +// 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 CollectionDefinitionResponse + { + /// + /// Initializes a new instance of the CollectionDefinitionResponse + /// class. + /// + public CollectionDefinitionResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CollectionDefinitionResponse + /// 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 CollectionDefinitionResponse(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/CollectionInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionInfo.cs new file mode 100644 index 000000000000..bfa170b32202 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionInfo.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 CollectionInfo + { + /// + /// Initializes a new instance of the CollectionInfo class. + /// + public CollectionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CollectionInfo 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 CollectionInfo(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/CollectionsResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/CollectionsResponse.cs new file mode 100644 index 000000000000..2e18211cb080 --- /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/ConformanceResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConformanceResponse.cs new file mode 100644 index 000000000000..9d26d1d001d1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConformanceResponse.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 ConformanceResponse + { + /// + /// Initializes a new instance of the ConformanceResponse class. + /// + public ConformanceResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConformanceResponse class. + /// + /// List of requirements classes that the + /// server conforms to. + public ConformanceResponse(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/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/ConversionListDetailInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListDetailInfo.cs new file mode 100644 index 000000000000..d626ddbc518d --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListDetailInfo.cs @@ -0,0 +1,95 @@ +// +// 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 conversion requests. + /// + public partial class ConversionListDetailInfo + { + /// + /// Initializes a new instance of the ConversionListDetailInfo class. + /// + public ConversionListDetailInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConversionListDetailInfo 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 ConversionListDetailInfo(string conversionId = default(string), string ontology = default(string), string udid = default(string), string created = default(string), string description = default(string), object featureCounts = default(object)) + { + 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 object FeatureCounts { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResponse.cs new file mode 100644 index 000000000000..03bab4926d8b --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ConversionListResponse.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 ConversionListResponse + { + /// + /// Initializes a new instance of the ConversionListResponse class. + /// + public ConversionListResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConversionListResponse class. + /// + /// A list of all the previously submitted + /// conversion requests. + /// If present, the location of the next page of + /// data. + public ConversionListResponse(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/DataDownloadPreviewHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataDownloadPreviewHeaders.cs new file mode 100644 index 000000000000..adaba0d09215 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataDownloadPreviewHeaders.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 DownloadPreview operation. + /// + public partial class DataDownloadPreviewHeaders + { + /// + /// Initializes a new instance of the DataDownloadPreviewHeaders class. + /// + public DataDownloadPreviewHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDownloadPreviewHeaders class. + /// + /// The content-type for the Download API + /// response. + public DataDownloadPreviewHeaders(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/DataGetOperationPreviewHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataGetOperationPreviewHeaders.cs new file mode 100644 index 000000000000..6924f6507c4c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataGetOperationPreviewHeaders.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 GetOperationPreview operation. + /// + public partial class DataGetOperationPreviewHeaders + { + /// + /// Initializes a new instance of the DataGetOperationPreviewHeaders + /// class. + /// + public DataGetOperationPreviewHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataGetOperationPreviewHeaders + /// class. + /// + /// If successful, a URI where details + /// on the newly created resource can be found. + public DataGetOperationPreviewHeaders(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/DataUpdatePreviewHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUpdatePreviewHeaders.cs new file mode 100644 index 000000000000..b6cdb6698374 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUpdatePreviewHeaders.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 UpdatePreview operation. + /// + public partial class DataUpdatePreviewHeaders + { + /// + /// Initializes a new instance of the DataUpdatePreviewHeaders class. + /// + public DataUpdatePreviewHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataUpdatePreviewHeaders 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 DataUpdatePreviewHeaders(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/DataUploadPreviewHeaders.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUploadPreviewHeaders.cs new file mode 100644 index 000000000000..729874c6f944 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DataUploadPreviewHeaders.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 UploadPreview operation. + /// + public partial class DataUploadPreviewHeaders + { + /// + /// Initializes a new instance of the DataUploadPreviewHeaders class. + /// + public DataUploadPreviewHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataUploadPreviewHeaders 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 DataUploadPreviewHeaders(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/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/DatasetDetailInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetDetailInfo.cs new file mode 100644 index 000000000000..7621b2094895 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetDetailInfo.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 DatasetDetailInfo + { + /// + /// Initializes a new instance of the DatasetDetailInfo class. + /// + public DatasetDetailInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetDetailInfo class. + /// + /// The created timestamp for the + /// dataset. + /// The id for the dataset. + /// The description for the dataset. + /// The feature counts for the + /// dataset. + public DatasetDetailInfo(string created = default(string), 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 string 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/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/DatasetListResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetListResponse.cs new file mode 100644 index 000000000000..a4ce3c68470c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DatasetListResponse.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 DatasetListResponse + { + /// + /// Initializes a new instance of the DatasetListResponse class. + /// + public DatasetListResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetListResponse class. + /// + /// A list of all the previously created + /// datasets. + /// If present, the location of the next page of + /// data. + public DatasetListResponse(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/DefinitionProperties.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DefinitionProperties.cs new file mode 100644 index 000000000000..22deb8d1fabf --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/DefinitionProperties.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 DefinitionProperties + { + /// + /// Initializes a new instance of the DefinitionProperties class. + /// + public DefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DefinitionProperties class. + /// + /// name of attribute + /// is attribute required + /// type of attribute + public DefinitionProperties(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..6990b19fb78b --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/ExtendedGeoJsonFeatureCollection.cs @@ -0,0 +1,140 @@ +// +// 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(string 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 string 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 (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + 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..3751cfdd16ad --- /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/FeatureResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureResponse.cs new file mode 100644 index 000000000000..a61a28950a19 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureResponse.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 FeatureResponse + { + /// + /// Initializes a new instance of the FeatureResponse class. + /// + public FeatureResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeatureResponse class. + /// + /// Links to other WFS endpoints. + public FeatureResponse(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/FeatureStateObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureStateObject.cs new file mode 100644 index 000000000000..b6c370e2ac71 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/FeatureStateObject.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 FeatureStateObject + { + /// + /// Initializes a new instance of the FeatureStateObject class. + /// + public FeatureStateObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeatureStateObject 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 FeatureStateObject(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..29325c4dace8 --- /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..0e6b674bc8c6 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeature.cs @@ -0,0 +1,121 @@ +// +// 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(string 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 string 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 (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + 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..d938d59077cc --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonFeatureCollection.cs @@ -0,0 +1,105 @@ +// +// 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(string 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 string 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 (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + 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..549c1d335fd9 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeoJsonObjectType.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 +{ + + /// + /// Defines values for GeoJsonObjectType. + /// + public static class GeoJsonObjectType + { + /// + /// `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"; + /// + /// `GeoJSON Feature` object. + /// + public const string GeoJsonFeature = "Feature"; + /// + /// `GeoJSON FeatureCollection` object. + /// + public const string GeoJsonFeatureCollection = "FeatureCollection"; + } +} 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/GeofenceGeometry.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceGeometry.cs new file mode 100644 index 000000000000..21727840a0f5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceGeometry.cs @@ -0,0 +1,138 @@ +// +// 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? nearestZ = default(double?)) + { + DeviceId = deviceId; + UdId = udId; + GeometryId = geometryId; + Distance = distance; + NearestLat = nearestLat; + NearestLon = nearestLon; + NearestZ = nearestZ; + 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? NearestZ { 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/GeofenceResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceResponse.cs new file mode 100644 index 000000000000..a4d35e59085f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GeofenceResponse.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 GeofenceResponse + { + /// + /// Initializes a new instance of the GeofenceResponse class. + /// + public GeofenceResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeofenceResponse 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 GeofenceResponse(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/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/GreatCircleDistanceResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponse.cs new file mode 100644 index 000000000000..4e45082e338f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponse.cs @@ -0,0 +1,61 @@ +// +// 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 Great Circle Distance call + /// + public partial class GreatCircleDistanceResponse + { + /// + /// Initializes a new instance of the GreatCircleDistanceResponse + /// class. + /// + public GreatCircleDistanceResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GreatCircleDistanceResponse + /// class. + /// + /// Summary object + /// Result Object + public GreatCircleDistanceResponse(GreatCircleDistanceResponseSummary summary = default(GreatCircleDistanceResponseSummary), GreatCircleDistanceResponseResult result = default(GreatCircleDistanceResponseResult)) + { + Summary = summary; + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets summary object + /// + [JsonProperty(PropertyName = "summary")] + public GreatCircleDistanceResponseSummary Summary { get; private set; } + + /// + /// Gets result Object + /// + [JsonProperty(PropertyName = "result")] + public GreatCircleDistanceResponseResult Result { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponseResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponseResult.cs new file mode 100644 index 000000000000..35bddb95cfcf --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponseResult.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; + + /// + /// Result Object + /// + public partial class GreatCircleDistanceResponseResult + { + /// + /// Initializes a new instance of the GreatCircleDistanceResponseResult + /// class. + /// + public GreatCircleDistanceResponseResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GreatCircleDistanceResponseResult + /// class. + /// + /// The great circle distance in meters + /// from the source point to the target point + public GreatCircleDistanceResponseResult(double? distanceInMeters = default(double?)) + { + DistanceInMeters = distanceInMeters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the great circle distance in meters from the source point to + /// the target point + /// + [JsonProperty(PropertyName = "distanceInMeters")] + public double? DistanceInMeters { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponseSummary.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponseSummary.cs new file mode 100644 index 000000000000..21300b117b45 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/GreatCircleDistanceResponseSummary.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; + + /// + /// Summary object + /// + public partial class GreatCircleDistanceResponseSummary + { + /// + /// Initializes a new instance of the + /// GreatCircleDistanceResponseSummary class. + /// + public GreatCircleDistanceResponseSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// GreatCircleDistanceResponseSummary class. + /// + public GreatCircleDistanceResponseSummary(SpatialCoordinate sourcePoint = default(SpatialCoordinate), SpatialCoordinate targetPoint = default(SpatialCoordinate)) + { + SourcePoint = sourcePoint; + TargetPoint = targetPoint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sourcePoint")] + public SpatialCoordinate SourcePoint { get; set; } + + /// + /// + [JsonProperty(PropertyName = "targetPoint")] + public SpatialCoordinate TargetPoint { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LandingPageResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LandingPageResponse.cs new file mode 100644 index 000000000000..d2dea2f1eafb --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LandingPageResponse.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 LandingPageResponse + { + /// + /// Initializes a new instance of the LandingPageResponse class. + /// + public LandingPageResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LandingPageResponse class. + /// + /// Links to other WFS endpoints. + public LandingPageResponse(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/LongRunningOperationResult.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/LongRunningOperationResult.cs new file mode 100644 index 000000000000..0dfc90960dba --- /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), string created = default(string), 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 string 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/MapDataDetailInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataDetailInfo.cs new file mode 100644 index 000000000000..776463f28db6 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataDetailInfo.cs @@ -0,0 +1,94 @@ +// +// 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 MapDataDetailInfo + { + /// + /// Initializes a new instance of the MapDataDetailInfo class. + /// + public MapDataDetailInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MapDataDetailInfo 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. + /// The current upload status of the + /// content. + /// The current data format. + /// The current description. + public MapDataDetailInfo(string udid = default(string), string location = default(string), long? sizeInBytes = default(long?), string uploadStatus = default(string), string dataFormat = default(string), string description = default(string)) + { + Udid = udid; + Location = location; + 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 Location { get; private set; } + + /// + /// Gets the size of the content in bytes. + /// + [JsonProperty(PropertyName = "sizeInBytes")] + public long? SizeInBytes { get; private set; } + + /// + /// Gets the current upload status of the content. + /// + [JsonProperty(PropertyName = "uploadStatus")] + public string UploadStatus { get; private set; } + + /// + /// Gets the current data format. + /// + [JsonProperty(PropertyName = "dataFormat")] + public string DataFormat { get; private 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/MapDataListResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataListResponse.cs new file mode 100644 index 000000000000..1521f70188f5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/MapDataListResponse.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 MapDataListResponse + { + /// + /// Initializes a new instance of the MapDataListResponse class. + /// + public MapDataListResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MapDataListResponse class. + /// + /// A list of all the previously uploaded + /// data. + public MapDataListResponse(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/NumberRuleObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberRuleObject.cs new file mode 100644 index 000000000000..d5c970f21ea5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberRuleObject.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 NumberRuleObject + { + /// + /// Initializes a new instance of the NumberRuleObject class. + /// + public NumberRuleObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NumberRuleObject 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 NumberRuleObject(RangeObject range = default(RangeObject), 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 RangeObject 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/NumberTypeStyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberTypeStyleRule.cs new file mode 100644 index 000000000000..8884e3dac5f7 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/NumberTypeStyleRule.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 NumberTypeStyleRule : StyleObject + { + /// + /// Initializes a new instance of the NumberTypeStyleRule class. + /// + public NumberTypeStyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NumberTypeStyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + /// Numeric style rules. + public NumberTypeStyleRule(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/PointInPolygonResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResponse.cs new file mode 100644 index 000000000000..649eb3c5e91c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResponse.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; + + /// + /// Returns true if point is within the polygon, false otherwise + /// + public partial class PointInPolygonResponse + { + /// + /// Initializes a new instance of the PointInPolygonResponse class. + /// + public PointInPolygonResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PointInPolygonResponse class. + /// + public PointInPolygonResponse(PointInPolygonSummary summary = default(PointInPolygonSummary), PointInPolygonResult result = default(PointInPolygonResult)) + { + Summary = summary; + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "summary")] + public PointInPolygonSummary Summary { get; set; } + + /// + /// + [JsonProperty(PropertyName = "result")] + public PointInPolygonResult Result { get; set; } + + } +} 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..c23be1ea45a3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/PointInPolygonResult.cs @@ -0,0 +1,61 @@ +// +// 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; + + /// + /// Point In Polygon Result Object + /// + 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(bool? pointInPolygons = default(bool?), IList intersectingGeometries = default(IList)) + { + PointInPolygons = pointInPolygons; + IntersectingGeometries = intersectingGeometries; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets point In Polygons Property + /// + [JsonProperty(PropertyName = "pointInPolygons")] + public bool? PointInPolygons { get; private set; } + + /// + /// Gets geometries array + /// + [JsonProperty(PropertyName = "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..55cfa553ea8c --- /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(SpatialCoordinate sourcePoint = default(SpatialCoordinate), 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 SpatialCoordinate 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/RangeObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/RangeObject.cs new file mode 100644 index 000000000000..4bbb4e2a8d4d --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/RangeObject.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 RangeObject + { + /// + /// Initializes a new instance of the RangeObject class. + /// + public RangeObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RangeObject 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 RangeObject(double? minimum = default(double?), double? maximum = default(double?), double? exclusiveMinimum = default(double?), double? exclusiveMaximum = default(double?)) + { + 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 double? Minimum { get; set; } + + /// + /// Gets or sets all the number x that x ≤ maximum. + /// + [JsonProperty(PropertyName = "maximum")] + public double? Maximum { get; set; } + + /// + /// Gets or sets all the number x that x &gt; exclusiveMinimum. + /// + [JsonProperty(PropertyName = "exclusiveMinimum")] + public double? ExclusiveMinimum { get; set; } + + /// + /// Gets or sets all the number x that x &lt; exclusiveMaximum. + /// + [JsonProperty(PropertyName = "exclusiveMaximum")] + public double? ExclusiveMaximum { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialCoordinate.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialCoordinate.cs new file mode 100644 index 000000000000..b2dd3bb34901 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/SpatialCoordinate.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; + + /// + /// A location represented as a latitude and longitude + /// + public partial class SpatialCoordinate + { + /// + /// Initializes a new instance of the SpatialCoordinate class. + /// + public SpatialCoordinate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SpatialCoordinate class. + /// + /// Latitude property + /// Longitude property + public SpatialCoordinate(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 latitude property + /// + [JsonProperty(PropertyName = "lat")] + public double? Lat { get; private set; } + + /// + /// Gets longitude property + /// + [JsonProperty(PropertyName = "lon")] + public double? Lon { get; private 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/StatesetCreatedResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetCreatedResponse.cs new file mode 100644 index 000000000000..88d0a6349c3a --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetCreatedResponse.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 StatesetCreatedResponse + { + /// + /// Initializes a new instance of the StatesetCreatedResponse class. + /// + public StatesetCreatedResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetCreatedResponse class. + /// + /// The ID for the new stateset + /// created. + public StatesetCreatedResponse(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/StatesetGetResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetGetResponse.cs new file mode 100644 index 000000000000..c1cec0d51892 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetGetResponse.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 StatesetGetResponse + { + /// + /// Initializes a new instance of the StatesetGetResponse class. + /// + public StatesetGetResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetGetResponse class. + /// + /// Description associated with the + /// stateset. + /// Dataset ID associated with the + /// stateset. + public StatesetGetResponse(string description = default(string), IList datasetIds = default(IList), StylesObject statesetStyle = default(StylesObject)) + { + Description = description; + DatasetIds = datasetIds; + StatesetStyle = statesetStyle; + 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 StylesObject StatesetStyle { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfoObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfoObject.cs new file mode 100644 index 000000000000..1fe97e12b32e --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetInfoObject.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The stateset information detail. + /// + public partial class StatesetInfoObject + { + /// + /// Initializes a new instance of the StatesetInfoObject class. + /// + public StatesetInfoObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetInfoObject class. + /// + /// The stateset ID of this stateset. + /// Description associated with the + /// stateset. + /// Dataset ID associated with the + /// stateset. + public StatesetInfoObject(string statesetId = default(string), string description = default(string), IList datasetIds = default(IList), StylesObject statesetStyle = default(StylesObject)) + { + StatesetId = statesetId; + Description = description; + DatasetIds = datasetIds; + StatesetStyle = statesetStyle; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the stateset ID of this stateset. + /// + [JsonProperty(PropertyName = "statesetId")] + public string StatesetId { get; set; } + + /// + /// 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 StylesObject StatesetStyle { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResponse.cs new file mode 100644 index 000000000000..efcd04b4c1c5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StatesetListResponse.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 StatesetListResponse + { + /// + /// Initializes a new instance of the StatesetListResponse class. + /// + public StatesetListResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatesetListResponse class. + /// + /// A list of statesets information. + /// If present, the location of the next page of + /// data. + public StatesetListResponse(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/StringTypeStyleRule.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StringTypeStyleRule.cs new file mode 100644 index 000000000000..4d39d5778bb1 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StringTypeStyleRule.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 StringTypeStyleRule : StyleObject + { + /// + /// Initializes a new instance of the StringTypeStyleRule class. + /// + public StringTypeStyleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StringTypeStyleRule class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + /// String style rules. + public StringTypeStyleRule(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/StyleObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleObject.cs new file mode 100644 index 000000000000..3e5a9cbbfe22 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StyleObject.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 NumberRuleObject, + /// StringRuleObject and BooleanRuleObject definitions + /// [here](https://aka.ms/AzureMapsStatesetStylesObject). + /// + public partial class StyleObject + { + /// + /// Initializes a new instance of the StyleObject class. + /// + public StyleObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StyleObject class. + /// + /// Stateset style key name. Key names are random + /// strings but they should be unique inside style array. + public StyleObject(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/StylesObject.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StylesObject.cs new file mode 100644 index 000000000000..6b0c204a89b0 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/StylesObject.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The styles model. + /// + public partial class StylesObject + { + /// + /// Initializes a new instance of the StylesObject class. + /// + public StylesObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StylesObject class. + /// + /// An array of stateset styles. The style rule + /// could be a numeric or string or a boolean type style rule. Refer + /// to NumberRuleObject, StringRuleObject and BooleanRuleObject + /// definitions [here](https://aka.ms/AzureMapsStatesetStylesObject). + /// + public StylesObject(IList styles = default(IList)) + { + Styles = styles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an array of stateset styles. The style rule could be a + /// numeric or string or a boolean type style rule. Refer to + /// NumberRuleObject, StringRuleObject and BooleanRuleObject + /// definitions [here](https://aka.ms/AzureMapsStatesetStylesObject). + /// + [JsonProperty(PropertyName = "styles")] + public IList Styles { 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/TilesetDetailInfo.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetDetailInfo.cs new file mode 100644 index 000000000000..b7777128290c --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetDetailInfo.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 TilesetDetailInfo + { + /// + /// Initializes a new instance of the TilesetDetailInfo class. + /// + public TilesetDetailInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TilesetDetailInfo 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 TilesetDetailInfo(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 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; private 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/TilesetListResponse.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetListResponse.cs new file mode 100644 index 000000000000..f92940f6b6a8 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/TilesetListResponse.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 TilesetListResponse + { + /// + /// Initializes a new instance of the TilesetListResponse class. + /// + public TilesetListResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TilesetListResponse class. + /// + /// A list of all tilesets. + /// If present, the location of the next page of + /// data. + public TilesetListResponse(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/UploadDataFormat.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/UploadDataFormat.cs new file mode 100644 index 000000000000..89a50273f5e3 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/UploadDataFormat.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 UploadDataFormat. + /// + public static class UploadDataFormat + { + /// + /// [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/WfsEndpointLink.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Models/WfsEndpointLink.cs new file mode 100644 index 000000000000..3b865ccc34ed --- /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..6e0f966f025f --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Spatial.cs @@ -0,0 +1,2148 @@ +// +// 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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, double latitude, double longitude, double? z = 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 (udid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "udid"); + } + if (searchBuffer > 500) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "searchBuffer", 500); + } + if (searchBuffer < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "searchBuffer", 0); + } + 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("deviceId", deviceId); + tracingParameters.Add("udid", udid); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("z", z); + tracingParameters.Add("userTime", userTime); + tracingParameters.Add("searchBuffer", searchBuffer); + tracingParameters.Add("isAsync", isAsync); + tracingParameters.Add("mode", mode); + 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))); + } + _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 (z != null) + { + _queryParameters.Add(string.Format("z={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(z, 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))); + } + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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 latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// The geofencing GeoJSON data. + /// + /// + /// 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, double latitude, double longitude, GeoJsonFeatureCollection searchGeofenceRequestBody, double? z = 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(); + } + 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("deviceId", deviceId); + tracingParameters.Add("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("z", z); + tracingParameters.Add("userTime", userTime); + tracingParameters.Add("searchBuffer", searchBuffer); + tracingParameters.Add("isAsync", isAsync); + tracingParameters.Add("mode", mode); + tracingParameters.Add("searchGeofenceRequestBody", searchGeofenceRequestBody); + 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))); + } + _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 (z != null) + { + _queryParameters.Add(string.Format("z={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(z, 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))); + } + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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 latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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. + /// + /// + /// 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(double latitude, double longitude, GeoJsonFeatureCollection closestPointRequestBody, 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(); + } + 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("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("numberOfClosestPoints", numberOfClosestPoints); + tracingParameters.Add("closestPointRequestBody", closestPointRequestBody); + 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))); + } + _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 (numberOfClosestPoints != null) + { + _queryParameters.Add(string.Format("numberOfClosestPoints={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(numberOfClosestPoints, 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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, double latitude, double longitude, 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"); + } + 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("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("numberOfClosestPoints", numberOfClosestPoints); + 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))); + } + _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 (numberOfClosestPoints != null) + { + _queryParameters.Add(string.Format("numberOfClosestPoints={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(numberOfClosestPoints, 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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. + /// + /// + /// 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(double latitude, double longitude, GeoJsonFeatureCollection pointInPolygonRequestBody, 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(); + } + 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("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("pointInPolygonRequestBody", pointInPolygonRequestBody); + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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> GetPointInPolygonWithHttpMessagesAsync(string udid, double latitude, double longitude, 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 = "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("latitude", latitude); + tracingParameters.Add("longitude", longitude); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetPointInPolygon", 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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..e9cd8b05239d --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/SpatialExtensions.cs @@ -0,0 +1,518 @@ +// +// 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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, double latitude, double longitude, double? z = 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.GetGeofenceWithHttpMessagesAsync(deviceId, udid, latitude, longitude, z, userTime, searchBuffer, 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 latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// The geofencing GeoJSON data. + /// + /// + /// 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, double latitude, double longitude, GeoJsonFeatureCollection searchGeofenceRequestBody, double? z = 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, latitude, longitude, searchGeofenceRequestBody, z, 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 latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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. + /// + /// + /// 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, double latitude, double longitude, GeoJsonFeatureCollection closestPointRequestBody, int? numberOfClosestPoints = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostClosestPointWithHttpMessagesAsync(latitude, longitude, closestPointRequestBody, 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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, double latitude, double longitude, int? numberOfClosestPoints = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetClosestPointWithHttpMessagesAsync(udid, latitude, longitude, 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// 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. + /// + /// + /// The cancellation token. + /// + public static async Task PostPointInPolygonAsync(this ISpatial operations, double latitude, double longitude, GeoJsonFeatureCollection pointInPolygonRequestBody, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostPointInPolygonWithHttpMessagesAsync(latitude, longitude, pointInPolygonRequestBody, 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. + /// + /// + /// The latitude of the location being passed. Example: 48.36. + /// + /// + /// The longitude of the location being passed. Example: -124.63. + /// + /// + /// The cancellation token. + /// + public static async Task GetPointInPolygonAsync(this ISpatial operations, string udid, double latitude, double longitude, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPointInPolygonWithHttpMessagesAsync(udid, latitude, longitude, 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/Tileset.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/Tileset.cs new file mode 100644 index 000000000000..33ca14dfe376 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/Tileset.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; + + /// + /// Tileset operations. + /// + public partial class Tileset : IServiceOperations, ITileset + { + /// + /// Initializes a new instance of the Tileset class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Tileset(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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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/TilesetExtensions.cs b/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetExtensions.cs new file mode 100644 index 000000000000..a8c0060dbe92 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/TilesetExtensions.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 Tileset. + /// + public static partial class TilesetExtensions + { + /// + /// **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 ITileset 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 ITileset 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 ITileset 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 ITileset 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 ITileset 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..7491c7a678f8 --- /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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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> GetConformanceWithHttpMessagesAsync(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, "GetConformance", 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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 = 50 * 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?), string bbox = default(string), 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 > 50) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "limit", 50); + } + 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("bbox", bbox); + 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 (bbox != null) + { + _queryParameters.Add(string.Format("bbox={0}", System.Uri.EscapeDataString(bbox))); + } + 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.XMsClientId != null) + { + if (_httpRequest.Headers.Contains("x-ms-client-id")) + { + _httpRequest.Headers.Remove("x-ms-client-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-id", Client.XMsClientId); + } + + + 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..0e1d922505e2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Creator/src/Generated/WFSExtensions.cs @@ -0,0 +1,364 @@ +// +// 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 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 GetConformanceAsync(this IWFS operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetConformanceWithHttpMessagesAsync(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 = 50 * 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?), string bbox = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetFeaturesWithHttpMessagesAsync(datasetId, collectionId, limit, bbox, 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(); + } + + } +}