From b7f69964894f67822fdfe4e655d2fd9721889db6 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 11 Jul 2023 17:39:24 +0200 Subject: [PATCH] Renamed API yaml file linked (instead of copied it) to client project and recreated the cs class --- misc/BreCalApi.cs | 6230 +++++++++++++++++++++++++++ misc/{index.yaml => BreCalApi.yaml} | 0 src/BreCalClient/Swagger.cs | 2167 ---------- src/BreCalClient/Swagger.yaml | 484 --- 4 files changed, 6230 insertions(+), 2651 deletions(-) create mode 100644 misc/BreCalApi.cs rename misc/{index.yaml => BreCalApi.yaml} (100%) delete mode 100644 src/BreCalClient/Swagger.cs delete mode 100644 src/BreCalClient/Swagger.yaml diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs new file mode 100644 index 0000000..e849a38 --- /dev/null +++ b/misc/BreCalApi.cs @@ -0,0 +1,6230 @@ + +//---------------------- +// +// Generated REST API Client Code Generator v1.7.17.0 on 11.07.2023 17:38:19 +// Using the tool OpenAPI Generator v6.6.0 +// +//---------------------- + + +using BreCalClient.......misc.Client; +using BreCalClient.......misc.Model; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; +using OpenAPIDateConverter = BreCalClient.......misc.Client.OpenAPIDateConverter; +using Polly; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Gets a list of all berths registered + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Berth> + List BerthsGet(int operationIndex = 0); + /// + /// Gets a list of all berths registered + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Berth> + ApiResponse> BerthsGetWithHttpInfo(int operationIndex = 0); + /// + /// Returns a JWT session token and user data if successful + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// LoginResult + LoginResult LoginPost(Credentials credentials, int operationIndex = 0); + /// + /// Returns a JWT session token and user data if successful + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// ApiResponse of LoginResult + ApiResponse LoginPostWithHttpInfo(Credentials credentials, int operationIndex = 0); + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// Notification + Notification NotificationsGet(int participantId, int shipcallId, int operationIndex = 0); + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// ApiResponse of Notification + ApiResponse NotificationsGetWithHttpInfo(int participantId, int shipcallId, int operationIndex = 0); + /// + /// gets a particular participant entry corresponding to user id + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// Participant + Participant ParticipantGet(int userId, int operationIndex = 0); + /// + /// gets a particular participant entry corresponding to user id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// ApiResponse of Participant + ApiResponse ParticipantGetWithHttpInfo(int userId, int operationIndex = 0); + /// + /// Gets a list of ship calls + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// List<Shipcall> + List ShipcallsGet(int participantId, int operationIndex = 0); + /// + /// Gets a list of ship calls + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// ApiResponse of List<Shipcall> + ApiResponse> ShipcallsGetWithHttpInfo(int participantId, int operationIndex = 0); + /// + /// Create a new ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// + void ShipcallsPost(Shipcall shipcall, int operationIndex = 0); + /// + /// Create a new ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse ShipcallsPostWithHttpInfo(Shipcall shipcall, int operationIndex = 0); + /// + /// Updates a ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// + void ShipcallsPut(Shipcall shipcall, int operationIndex = 0); + /// + /// Updates a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse ShipcallsPutWithHttpInfo(Shipcall shipcall, int operationIndex = 0); + /// + /// gets a list of registered shipcalls + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Ship> + List ShipsGet(int operationIndex = 0); + /// + /// gets a list of registered shipcalls + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Ship> + ApiResponse> ShipsGetWithHttpInfo(int operationIndex = 0); + /// + /// Delete a times entry for a ship call. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + void TimesDelete(int id, int operationIndex = 0); + /// + /// Delete a times entry for a ship call. + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TimesDeleteWithHttpInfo(int id, int operationIndex = 0); + /// + /// Get all recorded times for a a ship call + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// List<Times> + List TimesGet(int? shipcallId = default(int?), int operationIndex = 0); + /// + /// Get all recorded times for a a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// ApiResponse of List<Times> + ApiResponse> TimesGetWithHttpInfo(int? shipcallId = default(int?), int operationIndex = 0); + /// + /// Create a new times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// + void TimesPost(Times times, int operationIndex = 0); + /// + /// Create a new times entry for a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TimesPostWithHttpInfo(Times times, int operationIndex = 0); + /// + /// Update a times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// + void TimesPut(Times times, int operationIndex = 0); + /// + /// Update a times entry for a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TimesPutWithHttpInfo(Times times, int operationIndex = 0); + #endregion Synchronous Operations + } + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Gets a list of all berths registered + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Berth> + System.Threading.Tasks.Task> BerthsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Gets a list of all berths registered + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Berth>) + System.Threading.Tasks.Task>> BerthsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Returns a JWT session token and user data if successful + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of LoginResult + System.Threading.Tasks.Task LoginPostAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Returns a JWT session token and user data if successful + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (LoginResult) + System.Threading.Tasks.Task> LoginPostWithHttpInfoAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Notification + System.Threading.Tasks.Task NotificationsGetAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Notification) + System.Threading.Tasks.Task> NotificationsGetWithHttpInfoAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// gets a particular participant entry corresponding to user id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Participant + System.Threading.Tasks.Task ParticipantGetAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// gets a particular participant entry corresponding to user id + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Participant) + System.Threading.Tasks.Task> ParticipantGetWithHttpInfoAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Gets a list of ship calls + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Shipcall> + System.Threading.Tasks.Task> ShipcallsGetAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Gets a list of ship calls + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Shipcall>) + System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a new ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task ShipcallsPostAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a new ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> ShipcallsPostWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Updates a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task ShipcallsPutAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Updates a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> ShipcallsPutWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// gets a list of registered shipcalls + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Ship> + System.Threading.Tasks.Task> ShipsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// gets a list of registered shipcalls + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Ship>) + System.Threading.Tasks.Task>> ShipsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a times entry for a ship call. + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TimesDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a times entry for a ship call. + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TimesDeleteWithHttpInfoAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get all recorded times for a a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Times> + System.Threading.Tasks.Task> TimesGetAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get all recorded times for a a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Times>) + System.Threading.Tasks.Task>> TimesGetWithHttpInfoAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a new times entry for a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TimesPostAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a new times entry for a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TimesPostWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a times entry for a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TimesPutAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a times entry for a ship call + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TimesPutWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync + { + } + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private BreCalClient.......misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi() : this((string)null) + { + } + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(string basePath) + { + this.Configuration = BreCalClient.......misc.Client.Configuration.MergeConfigurations( + BreCalClient.......misc.Client.GlobalConfiguration.Instance, + new BreCalClient.......misc.Client.Configuration { BasePath = basePath } + ); + this.Client = new BreCalClient.......misc.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new BreCalClient.......misc.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = BreCalClient.......misc.Client.Configuration.DefaultExceptionFactory; + } + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(BreCalClient.......misc.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + this.Configuration = BreCalClient.......misc.Client.Configuration.MergeConfigurations( + BreCalClient.......misc.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new BreCalClient.......misc.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new BreCalClient.......misc.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = BreCalClient.......misc.Client.Configuration.DefaultExceptionFactory; + } + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public DefaultApi(BreCalClient.......misc.Client.ISynchronousClient client, BreCalClient.......misc.Client.IAsynchronousClient asyncClient, BreCalClient.......misc.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = BreCalClient.......misc.Client.Configuration.DefaultExceptionFactory; + } + /// + /// The client for accessing this underlying API asynchronously. + /// + public BreCalClient.......misc.Client.IAsynchronousClient AsynchronousClient { get; set; } + /// + /// The client for accessing this underlying API synchronously. + /// + public BreCalClient.......misc.Client.ISynchronousClient Client { get; set; } + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public BreCalClient.......misc.Client.IReadableConfiguration Configuration { get; set; } + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public BreCalClient.......misc.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + /// + /// Gets a list of all berths registered + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Berth> + public List BerthsGet(int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = BerthsGetWithHttpInfo(); + return localVarResponse.Data; + } + /// + /// Gets a list of all berths registered + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Berth> + public BreCalClient.......misc.Client.ApiResponse> BerthsGetWithHttpInfo(int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Operation = "DefaultApi.BerthsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Get>("/berths", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("BerthsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Gets a list of all berths registered + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Berth> + public async System.Threading.Tasks.Task> BerthsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = await BerthsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// Gets a list of all berths registered + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Berth>) + public async System.Threading.Tasks.Task>> BerthsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Operation = "DefaultApi.BerthsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/berths", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("BerthsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Returns a JWT session token and user data if successful + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// LoginResult + public LoginResult LoginPost(Credentials credentials, int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse localVarResponse = LoginPostWithHttpInfo(credentials); + return localVarResponse.Data; + } + /// + /// Returns a JWT session token and user data if successful + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// ApiResponse of LoginResult + public BreCalClient.......misc.Client.ApiResponse LoginPostWithHttpInfo(Credentials credentials, int operationIndex = 0) + { + // verify the required parameter 'credentials' is set + if (credentials == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'credentials' when calling DefaultApi->LoginPost"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = credentials; + localVarRequestOptions.Operation = "DefaultApi.LoginPost"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Post("/login", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Returns a JWT session token and user data if successful + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of LoginResult + public async System.Threading.Tasks.Task LoginPostAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse localVarResponse = await LoginPostWithHttpInfoAsync(credentials, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// Returns a JWT session token and user data if successful + /// + /// Thrown when fails to make API call + /// Login credentials + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (LoginResult) + public async System.Threading.Tasks.Task> LoginPostWithHttpInfoAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'credentials' is set + if (credentials == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'credentials' when calling DefaultApi->LoginPost"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = credentials; + localVarRequestOptions.Operation = "DefaultApi.LoginPost"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// Notification + public Notification NotificationsGet(int participantId, int shipcallId, int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse localVarResponse = NotificationsGetWithHttpInfo(participantId, shipcallId); + return localVarResponse.Data; + } + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// ApiResponse of Notification + public BreCalClient.......misc.Client.ApiResponse NotificationsGetWithHttpInfo(int participantId, int shipcallId, int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId)); + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId)); + localVarRequestOptions.Operation = "DefaultApi.NotificationsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Get("/notifications", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("NotificationsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Notification + public async System.Threading.Tasks.Task NotificationsGetAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse localVarResponse = await NotificationsGetWithHttpInfoAsync(participantId, shipcallId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// Gets a list of notifications pursuant to a specified participant and ship call + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id returned through loading of participant + /// **Id of ship call**. *Example: 52*. Id given in ship call list + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Notification) + public async System.Threading.Tasks.Task> NotificationsGetWithHttpInfoAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId)); + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId)); + localVarRequestOptions.Operation = "DefaultApi.NotificationsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/notifications", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("NotificationsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// gets a particular participant entry corresponding to user id + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// Participant + public Participant ParticipantGet(int userId, int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse localVarResponse = ParticipantGetWithHttpInfo(userId); + return localVarResponse.Data; + } + /// + /// gets a particular participant entry corresponding to user id + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// ApiResponse of Participant + public BreCalClient.......misc.Client.ApiResponse ParticipantGetWithHttpInfo(int userId, int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId)); + localVarRequestOptions.Operation = "DefaultApi.ParticipantGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Get("/participant", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ParticipantGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// gets a particular participant entry corresponding to user id + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Participant + public async System.Threading.Tasks.Task ParticipantGetAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse localVarResponse = await ParticipantGetWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// gets a particular participant entry corresponding to user id + /// + /// Thrown when fails to make API call + /// **Id of user**. *Example: 2*. User id returned by verify call. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Participant) + public async System.Threading.Tasks.Task> ParticipantGetWithHttpInfoAsync(int userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId)); + localVarRequestOptions.Operation = "DefaultApi.ParticipantGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/participant", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ParticipantGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Gets a list of ship calls + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// List<Shipcall> + public List ShipcallsGet(int participantId, int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = ShipcallsGetWithHttpInfo(participantId); + return localVarResponse.Data; + } + /// + /// Gets a list of ship calls + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// ApiResponse of List<Shipcall> + public BreCalClient.......misc.Client.ApiResponse> ShipcallsGetWithHttpInfo(int participantId, int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId)); + localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Get>("/shipcalls", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipcallsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Gets a list of ship calls + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Shipcall> + public async System.Threading.Tasks.Task> ShipcallsGetAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = await ShipcallsGetWithHttpInfoAsync(participantId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// Gets a list of ship calls + /// + /// Thrown when fails to make API call + /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Shipcall>) + public async System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int participantId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId)); + localVarRequestOptions.Operation = "DefaultApi.ShipcallsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/shipcalls", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipcallsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Create a new ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// + public void ShipcallsPost(Shipcall shipcall, int operationIndex = 0) + { + ShipcallsPostWithHttpInfo(shipcall); + } + /// + /// Create a new ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// ApiResponse of Object(void) + public BreCalClient.......misc.Client.ApiResponse ShipcallsPostWithHttpInfo(Shipcall shipcall, int operationIndex = 0) + { + // verify the required parameter 'shipcall' is set + if (shipcall == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPost"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = shipcall; + localVarRequestOptions.Operation = "DefaultApi.ShipcallsPost"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Post("/shipcalls", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipcallsPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Create a new ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task ShipcallsPostAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await ShipcallsPostWithHttpInfoAsync(shipcall, operationIndex, cancellationToken).ConfigureAwait(false); + } + /// + /// Create a new ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> ShipcallsPostWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'shipcall' is set + if (shipcall == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPost"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = shipcall; + localVarRequestOptions.Operation = "DefaultApi.ShipcallsPost"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/shipcalls", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipcallsPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Updates a ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// + public void ShipcallsPut(Shipcall shipcall, int operationIndex = 0) + { + ShipcallsPutWithHttpInfo(shipcall); + } + /// + /// Updates a ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// ApiResponse of Object(void) + public BreCalClient.......misc.Client.ApiResponse ShipcallsPutWithHttpInfo(Shipcall shipcall, int operationIndex = 0) + { + // verify the required parameter 'shipcall' is set + if (shipcall == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPut"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = shipcall; + localVarRequestOptions.Operation = "DefaultApi.ShipcallsPut"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Put("/shipcalls", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipcallsPut", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Updates a ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task ShipcallsPutAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await ShipcallsPutWithHttpInfoAsync(shipcall, operationIndex, cancellationToken).ConfigureAwait(false); + } + /// + /// Updates a ship call + /// + /// Thrown when fails to make API call + /// Creates a new ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> ShipcallsPutWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'shipcall' is set + if (shipcall == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPut"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = shipcall; + localVarRequestOptions.Operation = "DefaultApi.ShipcallsPut"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/shipcalls", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipcallsPut", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// gets a list of registered shipcalls + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Ship> + public List ShipsGet(int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = ShipsGetWithHttpInfo(); + return localVarResponse.Data; + } + /// + /// gets a list of registered shipcalls + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Ship> + public BreCalClient.......misc.Client.ApiResponse> ShipsGetWithHttpInfo(int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Operation = "DefaultApi.ShipsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Get>("/ships", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// gets a list of registered shipcalls + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Ship> + public async System.Threading.Tasks.Task> ShipsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = await ShipsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// gets a list of registered shipcalls + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Ship>) + public async System.Threading.Tasks.Task>> ShipsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Operation = "DefaultApi.ShipsGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/ships", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ShipsGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Delete a times entry for a ship call. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + public void TimesDelete(int id, int operationIndex = 0) + { + TimesDeleteWithHttpInfo(id); + } + /// + /// Delete a times entry for a ship call. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public BreCalClient.......misc.Client.ApiResponse TimesDeleteWithHttpInfo(int id, int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "id", id)); + localVarRequestOptions.Operation = "DefaultApi.TimesDelete"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Delete("/times", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesDelete", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Delete a times entry for a ship call. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TimesDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TimesDeleteWithHttpInfoAsync(id, operationIndex, cancellationToken).ConfigureAwait(false); + } + /// + /// Delete a times entry for a ship call. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TimesDeleteWithHttpInfoAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "id", id)); + localVarRequestOptions.Operation = "DefaultApi.TimesDelete"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesDelete", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Get all recorded times for a a ship call + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// List<Times> + public List TimesGet(int? shipcallId = default(int?), int operationIndex = 0) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = TimesGetWithHttpInfo(shipcallId); + return localVarResponse.Data; + } + /// + /// Get all recorded times for a a ship call + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// ApiResponse of List<Times> + public BreCalClient.......misc.Client.ApiResponse> TimesGetWithHttpInfo(int? shipcallId = default(int?), int operationIndex = 0) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + if (shipcallId != null) + { + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId)); + } + localVarRequestOptions.Operation = "DefaultApi.TimesGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Get>("/times", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Get all recorded times for a a ship call + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Times> + public async System.Threading.Tasks.Task> TimesGetAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.ApiResponse> localVarResponse = await TimesGetWithHttpInfoAsync(shipcallId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + /// + /// Get all recorded times for a a ship call + /// + /// Thrown when fails to make API call + /// **Id**. *Example: 42*. Id of referenced ship call. (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Times>) + public async System.Threading.Tasks.Task>> TimesGetWithHttpInfoAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + if (shipcallId != null) + { + localVarRequestOptions.QueryParameters.Add(BreCalClient.......misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId)); + } + localVarRequestOptions.Operation = "DefaultApi.TimesGet"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Create a new times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// + public void TimesPost(Times times, int operationIndex = 0) + { + TimesPostWithHttpInfo(times); + } + /// + /// Create a new times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// ApiResponse of Object(void) + public BreCalClient.......misc.Client.ApiResponse TimesPostWithHttpInfo(Times times, int operationIndex = 0) + { + // verify the required parameter 'times' is set + if (times == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPost"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = times; + localVarRequestOptions.Operation = "DefaultApi.TimesPost"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Post("/times", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Create a new times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TimesPostAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TimesPostWithHttpInfoAsync(times, operationIndex, cancellationToken).ConfigureAwait(false); + } + /// + /// Create a new times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. **Do not** provide id parameter. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TimesPostWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'times' is set + if (times == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPost"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = times; + localVarRequestOptions.Operation = "DefaultApi.TimesPost"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesPost", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Update a times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// + public void TimesPut(Times times, int operationIndex = 0) + { + TimesPutWithHttpInfo(times); + } + /// + /// Update a times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// ApiResponse of Object(void) + public BreCalClient.......misc.Client.ApiResponse TimesPutWithHttpInfo(Times times, int operationIndex = 0) + { + // verify the required parameter 'times' is set + if (times == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPut"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = times; + localVarRequestOptions.Operation = "DefaultApi.TimesPut"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = this.Client.Put("/times", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesPut", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + /// + /// Update a times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TimesPutAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + await TimesPutWithHttpInfoAsync(times, operationIndex, cancellationToken).ConfigureAwait(false); + } + /// + /// Update a times entry for a ship call + /// + /// Thrown when fails to make API call + /// Times entry that will be added to the ship call. The id parameter is **required**. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TimesPutWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'times' is set + if (times == null) + { + throw new BreCalClient.......misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPut"); + } + BreCalClient.......misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.......misc.Client.RequestOptions(); + string[] _contentTypes = new string[] { + "application/json" + }; + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + var localVarContentType = BreCalClient.......misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + var localVarAccept = BreCalClient.......misc.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + localVarRequestOptions.Data = times; + localVarRequestOptions.Operation = "DefaultApi.TimesPut"; + localVarRequestOptions.OperationIndex = operationIndex; + // authentication (ApiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key")); + } + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/times", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TimesPut", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + return localVarResponse; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is BreCalClient.......misc.Model.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((BreCalClient.......misc.Model.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); + } + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + public string[] AcceptedContentTypes => RestSharp.Serializers.ContentType.JsonAccept; + public SupportsContentType SupportsContentType => contentType => + contentType.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = BreCalClient.......misc.Client.GlobalConfiguration.Instance.BasePath; + } + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + _baseUrl = basePath; + } + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + return other; + } + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + RestRequest request = new RestRequest(path, Method(method)); + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + request.AddJsonBody(options.Data); + } + } + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, System.IO.Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + return request; + } + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + return transformed; + } + private ApiResponse Exec(RestRequest req, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var cookies = new CookieContainer(); + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + CookieContainer = cookies, + MaxTimeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent + }; + RestClient client = new RestClient(clientOptions) + .UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)); + InterceptRequest(req); + RestResponse response; + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(req)); + response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse + { + Request = req, + ErrorException = policyResult.FinalException + }; + } + else + { + response = client.Execute(req); + } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(BreCalClient.......misc.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + InterceptResponse(req, response); + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + result.Cookies.Add(cookie); + } + } + return result; + } + private async Task> ExecAsync(RestRequest req, RequestOptions options, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + MaxTimeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent + }; + RestClient client = new RestClient(clientOptions) + .UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)); + InterceptRequest(req); + RestResponse response; + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(req, ct), cancellationToken).ConfigureAwait(false); + response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse + { + Request = req, + ErrorException = policyResult.FinalException + }; + } + else + { + response = await client.ExecuteAsync(req, cancellationToken).ConfigureAwait(false); + } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(BreCalClient.......misc.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + InterceptResponse(req, response); + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + result.Cookies.Add(cookie); + } + } + return result; + } + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + /// + /// The content of this response + /// + Object Content { get; } + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + /// + /// The raw content of this response + /// + string RawContent { get; } + } + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + /// + /// The raw content + /// + public string RawContent { get; } + #endregion Properties + #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + #endregion Constructors + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if(collectionFormat == "deepObject") { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + return parameters; + } + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + return contentTypes[0]; // use the first content type specified in 'consumes' + } + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + return string.Join(",", accepts); + } + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + #endregion Constants + #region Static Members + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + #endregion Static Members + #region Private Members + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + #endregion Private Members + #region Constructors + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://puls200.dyn-dns.org:8088/brecal/api"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://puls200.dyn-dns.org:8088/brecal/api"}, + {"description", "Test server self-hosted by yours truly"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://puls200.dyn-dns.org:8088/brecal/api") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + BasePath = basePath; + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + #endregion Constructors + #region Properties + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath { + get { return _basePath; } + set { _basePath = value; } + } + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + return apiKeyValue; + } + /// + /// Gets or sets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + public X509CertificateCollection ClientCertificates { get; set; } + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// This helper property simplifies code generation. + /// + /// The access token. + public virtual string AccessToken { get; set; } + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + return null; + } + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + return url; + } + #endregion Properties + #region Methods + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (BreCalClient.......misc) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + return report; + } + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + #endregion Methods + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + Username = second.Username ?? first.Username, + Password = second.Password ?? first.Password, + AccessToken = second.AccessToken ?? first.AccessToken, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + ClientCertificates = second.ClientCertificates ?? first.ClientCertificates, + }; + return config; + } + #endregion Static Members + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + #endregion Private Members + #region Constructors + /// + private GlobalConfiguration() + { + } + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + #endregion Constructors + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Http methods supported by swagger + /// + public enum HttpMethod + { + /// HTTP GET request. + Get, + /// HTTP POST request. + Post, + /// HTTP PUT request. + Put, + /// HTTP DELETE request. + Delete, + /// HTTP HEAD request. + Head, + /// HTTP OPTIONS request. + Options, + /// HTTP PATCH request. + Patch + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Represents configuration aspects required to interact with the API endpoints. + /// + public interface IApiAccessor + { + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + IReadableConfiguration Configuration { get; set; } + /// + /// Gets the base path of the API client. + /// + /// The base path + string GetBasePath(); + /// + /// Provides a factory method hook for the creation of exceptions. + /// + ExceptionFactory ExceptionFactory { get; set; } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the access token. + /// + /// Access token. + string AccessToken { get; } + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + /// + /// Gets the username. + /// + /// Username. + string Username { get; } + /// + /// Gets the password. + /// + /// Password. + string Password { get; } + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + /// + /// Gets certificate collection to be sent with requests. + /// + /// X509 Certificate collection. + X509CertificateCollection ClientCertificates { get; } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + private readonly Dictionary> _dictionary; + #endregion Private Fields + #region Constructors + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + #endregion Constructors + #region Enumerators + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + #endregion Enumerators + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + #endregion Public Members + #region Private Members + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + return true; + } + #endregion Private Members + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + /// + /// Operation associated with the request path. + /// + public string Operation { get; set; } + /// + /// Index associated with the operation. + /// + public int OperationIndex { get; set; } + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Client +{ + /// + /// Configuration class to set the polly retry policies to be applied to the requests. + /// + public static class RetryConfiguration + { + /// + /// Retry policy + /// + public static Policy RetryPolicy { get; set; } + /// + /// Async retry policy + /// + public static AsyncPolicy AsyncRetryPolicy { get; set; } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// Ship berth used for a ship call + /// + [DataContract(Name = "berth")] + public partial class Berth : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name1. + /// name2. + public Berth(int id = default(int), string name1 = default(string), string name2 = default(string)) + { + this.Id = id; + this.Name1 = name1; + this.Name2 = name2; + } + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets Name1 + /// + [DataMember(Name = "name1", EmitDefaultValue = true)] + public string Name1 { get; set; } + /// + /// Gets or Sets Name2 + /// + [DataMember(Name = "name2", EmitDefaultValue = true)] + public string Name2 { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Berth {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name1: ").Append(Name1).Append("\n"); + sb.Append(" Name2: ").Append(Name2).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Berth); + } + /// + /// Returns true if Berth instances are equal + /// + /// Instance of Berth to be compared + /// Boolean + public bool Equals(Berth input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Name1 == input.Name1 || + (this.Name1 != null && + this.Name1.Equals(input.Name1)) + ) && + ( + this.Name2 == input.Name2 || + (this.Name2 != null && + this.Name2.Equals(input.Name2)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Name1 != null) + { + hashCode = (hashCode * 59) + this.Name1.GetHashCode(); + } + if (this.Name2 != null) + { + hashCode = (hashCode * 59) + this.Name2.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// Credentials + /// + [DataContract(Name = "credentials")] + public partial class Credentials : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Credentials() { } + /// + /// Initializes a new instance of the class. + /// + /// username (required). + /// password (required). + public Credentials(Object username = default(Object), Object password = default(Object)) + { + // to ensure "username" is required (not null) + if (username == null) + { + throw new ArgumentNullException("username is a required property for Credentials and cannot be null"); + } + this.Username = username; + // to ensure "password" is required (not null) + if (password == null) + { + throw new ArgumentNullException("password is a required property for Credentials and cannot be null"); + } + this.Password = password; + } + /// + /// Gets or Sets Username + /// + [DataMember(Name = "username", IsRequired = true, EmitDefaultValue = true)] + public Object Username { get; set; } + /// + /// Gets or Sets Password + /// + [DataMember(Name = "password", IsRequired = true, EmitDefaultValue = true)] + public Object Password { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Credentials {\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Credentials); + } + /// + /// Returns true if Credentials instances are equal + /// + /// Instance of Credentials to be compared + /// Boolean + public bool Equals(Credentials input) + { + if (input == null) + { + return false; + } + return + ( + this.Username == input.Username || + (this.Username != null && + this.Username.Equals(input.Username)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Username != null) + { + hashCode = (hashCode * 59) + this.Username.GetHashCode(); + } + if (this.Password != null) + { + hashCode = (hashCode * 59) + this.Password.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// Error + /// + [DataContract(Name = "Error")] + public partial class Error : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Error() { } + /// + /// Initializes a new instance of the class. + /// + /// A human readable error message (required). + public Error(string message = default(string)) + { + // to ensure "message" is required (not null) + if (message == null) + { + throw new ArgumentNullException("message is a required property for Error and cannot be null"); + } + this.Message = message; + } + /// + /// A human readable error message + /// + /// A human readable error message + [DataMember(Name = "message", IsRequired = true, EmitDefaultValue = true)] + public string Message { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Error {\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Error); + } + /// + /// Returns true if Error instances are equal + /// + /// Instance of Error to be compared + /// Boolean + public bool Equals(Error input) + { + if (input == null) + { + return false; + } + return + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// result structure of a successful login attempt + /// + [DataContract(Name = "login_result")] + public partial class LoginResult : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// participantId. + /// firstName. + /// lastName. + /// userName. + /// userPhone. + /// exp. + /// token. + public LoginResult(int id = default(int), int participantId = default(int), string firstName = default(string), string lastName = default(string), string userName = default(string), string userPhone = default(string), float exp = default(float), string token = default(string)) + { + this.Id = id; + this.ParticipantId = participantId; + this.FirstName = firstName; + this.LastName = lastName; + this.UserName = userName; + this.UserPhone = userPhone; + this.Exp = exp; + this.Token = token; + } + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets ParticipantId + /// + [DataMember(Name = "participant_id", EmitDefaultValue = true)] + public int ParticipantId { get; set; } + /// + /// Gets or Sets FirstName + /// + [DataMember(Name = "first_name", EmitDefaultValue = true)] + public string FirstName { get; set; } + /// + /// Gets or Sets LastName + /// + [DataMember(Name = "last_name", EmitDefaultValue = true)] + public string LastName { get; set; } + /// + /// Gets or Sets UserName + /// + [DataMember(Name = "user_name", EmitDefaultValue = true)] + public string UserName { get; set; } + /// + /// Gets or Sets UserPhone + /// + [DataMember(Name = "user_phone", EmitDefaultValue = true)] + public string UserPhone { get; set; } + /// + /// Gets or Sets Exp + /// + [DataMember(Name = "exp", EmitDefaultValue = true)] + public float Exp { get; set; } + /// + /// Gets or Sets Token + /// + [DataMember(Name = "token", EmitDefaultValue = true)] + public string Token { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LoginResult {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" UserName: ").Append(UserName).Append("\n"); + sb.Append(" UserPhone: ").Append(UserPhone).Append("\n"); + sb.Append(" Exp: ").Append(Exp).Append("\n"); + sb.Append(" Token: ").Append(Token).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LoginResult); + } + /// + /// Returns true if LoginResult instances are equal + /// + /// Instance of LoginResult to be compared + /// Boolean + public bool Equals(LoginResult input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.FirstName == input.FirstName || + (this.FirstName != null && + this.FirstName.Equals(input.FirstName)) + ) && + ( + this.LastName == input.LastName || + (this.LastName != null && + this.LastName.Equals(input.LastName)) + ) && + ( + this.UserName == input.UserName || + (this.UserName != null && + this.UserName.Equals(input.UserName)) + ) && + ( + this.UserPhone == input.UserPhone || + (this.UserPhone != null && + this.UserPhone.Equals(input.UserPhone)) + ) && + ( + this.Exp == input.Exp || + this.Exp.Equals(input.Exp) + ) && + ( + this.Token == input.Token || + (this.Token != null && + this.Token.Equals(input.Token)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + if (this.FirstName != null) + { + hashCode = (hashCode * 59) + this.FirstName.GetHashCode(); + } + if (this.LastName != null) + { + hashCode = (hashCode * 59) + this.LastName.GetHashCode(); + } + if (this.UserName != null) + { + hashCode = (hashCode * 59) + this.UserName.GetHashCode(); + } + if (this.UserPhone != null) + { + hashCode = (hashCode * 59) + this.UserPhone.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Exp.GetHashCode(); + if (this.Token != null) + { + hashCode = (hashCode * 59) + this.Token.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// a notification created by the engine if a times entry violates a rule + /// + [DataContract(Name = "notification")] + public partial class Notification : IEquatable, IValidatableObject + { + /// + /// Defines NotificationType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotificationTypeEnum + { + /// + /// Enum Undefined for value: undefined + /// + [EnumMember(Value = "undefined")] + Undefined = 1, + /// + /// Enum Email for value: email + /// + [EnumMember(Value = "email")] + Email = 2, + /// + /// Enum Push for value: push + /// + [EnumMember(Value = "push")] + Push = 3 + } + /// + /// Gets or Sets NotificationType + /// + [DataMember(Name = "notification_type", EmitDefaultValue = true)] + public NotificationTypeEnum? NotificationType { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// timesId. + /// participantId. + /// notificationType. + /// timestamp. + /// acknowledged. + public Notification(int id = default(int), int timesId = default(int), int participantId = default(int), NotificationTypeEnum? notificationType = default(NotificationTypeEnum?), DateTime timestamp = default(DateTime), bool acknowledged = default(bool)) + { + this.Id = id; + this.TimesId = timesId; + this.ParticipantId = participantId; + this.NotificationType = notificationType; + this.Timestamp = timestamp; + this.Acknowledged = acknowledged; + } + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets TimesId + /// + [DataMember(Name = "times_id", EmitDefaultValue = true)] + public int TimesId { get; set; } + /// + /// Gets or Sets ParticipantId + /// + [DataMember(Name = "participant_id", EmitDefaultValue = true)] + public int ParticipantId { get; set; } + /// + /// Gets or Sets Timestamp + /// + [DataMember(Name = "timestamp", EmitDefaultValue = true)] + public DateTime Timestamp { get; set; } + /// + /// Gets or Sets Acknowledged + /// + [DataMember(Name = "acknowledged", EmitDefaultValue = true)] + public bool Acknowledged { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Notification {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" TimesId: ").Append(TimesId).Append("\n"); + sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" NotificationType: ").Append(NotificationType).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" Acknowledged: ").Append(Acknowledged).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Notification); + } + /// + /// Returns true if Notification instances are equal + /// + /// Instance of Notification to be compared + /// Boolean + public bool Equals(Notification input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.TimesId == input.TimesId || + this.TimesId.Equals(input.TimesId) + ) && + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.NotificationType == input.NotificationType || + this.NotificationType.Equals(input.NotificationType) + ) && + ( + this.Timestamp == input.Timestamp || + (this.Timestamp != null && + this.Timestamp.Equals(input.Timestamp)) + ) && + ( + this.Acknowledged == input.Acknowledged || + this.Acknowledged.Equals(input.Acknowledged) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.TimesId.GetHashCode(); + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.NotificationType.GetHashCode(); + if (this.Timestamp != null) + { + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Acknowledged.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// A organisational entity that participates in Bremen Calling + /// + [DataContract(Name = "participant")] + public partial class Participant : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name. + /// street. + /// postalCode. + /// city. + public Participant(int id = default(int), string name = default(string), string street = default(string), string postalCode = default(string), string city = default(string)) + { + this.Id = id; + this.Name = name; + this.Street = street; + this.PostalCode = postalCode; + this.City = city; + } + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = true)] + public string Name { get; set; } + /// + /// Gets or Sets Street + /// + [DataMember(Name = "street", EmitDefaultValue = true)] + public string Street { get; set; } + /// + /// Gets or Sets PostalCode + /// + [DataMember(Name = "postal code", EmitDefaultValue = true)] + public string PostalCode { get; set; } + /// + /// Gets or Sets City + /// + [DataMember(Name = "city", EmitDefaultValue = true)] + public string City { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Participant {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Street: ").Append(Street).Append("\n"); + sb.Append(" PostalCode: ").Append(PostalCode).Append("\n"); + sb.Append(" City: ").Append(City).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Participant); + } + /// + /// Returns true if Participant instances are equal + /// + /// Instance of Participant to be compared + /// Boolean + public bool Equals(Participant input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Street == input.Street || + (this.Street != null && + this.Street.Equals(input.Street)) + ) && + ( + this.PostalCode == input.PostalCode || + (this.PostalCode != null && + this.PostalCode.Equals(input.PostalCode)) + ) && + ( + this.City == input.City || + (this.City != null && + this.City.Equals(input.City)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Street != null) + { + hashCode = (hashCode * 59) + this.Street.GetHashCode(); + } + if (this.PostalCode != null) + { + hashCode = (hashCode * 59) + this.PostalCode.GetHashCode(); + } + if (this.City != null) + { + hashCode = (hashCode * 59) + this.City.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// a ship + /// + [DataContract(Name = "ship")] + public partial class Ship : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id. + /// name. + /// imo. + /// callsign. + /// length. + /// width. + /// created. + /// modified. + public Ship(int id = default(int), string name = default(string), int imo = default(int), string callsign = default(string), float length = default(float), float width = default(float), DateTime created = default(DateTime), DateTime modified = default(DateTime)) + { + this.Id = id; + this.Name = name; + this.Imo = imo; + this.Callsign = callsign; + this.Length = length; + this.Width = width; + this.Created = created; + this.Modified = modified; + } + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = true)] + public string Name { get; set; } + /// + /// Gets or Sets Imo + /// + [DataMember(Name = "imo", EmitDefaultValue = true)] + public int Imo { get; set; } + /// + /// Gets or Sets Callsign + /// + [DataMember(Name = "callsign", EmitDefaultValue = true)] + public string Callsign { get; set; } + /// + /// Gets or Sets Length + /// + [DataMember(Name = "length", EmitDefaultValue = true)] + public float Length { get; set; } + /// + /// Gets or Sets Width + /// + [DataMember(Name = "width", EmitDefaultValue = true)] + public float Width { get; set; } + /// + /// Gets or Sets Created + /// + [DataMember(Name = "created", EmitDefaultValue = true)] + public DateTime Created { get; set; } + /// + /// Gets or Sets Modified + /// + [DataMember(Name = "modified", EmitDefaultValue = true)] + public DateTime Modified { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Ship {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Imo: ").Append(Imo).Append("\n"); + sb.Append(" Callsign: ").Append(Callsign).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" Width: ").Append(Width).Append("\n"); + sb.Append(" Created: ").Append(Created).Append("\n"); + sb.Append(" Modified: ").Append(Modified).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Ship); + } + /// + /// Returns true if Ship instances are equal + /// + /// Instance of Ship to be compared + /// Boolean + public bool Equals(Ship input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Imo == input.Imo || + this.Imo.Equals(input.Imo) + ) && + ( + this.Callsign == input.Callsign || + (this.Callsign != null && + this.Callsign.Equals(input.Callsign)) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.Width == input.Width || + this.Width.Equals(input.Width) + ) && + ( + this.Created == input.Created || + (this.Created != null && + this.Created.Equals(input.Created)) + ) && + ( + this.Modified == input.Modified || + (this.Modified != null && + this.Modified.Equals(input.Modified)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Imo.GetHashCode(); + if (this.Callsign != null) + { + hashCode = (hashCode * 59) + this.Callsign.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + hashCode = (hashCode * 59) + this.Width.GetHashCode(); + if (this.Created != null) + { + hashCode = (hashCode * 59) + this.Created.GetHashCode(); + } + if (this.Modified != null) + { + hashCode = (hashCode * 59) + this.Modified.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// Shipcall + /// + [DataContract(Name = "shipcall")] + public partial class Shipcall : IEquatable, IValidatableObject + { + /// + /// Defines Type + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TypeEnum + { + /// + /// Enum Incoming for value: incoming + /// + [EnumMember(Value = "incoming")] + Incoming = 1, + /// + /// Enum Outgoing for value: outgoing + /// + [EnumMember(Value = "outgoing")] + Outgoing = 2, + /// + /// Enum Shifting for value: shifting + /// + [EnumMember(Value = "shifting")] + Shifting = 3 + } + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public TypeEnum Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Shipcall() { } + /// + /// Initializes a new instance of the class. + /// + /// The unique identifier of a ship call (required). + /// type (required). + /// description. + public Shipcall(int id = default(int), TypeEnum type = default(TypeEnum), string description = default(string)) + { + this.Id = id; + this.Type = type; + this.Description = description; + } + /// + /// The unique identifier of a ship call + /// + /// The unique identifier of a ship call + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets Description + /// + [DataMember(Name = "description", EmitDefaultValue = true)] + public string Description { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Shipcall {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Shipcall); + } + /// + /// Returns true if Shipcall instances are equal + /// + /// Instance of Shipcall to be compared + /// Boolean + public bool Equals(Shipcall input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 1.0.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.......misc.Model +{ + /// + /// the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated + /// + [DataContract(Name = "times")] + public partial class Times : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Times() { } + /// + /// Initializes a new instance of the class. + /// + /// id. + /// startPlanned. + /// endPlanned. + /// durationPlanned. + /// startActual. + /// endActual. + /// shipcallId (required). + /// participantId (required). + public Times(int id = default(int), DateTime startPlanned = default(DateTime), DateTime endPlanned = default(DateTime), int durationPlanned = default(int), DateTime startActual = default(DateTime), DateTime endActual = default(DateTime), int shipcallId = default(int), int participantId = default(int)) + { + this.ShipcallId = shipcallId; + this.ParticipantId = participantId; + this.Id = id; + this.StartPlanned = startPlanned; + this.EndPlanned = endPlanned; + this.DurationPlanned = durationPlanned; + this.StartActual = startActual; + this.EndActual = endActual; + } + /// + /// Gets or Sets Id + /// + [DataMember(Name = "id", EmitDefaultValue = true)] + public int Id { get; set; } + /// + /// Gets or Sets StartPlanned + /// + [DataMember(Name = "start_planned", EmitDefaultValue = true)] + public DateTime StartPlanned { get; set; } + /// + /// Gets or Sets EndPlanned + /// + [DataMember(Name = "end_planned", EmitDefaultValue = true)] + public DateTime EndPlanned { get; set; } + /// + /// Gets or Sets DurationPlanned + /// + [DataMember(Name = "duration_planned", EmitDefaultValue = true)] + public int DurationPlanned { get; set; } + /// + /// Gets or Sets StartActual + /// + [DataMember(Name = "start_actual", EmitDefaultValue = true)] + public DateTime StartActual { get; set; } + /// + /// Gets or Sets EndActual + /// + [DataMember(Name = "end_actual", EmitDefaultValue = true)] + public DateTime EndActual { get; set; } + /// + /// Gets or Sets ShipcallId + /// + [DataMember(Name = "shipcall_id", IsRequired = true, EmitDefaultValue = true)] + public int ShipcallId { get; set; } + /// + /// Gets or Sets ParticipantId + /// + [DataMember(Name = "participant_id", IsRequired = true, EmitDefaultValue = true)] + public int ParticipantId { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Times {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" StartPlanned: ").Append(StartPlanned).Append("\n"); + sb.Append(" EndPlanned: ").Append(EndPlanned).Append("\n"); + sb.Append(" DurationPlanned: ").Append(DurationPlanned).Append("\n"); + sb.Append(" StartActual: ").Append(StartActual).Append("\n"); + sb.Append(" EndActual: ").Append(EndActual).Append("\n"); + sb.Append(" ShipcallId: ").Append(ShipcallId).Append("\n"); + sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Times); + } + /// + /// Returns true if Times instances are equal + /// + /// Instance of Times to be compared + /// Boolean + public bool Equals(Times input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.StartPlanned == input.StartPlanned || + (this.StartPlanned != null && + this.StartPlanned.Equals(input.StartPlanned)) + ) && + ( + this.EndPlanned == input.EndPlanned || + (this.EndPlanned != null && + this.EndPlanned.Equals(input.EndPlanned)) + ) && + ( + this.DurationPlanned == input.DurationPlanned || + this.DurationPlanned.Equals(input.DurationPlanned) + ) && + ( + this.StartActual == input.StartActual || + (this.StartActual != null && + this.StartActual.Equals(input.StartActual)) + ) && + ( + this.EndActual == input.EndActual || + (this.EndActual != null && + this.EndActual.Equals(input.EndActual)) + ) && + ( + this.ShipcallId == input.ShipcallId || + this.ShipcallId.Equals(input.ShipcallId) + ) && + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.StartPlanned != null) + { + hashCode = (hashCode * 59) + this.StartPlanned.GetHashCode(); + } + if (this.EndPlanned != null) + { + hashCode = (hashCode * 59) + this.EndPlanned.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DurationPlanned.GetHashCode(); + if (this.StartActual != null) + { + hashCode = (hashCode * 59) + this.StartActual.GetHashCode(); + } + if (this.EndActual != null) + { + hashCode = (hashCode * 59) + this.EndActual.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ShipcallId.GetHashCode(); + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + diff --git a/misc/index.yaml b/misc/BreCalApi.yaml similarity index 100% rename from misc/index.yaml rename to misc/BreCalApi.yaml diff --git a/src/BreCalClient/Swagger.cs b/src/BreCalClient/Swagger.cs deleted file mode 100644 index 68516e6..0000000 --- a/src/BreCalClient/Swagger.cs +++ /dev/null @@ -1,2167 +0,0 @@ - -//---------------------- -// -// Generated REST API Client Code Generator v1.7.17.0 on 29.06.2023 08:07:07 -// Using the tool NSwag v13.19.0 -// -//---------------------- - - -//---------------------- -// -// Generated using the NSwag toolchain v13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0)) (http://NSwag.org) -// -//---------------------- - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" -#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" -#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" - -namespace BreCalClient -{ - using System = global::System; - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial interface IBremencallingAPIClient - { - /// - /// Returns a session key if successful - /// - /// Successful response - /// A server side error occurred. - System.Threading.Tasks.Task VerifyAsync(); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a session key if successful - /// - /// Successful response - /// A server side error occurred. - System.Threading.Tasks.Task VerifyAsync(System.Threading.CancellationToken cancellationToken); - - /// - /// Gets a list of ship calls - /// - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls - /// ship call list - /// A server side error occurred. - System.Threading.Tasks.Task> ShipcallsAllAsync(int participant_id); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Gets a list of ship calls - /// - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls - /// ship call list - /// A server side error occurred. - System.Threading.Tasks.Task> ShipcallsAllAsync(int participant_id, System.Threading.CancellationToken cancellationToken); - - /// - /// Create a new ship call - /// - /// Creates a new ship call. **Do not** provide id parameter. - /// A server side error occurred. - System.Threading.Tasks.Task ShipcallsPOSTAsync(Shipcall body); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Create a new ship call - /// - /// Creates a new ship call. **Do not** provide id parameter. - /// A server side error occurred. - System.Threading.Tasks.Task ShipcallsPOSTAsync(Shipcall body, System.Threading.CancellationToken cancellationToken); - - /// - /// Updates a ship call - /// - /// Creates a new ship call. The id parameter is **required**. - /// A server side error occurred. - System.Threading.Tasks.Task ShipcallsPUTAsync(Shipcall body); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Updates a ship call - /// - /// Creates a new ship call. The id parameter is **required**. - /// A server side error occurred. - System.Threading.Tasks.Task ShipcallsPUTAsync(Shipcall body, System.Threading.CancellationToken cancellationToken); - - /// - /// gets a list of registered shipcalls - /// - /// list of ships - /// A server side error occurred. - System.Threading.Tasks.Task> ShipsAsync(); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// gets a list of registered shipcalls - /// - /// list of ships - /// A server side error occurred. - System.Threading.Tasks.Task> ShipsAsync(System.Threading.CancellationToken cancellationToken); - - /// - /// gets a particular participant entry corresponding to user id - /// - /// **Id of user**. *Example: 2*. User id returned by verify call. - /// ship call list - /// A server side error occurred. - System.Threading.Tasks.Task ParticipantAsync(int user_id); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// gets a particular participant entry corresponding to user id - /// - /// **Id of user**. *Example: 2*. User id returned by verify call. - /// ship call list - /// A server side error occurred. - System.Threading.Tasks.Task ParticipantAsync(int user_id, System.Threading.CancellationToken cancellationToken); - - /// - /// Get all recorded times for a a ship call - /// - /// **Id**. *Example: 42*. Id of referenced ship call. - /// list of recorded times - /// A server side error occurred. - System.Threading.Tasks.Task> TimesAllAsync(int? shipcall_id); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Get all recorded times for a a ship call - /// - /// **Id**. *Example: 42*. Id of referenced ship call. - /// list of recorded times - /// A server side error occurred. - System.Threading.Tasks.Task> TimesAllAsync(int? shipcall_id, System.Threading.CancellationToken cancellationToken); - - /// - /// Create a new times entry for a ship call - /// - /// Times entry that will be added to the ship call. **Do not** provide id parameter. - /// A server side error occurred. - System.Threading.Tasks.Task TimesPOSTAsync(Times body); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Create a new times entry for a ship call - /// - /// Times entry that will be added to the ship call. **Do not** provide id parameter. - /// A server side error occurred. - System.Threading.Tasks.Task TimesPOSTAsync(Times body, System.Threading.CancellationToken cancellationToken); - - /// - /// Update a times entry for a ship call - /// - /// Times entry that will be added to the ship call. The id parameter is **required**. - /// A server side error occurred. - System.Threading.Tasks.Task TimesPUTAsync(Times body); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Update a times entry for a ship call - /// - /// Times entry that will be added to the ship call. The id parameter is **required**. - /// A server side error occurred. - System.Threading.Tasks.Task TimesPUTAsync(Times body, System.Threading.CancellationToken cancellationToken); - - /// - /// Delete a times entry for a ship call. - /// - /// A server side error occurred. - System.Threading.Tasks.Task TimesDELETEAsync(int id); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Delete a times entry for a ship call. - /// - /// A server side error occurred. - System.Threading.Tasks.Task TimesDELETEAsync(int id, System.Threading.CancellationToken cancellationToken); - - /// - /// Gets a list of notifications pursuant to a specified participant and ship call - /// - /// **Id of participant**. *Example: 2*. Id returned through loading of participant - /// **Id of ship call**. *Example: 52*. Id given in ship call list - /// notification list - /// A server side error occurred. - System.Threading.Tasks.Task NotificationsAsync(int participant_id, int shipcall_id); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Gets a list of notifications pursuant to a specified participant and ship call - /// - /// **Id of participant**. *Example: 2*. Id returned through loading of participant - /// **Id of ship call**. *Example: 52*. Id given in ship call list - /// notification list - /// A server side error occurred. - System.Threading.Tasks.Task NotificationsAsync(int participant_id, int shipcall_id, System.Threading.CancellationToken cancellationToken); - - /// - /// Gets a list of all berths registered - /// - /// list of berths - /// A server side error occurred. - System.Threading.Tasks.Task> BerthsAsync(); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Gets a list of all berths registered - /// - /// list of berths - /// A server side error occurred. - System.Threading.Tasks.Task> BerthsAsync(System.Threading.CancellationToken cancellationToken); - - } - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class BremencallingAPIClient : IBremencallingAPIClient - { - private System.Net.Http.HttpClient _httpClient; - private System.Lazy _settings; - - public BremencallingAPIClient(System.Net.Http.HttpClient httpClient) - { - _httpClient = httpClient; - _settings = new System.Lazy(CreateSerializerSettings); - } - - private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() - { - var settings = new Newtonsoft.Json.JsonSerializerSettings(); - UpdateJsonSerializerSettings(settings); - return settings; - } - - protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } - - partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); - - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); - partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); - partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - - /// - /// Returns a session key if successful - /// - /// Successful response - /// A server side error occurred. - public virtual System.Threading.Tasks.Task VerifyAsync() - { - return VerifyAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Returns a session key if successful - /// - /// Successful response - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task VerifyAsync(System.Threading.CancellationToken cancellationToken) - { - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("verify"); - - 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(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 403) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - /// - /// Gets a list of ship calls - /// - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls - /// ship call list - /// A server side error occurred. - public virtual System.Threading.Tasks.Task> ShipcallsAllAsync(int participant_id) - { - return ShipcallsAllAsync(participant_id, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Gets a list of ship calls - /// - /// **Id of participant**. *Example: 2*. Id of participant entity requesting ship calls - /// ship call list - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> ShipcallsAllAsync(int participant_id, System.Threading.CancellationToken cancellationToken) - { - if (participant_id == null) - throw new System.ArgumentNullException("participant_id"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("shipcalls?"); - urlBuilder_.Append(System.Uri.EscapeDataString("participant_id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(participant_id, 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>(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - /// - /// Create a new ship call - /// - /// Creates a new ship call. **Do not** provide id parameter. - /// A server side error occurred. - public virtual System.Threading.Tasks.Task ShipcallsPOSTAsync(Shipcall body) - { - return ShipcallsPOSTAsync(body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Create a new ship call - /// - /// Creates a new ship call. **Do not** provide id parameter. - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ShipcallsPOSTAsync(Shipcall body, System.Threading.CancellationToken cancellationToken) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("shipcalls"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); - var content_ = new System.Net.Http.StringContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - - 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_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - - if (status_ == 200 || status_ == 204) - { - - return; - } - 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(); - } - } - - /// - /// Updates a ship call - /// - /// Creates a new ship call. The id parameter is **required**. - /// A server side error occurred. - public virtual System.Threading.Tasks.Task ShipcallsPUTAsync(Shipcall body) - { - return ShipcallsPUTAsync(body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Updates a ship call - /// - /// Creates a new ship call. The id parameter is **required**. - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ShipcallsPUTAsync(Shipcall body, System.Threading.CancellationToken cancellationToken) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("shipcalls"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); - var content_ = new System.Net.Http.StringContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - - 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_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - - if (status_ == 200 || status_ == 204) - { - - return; - } - 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(); - } - } - - /// - /// gets a list of registered shipcalls - /// - /// list of ships - /// A server side error occurred. - public virtual System.Threading.Tasks.Task> ShipsAsync() - { - return ShipsAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// gets a list of registered shipcalls - /// - /// list of ships - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> ShipsAsync(System.Threading.CancellationToken cancellationToken) - { - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("ships"); - - 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>(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - /// - /// gets a particular participant entry corresponding to user id - /// - /// **Id of user**. *Example: 2*. User id returned by verify call. - /// ship call list - /// A server side error occurred. - public virtual System.Threading.Tasks.Task ParticipantAsync(int user_id) - { - return ParticipantAsync(user_id, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// gets a particular participant entry corresponding to user id - /// - /// **Id of user**. *Example: 2*. User id returned by verify call. - /// ship call list - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task ParticipantAsync(int user_id, System.Threading.CancellationToken cancellationToken) - { - if (user_id == null) - throw new System.ArgumentNullException("user_id"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("participant?"); - urlBuilder_.Append(System.Uri.EscapeDataString("user_id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(user_id, 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(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - /// - /// Get all recorded times for a a ship call - /// - /// **Id**. *Example: 42*. Id of referenced ship call. - /// list of recorded times - /// A server side error occurred. - public virtual System.Threading.Tasks.Task> TimesAllAsync(int? shipcall_id) - { - return TimesAllAsync(shipcall_id, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Get all recorded times for a a ship call - /// - /// **Id**. *Example: 42*. Id of referenced ship call. - /// list of recorded times - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> TimesAllAsync(int? shipcall_id, System.Threading.CancellationToken cancellationToken) - { - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("times?"); - if (shipcall_id != null) - { - urlBuilder_.Append(System.Uri.EscapeDataString("shipcall_id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(shipcall_id, 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>(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - /// - /// Create a new times entry for a ship call - /// - /// Times entry that will be added to the ship call. **Do not** provide id parameter. - /// A server side error occurred. - public virtual System.Threading.Tasks.Task TimesPOSTAsync(Times body) - { - return TimesPOSTAsync(body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Create a new times entry for a ship call - /// - /// Times entry that will be added to the ship call. **Do not** provide id parameter. - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TimesPOSTAsync(Times body, System.Threading.CancellationToken cancellationToken) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("times"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); - var content_ = new System.Net.Http.StringContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("POST"); - - 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_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - - if (status_ == 200 || status_ == 204) - { - - return; - } - 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(); - } - } - - /// - /// Update a times entry for a ship call - /// - /// Times entry that will be added to the ship call. The id parameter is **required**. - /// A server side error occurred. - public virtual System.Threading.Tasks.Task TimesPUTAsync(Times body) - { - return TimesPUTAsync(body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Update a times entry for a ship call - /// - /// Times entry that will be added to the ship call. The id parameter is **required**. - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TimesPUTAsync(Times body, System.Threading.CancellationToken cancellationToken) - { - if (body == null) - throw new System.ArgumentNullException("body"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("times"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value); - var content_ = new System.Net.Http.StringContent(json_); - content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); - request_.Content = content_; - request_.Method = new System.Net.Http.HttpMethod("PUT"); - - 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_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - - if (status_ == 200 || status_ == 204) - { - - return; - } - 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(); - } - } - - /// - /// Delete a times entry for a ship call. - /// - /// A server side error occurred. - public virtual System.Threading.Tasks.Task TimesDELETEAsync(int id) - { - return TimesDELETEAsync(id, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Delete a times entry for a ship call. - /// - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TimesDELETEAsync(int id, System.Threading.CancellationToken cancellationToken) - { - if (id == null) - throw new System.ArgumentNullException("id"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("times?"); - urlBuilder_.Append(System.Uri.EscapeDataString("id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(id, 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("DELETE"); - - 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_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - - if (status_ == 200 || status_ == 204) - { - - return; - } - 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(); - } - } - - /// - /// Gets a list of notifications pursuant to a specified participant and ship call - /// - /// **Id of participant**. *Example: 2*. Id returned through loading of participant - /// **Id of ship call**. *Example: 52*. Id given in ship call list - /// notification list - /// A server side error occurred. - public virtual System.Threading.Tasks.Task NotificationsAsync(int participant_id, int shipcall_id) - { - return NotificationsAsync(participant_id, shipcall_id, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Gets a list of notifications pursuant to a specified participant and ship call - /// - /// **Id of participant**. *Example: 2*. Id returned through loading of participant - /// **Id of ship call**. *Example: 52*. Id given in ship call list - /// notification list - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task NotificationsAsync(int participant_id, int shipcall_id, System.Threading.CancellationToken cancellationToken) - { - if (participant_id == null) - throw new System.ArgumentNullException("participant_id"); - - if (shipcall_id == null) - throw new System.ArgumentNullException("shipcall_id"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("notifications?"); - urlBuilder_.Append(System.Uri.EscapeDataString("participant_id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(participant_id, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); - urlBuilder_.Append(System.Uri.EscapeDataString("shipcall_id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(shipcall_id, 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(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - /// - /// Gets a list of all berths registered - /// - /// list of berths - /// A server side error occurred. - public virtual System.Threading.Tasks.Task> BerthsAsync() - { - return BerthsAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Gets a list of all berths registered - /// - /// list of berths - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task> BerthsAsync(System.Threading.CancellationToken cancellationToken) - { - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append("berths"); - - 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>(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - if (status_ == 400) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Invalid input", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 401) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not authorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 503) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new ApiException("Not available", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - 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(); - } - } - - protected struct ObjectResponseResult - { - public ObjectResponseResult(T responseObject, string responseText) - { - this.Object = responseObject; - this.Text = responseText; - } - - public T Object { get; } - - public string Text { get; } - } - - public bool ReadResponseAsString { get; set; } - - protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); - return new ObjectResponseResult(typedBody, responseText); - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); - } - } - else - { - try - { - using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) - using (var streamReader = new System.IO.StreamReader(responseStream)) - using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) - { - var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); - var typedBody = serializer.Deserialize(jsonTextReader); - return new ObjectResponseResult(typedBody, string.Empty); - } - } - catch (Newtonsoft.Json.JsonException exception) - { - var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; - throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); - } - } - } - - private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) - { - if (value == null) - { - return ""; - } - - if (value is System.Enum) - { - var name = System.Enum.GetName(value.GetType(), value); - if (name != null) - { - var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); - if (field != null) - { - var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) - as System.Runtime.Serialization.EnumMemberAttribute; - if (attribute != null) - { - return attribute.Value != null ? attribute.Value : name; - } - } - - var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); - return converted == null ? string.Empty : converted; - } - } - else if (value is bool) - { - return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); - } - else if (value is byte[]) - { - return System.Convert.ToBase64String((byte[]) value); - } - else if (value.GetType().IsArray) - { - var array = System.Linq.Enumerable.OfType((System.Array) value); - return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); - } - - var result = System.Convert.ToString(value, cultureInfo); - return result == null ? "" : result; - } - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Shipcall - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] - public int Id { get; set; } - - [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public ShipcallType Type { get; set; } - - [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Description { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Shipcalls : System.Collections.ObjectModel.Collection - { - - } - - /// - /// the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Times - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } - - [Newtonsoft.Json.JsonProperty("start_planned", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset Start_planned { get; set; } - - [Newtonsoft.Json.JsonProperty("end_planned", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset End_planned { get; set; } - - [Newtonsoft.Json.JsonProperty("duration_planned", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Duration_planned { get; set; } - - [Newtonsoft.Json.JsonProperty("start_actual", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset Start_actual { get; set; } - - [Newtonsoft.Json.JsonProperty("end_actual", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset End_actual { get; set; } - - [Newtonsoft.Json.JsonProperty("shipcall_id", Required = Newtonsoft.Json.Required.Always)] - public int Shipcall_id { get; set; } - - [Newtonsoft.Json.JsonProperty("participant_id", Required = Newtonsoft.Json.Required.Always)] - public int Participant_id { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Times_list : System.Collections.ObjectModel.Collection - { - - } - - /// - /// Ship berth used for a ship call - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Berth - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } - - [Newtonsoft.Json.JsonProperty("name1", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name1 { get; set; } - - [Newtonsoft.Json.JsonProperty("name2", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name2 { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Berth_list : System.Collections.ObjectModel.Collection - { - - } - - /// - /// a ship - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Ship - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } - - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name { get; set; } - - [Newtonsoft.Json.JsonProperty("imo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Imo { get; set; } - - [Newtonsoft.Json.JsonProperty("callsign", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Callsign { get; set; } - - [Newtonsoft.Json.JsonProperty("length", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public float Length { get; set; } - - [Newtonsoft.Json.JsonProperty("width", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public float Width { get; set; } - - [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset Created { get; set; } - - [Newtonsoft.Json.JsonProperty("modified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset Modified { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Ship_list : System.Collections.ObjectModel.Collection - { - - } - - /// - /// a notification created by the engine if a times entry violates a rule - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Notification - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } - - [Newtonsoft.Json.JsonProperty("times_id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Times_id { get; set; } - - [Newtonsoft.Json.JsonProperty("participant_id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Participant_id { get; set; } - - [Newtonsoft.Json.JsonProperty("notification_type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public Notification_type Notification_type { get; set; } - - [Newtonsoft.Json.JsonProperty("timestamp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.DateTimeOffset Timestamp { get; set; } - - [Newtonsoft.Json.JsonProperty("acknowledged", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool Acknowledged { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Notification_list : System.Collections.ObjectModel.Collection - { - - } - - /// - /// A organisational entity that participates in Bremen Calling - /// - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Participant - { - [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int Id { get; set; } - - [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Name { get; set; } - - [Newtonsoft.Json.JsonProperty("street", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Street { get; set; } - - [Newtonsoft.Json.JsonProperty("postal code", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string Postal_code { get; set; } - - [Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public string City { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class Error - { - /// - /// A human readable error message - /// - [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] - public string Message { get; set; } - - private System.Collections.Generic.IDictionary _additionalProperties; - - [Newtonsoft.Json.JsonExtensionData] - public System.Collections.Generic.IDictionary AdditionalProperties - { - get { return _additionalProperties ?? (_additionalProperties = new System.Collections.Generic.Dictionary()); } - set { _additionalProperties = value; } - } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public enum ShipcallType - { - - [System.Runtime.Serialization.EnumMember(Value = @"incoming")] - Incoming = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"outgoing")] - Outgoing = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"shifting")] - Shifting = 2, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public enum Notification_type - { - - [System.Runtime.Serialization.EnumMember(Value = @"undefined")] - Undefined = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"email")] - Email = 1, - - [System.Runtime.Serialization.EnumMember(Value = @"push")] - Push = 2, - - } - - - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class ApiException : System.Exception - { - public int StatusCode { get; private set; } - - public string Response { get; private set; } - - public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } - - public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) - : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) - { - StatusCode = statusCode; - Response = response; - Headers = headers; - } - - public override string ToString() - { - return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); - } - } - - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.1.0))")] - public partial class ApiException : ApiException - { - public TResult Result { get; private set; } - - public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) - : base(message, statusCode, response, headers, innerException) - { - Result = result; - } - } - -} - -#pragma warning restore 108 -#pragma warning restore 114 -#pragma warning restore 472 -#pragma warning restore 612 -#pragma warning restore 1573 -#pragma warning restore 1591 -#pragma warning restore 8073 -#pragma warning restore 3016 -#pragma warning restore 8603 \ No newline at end of file diff --git a/src/BreCalClient/Swagger.yaml b/src/BreCalClient/Swagger.yaml deleted file mode 100644 index bb736a6..0000000 --- a/src/BreCalClient/Swagger.yaml +++ /dev/null @@ -1,484 +0,0 @@ -openapi: '3.0.0' -info: - version: '1.0.0' - title: 'Bremen calling API' - description: Administer DEBRE ship calls, times and notifications - termsOfService: "https://www.bsmd.de/" # url to terms page - contact: - name: "Bremen calling API" - url: "https://www.textbausteine.net" - email: "info@textbausteine.net" - license: - name: "Use at your own risk" - url: "https://www.bsmd.de/license" - -servers: - # tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step3_servers_object.html - - url : "https://puls200.dyn-dns.org:8088/brecal/api" - description: "Test server self-hosted by yours truly" - -paths: - # tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html - /verify: - get: - summary: Returns a session key if successful - responses: - 200: - description: Successful response - content: - application/json: - schema: - title: Session key - type: string - 400: - $ref: '#/components/responses/400' - 403: - $ref: '#/components/responses/403' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - /shipcalls: - get: - summary: Gets a list of ship calls - parameters: - - name: participant_id - in: query - required: true - description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls" - schema: - type: integer - responses: - 200: - description: ship call list - content: - application/json: - schema: - $ref: '#/components/schemas/shipcalls' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - post: - summary: Create a new ship call - requestBody: - description: Creates a new ship call. **Do not** provide id parameter. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/shipcall' - responses: - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - put: - summary: Updates a ship call - requestBody: - description: Creates a new ship call. The id parameter is **required**. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/shipcall' - responses: - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - /ships: - get: - summary: gets a list of registered shipcalls - responses: - 200: - description: list of ships - content: - application/json: - schema: - $ref: '#/components/schemas/ship_list' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - /participant: - get: - summary: gets a particular participant entry corresponding to user id - parameters: - - name: user_id - in: query - required: true - description: "**Id of user**. *Example: 2*. User id returned by verify call." - schema: - type: integer - responses: - 200: - description: ship call list - content: - application/json: - schema: - $ref: '#/components/schemas/participant' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - /times: - get: - summary: Get all recorded times for a a ship call - parameters: - - name: shipcall_id - in: query - description: "**Id**. *Example: 42*. Id of referenced ship call." - schema: - type: integer - responses: - 200: - description: list of recorded times - content: - application/json: - schema: - $ref: '#/components/schemas/times_list' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - post: - summary: Create a new times entry for a ship call - requestBody: - description: Times entry that will be added to the ship call. **Do not** provide id parameter. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/times' - responses: - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - put: - summary: Update a times entry for a ship call - requestBody: - description: Times entry that will be added to the ship call. The id parameter is **required**. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/times' - responses: - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - delete: - summary: Delete a times entry for a ship call. - parameters: - - name: id - in: query - required: true - schema: - $ref: '#/components/schemas/timesId' - responses: - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - - /notifications: - get: - summary: Gets a list of notifications pursuant to a specified participant and ship call - parameters: - - name: participant_id - in: query - required: true - description: "**Id of participant**. *Example: 2*. Id returned through loading of participant" - schema: - type: integer - - name: shipcall_id - in: query - required: true - description: "**Id of ship call**. *Example: 52*. Id given in ship call list" - schema: - $ref: '#/components/schemas/shipcallId' - responses: - 200: - description: notification list - content: - application/json: - schema: - $ref: '#/components/schemas/notification' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' - /berths: - get: - summary: Gets a list of all berths registered - responses: - 200: - description: list of berths - content: - application/json: - schema: - $ref: '#/components/schemas/berth_list' - 400: - $ref: '#/components/responses/400' - 401: - $ref: '#/components/responses/401' - 500: - $ref: '#/components/responses/500' - 503: - $ref: '#/components/responses/503' -components: - schemas: - timesId: - description: The unique identifier for a times entry - type: integer - shipcallId: - description: The unique identifier of a ship call - type: integer - shipcall: - type: object - required: - - id - - ship_id - - type - - eta - - voyage - - etd - properties: - id: - $ref: '#/components/schemas/shipcallId' - - type: - type: string - enum: - - incoming - - outgoing - - shifting - - description: - type: string - - shipcalls: - type: array - items: - $ref: '#/components/schemas/shipcall' - - times: - type: object - description: the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated - required: - - shipcall_id - - participant_id - properties: - id: - type: integer - start_planned: - type: string - format: date-time - end_planned: - type: string - format: date-time - duration_planned: - type: integer - start_actual: - type: string - format: date-time - end_actual: - type: string - format: date-time - shipcall_id: - type: integer - participant_id: - type: integer - - times_list: - type: array - items: - $ref: '#/components/schemas/times' - - berth: - type: object - description: Ship berth used for a ship call - properties: - id: - type: integer - name1: - type: string - name2: - type: string - - berth_list: - type: array - items: - $ref: '#/components/schemas/berth' - - ship: - type: object - description: a ship - properties: - id: - type: integer - name: - type: string - imo: - type: integer - callsign: - type: string - length: - type: number - format: float - width: - type: number - format: float - created: - type: string - format: date-time - modified: - type: string - format: date-time - - ship_list: - type: array - items: - $ref: '#/components/schemas/ship' - - notification: - type: object - description: a notification created by the engine if a times entry violates a rule - properties: - id: - type: integer - times_id: - type: integer - participant_id: - type: integer - notification_type: - type: string - enum: [undefined, email, push] - timestamp: - type: string - format: date-time - acknowledged: - type: boolean - - notification_list: - type: array - items: - $ref: '#/components/schemas/notification' - - participant: - type: object - description: A organisational entity that participates in Bremen Calling - properties: - id: - type: integer - name: - type: string - street: - type: string - postal code: - type: string - city: - type: string - - Error: - type: object - required: - - message - properties: - message: - description: A human readable error message - type: string - - securitySchemes: - ApiKey: - type: apiKey - in: header - name: X-Api-Key - responses: - 400: - description: Invalid input - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 401: - description: Not authorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 403: - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 500: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - 503: - description: Not available - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - -security: - - ApiKey: [] -externalDocs: - url: http://textbausteine.net/ - description: Extra documentation and conditions for Bremen Calling