//----------------------
//
// Generated REST API Client Code Generator v1.9.8.0 on 06.05.2024 13:42:21
// Using the tool OpenAPI Generator v7.4.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.Security;
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;
using System.Web;
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 1.3.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Api
{
#pragma warning disable CS8073
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IShipApiSync : IApiAccessor
{
#region Synchronous Operations
///
/// Delete a ship (logically).
///
///
/// A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Id
Id ShipDelete(int id, int operationIndex = 0);
///
/// Delete a ship (logically).
///
///
/// A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipDeleteWithHttpInfo(int id, int operationIndex = 0);
///
/// Update a ship entry
///
///
/// Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// Id
Id ShipUpdate(Ship ship, int operationIndex = 0);
///
/// Update a ship entry
///
///
/// Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipUpdateWithHttpInfo(Ship ship, int operationIndex = 0);
///
/// create a new ship entry
///
///
/// adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
Id ShipsCreate(Ship ship, int operationIndex = 0);
///
/// create a new ship entry
///
///
/// adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipsCreateWithHttpInfo(Ship ship, int operationIndex = 0);
///
/// gets a list of ships
///
///
/// Gets a list of ships including logically deleted ships to be used with shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Ship>
List ShipsGet(int operationIndex = 0);
///
/// gets a list of ships
///
///
/// Gets a list of ships including logically deleted ships to be used with shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Ship>
ApiResponse> ShipsGetWithHttpInfo(int operationIndex = 0);
#endregion Synchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IShipApiAsync : IApiAccessor
{
#region Asynchronous Operations
///
/// Delete a ship (logically).
///
///
/// A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task ShipDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Delete a ship (logically).
///
///
/// A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> ShipDeleteWithHttpInfoAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update a ship entry
///
///
/// Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task ShipUpdateAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update a ship entry
///
///
/// Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> ShipUpdateWithHttpInfoAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// create a new ship entry
///
///
/// adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task ShipsCreateAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// create a new ship entry
///
///
/// adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> ShipsCreateWithHttpInfoAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// gets a list of ships
///
///
/// Gets a list of ships including logically deleted ships to be used with 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 ships
///
///
/// Gets a list of ships including logically deleted ships to be used with 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));
#endregion Asynchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IShipApi : IShipApiSync, IShipApiAsync
{
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public partial class ShipApi : IShipApi
{
private BreCalClient.misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
///
/// Initializes a new instance of the class.
///
///
public ShipApi() : this((string)null)
{
}
///
/// Initializes a new instance of the class.
///
///
public ShipApi(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 ShipApi(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 ShipApi(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; }
}
///
/// Delete a ship (logically). A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Id
public Id ShipDelete(int id, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipDeleteWithHttpInfo(id);
return localVarResponse.Data;
}
///
/// Delete a ship (logically). A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipDeleteWithHttpInfo(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 = "ShipApi.ShipDelete";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Delete("/ships", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipDelete", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Delete a ship (logically). A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task ShipDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipDeleteWithHttpInfoAsync(id, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Delete a ship (logically). A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> ShipDeleteWithHttpInfoAsync(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 = "ShipApi.ShipDelete";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.DeleteAsync("/ships", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipDelete", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update a ship entry Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// Id
public Id ShipUpdate(Ship ship, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipUpdateWithHttpInfo(ship);
return localVarResponse.Data;
}
///
/// Update a ship entry Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipUpdateWithHttpInfo(Ship ship, int operationIndex = 0)
{
// verify the required parameter 'ship' is set
if (ship == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'ship' when calling ShipApi->ShipUpdate");
}
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 = ship;
localVarRequestOptions.Operation = "ShipApi.ShipUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Put("/ships", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipUpdate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update a ship entry Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task ShipUpdateAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipUpdateWithHttpInfoAsync(ship, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Update a ship entry Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
///
/// Thrown when fails to make API call
/// Updated ship entry. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> ShipUpdateWithHttpInfoAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'ship' is set
if (ship == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'ship' when calling ShipApi->ShipUpdate");
}
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 = ship;
localVarRequestOptions.Operation = "ShipApi.ShipUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.PutAsync("/ships", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipUpdate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// create a new ship entry adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
public Id ShipsCreate(Ship ship, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipsCreateWithHttpInfo(ship);
return localVarResponse.Data;
}
///
/// create a new ship entry adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipsCreateWithHttpInfo(Ship ship, int operationIndex = 0)
{
// verify the required parameter 'ship' is set
if (ship == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'ship' when calling ShipApi->ShipsCreate");
}
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 = ship;
localVarRequestOptions.Operation = "ShipApi.ShipsCreate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Post("/ships", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipsCreate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// create a new ship entry adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task ShipsCreateAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipsCreateWithHttpInfoAsync(ship, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// create a new ship entry adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
///
/// Thrown when fails to make API call
/// Ship details. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> ShipsCreateWithHttpInfoAsync(Ship ship, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'ship' is set
if (ship == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'ship' when calling ShipApi->ShipsCreate");
}
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 = ship;
localVarRequestOptions.Operation = "ShipApi.ShipsCreate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.PostAsync("/ships", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipsCreate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// gets a list of ships Gets a list of ships including logically deleted ships to be used with 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 ships Gets a list of ships including logically deleted ships to be used with 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 = "ShipApi.ShipsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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 ships Gets a list of ships including logically deleted ships to be used with 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 ships Gets a list of ships including logically deleted ships to be used with 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 = "ShipApi.ShipsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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;
}
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 1.3.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 IShipcallApiSync : IApiAccessor
{
#region Synchronous Operations
///
/// Create a new ship call
///
///
/// A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
Id ShipcallCreate(Shipcall shipcall, int operationIndex = 0);
///
/// Create a new ship call
///
///
/// A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipcallCreateWithHttpInfo(Shipcall shipcall, int operationIndex = 0);
///
/// Updates a ship call
///
///
/// Updates a shipcall. Usually done if the participant assignments change.
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Id
Id ShipcallUpdate(Shipcall shipcall, int operationIndex = 0);
///
/// Updates a ship call
///
///
/// Updates a shipcall. Usually done if the participant assignments change.
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipcallUpdateWithHttpInfo(Shipcall shipcall, int operationIndex = 0);
///
/// Gets a list of ship calls
///
///
/// Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// List<Shipcall>
List ShipcallsGet(int? pastDays = default(int?), int operationIndex = 0);
///
/// Gets a list of ship calls
///
///
/// Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Shipcall>
ApiResponse> ShipcallsGetWithHttpInfo(int? pastDays = default(int?), int operationIndex = 0);
#endregion Synchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IShipcallApiAsync : IApiAccessor
{
#region Asynchronous Operations
///
/// Create a new ship call
///
///
/// A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// 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 Id
System.Threading.Tasks.Task ShipcallCreateAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Create a new ship call
///
///
/// A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// 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 (Id)
System.Threading.Tasks.Task> ShipcallCreateWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Updates a ship call
///
///
/// Updates a shipcall. Usually done if the participant assignments change.
///
/// 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 Id
System.Threading.Tasks.Task ShipcallUpdateAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Updates a ship call
///
///
/// Updates a shipcall. Usually done if the participant assignments change.
///
/// 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 (Id)
System.Threading.Tasks.Task> ShipcallUpdateWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets a list of ship calls
///
///
/// Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Shipcall>
System.Threading.Tasks.Task> ShipcallsGetAsync(int? pastDays = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets a list of ship calls
///
///
/// Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Shipcall>)
System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int? pastDays = default(int?), 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 IShipcallApi : IShipcallApiSync, IShipcallApiAsync
{
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public partial class ShipcallApi : IShipcallApi
{
private BreCalClient.misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
///
/// Initializes a new instance of the class.
///
///
public ShipcallApi() : this((string)null)
{
}
///
/// Initializes a new instance of the class.
///
///
public ShipcallApi(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 ShipcallApi(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 ShipcallApi(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; }
}
///
/// Create a new ship call A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
public Id ShipcallCreate(Shipcall shipcall, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipcallCreateWithHttpInfo(shipcall);
return localVarResponse.Data;
}
///
/// Create a new ship call A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipcallCreateWithHttpInfo(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 ShipcallApi->ShipcallCreate");
}
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 = "ShipcallApi.ShipcallCreate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Post("/shipcalls", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipcallCreate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Create a new ship call A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// 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 Id
public async System.Threading.Tasks.Task ShipcallCreateAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipcallCreateWithHttpInfoAsync(shipcall, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Create a new ship call A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
///
/// 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 (Id)
public async System.Threading.Tasks.Task> ShipcallCreateWithHttpInfoAsync(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 ShipcallApi->ShipcallCreate");
}
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 = "ShipcallApi.ShipcallCreate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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("ShipcallCreate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Updates a ship call Updates a shipcall. Usually done if the participant assignments change.
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Id
public Id ShipcallUpdate(Shipcall shipcall, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipcallUpdateWithHttpInfo(shipcall);
return localVarResponse.Data;
}
///
/// Updates a ship call Updates a shipcall. Usually done if the participant assignments change.
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipcallUpdateWithHttpInfo(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 ShipcallApi->ShipcallUpdate");
}
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 = "ShipcallApi.ShipcallUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Put("/shipcalls", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ShipcallUpdate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Updates a ship call Updates a shipcall. Usually done if the participant assignments change.
///
/// 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 Id
public async System.Threading.Tasks.Task ShipcallUpdateAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipcallUpdateWithHttpInfoAsync(shipcall, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Updates a ship call Updates a shipcall. Usually done if the participant assignments change.
///
/// 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 (Id)
public async System.Threading.Tasks.Task> ShipcallUpdateWithHttpInfoAsync(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 ShipcallApi->ShipcallUpdate");
}
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 = "ShipcallApi.ShipcallUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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("ShipcallUpdate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Gets a list of ship calls Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// List<Shipcall>
public List ShipcallsGet(int? pastDays = default(int?), int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = ShipcallsGetWithHttpInfo(pastDays);
return localVarResponse.Data;
}
///
/// Gets a list of ship calls Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Shipcall>
public BreCalClient.misc.Client.ApiResponse> ShipcallsGetWithHttpInfo(int? pastDays = 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 (pastDays != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "past_days", pastDays));
}
localVarRequestOptions.Operation = "ShipcallApi.ShipcallsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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 Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Shipcall>
public async System.Threading.Tasks.Task> ShipcallsGetAsync(int? pastDays = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await ShipcallsGetWithHttpInfoAsync(pastDays, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Gets a list of ship calls Get current ship calls
///
/// Thrown when fails to make API call
/// number of days in the past to include in the result. *Example: 7*. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Shipcall>)
public async System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int? pastDays = 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 (pastDays != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "past_days", pastDays));
}
localVarRequestOptions.Operation = "ShipcallApi.ShipcallsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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;
}
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 1.3.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 IStaticApiSync : IApiAccessor
{
#region Synchronous Operations
///
/// Gets a list of all berths registered
///
///
/// Returns a list of berths, including berths that are (logically) deleted
///
/// 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
///
///
/// Returns a list of berths, including berths that are (logically) deleted
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Berth>
ApiResponse> BerthsGetWithHttpInfo(int operationIndex = 0);
///
/// History data
///
///
/// This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// List<History>
List HistoryGet(int shipcallId, int operationIndex = 0);
///
/// History data
///
///
/// This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// ApiResponse of List<History>
ApiResponse> HistoryGetWithHttpInfo(int shipcallId, int operationIndex = 0);
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
///
/// List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Notification
Notification NotificationsGet(int shipcallId, int operationIndex = 0);
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
///
/// List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// ApiResponse of Notification
ApiResponse NotificationsGetWithHttpInfo(int shipcallId, int operationIndex = 0);
///
/// gets one or all participants
///
///
/// If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// List<Participant>
List ParticipantsGet(int? userId = default(int?), int operationIndex = 0);
///
/// gets one or all participants
///
///
/// If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Participant>
ApiResponse> ParticipantsGetWithHttpInfo(int? userId = default(int?), int operationIndex = 0);
#endregion Synchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IStaticApiAsync : IApiAccessor
{
#region Asynchronous Operations
///
/// Gets a list of all berths registered
///
///
/// Returns a list of berths, including berths that are (logically) deleted
///
/// 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
///
///
/// Returns a list of berths, including berths that are (logically) deleted
///
/// 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));
///
/// History data
///
///
/// This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **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 List<History>
System.Threading.Tasks.Task> HistoryGetAsync(int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// History data
///
///
/// This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **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 (List<History>)
System.Threading.Tasks.Task>> HistoryGetWithHttpInfoAsync(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
///
///
/// List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **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 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
///
///
/// List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **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 shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// gets one or all participants
///
///
/// If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Participant>
System.Threading.Tasks.Task> ParticipantsGetAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// gets one or all participants
///
///
/// If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Participant>)
System.Threading.Tasks.Task>> ParticipantsGetWithHttpInfoAsync(int? userId = default(int?), 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 IStaticApi : IStaticApiSync, IStaticApiAsync
{
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public partial class StaticApi : IStaticApi
{
private BreCalClient.misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
///
/// Initializes a new instance of the class.
///
///
public StaticApi() : this((string)null)
{
}
///
/// Initializes a new instance of the class.
///
///
public StaticApi(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 StaticApi(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 StaticApi(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 Returns a list of berths, including berths that are (logically) deleted
///
/// 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 Returns a list of berths, including berths that are (logically) deleted
///
/// 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 = "StaticApi.BerthsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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 Returns a list of berths, including berths that are (logically) deleted
///
/// 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 Returns a list of berths, including berths that are (logically) deleted
///
/// 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 = "StaticApi.BerthsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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;
}
///
/// History data This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// List<History>
public List HistoryGet(int shipcallId, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = HistoryGetWithHttpInfo(shipcallId);
return localVarResponse.Data;
}
///
/// History data This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// ApiResponse of List<History>
public BreCalClient.misc.Client.ApiResponse> HistoryGetWithHttpInfo(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("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "StaticApi.HistoryGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Get>("/history", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("HistoryGet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// History data This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **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 List<History>
public async System.Threading.Tasks.Task> HistoryGetAsync(int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await HistoryGetWithHttpInfoAsync(shipcallId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// History data This endpoint returns a list of changes made to the specific shipcall
///
/// Thrown when fails to make API call
/// **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 (List<History>)
public async System.Threading.Tasks.Task>> HistoryGetWithHttpInfoAsync(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("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "StaticApi.HistoryGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.GetAsync>("/history", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("HistoryGet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Notification
public Notification NotificationsGet(int shipcallId, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = NotificationsGetWithHttpInfo(shipcallId);
return localVarResponse.Data;
}
///
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **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 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("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "StaticApi.NotificationsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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 List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **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 shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await NotificationsGetWithHttpInfoAsync(shipcallId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Gets a list of notifications pursuant to a specified participant and ship call List of notifications (tbd)
///
/// Thrown when fails to make API call
/// **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 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("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "StaticApi.NotificationsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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 one or all participants If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// List<Participant>
public List ParticipantsGet(int? userId = default(int?), int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = ParticipantsGetWithHttpInfo(userId);
return localVarResponse.Data;
}
///
/// gets one or all participants If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Participant>
public BreCalClient.misc.Client.ApiResponse> ParticipantsGetWithHttpInfo(int? userId = 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 (userId != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId));
}
localVarRequestOptions.Operation = "StaticApi.ParticipantsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Get>("/participants", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ParticipantsGet", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// gets one or all participants If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Participant>
public async System.Threading.Tasks.Task> ParticipantsGetAsync(int? userId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await ParticipantsGetWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// gets one or all participants If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Participant>)
public async System.Threading.Tasks.Task>> ParticipantsGetWithHttpInfoAsync(int? userId = 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 (userId != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "user_id", userId));
}
localVarRequestOptions.Operation = "StaticApi.ParticipantsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.GetAsync>("/participants", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ParticipantsGet", 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.3.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 ITimesApiSync : IApiAccessor
{
#region Synchronous Operations
///
/// Create a new times entry for a ship call
///
///
/// The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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.
/// Id
Id TimesCreate(Times times, int operationIndex = 0);
///
/// Create a new times entry for a ship call
///
///
/// The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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 Id
ApiResponse TimesCreateWithHttpInfo(Times times, int operationIndex = 0);
///
/// Delete a times entry for a ship call.
///
///
/// A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Id
Id TimesDelete(int id, int operationIndex = 0);
///
/// Delete a times entry for a ship call.
///
///
/// A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse TimesDeleteWithHttpInfo(int id, int operationIndex = 0);
///
/// Gets list of times
///
///
/// Get all times assigned to a shipcall. These might not be complete.
///
/// 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);
///
/// Gets list of times
///
///
/// Get all times assigned to a shipcall. These might not be complete.
///
/// 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);
///
/// Update a times entry for a ship call
///
///
/// Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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.
/// Id
Id TimesUpdate(Times times, int operationIndex = 0);
///
/// Update a times entry for a ship call
///
///
/// Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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 Id
ApiResponse TimesUpdateWithHttpInfo(Times times, int operationIndex = 0);
#endregion Synchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface ITimesApiAsync : IApiAccessor
{
#region Asynchronous Operations
///
/// Create a new times entry for a ship call
///
///
/// The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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 Id
System.Threading.Tasks.Task TimesCreateAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Create a new times entry for a ship call
///
///
/// The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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 (Id)
System.Threading.Tasks.Task> TimesCreateWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Delete a times entry for a ship call.
///
///
/// A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
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.
///
///
/// A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> TimesDeleteWithHttpInfoAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets list of times
///
///
/// Get all times assigned to a shipcall. These might not be complete.
///
/// 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));
///
/// Gets list of times
///
///
/// Get all times assigned to a shipcall. These might not be complete.
///
/// 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));
///
/// Update a times entry for a ship call
///
///
/// Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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 Id
System.Threading.Tasks.Task TimesUpdateAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update a times entry for a ship call
///
///
/// Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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 (Id)
System.Threading.Tasks.Task> TimesUpdateWithHttpInfoAsync(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 ITimesApi : ITimesApiSync, ITimesApiAsync
{
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public partial class TimesApi : ITimesApi
{
private BreCalClient.misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
///
/// Initializes a new instance of the class.
///
///
public TimesApi() : this((string)null)
{
}
///
/// Initializes a new instance of the class.
///
///
public TimesApi(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 TimesApi(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 TimesApi(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; }
}
///
/// Create a new times entry for a ship call The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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.
/// Id
public Id TimesCreate(Times times, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = TimesCreateWithHttpInfo(times);
return localVarResponse.Data;
}
///
/// Create a new times entry for a ship call The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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 Id
public BreCalClient.misc.Client.ApiResponse TimesCreateWithHttpInfo(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 TimesApi->TimesCreate");
}
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 = "TimesApi.TimesCreate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Post("/times", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("TimesCreate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Create a new times entry for a ship call The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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 Id
public async System.Threading.Tasks.Task TimesCreateAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await TimesCreateWithHttpInfoAsync(times, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Create a new times entry for a ship call The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
///
/// 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 (Id)
public async System.Threading.Tasks.Task> TimesCreateWithHttpInfoAsync(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 TimesApi->TimesCreate");
}
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 = "TimesApi.TimesCreate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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("TimesCreate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Delete a times entry for a ship call. A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Id
public Id TimesDelete(int id, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = TimesDeleteWithHttpInfo(id);
return localVarResponse.Data;
}
///
/// Delete a times entry for a ship call. A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// ApiResponse of Id
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 = "TimesApi.TimesDelete";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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. A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task TimesDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await TimesDeleteWithHttpInfoAsync(id, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Delete a times entry for a ship call. A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
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 = "TimesApi.TimesDelete";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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;
}
///
/// Gets list of times Get all times assigned to a shipcall. These might not be complete.
///
/// 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;
}
///
/// Gets list of times Get all times assigned to a shipcall. These might not be complete.
///
/// 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 = "TimesApi.TimesGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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;
}
///
/// Gets list of times Get all times assigned to a shipcall. These might not be complete.
///
/// 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;
}
///
/// Gets list of times Get all times assigned to a shipcall. These might not be complete.
///
/// 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 = "TimesApi.TimesGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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;
}
///
/// Update a times entry for a ship call Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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.
/// Id
public Id TimesUpdate(Times times, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = TimesUpdateWithHttpInfo(times);
return localVarResponse.Data;
}
///
/// Update a times entry for a ship call Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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 Id
public BreCalClient.misc.Client.ApiResponse TimesUpdateWithHttpInfo(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 TimesApi->TimesUpdate");
}
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 = "TimesApi.TimesUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Put("/times", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("TimesUpdate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update a times entry for a ship call Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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 Id
public async System.Threading.Tasks.Task TimesUpdateAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await TimesUpdateWithHttpInfoAsync(times, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Update a times entry for a ship call Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
///
/// 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 (Id)
public async System.Threading.Tasks.Task> TimesUpdateWithHttpInfoAsync(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 TimesApi->TimesUpdate");
}
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 = "TimesApi.TimesUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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("TimesUpdate", 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.3.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 IUserApiSync : IApiAccessor
{
#region Synchronous Operations
///
/// Returns a JWT session token and user data if successful
///
///
/// Perform login
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// LoginResult
LoginResult Login(Credentials credentials, int operationIndex = 0);
///
/// Returns a JWT session token and user data if successful
///
///
/// Perform login
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// ApiResponse of LoginResult
ApiResponse LoginWithHttpInfo(Credentials credentials, int operationIndex = 0);
///
/// Update user details (first/last name, phone, password)
///
///
/// Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Id
Id UserUpdate(UserDetails userDetails, int operationIndex = 0);
///
/// Update user details (first/last name, phone, password)
///
///
/// Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse UserUpdateWithHttpInfo(UserDetails userDetails, int operationIndex = 0);
#endregion Synchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IUserApiAsync : IApiAccessor
{
#region Asynchronous Operations
///
/// Returns a JWT session token and user data if successful
///
///
/// Perform login
///
/// 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 LoginAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Returns a JWT session token and user data if successful
///
///
/// Perform login
///
/// 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> LoginWithHttpInfoAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update user details (first/last name, phone, password)
///
///
/// Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task UserUpdateAsync(UserDetails userDetails, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update user details (first/last name, phone, password)
///
///
/// Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> UserUpdateWithHttpInfoAsync(UserDetails userDetails, 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 IUserApi : IUserApiSync, IUserApiAsync
{
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public partial class UserApi : IUserApi
{
private BreCalClient.misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
///
/// Initializes a new instance of the class.
///
///
public UserApi() : this((string)null)
{
}
///
/// Initializes a new instance of the class.
///
///
public UserApi(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 UserApi(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 UserApi(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; }
}
///
/// Returns a JWT session token and user data if successful Perform login
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// LoginResult
public LoginResult Login(Credentials credentials, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = LoginWithHttpInfo(credentials);
return localVarResponse.Data;
}
///
/// Returns a JWT session token and user data if successful Perform login
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// ApiResponse of LoginResult
public BreCalClient.misc.Client.ApiResponse LoginWithHttpInfo(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 UserApi->Login");
}
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 = "UserApi.Login";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Post("/login", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("Login", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Returns a JWT session token and user data if successful Perform login
///
/// 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 LoginAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await LoginWithHttpInfoAsync(credentials, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Returns a JWT session token and user data if successful Perform login
///
/// 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> LoginWithHttpInfoAsync(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 UserApi->Login");
}
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 = "UserApi.Login";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// 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("Login", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update user details (first/last name, phone, password) Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Id
public Id UserUpdate(UserDetails userDetails, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = UserUpdateWithHttpInfo(userDetails);
return localVarResponse.Data;
}
///
/// Update user details (first/last name, phone, password) Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse UserUpdateWithHttpInfo(UserDetails userDetails, int operationIndex = 0)
{
// verify the required parameter 'userDetails' is set
if (userDetails == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'userDetails' when calling UserApi->UserUpdate");
}
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 = userDetails;
localVarRequestOptions.Operation = "UserApi.UserUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = this.Client.Put("/user", localVarRequestOptions, this.Configuration);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("UserUpdate", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update user details (first/last name, phone, password) Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task UserUpdateAsync(UserDetails userDetails, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await UserUpdateWithHttpInfoAsync(userDetails, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Update user details (first/last name, phone, password) Update user information
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> UserUpdateWithHttpInfoAsync(UserDetails userDetails, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'userDetails' is set
if (userDetails == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'userDetails' when calling UserApi->UserUpdate");
}
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 = userDetails;
localVarRequestOptions.Operation = "UserApi.UserUpdate";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", this.Configuration.GetApiKeyWithPrefix("Authorization"));
}
// make the HTTP request
var localVarResponse = await this.AsynchronousClient.PutAsync("/user", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("UserUpdate", 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.3.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 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.ContentType.JsonAccept;
public SupportsContentType SupportsContentType => contentType =>
contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) ||
contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase);
public ContentType ContentType { get; set; } = RestSharp.ContentType.Json;
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 request, 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,
UseDefaultCredentials = configuration.UseDefaultCredentials,
RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
using (RestClient client = new RestClient(clientOptions,
configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration))))
{
InterceptRequest(request);
RestResponse response;
if (RetryConfiguration.RetryPolicy != null)
{
var policy = RetryConfiguration.RetryPolicy;
var policyResult = policy.ExecuteAndCapture(() => client.Execute(request));
response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse(request)
{
ErrorException = policyResult.FinalException
};
}
else
{
response = client.Execute(request);
}
// 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(request, 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 request, 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,
UseDefaultCredentials = configuration.UseDefaultCredentials,
RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
using (RestClient client = new RestClient(clientOptions,
configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration))))
{
InterceptRequest(request);
RestResponse response;
if (RetryConfiguration.AsyncRetryPolicy != null)
{
var policy = RetryConfiguration.AsyncRetryPolicy;
var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false);
response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse(request)
{
ErrorException = policyResult.FinalException
};
}
else
{
response = await client.ExecuteAsync(request, 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(request, 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.3.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.3.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; }
///