diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationClient.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationClient.cs new file mode 100644 index 000000000000..d18bd6702425 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationClient.cs @@ -0,0 +1,241 @@ +// +// 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.Elevation +{ + 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; + + /// + /// The Azure Maps Elevation API provides an HTTP interface to query + /// elevation data on the surface of the Earth. Elevation data can be + /// retrieved at specific locations by sending lat/lon coordinates, by + /// defining an ordered set of vertices that form a Polyline and a number + /// of sample points along the length of a Polyline, or by defining a + /// bounding box that consists of equally spaced vertices as rows and + /// columns. The vertical datum is EPSG:3855. This datum uses the EGM2008 + /// geoid model applied to the WGS84 ellipsoid as its zero height + /// reference surface. The vertical unit is measured in meters, the spatial + /// resolution of the elevation data is 0.8 arc-second for global coverage + /// (~24 meters). + /// + public partial class ElevationClient : ServiceClient, IElevationClient + { + /// + /// 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; } + + /// + /// Version number of Azure Maps API. + /// + public string ApiVersion { 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; } + + /// + /// This parameter specifies where the Azure Maps Creator resource is located. + /// Valid values are us and eu. Possible values include: 'us', 'eu' + /// + public string Geography { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the IElevationOperations. + /// + public virtual IElevationOperations Elevation { get; private set; } + + /// + /// Initializes a new instance of the ElevationClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ElevationClient.Dispose(). False: will not dispose provided httpClient + protected ElevationClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ElevationClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ElevationClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ElevationClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ElevationClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ElevationClient 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 ElevationClient(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 ElevationClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ElevationClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ElevationClient(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 ElevationClient 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 ElevationClient(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() + { + Elevation = new ElevationOperations(this); + BaseUri = "https://{geography}.atlas.microsoft.com"; + ApiVersion = "1.0"; + 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() + } + }; + CustomInitialize(); + } + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationOperations.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationOperations.cs new file mode 100644 index 000000000000..5d1c72b779a2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationOperations.cs @@ -0,0 +1,1124 @@ +// +// 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.Elevation +{ + 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; + + /// + /// ElevationOperations operations. + /// + public partial class ElevationOperations : IServiceOperations, IElevationOperations + { + /// + /// Initializes a new instance of the ElevationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public ElevationOperations(ElevationClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ElevationClient + /// + public ElevationClient Client { get; private set; } + + /// + /// Get Elevation Data on One or More Points + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Points API provides elevation data for one or more points. + /// A point is defined in lat,long coordinate format. + /// + /// Due to the URL character length limit of 2048, it's not possible to pass + /// more than 100 coordinates as a pipeline delimited string in a URL GET + /// request. If you intend to pass more than 100 coordinates as a pipeline + /// delimited string, use the [POST Data + /// For + /// Points](https://docs.microsoft.com/en-us/rest/api/maps/elevation/postdataforpoints). + /// + /// + /// The string representation of a list of points. A point is defined in + /// lon/lat WGS84 coordinate reference system format. If multiple points are + /// requested, each of the points in a list should be separated by the pipe + /// ('|') character. The maximum number of points that can be requested in a + /// single request is 2,000. The resolution of the elevation data will be the + /// highest for a single point and will decrease if multiple points are spread + /// further apart. + /// + /// + /// 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> GetDataForPointsWithHttpMessagesAsync(IList points, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (points == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "points"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("points", points); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDataForPoints", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "elevation/point/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (points != null) + { + _queryParameters.Add(string.Format("points={0}", string.Join("|", points))); + } + 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; + } + + /// + /// Query Elevation Data for Multiple Points + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Post Data for Points API provides elevation data for multiple points. + /// A point is defined lon/lat coordinate format. Use the POST endpoint only + /// if you intend to pass multiple points in the request. If you intend to pass + /// a single coordinate into the API, use the [GET Data For Points + /// API](https://docs.microsoft.com/en-us/rest/api/maps/elevation/getdataforpoints). + /// + /// + /// The string representation of a list of points. A point is defined in + /// lon/lat WGS84 coordinate reference system format. Each points in a list + /// should be separated by the pipe ('|') character. The number of points that + /// can be requested in a POST request ranges from 2 to 2,000. The resolution + /// of the elevation data will be the highest for a single point and will + /// decrease if multiple points are spread further apart. + /// + /// + /// 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> PostDataForPointsWithHttpMessagesAsync(IList pointsRequestBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (pointsRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "pointsRequestBody"); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("pointsRequestBody", pointsRequestBody); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostDataForPoints", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "elevation/point/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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(pointsRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(pointsRequestBody, 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; + } + + /// + /// Get Elevation Data Along a Polyline + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Polyline API provides elevation data along a polyline. + /// + /// A polyline is defined by passing in between 2 and N endpoint coordinates + /// separated by a pipe ('|') character. In addition to passing in endpoints, + /// customers can specify the number of sample points that will be used to + /// divide polyline into equally spaced segments. Elevation data at both start + /// and endpoints and equally spaced points along the polyline will be + /// returned. + /// + /// A line between two endpoints is a straight Cartesian line, the shortest + /// line between those two points in the coordinate reference system. Note that + /// the point is chosen based on Euclidean distance and may markedly differ + /// from the geodesic path along the curved surface of the reference + /// ellipsoid. + /// + /// + /// The string representation of a polyline path. A polyline is defined by + /// endpoint coordinates, with each endpoint separated by a pipe ('|') + /// character. The polyline should be defined in the following format: + /// `[longitude_point1, latitude_point1 | longitude_point2, latitude_point2, + /// ..., longitude_pointN, latitude_pointN]`. + /// + /// The longitude and latitude values refer to the World Geodetic System + /// (WGS84) coordinate reference system. The resolution of the data used to + /// compute the elevation depends on the distance between the endpoints. + /// + /// + /// The samples parameter specifies the number of equally spaced points at + /// which elevation values should be provided along a polyline path. The + /// number of samples should range from 2 to 2,000. Default value is 10. + /// + /// + /// 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> GetDataForPolylineWithHttpMessagesAsync(IList lines, int? samples = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (lines == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "lines"); + } + if (samples > 2000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "samples", 2000); + } + if (samples < 2) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "samples", 2); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("lines", lines); + tracingParameters.Add("samples", samples); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDataForPolyline", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "elevation/line/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (lines != null) + { + _queryParameters.Add(string.Format("lines={0}", string.Join("|", lines))); + } + if (samples != null) + { + _queryParameters.Add(string.Format("samples={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(samples, 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; + } + + /// + /// Query Elevation Data Along a Polyline + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Post Data for Polyline API provides elevation data along a polyline. A + /// polyline is defined by passing in between 2 and N endpoint coordinates + /// separated by a pipe ('|') character. In addition to passing in endpoints, + /// customers can specify the number of sample points that will be used to + /// divide polyline into equally spaced segments. + /// + /// Elevation data at both start and end points and equally spaced points + /// along the polyline will be returned. A line between two endpoints is a + /// straight Cartesian line, the shortest line between those two points in the + /// coordinate reference system. Note that the point is chosen based on + /// Euclidean distance and may markedly differ from the geodesic path along the + /// curved surface of the reference ellipsoid. + /// + /// + /// The string representation of a polyline path. A polyline is defined by + /// endpoint coordinates, with each endpoint separated by a pipe ('|') + /// character. The polyline should be defined in the following format: + /// `[longitude_point1, latitude_point1 | longitude_point2, latitude_point2, + /// ..., longitude_pointN, latitude_pointN]`. The longitude and latitude + /// values refer to the World Geodetic System (WGS84) coordinate reference + /// system. The resolution of the data used to compute the elevation will + /// depend on the distance between the endpoints. + /// + /// + /// The samples parameter specifies the number of equally spaced points at + /// which elevation values should be provided along a polyline path. The + /// number of samples should range from 2 to 2,000. Default value is 10. + /// + /// + /// 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> PostDataForPolylineWithHttpMessagesAsync(IList linesRequestBody, int? samples = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (linesRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "linesRequestBody"); + } + if (samples > 2000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "samples", 2000); + } + if (samples < 2) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "samples", 2); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("linesRequestBody", linesRequestBody); + tracingParameters.Add("samples", samples); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostDataForPolyline", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "elevation/line/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (samples != null) + { + _queryParameters.Add(string.Format("samples={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(samples, 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(linesRequestBody != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(linesRequestBody, 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; + } + + /// + /// Get Elevation Data at Equally Spaced Locations Within a Bounding Box + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Bounding Box API provides elevation data at equally spaced + /// locations within a bounding box. A bounding box is defined by the + /// coordinates for two corners (southwest, northeast) and then subsequently + /// divided into rows and columns. + /// + /// Elevations are returned for the vertices of the grid created by the rows + /// and columns. Up to 2,000 elevations can be returned in a single request. + /// The returned elevation values are ordered, starting at the southwest + /// corner, and then proceeding west to east along the row. At the end of the + /// row, it moves north to the next row, and repeats the process until it + /// reaches the far northeast corner. + /// + /// + /// The string that represents the rectangular area of a bounding box. The + /// bounds parameter is defined by the 4 bounding box coordinates, with WGS84 + /// longitude and latitude of the southwest corner followed by WGS84 longitude + /// and latitude of the northeast corner. The string is presented in the + /// following format: `[SouthwestCorner_Longitude, SouthwestCorner_Latitude, + /// NortheastCorner_Longitude, NortheastCorner_Latitude]`. + /// + /// + /// Specifies the number of rows to use to divide the bounding box area into a + /// grid. The number of vertices in the grid should be less than 2,000. + /// + /// + /// Specifies the number of columns to use to divide the bounding box area into + /// a grid. The number of vertices in the grid should be less than 2,000. + /// + /// + /// 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> GetDataForBoundingBoxWithHttpMessagesAsync(IList bounds, int rows, int columns, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Geography == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Geography"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (bounds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bounds"); + } + if (rows > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "rows", 1000); + } + if (rows < 2) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "rows", 2); + } + if (columns > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "columns", 1000); + } + if (columns < 2) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "columns", 2); + } + string format = "json"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("format", format); + tracingParameters.Add("bounds", bounds); + tracingParameters.Add("rows", rows); + tracingParameters.Add("columns", columns); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDataForBoundingBox", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "elevation/lattice/{format}"; + _url = _url.Replace("{geography}", System.Uri.EscapeDataString(Client.Geography)); + _url = _url.Replace("{format}", System.Uri.EscapeDataString(format)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (bounds != null) + { + _queryParameters.Add(string.Format("bounds={0}", System.Uri.EscapeDataString(string.Join(",", bounds)))); + } + _queryParameters.Add(string.Format("rows={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(rows, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("columns={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(columns, 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; + } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationOperationsExtensions.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationOperationsExtensions.cs new file mode 100644 index 000000000000..bef6a4ef5c7a --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/ElevationOperationsExtensions.cs @@ -0,0 +1,245 @@ +// +// 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.Elevation +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ElevationOperations. + /// + public static partial class ElevationOperationsExtensions + { + /// + /// Get Elevation Data on One or More Points + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Points API provides elevation data for one or more points. + /// A point is defined in lat,long coordinate format. + /// + /// Due to the URL character length limit of 2048, it's not possible to pass + /// more than 100 coordinates as a pipeline delimited string in a URL GET + /// request. If you intend to pass more than 100 coordinates as a pipeline + /// delimited string, use the [POST Data + /// For + /// Points](https://docs.microsoft.com/en-us/rest/api/maps/elevation/postdataforpoints). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The string representation of a list of points. A point is defined in + /// lon/lat WGS84 coordinate reference system format. If multiple points are + /// requested, each of the points in a list should be separated by the pipe + /// ('|') character. The maximum number of points that can be requested in a + /// single request is 2,000. The resolution of the elevation data will be the + /// highest for a single point and will decrease if multiple points are spread + /// further apart. + /// + /// + /// The cancellation token. + /// + public static async Task GetDataForPointsAsync(this IElevationOperations operations, IList points, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDataForPointsWithHttpMessagesAsync(points, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Query Elevation Data for Multiple Points + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Post Data for Points API provides elevation data for multiple points. + /// A point is defined lon/lat coordinate format. Use the POST endpoint only + /// if you intend to pass multiple points in the request. If you intend to pass + /// a single coordinate into the API, use the [GET Data For Points + /// API](https://docs.microsoft.com/en-us/rest/api/maps/elevation/getdataforpoints). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The string representation of a list of points. A point is defined in + /// lon/lat WGS84 coordinate reference system format. Each points in a list + /// should be separated by the pipe ('|') character. The number of points that + /// can be requested in a POST request ranges from 2 to 2,000. The resolution + /// of the elevation data will be the highest for a single point and will + /// decrease if multiple points are spread further apart. + /// + /// + /// The cancellation token. + /// + public static async Task PostDataForPointsAsync(this IElevationOperations operations, IList pointsRequestBody, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostDataForPointsWithHttpMessagesAsync(pointsRequestBody, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get Elevation Data Along a Polyline + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Polyline API provides elevation data along a polyline. + /// + /// A polyline is defined by passing in between 2 and N endpoint coordinates + /// separated by a pipe ('|') character. In addition to passing in endpoints, + /// customers can specify the number of sample points that will be used to + /// divide polyline into equally spaced segments. Elevation data at both start + /// and endpoints and equally spaced points along the polyline will be + /// returned. + /// + /// A line between two endpoints is a straight Cartesian line, the shortest + /// line between those two points in the coordinate reference system. Note that + /// the point is chosen based on Euclidean distance and may markedly differ + /// from the geodesic path along the curved surface of the reference + /// ellipsoid. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The string representation of a polyline path. A polyline is defined by + /// endpoint coordinates, with each endpoint separated by a pipe ('|') + /// character. The polyline should be defined in the following format: + /// `[longitude_point1, latitude_point1 | longitude_point2, latitude_point2, + /// ..., longitude_pointN, latitude_pointN]`. + /// + /// The longitude and latitude values refer to the World Geodetic System + /// (WGS84) coordinate reference system. The resolution of the data used to + /// compute the elevation depends on the distance between the endpoints. + /// + /// + /// The samples parameter specifies the number of equally spaced points at + /// which elevation values should be provided along a polyline path. The + /// number of samples should range from 2 to 2,000. Default value is 10. + /// + /// + /// The cancellation token. + /// + public static async Task GetDataForPolylineAsync(this IElevationOperations operations, IList lines, int? samples = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDataForPolylineWithHttpMessagesAsync(lines, samples, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Query Elevation Data Along a Polyline + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Post Data for Polyline API provides elevation data along a polyline. A + /// polyline is defined by passing in between 2 and N endpoint coordinates + /// separated by a pipe ('|') character. In addition to passing in endpoints, + /// customers can specify the number of sample points that will be used to + /// divide polyline into equally spaced segments. + /// + /// Elevation data at both start and end points and equally spaced points + /// along the polyline will be returned. A line between two endpoints is a + /// straight Cartesian line, the shortest line between those two points in the + /// coordinate reference system. Note that the point is chosen based on + /// Euclidean distance and may markedly differ from the geodesic path along the + /// curved surface of the reference ellipsoid. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The string representation of a polyline path. A polyline is defined by + /// endpoint coordinates, with each endpoint separated by a pipe ('|') + /// character. The polyline should be defined in the following format: + /// `[longitude_point1, latitude_point1 | longitude_point2, latitude_point2, + /// ..., longitude_pointN, latitude_pointN]`. The longitude and latitude + /// values refer to the World Geodetic System (WGS84) coordinate reference + /// system. The resolution of the data used to compute the elevation will + /// depend on the distance between the endpoints. + /// + /// + /// The samples parameter specifies the number of equally spaced points at + /// which elevation values should be provided along a polyline path. The + /// number of samples should range from 2 to 2,000. Default value is 10. + /// + /// + /// The cancellation token. + /// + public static async Task PostDataForPolylineAsync(this IElevationOperations operations, IList linesRequestBody, int? samples = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostDataForPolylineWithHttpMessagesAsync(linesRequestBody, samples, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get Elevation Data at Equally Spaced Locations Within a Bounding Box + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Bounding Box API provides elevation data at equally spaced + /// locations within a bounding box. A bounding box is defined by the + /// coordinates for two corners (southwest, northeast) and then subsequently + /// divided into rows and columns. + /// + /// Elevations are returned for the vertices of the grid created by the rows + /// and columns. Up to 2,000 elevations can be returned in a single request. + /// The returned elevation values are ordered, starting at the southwest + /// corner, and then proceeding west to east along the row. At the end of the + /// row, it moves north to the next row, and repeats the process until it + /// reaches the far northeast corner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The string that represents the rectangular area of a bounding box. The + /// bounds parameter is defined by the 4 bounding box coordinates, with WGS84 + /// longitude and latitude of the southwest corner followed by WGS84 longitude + /// and latitude of the northeast corner. The string is presented in the + /// following format: `[SouthwestCorner_Longitude, SouthwestCorner_Latitude, + /// NortheastCorner_Longitude, NortheastCorner_Latitude]`. + /// + /// + /// Specifies the number of rows to use to divide the bounding box area into a + /// grid. The number of vertices in the grid should be less than 2,000. + /// + /// + /// Specifies the number of columns to use to divide the bounding box area into + /// a grid. The number of vertices in the grid should be less than 2,000. + /// + /// + /// The cancellation token. + /// + public static async Task GetDataForBoundingBoxAsync(this IElevationOperations operations, IList bounds, int rows, int columns, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDataForBoundingBoxWithHttpMessagesAsync(bounds, rows, columns, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/IElevationClient.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/IElevationClient.cs new file mode 100644 index 000000000000..c91bc5818384 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/IElevationClient.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.Elevation +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + + /// + /// The Azure Maps Elevation API provides an HTTP interface to query + /// elevation data on the surface of the Earth. Elevation data can be + /// retrieved at specific locations by sending lat/lon coordinates, by + /// defining an ordered set of vertices that form a Polyline and a number + /// of sample points along the length of a Polyline, or by defining a + /// bounding box that consists of equally spaced vertices as rows and + /// columns. The vertical datum is EPSG:3855. This datum uses the EGM2008 + /// geoid model applied to the WGS84 ellipsoid as its zero height + /// reference surface. The vertical unit is measured in meters, the spatial + /// resolution of the elevation data is 0.8 arc-second for global coverage + /// (~24 meters). + /// + public partial interface IElevationClient : 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; } + + /// + /// Version number of Azure Maps API. + /// + string ApiVersion { 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; } + + /// + /// This parameter specifies where the Azure Maps Creator resource is + /// located. Valid values are us and eu. Possible values include: + /// 'us', 'eu' + /// + string Geography { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the IElevationOperations. + /// + IElevationOperations Elevation { get; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/IElevationOperations.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/IElevationOperations.cs new file mode 100644 index 000000000000..1a4acccddb42 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/IElevationOperations.cs @@ -0,0 +1,271 @@ +// +// 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.Elevation +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ElevationOperations operations. + /// + public partial interface IElevationOperations + { + /// + /// Get Elevation Data on One or More Points + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Points API provides elevation data for one or more + /// points. A point is defined in lat,long coordinate format. + /// + /// Due to the URL character length limit of 2048, it's not possible + /// to pass more than 100 coordinates as a pipeline delimited string + /// in a URL GET request. If you intend to pass more than 100 + /// coordinates as a pipeline delimited string, use the [POST Data + /// For + /// Points](https://docs.microsoft.com/en-us/rest/api/maps/elevation/postdataforpoints). + /// + /// + /// The string representation of a list of points. A point is defined + /// in lon/lat WGS84 coordinate reference system format. If multiple + /// points are requested, each of the points in a list should be + /// separated by the pipe ('|') character. The maximum number of + /// points that can be requested in a single request is 2,000. The + /// resolution of the elevation data will be the highest for a single + /// point and will decrease if multiple points are spread further + /// apart. + /// + /// + /// 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> GetDataForPointsWithHttpMessagesAsync(IList points, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Query Elevation Data for Multiple Points + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Post Data for Points API provides elevation data for multiple + /// points. A point is defined lon/lat coordinate format. Use the POST + /// endpoint only if you intend to pass multiple points in the + /// request. If you intend to pass a single coordinate into the API, + /// use the [GET Data For Points + /// API](https://docs.microsoft.com/en-us/rest/api/maps/elevation/getdataforpoints). + /// + /// + /// The string representation of a list of points. A point is defined + /// in lon/lat WGS84 coordinate reference system format. Each points + /// in a list should be separated by the pipe ('|') character. The + /// number of points that can be requested in a POST request ranges + /// from 2 to 2,000. The resolution of the elevation data will be the + /// highest for a single point and will decrease if multiple points + /// are spread further apart. + /// + /// + /// 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> PostDataForPointsWithHttpMessagesAsync(IList pointsRequestBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Elevation Data Along a Polyline + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Polyline API provides elevation data along a + /// polyline. + /// + /// A polyline is defined by passing in between 2 and N endpoint + /// coordinates separated by a pipe ('|') character. In addition to + /// passing in endpoints, customers can specify the number of sample + /// points that will be used to divide polyline into equally spaced + /// segments. Elevation data at both start and endpoints and equally + /// spaced points along the polyline will be returned. + /// + /// A line between two endpoints is a straight Cartesian line, the + /// shortest line between those two points in the coordinate reference + /// system. Note that the point is chosen based on Euclidean distance + /// and may markedly differ from the geodesic path along the curved + /// surface of the reference ellipsoid. + /// + /// + /// The string representation of a polyline path. A polyline is defined + /// by endpoint coordinates, with each endpoint separated by a pipe + /// ('|') character. The polyline should be defined in the following + /// format: `[longitude_point1, latitude_point1 | longitude_point2, + /// latitude_point2, ..., longitude_pointN, latitude_pointN]`. + /// + /// The longitude and latitude values refer to the World Geodetic + /// System (WGS84) coordinate reference system. The resolution of the + /// data used to compute the elevation depends on the distance between + /// the endpoints. + /// + /// + /// The samples parameter specifies the number of equally spaced points + /// at which elevation values should be provided along a polyline + /// path. The number of samples should range from 2 to 2,000. Default + /// value is 10. + /// + /// + /// 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> GetDataForPolylineWithHttpMessagesAsync(IList lines, int? samples = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Query Elevation Data Along a Polyline + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Post Data for Polyline API provides elevation data along a + /// polyline. A polyline is defined by passing in between 2 and N + /// endpoint coordinates separated by a pipe ('|') character. In + /// addition to passing in endpoints, customers can specify the number + /// of sample points that will be used to divide polyline into equally + /// spaced segments. + /// + /// Elevation data at both start and end points and equally spaced + /// points along the polyline will be returned. A line between two + /// endpoints is a straight Cartesian line, the shortest line between + /// those two points in the coordinate reference system. Note that the + /// point is chosen based on Euclidean distance and may markedly + /// differ from the geodesic path along the curved surface of the + /// reference ellipsoid. + /// + /// + /// The string representation of a polyline path. A polyline is defined + /// by endpoint coordinates, with each endpoint separated by a pipe + /// ('|') character. The polyline should be defined in the following + /// format: `[longitude_point1, latitude_point1 | longitude_point2, + /// latitude_point2, ..., longitude_pointN, latitude_pointN]`. The + /// longitude and latitude values refer to the World Geodetic System + /// (WGS84) coordinate reference system. The resolution of the data + /// used to compute the elevation will depend on the distance between + /// the endpoints. + /// + /// + /// The samples parameter specifies the number of equally spaced points + /// at which elevation values should be provided along a polyline + /// path. The number of samples should range from 2 to 2,000. Default + /// value is 10. + /// + /// + /// 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> PostDataForPolylineWithHttpMessagesAsync(IList linesRequestBody, int? samples = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Elevation Data at Equally Spaced Locations Within a Bounding + /// Box + /// + /// + /// **Applies to**: S1 pricing tier. + /// + /// The Get Data for Bounding Box API provides elevation data at + /// equally spaced locations within a bounding box. A bounding box is + /// defined by the coordinates for two corners (southwest, northeast) + /// and then subsequently divided into rows and columns. + /// + /// Elevations are returned for the vertices of the grid created by the + /// rows and columns. Up to 2,000 elevations can be returned in a + /// single request. The returned elevation values are ordered, + /// starting at the southwest corner, and then proceeding west to east + /// along the row. At the end of the row, it moves north to the next + /// row, and repeats the process until it reaches the far northeast + /// corner. + /// + /// + /// The string that represents the rectangular area of a bounding box. + /// The bounds parameter is defined by the 4 bounding box coordinates, + /// with WGS84 longitude and latitude of the southwest corner followed + /// by WGS84 longitude and latitude of the northeast corner. The + /// string is presented in the following format: + /// `[SouthwestCorner_Longitude, SouthwestCorner_Latitude, + /// NortheastCorner_Longitude, NortheastCorner_Latitude]`. + /// + /// + /// Specifies the number of rows to use to divide the bounding box area + /// into a grid. The number of vertices in the grid should be less + /// than 2,000. + /// + /// + /// Specifies the number of columns to use to divide the bounding box + /// area into a grid. The number of vertices in the grid should be + /// less than 2,000. + /// + /// + /// 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> GetDataForBoundingBoxWithHttpMessagesAsync(IList bounds, int rows, int columns, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/BoundingBoxResult.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/BoundingBoxResult.cs new file mode 100644 index 000000000000..7f8e45d26dea --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/BoundingBoxResult.cs @@ -0,0 +1,51 @@ +// +// 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.Elevation.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response from a successful Get Data for Bounding Box API. + /// + public partial class BoundingBoxResult + { + /// + /// Initializes a new instance of the BoundingBoxResult class. + /// + public BoundingBoxResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BoundingBoxResult class. + /// + public BoundingBoxResult(IList data = default(IList)) + { + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "data")] + public IList Data { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/CoordinatesPair.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/CoordinatesPair.cs new file mode 100644 index 000000000000..8b6aa74d4ef9 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/CoordinatesPair.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.Elevation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A location represented as a latitude and longitude. + /// + public partial class CoordinatesPair + { + /// + /// Initializes a new instance of the CoordinatesPair class. + /// + public CoordinatesPair() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CoordinatesPair class. + /// + /// Latitude property + /// Longitude property + public CoordinatesPair(double? latitude = default(double?), double? longitude = default(double?)) + { + Latitude = latitude; + Longitude = longitude; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets latitude property + /// + [JsonProperty(PropertyName = "latitude")] + public double? Latitude { get; set; } + + /// + /// Gets or sets longitude property + /// + [JsonProperty(PropertyName = "longitude")] + public double? Longitude { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/CoordinatesPairAbbreviated.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/CoordinatesPairAbbreviated.cs new file mode 100644 index 000000000000..24abff950d8d --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/CoordinatesPairAbbreviated.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.Elevation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A location represented as a latitude and longitude using short names + /// 'lat' & 'lon'. + /// + public partial class CoordinatesPairAbbreviated + { + /// + /// Initializes a new instance of the CoordinatesPairAbbreviated class. + /// + public CoordinatesPairAbbreviated() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CoordinatesPairAbbreviated class. + /// + /// Latitude property + /// Longitude property + public CoordinatesPairAbbreviated(double? lat = default(double?), double? lon = default(double?)) + { + Lat = lat; + Lon = lon; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets latitude property + /// + [JsonProperty(PropertyName = "lat")] + public double? Lat { get; set; } + + /// + /// Gets or sets longitude property + /// + [JsonProperty(PropertyName = "lon")] + public double? Lon { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..2913e250296f --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/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.Elevation.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.Elevation/src/Generated/Models/ErrorDetail.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..80d664ea692e --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/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.Elevation.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.Elevation/src/Generated/Models/ErrorResponse.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..0cb3717ddcdf --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/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.Elevation.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.Elevation/src/Generated/Models/ErrorResponseException.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..3d934bc1f70e --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/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.Elevation.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.Elevation/src/Generated/Models/GeographicResourceLocation.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/GeographicResourceLocation.cs new file mode 100644 index 000000000000..7dcadf476082 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/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.Elevation.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.Elevation/src/Generated/Models/LinesResult.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/LinesResult.cs new file mode 100644 index 000000000000..9c92e2b2c569 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/LinesResult.cs @@ -0,0 +1,51 @@ +// +// 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.Elevation.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response from a successful Elevation Polyline request. + /// + public partial class LinesResult + { + /// + /// Initializes a new instance of the LinesResult class. + /// + public LinesResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinesResult class. + /// + public LinesResult(IList data = default(IList)) + { + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "data")] + public IList Data { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/PointElevationResult.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/PointElevationResult.cs new file mode 100644 index 000000000000..2089a26ce7f2 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/PointElevationResult.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Azure.Maps.Elevation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The elevation data. + /// + public partial class PointElevationResult + { + /// + /// Initializes a new instance of the PointElevationResult class. + /// + public PointElevationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PointElevationResult class. + /// + /// The elevation value in + /// meters. + public PointElevationResult(CoordinatesPair coordinate = default(CoordinatesPair), double? elevationInMeter = default(double?)) + { + Coordinate = coordinate; + ElevationInMeter = elevationInMeter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "coordinate")] + public CoordinatesPair Coordinate { get; set; } + + /// + /// Gets the elevation value in meters. + /// + [JsonProperty(PropertyName = "elevationInMeter")] + public double? ElevationInMeter { get; private set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/PointsResult.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/PointsResult.cs new file mode 100644 index 000000000000..018033baef5f --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/Models/PointsResult.cs @@ -0,0 +1,51 @@ +// +// 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.Elevation.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response from a successful Elevation Points request. + /// + public partial class PointsResult + { + /// + /// Initializes a new instance of the PointsResult class. + /// + public PointsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PointsResult class. + /// + public PointsResult(IList data = default(IList)) + { + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "data")] + public IList Data { get; set; } + + } +} diff --git a/sdk/maps/Azure.Maps.Elevation/src/Generated/SdkInfo_ElevationClient.cs b/sdk/maps/Azure.Maps.Elevation/src/Generated/SdkInfo_ElevationClient.cs new file mode 100644 index 000000000000..e4c71419a4d5 --- /dev/null +++ b/sdk/maps/Azure.Maps.Elevation/src/Generated/SdkInfo_ElevationClient.cs @@ -0,0 +1,27 @@ + +// +// 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.Elevation +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ElevationClient + { + get + { + return new Tuple[] + { + new Tuple("ElevationClient", "Elevation", "1.0"), + }.AsEnumerable(); + } + } + } +}