Ejemplo n.º 1
0
 public OutLicenseModel(System.DateTimeOffset @expiresAt, System.Guid @id, string @license, string @publicKey, string @publicKeyName)
 {
     this.Id            = @id;
     this.ExpiresAt     = @expiresAt;
     this.License       = @license;
     this.PublicKey     = @publicKey;
     this.PublicKeyName = @publicKeyName;
 }
Ejemplo n.º 2
0
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <summary>Fetch a list of Positions within the time period for the Devices or Groups</summary>
        /// <param name="from">in IS0 8601 format. eg. `1963-11-22T18:30:00Z`</param>
        /// <param name="to">in IS0 8601 format. eg. `1963-11-22T18:30:00Z`</param>
        /// <returns>OK</returns>
        /// <exception cref="ApiException">A server side error occurred.</exception>
        public async System.Threading.Tasks.Task <SwaggerResponse <System.Collections.Generic.ICollection <Position> > > RouteAsync(System.Collections.Generic.IEnumerable <int> deviceId, System.Collections.Generic.IEnumerable <int> groupId, System.DateTimeOffset from, System.DateTimeOffset to, System.Threading.CancellationToken cancellationToken)
        {
            if (from == null)
            {
                throw new System.ArgumentNullException("from");
            }

            if (to == null)
            {
                throw new System.ArgumentNullException("to");
            }

            var urlBuilder_ = new System.Text.StringBuilder();

            urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/reports/route?");
            if (deviceId != null)
            {
                foreach (var item_ in deviceId)
                {
                    urlBuilder_.Append(System.Uri.EscapeDataString("deviceId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
                }
            }
            if (groupId != null)
            {
                foreach (var item_ in groupId)
                {
                    urlBuilder_.Append(System.Uri.EscapeDataString("groupId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
                }
            }
            urlBuilder_.Append(System.Uri.EscapeDataString("from") + "=").Append(System.Uri.EscapeDataString(from.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            urlBuilder_.Append(System.Uri.EscapeDataString("to") + "=").Append(System.Uri.EscapeDataString(to.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            urlBuilder_.Length--;

            var client_        = _httpClient;
            var disposeClient_ = false;

            try
            {
                using (var request_ = new System.Net.Http.HttpRequestMessage())
                {
                    request_.Method = new System.Net.Http.HttpMethod("GET");
                    request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));

                    PrepareRequest(client_, request_, urlBuilder_);
                    var url_ = urlBuilder_.ToString();
                    request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
                    PrepareRequest(client_, request_, url_);

                    var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);

                    var disposeResponse_ = true;
                    try
                    {
                        var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
                        if (response_.Content != null && response_.Content.Headers != null)
                        {
                            foreach (var item_ in response_.Content.Headers)
                            {
                                headers_[item_.Key] = item_.Value;
                            }
                        }

                        ProcessResponse(client_, response_);

                        var status_ = (int)response_.StatusCode;
                        if (status_ == 200)
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <System.Collections.Generic.ICollection <Position> >(response_, headers_).ConfigureAwait(false);

                            if (objectResponse_.Object == null)
                            {
                                throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
                            }
                            return(new SwaggerResponse <System.Collections.Generic.ICollection <Position> >(status_, headers_, objectResponse_.Object));
                        }
                        else
                        {
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);

                            throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
                        }
                    }
                    finally
                    {
                        if (disposeResponse_)
                        {
                            response_.Dispose();
                        }
                    }
                }
            }
            finally
            {
                if (disposeClient_)
                {
                    client_.Dispose();
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>Fetch a list of ReportStops within the time period for the Devices or Groups</summary>
 /// <param name="from">in IS0 8601 format. eg. `1963-11-22T18:30:00Z`</param>
 /// <param name="to">in IS0 8601 format. eg. `1963-11-22T18:30:00Z`</param>
 /// <returns>OK</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <SwaggerResponse <System.Collections.Generic.ICollection <ReportStops> > > StopsAsync(System.Collections.Generic.IEnumerable <int> deviceId, System.Collections.Generic.IEnumerable <int> groupId, System.DateTimeOffset from, System.DateTimeOffset to)
 {
     return(StopsAsync(deviceId, groupId, from, to, System.Threading.CancellationToken.None));
 }
Ejemplo n.º 4
0
 /// <summary>Fetch a list of Events within the time period for the Devices or Groups</summary>
 /// <param name="type">% can be used to return events of all types</param>
 /// <param name="from">in IS0 8601 format. eg. `1963-11-22T18:30:00Z`</param>
 /// <param name="to">in IS0 8601 format. eg. `1963-11-22T18:30:00Z`</param>
 /// <returns>OK</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <SwaggerResponse <System.Collections.Generic.ICollection <Event> > > EventsAsync(System.Collections.Generic.IEnumerable <int> deviceId, System.Collections.Generic.IEnumerable <int> groupId, System.Collections.Generic.IEnumerable <string> type, System.DateTimeOffset from, System.DateTimeOffset to)
 {
     return(EventsAsync(deviceId, groupId, type, from, to, System.Threading.CancellationToken.None));
 }
Ejemplo n.º 5
0
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>Success</returns>
        /// <exception cref="ApiException">A server side error occurred.</exception>
        public async System.Threading.Tasks.Task <System.Collections.Generic.ICollection <Transaction> > FindTransactionsAsync(System.DateTimeOffset from, System.DateTimeOffset till, System.Threading.CancellationToken cancellationToken)
        {
            if (from == null)
            {
                throw new System.ArgumentNullException("from");
            }

            if (till == null)
            {
                throw new System.ArgumentNullException("till");
            }

            var urlBuilder_ = new System.Text.StringBuilder();

            urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/transactions/{from}/{till}");
            urlBuilder_.Replace("{from}", System.Uri.EscapeDataString(from.ToString("s", System.Globalization.CultureInfo.InvariantCulture)));
            urlBuilder_.Replace("{till}", System.Uri.EscapeDataString(till.ToString("s", System.Globalization.CultureInfo.InvariantCulture)));

            var client_ = _httpClient;

            try
            {
                using (var request_ = new System.Net.Http.HttpRequestMessage())
                {
                    request_.Method = new System.Net.Http.HttpMethod("GET");
                    request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));

                    PrepareRequest(client_, request_, urlBuilder_);
                    var url_ = urlBuilder_.ToString();
                    request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
                    PrepareRequest(client_, request_, url_);

                    var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);

                    try
                    {
                        var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
                        if (response_.Content != null && response_.Content.Headers != null)
                        {
                            foreach (var item_ in response_.Content.Headers)
                            {
                                headers_[item_.Key] = item_.Value;
                            }
                        }

                        ProcessResponse(client_, response_);

                        var status_ = ((int)response_.StatusCode).ToString();
                        if (status_ == "200")
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <System.Collections.Generic.ICollection <Transaction> >(response_, headers_).ConfigureAwait(false);

                            return(objectResponse_.Object);
                        }
                        else
                        if (status_ != "200" && status_ != "204")
                        {
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);

                            throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null);
                        }

                        return(default(System.Collections.Generic.ICollection <Transaction>));
                    }
                    finally
                    {
                        if (response_ != null)
                        {
                            response_.Dispose();
                        }
                    }
                }
            }
            finally
            {
            }
        }
Ejemplo n.º 6
0
 /// <returns>Success</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <System.Collections.Generic.ICollection <Transaction> > FindTransactionsAsync(System.DateTimeOffset from, System.DateTimeOffset till)
 {
     return(FindTransactionsAsync(from, till, System.Threading.CancellationToken.None));
 }
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <summary>Returns the forecast purpose of a trip</summary>
        /// <param name="originLocationCode">city/airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx) from which the traveler will depart, e.g. BOS for Boston</param>
        /// <param name="destinationLocationCode">city/airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx) to which the traveler is going, e.g. PAR for Paris</param>
        /// <param name="departureDate">the date on which the traveler will depart from the origin to go to the destination. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2017-12-25</param>
        /// <param name="returnDate">the date on which the traveler will depart from the destination to return to the origin. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2018-02-28</param>
        /// <param name="searchDate">the date on which the traveler is performing the search. If this parameter is not specified, current date will be used. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2018-02-28</param>
        /// <returns>Success</returns>
        /// <exception cref="ApiException">A server side error occurred.</exception>
        public async System.Threading.Tasks.Task <Prediction> GetTripPurposePredictionAsync(string originLocationCode, string destinationLocationCode, System.DateTimeOffset departureDate, System.DateTimeOffset returnDate, System.DateTimeOffset?searchDate, System.Threading.CancellationToken cancellationToken)
        {
            if (originLocationCode == null)
            {
                throw new System.ArgumentNullException("originLocationCode");
            }

            if (destinationLocationCode == null)
            {
                throw new System.ArgumentNullException("destinationLocationCode");
            }

            if (departureDate == null)
            {
                throw new System.ArgumentNullException("departureDate");
            }

            if (returnDate == null)
            {
                throw new System.ArgumentNullException("returnDate");
            }

            var urlBuilder_ = new System.Text.StringBuilder();

            urlBuilder_.Append("travel/predictions/trip-purpose?");
            urlBuilder_.Append(System.Uri.EscapeDataString("originLocationCode") + "=").Append(System.Uri.EscapeDataString(ConvertToString(originLocationCode, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            urlBuilder_.Append(System.Uri.EscapeDataString("destinationLocationCode") + "=").Append(System.Uri.EscapeDataString(ConvertToString(destinationLocationCode, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            urlBuilder_.Append(System.Uri.EscapeDataString("departureDate") + "=").Append(System.Uri.EscapeDataString(departureDate.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            urlBuilder_.Append(System.Uri.EscapeDataString("returnDate") + "=").Append(System.Uri.EscapeDataString(returnDate.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            if (searchDate != null)
            {
                urlBuilder_.Append(System.Uri.EscapeDataString("searchDate") + "=").Append(System.Uri.EscapeDataString(searchDate.Value.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            urlBuilder_.Length--;

            var client_ = _httpClient;

            try
            {
                using (var request_ = new System.Net.Http.HttpRequestMessage())
                {
                    request_.Method = new System.Net.Http.HttpMethod("GET");
                    request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.amadeus+json"));

                    PrepareRequest(client_, request_, urlBuilder_);
                    var url_ = urlBuilder_.ToString();
                    request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
                    PrepareRequest(client_, request_, url_);

                    var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);

                    try
                    {
                        var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
                        if (response_.Content != null && response_.Content.Headers != null)
                        {
                            foreach (var item_ in response_.Content.Headers)
                            {
                                headers_[item_.Key] = item_.Value;
                            }
                        }

                        ProcessResponse(client_, response_);

                        var status_ = ((int)response_.StatusCode).ToString();
                        if (status_ == "200")
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <Prediction>(response_, headers_).ConfigureAwait(false);

                            return(objectResponse_.Object);
                        }
                        else
                        if (status_ == "400")
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <Error_400>(response_, headers_).ConfigureAwait(false);

                            throw new ApiException <Error_400>("code    | title                                 \n------- | ------------------------------------- \n477     | INVALID FORMAT\n572     | INVALID OPTION\n4926    | INVALID DATA RECEIVED               \n32171   | MANDATORY DATA MISSING \t     \n", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null);
                        }
                        else
                        {
                            var objectResponse_ = await ReadObjectResponseAsync <Error_500>(response_, headers_).ConfigureAwait(false);

                            throw new ApiException <Error_500>("Unexpected Error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null);
                        }
                    }
                    finally
                    {
                        if (response_ != null)
                        {
                            response_.Dispose();
                        }
                    }
                }
            }
            finally
            {
            }
        }
 /// <summary>Returns the forecast purpose of a trip</summary>
 /// <param name="originLocationCode">city/airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx) from which the traveler will depart, e.g. BOS for Boston</param>
 /// <param name="destinationLocationCode">city/airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx) to which the traveler is going, e.g. PAR for Paris</param>
 /// <param name="departureDate">the date on which the traveler will depart from the origin to go to the destination. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2017-12-25</param>
 /// <param name="returnDate">the date on which the traveler will depart from the destination to return to the origin. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2018-02-28</param>
 /// <param name="searchDate">the date on which the traveler is performing the search. If this parameter is not specified, current date will be used. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2018-02-28</param>
 /// <returns>Success</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <Prediction> GetTripPurposePredictionAsync(string originLocationCode, string destinationLocationCode, System.DateTimeOffset departureDate, System.DateTimeOffset returnDate, System.DateTimeOffset?searchDate)
 {
     return(GetTripPurposePredictionAsync(originLocationCode, destinationLocationCode, departureDate, returnDate, searchDate, System.Threading.CancellationToken.None));
 }
 /// <summary>Returns a percentage of on-time flight departures from a given airport.</summary>
 /// <param name="airportCode">airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx), e.g. BOS for Boston</param>
 /// <param name="date">the date on which the traveler will depart from the give airport. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2019-12-25</param>
 /// <returns>Success</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <Prediction> GetAirportOnTimePredictionAsync(string airportCode, System.DateTimeOffset date)
 {
     return(GetAirportOnTimePredictionAsync(airportCode, date, System.Threading.CancellationToken.None));
 }
 /// <summary>Return the delay segment where the flight is likely to lay.</summary>
 /// <param name="originLocationCode">city/airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx) from which the traveler is departing, e.g. PAR for Paris</param>
 /// <param name="destinationLocationCode">city/airport [IATA code](http://www.iata.org/publications/Pages/code-search.aspx) to which the traveler is going, e.g. PAR for Paris</param>
 /// <param name="departureDate">the date on which the traveler will depart from the origin to go to the destination. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2019-12-25</param>
 /// <param name="departureTime">local time relative to originLocationCode on which the traveler will depart from the origin. Time respects ISO 8601 standard. e.g. 13:22:00</param>
 /// <param name="arrivalDate">the date on which the traveler will arrive to the destination from the origin. Dates are specified in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) YYYY-MM-DD format, e.g. 2019-12-25</param>
 /// <param name="arrivalTime">local time relative to destinationLocationCode on which the traveler will arrive to destination. Time respects ISO 8601 standard. e.g. 13:22:00</param>
 /// <param name="aircraftCode">IATA aircraft code (http://www.flugzeuginfo.net/table_accodes_iata_en.php)</param>
 /// <param name="carrierCode">airline / carrier code</param>
 /// <param name="flightNumber">flight number as assigned by the carrier</param>
 /// <param name="duration">flight duration in [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) PnYnMnDTnHnMnS format, e.g. PT2H10M</param>
 /// <returns>Success</returns>
 /// <exception cref="ApiException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <Prediction> GetFlightDelayPredictionAsync(string originLocationCode, string destinationLocationCode, System.DateTimeOffset departureDate, System.DateTimeOffset departureTime, System.DateTimeOffset arrivalDate, System.DateTimeOffset arrivalTime, string aircraftCode, string carrierCode, string flightNumber, string duration)
 {
     return(GetFlightDelayPredictionAsync(originLocationCode, destinationLocationCode, departureDate, departureTime, arrivalDate, arrivalTime, aircraftCode, carrierCode, flightNumber, duration, System.Threading.CancellationToken.None));
 }