//----------------------
//
// Generated REST API Client Code Generator v1.8.4.0 on 04.10.2023 07:39:32
// Using the tool OpenAPI Generator v7.0.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;
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Api
{
#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IDefaultApiSync : IApiAccessor
{
#region Synchronous Operations
///
/// Gets a list of all berths registered
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Berth>
List BerthsGet(int operationIndex = 0);
///
/// Gets a list of all berths registered
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Berth>
ApiResponse> BerthsGetWithHttpInfo(int operationIndex = 0);
///
/// Returns a JWT session token and user data if successful
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// LoginResult
LoginResult LoginPost(Credentials credentials, int operationIndex = 0);
///
/// Returns a JWT session token and user data if successful
///
///
///
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// ApiResponse of LoginResult
ApiResponse LoginPostWithHttpInfo(Credentials credentials, int operationIndex = 0);
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Notification
Notification NotificationsGet(int participantId, int shipcallId, int operationIndex = 0);
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
///
///
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// ApiResponse of Notification
ApiResponse NotificationsGetWithHttpInfo(int participantId, int shipcallId, int operationIndex = 0);
///
/// gets a particular participant entry corresponding to user id
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// List<Participant>
List ParticipantsGet(int? userId = default(int?), int operationIndex = 0);
///
/// gets a particular participant entry corresponding to user id
///
///
///
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Participant>
ApiResponse> ParticipantsGetWithHttpInfo(int? userId = default(int?), int operationIndex = 0);
///
/// Gets a list of ship calls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Shipcall>
List ShipcallsGet(int operationIndex = 0);
///
/// Gets a list of ship calls
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Shipcall>
ApiResponse> ShipcallsGetWithHttpInfo(int operationIndex = 0);
///
/// Create a new ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
Id ShipcallsPost(Shipcall shipcall, int operationIndex = 0);
///
/// Create a new ship call
///
///
///
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipcallsPostWithHttpInfo(Shipcall shipcall, int operationIndex = 0);
///
/// Updates a ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Id
Id ShipcallsPut(Shipcall shipcall, int operationIndex = 0);
///
/// Updates a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse ShipcallsPutWithHttpInfo(Shipcall shipcall, int operationIndex = 0);
///
/// gets a list of registered shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Ship>
List ShipsGet(int operationIndex = 0);
///
/// gets a list of registered shipcalls
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Ship>
ApiResponse> ShipsGetWithHttpInfo(int operationIndex = 0);
///
/// Delete a times entry for a ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
///
void TimesDelete(int id, int operationIndex = 0);
///
/// Delete a times entry for a ship call.
///
///
///
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// ApiResponse of Object(void)
ApiResponse TimesDeleteWithHttpInfo(int id, int operationIndex = 0);
///
/// Get all recorded times for a a ship call
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// List<Times>
List TimesGet(int? shipcallId = default(int?), int operationIndex = 0);
///
/// Get all recorded times for a a ship call
///
///
///
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Times>
ApiResponse> TimesGetWithHttpInfo(int? shipcallId = default(int?), int operationIndex = 0);
///
/// Create a new times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
Id TimesPost(Times times, int operationIndex = 0);
///
/// Create a new times entry for a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse TimesPostWithHttpInfo(Times times, int operationIndex = 0);
///
/// Update a times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Id
Id TimesPut(Times times, int operationIndex = 0);
///
/// Update a times entry for a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
ApiResponse TimesPutWithHttpInfo(Times times, int operationIndex = 0);
///
/// Update user details (first/last name, phone, password)
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
///
void UserPut(UserDetails userDetails, int operationIndex = 0);
///
/// Update user details (first/last name, phone, password)
///
///
///
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// ApiResponse of Object(void)
ApiResponse UserPutWithHttpInfo(UserDetails userDetails, int operationIndex = 0);
#endregion Synchronous Operations
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IDefaultApiAsync : IApiAccessor
{
#region Asynchronous Operations
///
/// Gets a list of all berths registered
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Berth>
System.Threading.Tasks.Task> BerthsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets a list of all berths registered
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Berth>)
System.Threading.Tasks.Task>> BerthsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Returns a JWT session token and user data if successful
///
///
///
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of LoginResult
System.Threading.Tasks.Task LoginPostAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Returns a JWT session token and user data if successful
///
///
///
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (LoginResult)
System.Threading.Tasks.Task> LoginPostWithHttpInfoAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
///
///
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Notification
System.Threading.Tasks.Task NotificationsGetAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
///
///
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Notification)
System.Threading.Tasks.Task> NotificationsGetWithHttpInfoAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// gets a particular participant entry corresponding to user id
///
///
///
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (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 a particular participant entry corresponding to user id
///
///
///
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (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));
///
/// Gets a list of ship calls
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Shipcall>
System.Threading.Tasks.Task> ShipcallsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Gets a list of ship calls
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Shipcall>)
System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Create a new ship call
///
///
///
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task ShipcallsPostAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Create a new ship call
///
///
///
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> ShipcallsPostWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Updates a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task ShipcallsPutAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Updates a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> ShipcallsPutWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// gets a list of registered shipcalls
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Ship>
System.Threading.Tasks.Task> ShipsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// gets a list of registered shipcalls
///
///
///
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Ship>)
System.Threading.Tasks.Task>> ShipsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Delete a times entry for a ship call.
///
///
///
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of void
System.Threading.Tasks.Task TimesDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Delete a times entry for a ship call.
///
///
///
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse
System.Threading.Tasks.Task> TimesDeleteWithHttpInfoAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Get all recorded times for a a ship call
///
///
///
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Times>
System.Threading.Tasks.Task> TimesGetAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Get all recorded times for a a ship call
///
///
///
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Times>)
System.Threading.Tasks.Task>> TimesGetWithHttpInfoAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Create a new times entry for a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task TimesPostAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Create a new times entry for a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> TimesPostWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update a times entry for a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
System.Threading.Tasks.Task TimesPutAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update a times entry for a ship call
///
///
///
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
System.Threading.Tasks.Task> TimesPutWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update user details (first/last name, phone, password)
///
///
///
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of void
System.Threading.Tasks.Task UserPutAsync(UserDetails userDetails, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Update user details (first/last name, phone, password)
///
///
///
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse
System.Threading.Tasks.Task> UserPutWithHttpInfoAsync(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 IDefaultApi : IDefaultApiSync, IDefaultApiAsync
{
}
///
/// Represents a collection of functions to interact with the API endpoints
///
public partial class DefaultApi : IDefaultApi
{
private BreCalClient.misc.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
///
/// Initializes a new instance of the class.
///
///
public DefaultApi() : this((string)null)
{
}
///
/// Initializes a new instance of the class.
///
///
public DefaultApi(string basePath)
{
this.Configuration = BreCalClient.misc.Client.Configuration.MergeConfigurations(
BreCalClient.misc.Client.GlobalConfiguration.Instance,
new BreCalClient.misc.Client.Configuration { BasePath = basePath }
);
this.Client = new BreCalClient.misc.Client.ApiClient(this.Configuration.BasePath);
this.AsynchronousClient = new BreCalClient.misc.Client.ApiClient(this.Configuration.BasePath);
this.ExceptionFactory = BreCalClient.misc.Client.Configuration.DefaultExceptionFactory;
}
///
/// Initializes a new instance of the class
/// using Configuration object
///
/// An instance of Configuration
///
public DefaultApi(BreCalClient.misc.Client.Configuration configuration)
{
if (configuration == null) throw new ArgumentNullException("configuration");
this.Configuration = BreCalClient.misc.Client.Configuration.MergeConfigurations(
BreCalClient.misc.Client.GlobalConfiguration.Instance,
configuration
);
this.Client = new BreCalClient.misc.Client.ApiClient(this.Configuration.BasePath);
this.AsynchronousClient = new BreCalClient.misc.Client.ApiClient(this.Configuration.BasePath);
ExceptionFactory = BreCalClient.misc.Client.Configuration.DefaultExceptionFactory;
}
///
/// Initializes a new instance of the class
/// using a Configuration object and client instance.
///
/// The client interface for synchronous API access.
/// The client interface for asynchronous API access.
/// The configuration object.
public DefaultApi(BreCalClient.misc.Client.ISynchronousClient client, BreCalClient.misc.Client.IAsynchronousClient asyncClient, BreCalClient.misc.Client.IReadableConfiguration configuration)
{
if (client == null) throw new ArgumentNullException("client");
if (asyncClient == null) throw new ArgumentNullException("asyncClient");
if (configuration == null) throw new ArgumentNullException("configuration");
this.Client = client;
this.AsynchronousClient = asyncClient;
this.Configuration = configuration;
this.ExceptionFactory = BreCalClient.misc.Client.Configuration.DefaultExceptionFactory;
}
///
/// The client for accessing this underlying API asynchronously.
///
public BreCalClient.misc.Client.IAsynchronousClient AsynchronousClient { get; set; }
///
/// The client for accessing this underlying API synchronously.
///
public BreCalClient.misc.Client.ISynchronousClient Client { get; set; }
///
/// Gets the base path of the API client.
///
/// The base path
public string GetBasePath()
{
return this.Configuration.BasePath;
}
///
/// Gets or sets the configuration object
///
/// An instance of the Configuration
public BreCalClient.misc.Client.IReadableConfiguration Configuration { get; set; }
///
/// Provides a factory method hook for the creation of exceptions.
///
public BreCalClient.misc.Client.ExceptionFactory ExceptionFactory
{
get
{
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
{
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
}
return _exceptionFactory;
}
set { _exceptionFactory = value; }
}
///
/// Gets a list of all berths registered
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Berth>
public List BerthsGet(int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = BerthsGetWithHttpInfo();
return localVarResponse.Data;
}
///
/// Gets a list of all berths registered
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Berth>
public BreCalClient.misc.Client.ApiResponse> BerthsGetWithHttpInfo(int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "DefaultApi.BerthsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Berth>
public async System.Threading.Tasks.Task> BerthsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await BerthsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Gets a list of all berths registered
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Berth>)
public async System.Threading.Tasks.Task>> BerthsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "DefaultApi.BerthsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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;
}
///
/// Returns a JWT session token and user data if successful
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// LoginResult
public LoginResult LoginPost(Credentials credentials, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = LoginPostWithHttpInfo(credentials);
return localVarResponse.Data;
}
///
/// Returns a JWT session token and user data if successful
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// ApiResponse of LoginResult
public BreCalClient.misc.Client.ApiResponse LoginPostWithHttpInfo(Credentials credentials, int operationIndex = 0)
{
// verify the required parameter 'credentials' is set
if (credentials == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'credentials' when calling DefaultApi->LoginPost");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = credentials;
localVarRequestOptions.Operation = "DefaultApi.LoginPost";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("LoginPost", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Returns a JWT session token and user data if successful
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of LoginResult
public async System.Threading.Tasks.Task LoginPostAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await LoginPostWithHttpInfoAsync(credentials, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Returns a JWT session token and user data if successful
///
/// Thrown when fails to make API call
/// Login credentials
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (LoginResult)
public async System.Threading.Tasks.Task> LoginPostWithHttpInfoAsync(Credentials credentials, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'credentials' is set
if (credentials == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'credentials' when calling DefaultApi->LoginPost");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = credentials;
localVarRequestOptions.Operation = "DefaultApi.LoginPost";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("LoginPost", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Notification
public Notification NotificationsGet(int participantId, int shipcallId, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = NotificationsGetWithHttpInfo(participantId, shipcallId);
return localVarResponse.Data;
}
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// ApiResponse of Notification
public BreCalClient.misc.Client.ApiResponse NotificationsGetWithHttpInfo(int participantId, int shipcallId, int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId));
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "DefaultApi.NotificationsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Notification
public async System.Threading.Tasks.Task NotificationsGetAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await NotificationsGetWithHttpInfoAsync(participantId, shipcallId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Gets a list of notifications pursuant to a specified participant and ship call
///
/// Thrown when fails to make API call
/// **Id of participant**. *Example: 2*. Id returned through loading of participant
/// **Id of ship call**. *Example: 52*. Id given in ship call list
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Notification)
public async System.Threading.Tasks.Task> NotificationsGetWithHttpInfoAsync(int participantId, int shipcallId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "participant_id", participantId));
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId));
localVarRequestOptions.Operation = "DefaultApi.NotificationsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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 a particular participant entry corresponding to user id
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (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 a particular participant entry corresponding to user id
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (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 = "DefaultApi.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 a particular participant entry corresponding to user id
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (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 a particular participant entry corresponding to user id
///
/// Thrown when fails to make API call
/// **Id of user**. *Example: 2*. User id returned by verify call. (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 = "DefaultApi.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;
}
///
/// Gets a list of ship calls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Shipcall>
public List ShipcallsGet(int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = ShipcallsGetWithHttpInfo();
return localVarResponse.Data;
}
///
/// Gets a list of ship calls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Shipcall>
public BreCalClient.misc.Client.ApiResponse> ShipcallsGetWithHttpInfo(int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "DefaultApi.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
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Shipcall>
public async System.Threading.Tasks.Task> ShipcallsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await ShipcallsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Gets a list of ship calls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Shipcall>)
public async System.Threading.Tasks.Task>> ShipcallsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "DefaultApi.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;
}
///
/// Create a new ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
public Id ShipcallsPost(Shipcall shipcall, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipcallsPostWithHttpInfo(shipcall);
return localVarResponse.Data;
}
///
/// Create a new ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipcallsPostWithHttpInfo(Shipcall shipcall, int operationIndex = 0)
{
// verify the required parameter 'shipcall' is set
if (shipcall == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPost");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = shipcall;
localVarRequestOptions.Operation = "DefaultApi.ShipcallsPost";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("ShipcallsPost", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Create a new ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task ShipcallsPostAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipcallsPostWithHttpInfoAsync(shipcall, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Create a new ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> ShipcallsPostWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'shipcall' is set
if (shipcall == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPost");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = shipcall;
localVarRequestOptions.Operation = "DefaultApi.ShipcallsPost";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("ShipcallsPost", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Updates a ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Id
public Id ShipcallsPut(Shipcall shipcall, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = ShipcallsPutWithHttpInfo(shipcall);
return localVarResponse.Data;
}
///
/// Updates a ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse ShipcallsPutWithHttpInfo(Shipcall shipcall, int operationIndex = 0)
{
// verify the required parameter 'shipcall' is set
if (shipcall == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPut");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = shipcall;
localVarRequestOptions.Operation = "DefaultApi.ShipcallsPut";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("ShipcallsPut", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Updates a ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task ShipcallsPutAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await ShipcallsPutWithHttpInfoAsync(shipcall, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Updates a ship call
///
/// Thrown when fails to make API call
/// Creates a new ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> ShipcallsPutWithHttpInfoAsync(Shipcall shipcall, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'shipcall' is set
if (shipcall == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'shipcall' when calling DefaultApi->ShipcallsPut");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = shipcall;
localVarRequestOptions.Operation = "DefaultApi.ShipcallsPut";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("ShipcallsPut", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// gets a list of registered shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// List<Ship>
public List ShipsGet(int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = ShipsGetWithHttpInfo();
return localVarResponse.Data;
}
///
/// gets a list of registered shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// ApiResponse of List<Ship>
public BreCalClient.misc.Client.ApiResponse> ShipsGetWithHttpInfo(int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "DefaultApi.ShipsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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 registered shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Ship>
public async System.Threading.Tasks.Task> ShipsGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await ShipsGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// gets a list of registered shipcalls
///
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Ship>)
public async System.Threading.Tasks.Task>> ShipsGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Operation = "DefaultApi.ShipsGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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;
}
///
/// Delete a times entry for a ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
///
public void TimesDelete(int id, int operationIndex = 0)
{
TimesDeleteWithHttpInfo(id);
}
///
/// Delete a times entry for a ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// ApiResponse of Object(void)
public BreCalClient.misc.Client.ApiResponse TimesDeleteWithHttpInfo(int id, int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "id", id));
localVarRequestOptions.Operation = "DefaultApi.TimesDelete";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of void
public async System.Threading.Tasks.Task TimesDeleteAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
await TimesDeleteWithHttpInfoAsync(id, operationIndex, cancellationToken).ConfigureAwait(false);
}
///
/// Delete a times entry for a ship call.
///
/// Thrown when fails to make API call
///
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse
public async System.Threading.Tasks.Task> TimesDeleteWithHttpInfoAsync(int id, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "id", id));
localVarRequestOptions.Operation = "DefaultApi.TimesDelete";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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;
}
///
/// Get all recorded times for a a ship call
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// List<Times>
public List TimesGet(int? shipcallId = default(int?), int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = TimesGetWithHttpInfo(shipcallId);
return localVarResponse.Data;
}
///
/// Get all recorded times for a a ship call
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// ApiResponse of List<Times>
public BreCalClient.misc.Client.ApiResponse> TimesGetWithHttpInfo(int? shipcallId = default(int?), int operationIndex = 0)
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
if (shipcallId != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId));
}
localVarRequestOptions.Operation = "DefaultApi.TimesGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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;
}
///
/// Get all recorded times for a a ship call
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of List<Times>
public async System.Threading.Tasks.Task> TimesGetAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse> localVarResponse = await TimesGetWithHttpInfoAsync(shipcallId, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Get all recorded times for a a ship call
///
/// Thrown when fails to make API call
/// **Id**. *Example: 42*. Id of referenced ship call. (optional)
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (List<Times>)
public async System.Threading.Tasks.Task>> TimesGetWithHttpInfoAsync(int? shipcallId = default(int?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
if (shipcallId != null)
{
localVarRequestOptions.QueryParameters.Add(BreCalClient.misc.Client.ClientUtils.ParameterToMultiMap("", "shipcall_id", shipcallId));
}
localVarRequestOptions.Operation = "DefaultApi.TimesGet";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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;
}
///
/// Create a new times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Id
public Id TimesPost(Times times, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = TimesPostWithHttpInfo(times);
return localVarResponse.Data;
}
///
/// Create a new times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse TimesPostWithHttpInfo(Times times, int operationIndex = 0)
{
// verify the required parameter 'times' is set
if (times == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPost");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = times;
localVarRequestOptions.Operation = "DefaultApi.TimesPost";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("TimesPost", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Create a new times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task TimesPostAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await TimesPostWithHttpInfoAsync(times, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Create a new times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. **Do not** provide id parameter.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> TimesPostWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'times' is set
if (times == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPost");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = times;
localVarRequestOptions.Operation = "DefaultApi.TimesPost";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("TimesPost", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update a times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Id
public Id TimesPut(Times times, int operationIndex = 0)
{
BreCalClient.misc.Client.ApiResponse localVarResponse = TimesPutWithHttpInfo(times);
return localVarResponse.Data;
}
///
/// Update a times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// ApiResponse of Id
public BreCalClient.misc.Client.ApiResponse TimesPutWithHttpInfo(Times times, int operationIndex = 0)
{
// verify the required parameter 'times' is set
if (times == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPut");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = times;
localVarRequestOptions.Operation = "DefaultApi.TimesPut";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("TimesPut", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update a times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of Id
public async System.Threading.Tasks.Task TimesPutAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
BreCalClient.misc.Client.ApiResponse localVarResponse = await TimesPutWithHttpInfoAsync(times, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
}
///
/// Update a times entry for a ship call
///
/// Thrown when fails to make API call
/// Times entry that will be added to the ship call. The id parameter is **required**.
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (Id)
public async System.Threading.Tasks.Task> TimesPutWithHttpInfoAsync(Times times, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
// verify the required parameter 'times' is set
if (times == null)
{
throw new BreCalClient.misc.Client.ApiException(400, "Missing required parameter 'times' when calling DefaultApi->TimesPut");
}
BreCalClient.misc.Client.RequestOptions localVarRequestOptions = new BreCalClient.misc.Client.RequestOptions();
string[] _contentTypes = new string[] {
"application/json"
};
// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};
var localVarContentType = BreCalClient.misc.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null)
{
localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
}
var localVarAccept = BreCalClient.misc.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null)
{
localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
}
localVarRequestOptions.Data = times;
localVarRequestOptions.Operation = "DefaultApi.TimesPut";
localVarRequestOptions.OperationIndex = operationIndex;
// authentication (ApiKey) required
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("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("TimesPut", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update user details (first/last name, phone, password)
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
///
public void UserPut(UserDetails userDetails, int operationIndex = 0)
{
UserPutWithHttpInfo(userDetails);
}
///
/// Update user details (first/last name, phone, password)
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// ApiResponse of Object(void)
public BreCalClient.misc.Client.ApiResponse UserPutWithHttpInfo(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 DefaultApi->UserPut");
}
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 = "DefaultApi.UserPut";
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("UserPut", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
///
/// Update user details (first/last name, phone, password)
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of void
public async System.Threading.Tasks.Task UserPutAsync(UserDetails userDetails, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
await UserPutWithHttpInfoAsync(userDetails, operationIndex, cancellationToken).ConfigureAwait(false);
}
///
/// Update user details (first/last name, phone, password)
///
/// Thrown when fails to make API call
/// User details
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse
public async System.Threading.Tasks.Task> UserPutWithHttpInfoAsync(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 DefaultApi->UserPut");
}
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 = "DefaultApi.UserPut";
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("UserPut", localVarResponse);
if (_exception != null)
{
throw _exception;
}
}
return localVarResponse;
}
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.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
};
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: 0.6.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: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// Provides a non-generic contract for the ApiResponse wrapper.
///
public interface IApiResponse
{
///
/// The data type of
///
Type ResponseType { get; }
///
/// The content of this response
///
Object Content { get; }
///
/// Gets or sets the status code (HTTP status code)
///
/// The status code.
HttpStatusCode StatusCode { get; }
///
/// Gets or sets the HTTP headers
///
/// HTTP headers
Multimap Headers { get; }
///
/// Gets or sets any error text defined by the calling client.
///
string ErrorText { get; set; }
///
/// Gets or sets any cookies passed along on the response.
///
List Cookies { get; set; }
///
/// The raw content of this response
///
string RawContent { get; }
}
///
/// API Response
///
public class ApiResponse : IApiResponse
{
#region Properties
///
/// Gets or sets the status code (HTTP status code)
///
/// The status code.
public HttpStatusCode StatusCode { get; }
///
/// Gets or sets the HTTP headers
///
/// HTTP headers
public Multimap Headers { get; }
///
/// Gets or sets the data (parsed HTTP body)
///
/// The data.
public T Data { get; }
///
/// Gets or sets any error text defined by the calling client.
///
public string ErrorText { get; set; }
///
/// Gets or sets any cookies passed along on the response.
///
public List Cookies { get; set; }
///
/// The content of this response
///
public Type ResponseType
{
get { return typeof(T); }
}
///
/// The data type of
///
public object Content
{
get { return Data; }
}
///
/// The raw content
///
public string RawContent { get; }
#endregion Properties
#region Constructors
///
/// Initializes a new instance of the class.
///
/// HTTP status code.
/// HTTP headers.
/// Data (parsed HTTP body)
/// Raw content.
public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent)
{
StatusCode = statusCode;
Headers = headers;
Data = data;
RawContent = rawContent;
}
///
/// Initializes a new instance of the class.
///
/// HTTP status code.
/// HTTP headers.
/// Data (parsed HTTP body)
public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null)
{
}
///
/// Initializes a new instance of the class.
///
/// HTTP status code.
/// Data (parsed HTTP body)
/// Raw content.
public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent)
{
}
///
/// Initializes a new instance of the class.
///
/// HTTP status code.
/// Data (parsed HTTP body)
public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null)
{
}
#endregion Constructors
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// Utility functions providing some benefit to API client consumers.
///
public static class ClientUtils
{
///
/// Sanitize filename by removing the path
///
/// Filename
/// Filename
public static string SanitizeFilename(string filename)
{
Match match = Regex.Match(filename, @".*[/\\](.*)$");
return match.Success ? match.Groups[1].Value : filename;
}
///
/// Convert params to key/value pairs.
/// Use collectionFormat to properly format lists and collections.
///
/// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi
/// Key name.
/// Value object.
/// A multimap of keys with 1..n associated values.
public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value)
{
var parameters = new Multimap();
if (value is ICollection collection && collectionFormat == "multi")
{
foreach (var item in collection)
{
parameters.Add(name, ParameterToString(item));
}
}
else if (value is IDictionary dictionary)
{
if(collectionFormat == "deepObject") {
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value));
}
}
else {
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value));
}
}
}
else
{
parameters.Add(name, ParameterToString(value));
}
return parameters;
}
///
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
/// Otherwise just return the string.
///
/// The parameter (header, path, query, form).
/// An optional configuration instance, providing formatting options used in processing.
/// Formatted string.
public static string ParameterToString(object obj, IReadableConfiguration configuration = null)
{
if (obj is DateTime dateTime)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is DateTimeOffset dateTimeOffset)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is bool boolean)
return boolean ? "true" : "false";
if (obj is ICollection collection) {
List entries = new List();
foreach (var entry in collection)
entries.Add(ParameterToString(entry, configuration));
return string.Join(",", entries);
}
if (obj is Enum && HasEnumMemberAttrValue(obj))
return GetEnumMemberAttrValue(obj);
return Convert.ToString(obj, CultureInfo.InvariantCulture);
}
///
/// Serializes the given object when not null. Otherwise return null.
///
/// The object to serialize.
/// Serialized string.
public static string Serialize(object obj)
{
return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null;
}
///
/// Encode string in base64 format.
///
/// string to be encoded.
/// Encoded string.
public static string Base64Encode(string text)
{
return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text));
}
///
/// Convert stream to byte array
///
/// Input stream to be converted
/// Byte array
public static byte[] ReadAsBytes(Stream inputStream)
{
using (var ms = new MemoryStream())
{
inputStream.CopyTo(ms);
return ms.ToArray();
}
}
///
/// Select the Content-Type header's value from the given content-type array:
/// if JSON type exists in the given array, use it;
/// otherwise use the first one defined in 'consumes'
///
/// The Content-Type array to select from.
/// The Content-Type header to use.
public static string SelectHeaderContentType(string[] contentTypes)
{
if (contentTypes.Length == 0)
return null;
foreach (var contentType in contentTypes)
{
if (IsJsonMime(contentType))
return contentType;
}
return contentTypes[0]; // use the first content type specified in 'consumes'
}
///
/// Select the Accept header's value from the given accepts array:
/// if JSON exists in the given array, use it;
/// otherwise use all of them (joining into a string)
///
/// The accepts array to select from.
/// The Accept header to use.
public static string SelectHeaderAccept(string[] accepts)
{
if (accepts.Length == 0)
return null;
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
return "application/json";
return string.Join(",", accepts);
}
///
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
///
public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
///
/// Check if the given MIME is a JSON MIME.
/// JSON MIME examples:
/// application/json
/// application/json; charset=UTF8
/// APPLICATION/JSON
/// application/vnd.company+json
///
/// MIME
/// Returns True if MIME type is json.
public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
}
///
/// Is the Enum decorated with EnumMember Attribute
///
///
/// true if found
private static bool HasEnumMemberAttrValue(object enumVal)
{
if (enumVal == null)
throw new ArgumentNullException(nameof(enumVal));
var enumType = enumVal.GetType();
var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException());
var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault();
if (attr != null) return true;
return false;
}
///
/// Get the EnumMember value
///
///
/// EnumMember value as string otherwise null
private static string GetEnumMemberAttrValue(object enumVal)
{
if (enumVal == null)
throw new ArgumentNullException(nameof(enumVal));
var enumType = enumVal.GetType();
var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException());
var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault();
if (attr != null)
{
return attr.Value;
}
return null;
}
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// Represents a set of configuration settings
///
public class Configuration : IReadableConfiguration
{
#region Constants
///
/// Version of the package.
///
/// Version of the package.
public const string Version = "1.0.0";
///
/// Identifier for ISO 8601 DateTime Format
///
/// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.
// ReSharper disable once InconsistentNaming
public const string ISO8601_DATETIME_FORMAT = "o";
#endregion Constants
#region Static Members
///
/// Default creation of exceptions for a given method name and response object
///
public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
{
var status = (int)response.StatusCode;
if (status >= 400)
{
return new ApiException(status,
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
response.RawContent, response.Headers);
}
return null;
};
#endregion Static Members
#region Private Members
///
/// Defines the base path of the target API server.
/// Example: http://localhost:3000/v1/
///
private string _basePath;
private bool _useDefaultCredentials = false;
///
/// Gets or sets the API key based on the authentication name.
/// This is the key and value comprising the "secret" for accessing an API.
///
/// The API key.
private IDictionary _apiKey;
///
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
///
/// The prefix of the API key.
private IDictionary _apiKeyPrefix;
private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
private string _tempFolderPath = Path.GetTempPath();
///
/// Gets or sets the servers defined in the OpenAPI spec.
///
/// The servers
private IList> _servers;
///
/// Gets or sets the operation servers defined in the OpenAPI spec.
///
/// The operation servers
private IReadOnlyDictionary>> _operationServers;
#endregion Private Members
#region Constructors
///
/// Initializes a new instance of the class
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
public Configuration()
{
Proxy = null;
UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp");
BasePath = "https://brecaltest.bsmd-emswe.eu";
DefaultHeaders = new ConcurrentDictionary();
ApiKey = new ConcurrentDictionary();
ApiKeyPrefix = new ConcurrentDictionary();
Servers = new List>()
{
{
new Dictionary {
{"url", "https://brecaltest.bsmd-emswe.eu"},
{"description", "Test server hosted on vcup"},
}
}
};
OperationServers = new Dictionary>>()
{
};
// Setting Timeout has side effects (forces ApiClient creation).
Timeout = 100000;
}
///
/// Initializes a new instance of the class
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
public Configuration(
IDictionary defaultHeaders,
IDictionary apiKey,
IDictionary apiKeyPrefix,
string basePath = "https://brecaltest.bsmd-emswe.eu") : this()
{
if (string.IsNullOrWhiteSpace(basePath))
throw new ArgumentException("The provided basePath is invalid.", "basePath");
if (defaultHeaders == null)
throw new ArgumentNullException("defaultHeaders");
if (apiKey == null)
throw new ArgumentNullException("apiKey");
if (apiKeyPrefix == null)
throw new ArgumentNullException("apiKeyPrefix");
BasePath = basePath;
foreach (var keyValuePair in defaultHeaders)
{
DefaultHeaders.Add(keyValuePair);
}
foreach (var keyValuePair in apiKey)
{
ApiKey.Add(keyValuePair);
}
foreach (var keyValuePair in apiKeyPrefix)
{
ApiKeyPrefix.Add(keyValuePair);
}
}
#endregion Constructors
#region Properties
///
/// Gets or sets the base path for API access.
///
public virtual string BasePath
{
get { return _basePath; }
set { _basePath = value; }
}
///
/// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false.
///
public virtual bool UseDefaultCredentials
{
get { return _useDefaultCredentials; }
set { _useDefaultCredentials = value; }
}
///
/// Gets or sets the default header.
///
[Obsolete("Use DefaultHeaders instead.")]
public virtual IDictionary DefaultHeader
{
get
{
return DefaultHeaders;
}
set
{
DefaultHeaders = value;
}
}
///
/// Gets or sets the default headers.
///
public virtual IDictionary DefaultHeaders { get; set; }
///
/// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds.
///
public virtual int Timeout { get; set; }
///
/// Gets or sets the proxy
///
/// Proxy.
public virtual WebProxy Proxy { get; set; }
///
/// Gets or sets the HTTP user agent.
///
/// Http user agent.
public virtual string UserAgent { get; set; }
///
/// Gets or sets the username (HTTP basic authentication).
///
/// The username.
public virtual string Username { get; set; }
///
/// Gets or sets the password (HTTP basic authentication).
///
/// The password.
public virtual string Password { get; set; }
///
/// Gets the API key with prefix.
///
/// API key identifier (authentication scheme).
/// API key with prefix.
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
{
string apiKeyValue;
ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue);
string apiKeyPrefix;
if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix))
{
return apiKeyPrefix + " " + apiKeyValue;
}
return apiKeyValue;
}
///
/// Gets or sets certificate collection to be sent with requests.
///
/// X509 Certificate collection.
public X509CertificateCollection ClientCertificates { get; set; }
///
/// Gets or sets the access token for OAuth2 authentication.
///
/// This helper property simplifies code generation.
///
/// The access token.
public virtual string AccessToken { get; set; }
///
/// Gets or sets the temporary folder path to store the files downloaded from the server.
///
/// Folder path.
public virtual string TempFolderPath
{
get { return _tempFolderPath; }
set
{
if (string.IsNullOrEmpty(value))
{
_tempFolderPath = Path.GetTempPath();
return;
}
// create the directory if it does not exist
if (!Directory.Exists(value))
{
Directory.CreateDirectory(value);
}
// check if the path contains directory separator at the end
if (value[value.Length - 1] == Path.DirectorySeparatorChar)
{
_tempFolderPath = value;
}
else
{
_tempFolderPath = value + Path.DirectorySeparatorChar;
}
}
}
///
/// Gets or sets the date time format used when serializing in the ApiClient
/// By default, it's set to ISO 8601 - "o", for others see:
/// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
/// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
/// No validation is done to ensure that the string you're providing is valid
///
/// The DateTimeFormat string
public virtual string DateTimeFormat
{
get { return _dateTimeFormat; }
set
{
if (string.IsNullOrEmpty(value))
{
// Never allow a blank or null string, go back to the default
_dateTimeFormat = ISO8601_DATETIME_FORMAT;
return;
}
// Caution, no validation when you choose date time format other than ISO 8601
// Take a look at the above links
_dateTimeFormat = value;
}
}
///
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
///
/// Whatever you set here will be prepended to the value defined in AddApiKey.
///
/// An example invocation here might be:
///
/// ApiKeyPrefix["Authorization"] = "Bearer";
///
/// … where ApiKey["Authorization"] would then be used to set the value of your bearer token.
///
///
/// OAuth2 workflows should set tokens via AccessToken.
///
///
/// The prefix of the API key.
public virtual IDictionary ApiKeyPrefix
{
get { return _apiKeyPrefix; }
set
{
if (value == null)
{
throw new InvalidOperationException("ApiKeyPrefix collection may not be null.");
}
_apiKeyPrefix = value;
}
}
///
/// Gets or sets the API key based on the authentication name.
///
/// The API key.
public virtual IDictionary ApiKey
{
get { return _apiKey; }
set
{
if (value == null)
{
throw new InvalidOperationException("ApiKey collection may not be null.");
}
_apiKey = value;
}
}
///
/// Gets or sets the servers.
///
/// The servers.
public virtual IList> Servers
{
get { return _servers; }
set
{
if (value == null)
{
throw new InvalidOperationException("Servers may not be null.");
}
_servers = value;
}
}
///
/// Gets or sets the operation servers.
///
/// The operation servers.
public virtual IReadOnlyDictionary>> OperationServers
{
get { return _operationServers; }
set
{
if (value == null)
{
throw new InvalidOperationException("Operation servers may not be null.");
}
_operationServers = value;
}
}
///
/// Returns URL based on server settings without providing values
/// for the variables
///
/// Array index of the server settings.
/// The server URL.
public string GetServerUrl(int index)
{
return GetServerUrl(Servers, index, null);
}
///
/// Returns URL based on server settings.
///
/// Array index of the server settings.
/// Dictionary of the variables and the corresponding values.
/// The server URL.
public string GetServerUrl(int index, Dictionary inputVariables)
{
return GetServerUrl(Servers, index, inputVariables);
}
///
/// Returns URL based on operation server settings.
///
/// Operation associated with the request path.
/// Array index of the server settings.
/// The operation server URL.
public string GetOperationServerUrl(string operation, int index)
{
return GetOperationServerUrl(operation, index, null);
}
///
/// Returns URL based on operation server settings.
///
/// Operation associated with the request path.
/// Array index of the server settings.
/// Dictionary of the variables and the corresponding values.
/// The operation server URL.
public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables)
{
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
{
return GetServerUrl(operationServer, index, inputVariables);
}
return null;
}
///
/// Returns URL based on server settings.
///
/// Dictionary of server settings.
/// Array index of the server settings.
/// Dictionary of the variables and the corresponding values.
/// The server URL.
private string GetServerUrl(IList> servers, int index, Dictionary inputVariables)
{
if (index < 0 || index >= servers.Count)
{
throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}.");
}
if (inputVariables == null)
{
inputVariables = new Dictionary();
}
IReadOnlyDictionary server = servers[index];
string url = (string)server["url"];
if (server.ContainsKey("variables"))
{
// go through each variable and assign a value
foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"])
{
IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value);
if (inputVariables.ContainsKey(variable.Key))
{
if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key]))
{
url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]);
}
else
{
throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}");
}
}
else
{
// use default value
url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]);
}
}
}
return url;
}
///
/// Gets and Sets the RemoteCertificateValidationCallback
///
public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
#region Methods
///
/// Returns a string with essential information for debugging.
///
public static string ToDebugReport()
{
string report = "C# SDK (BreCalClient.misc) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 0.6.0\n";
report += " SDK Package Version: 1.0.0\n";
return report;
}
///
/// Add Api Key Header.
///
/// Api Key name.
/// Api Key value.
///
public void AddApiKey(string key, string value)
{
ApiKey[key] = value;
}
///
/// Sets the API key prefix.
///
/// Api Key name.
/// Api Key value.
public void AddApiKeyPrefix(string key, string value)
{
ApiKeyPrefix[key] = value;
}
#endregion Methods
#region Static Members
///
/// Merge configurations.
///
/// First configuration.
/// Second configuration.
/// Merged configuration.
public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second)
{
if (second == null) return first ?? GlobalConfiguration.Instance;
Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value;
foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value;
foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value;
var config = new Configuration
{
ApiKey = apiKey,
ApiKeyPrefix = apiKeyPrefix,
DefaultHeaders = defaultHeaders,
BasePath = second.BasePath ?? first.BasePath,
Timeout = second.Timeout,
Proxy = second.Proxy ?? first.Proxy,
UserAgent = second.UserAgent ?? first.UserAgent,
Username = second.Username ?? first.Username,
Password = second.Password ?? first.Password,
AccessToken = second.AccessToken ?? first.AccessToken,
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
UseDefaultCredentials = second.UseDefaultCredentials,
RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
#endregion Static Members
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// A delegate to ExceptionFactory method
///
/// Method name
/// Response
/// Exceptions
public delegate Exception ExceptionFactory(string methodName, IApiResponse response);
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// provides a compile-time extension point for globally configuring
/// API Clients.
///
///
/// A customized implementation via partial class may reside in another file and may
/// be excluded from automatic generation via a .openapi-generator-ignore file.
///
public partial class GlobalConfiguration : Configuration
{
#region Private Members
private static readonly object GlobalConfigSync = new { };
private static IReadableConfiguration _globalConfiguration;
#endregion Private Members
#region Constructors
///
private GlobalConfiguration()
{
}
///
public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath)
{
}
static GlobalConfiguration()
{
Instance = new GlobalConfiguration();
}
#endregion Constructors
///
/// Gets or sets the default Configuration.
///
/// Configuration.
public static IReadableConfiguration Instance
{
get { return _globalConfiguration; }
set
{
lock (GlobalConfigSync)
{
_globalConfiguration = value;
}
}
}
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// Http methods supported by swagger
///
public enum HttpMethod
{
/// HTTP GET request.
Get,
/// HTTP POST request.
Post,
/// HTTP PUT request.
Put,
/// HTTP DELETE request.
Delete,
/// HTTP HEAD request.
Head,
/// HTTP OPTIONS request.
Options,
/// HTTP PATCH request.
Patch
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// Represents configuration aspects required to interact with the API endpoints.
///
public interface IApiAccessor
{
///
/// Gets or sets the configuration object
///
/// An instance of the Configuration
IReadableConfiguration Configuration { get; set; }
///
/// Gets the base path of the API client.
///
/// The base path
string GetBasePath();
///
/// Provides a factory method hook for the creation of exceptions.
///
ExceptionFactory ExceptionFactory { get; set; }
}
}
/*
* Bremen calling API
*
* Administer DEBRE ship calls, times and notifications
*
* The version of the OpenAPI document: 0.6.0
* Contact: info@textbausteine.net
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace BreCalClient.misc.Client
{
///
/// Contract for Asynchronous RESTful API interactions.
///
/// This interface allows consumers to provide a custom API accessor client.
///
public interface IAsynchronousClient
{
///
/// Executes a non-blocking call to some using the GET http verb.
///
/// The relative path to invoke.
/// The request parameters to pass along to the client.
/// Per-request configurable settings.
/// Cancellation Token to cancel the request.
/// The return type.
/// A task eventually representing the response data, decorated with
Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// Executes a non-blocking call to some using the POST http verb.
///
/// The relative path to invoke.
/// The request parameters to pass along to the client.
/// Per-request configurable settings.
/// Cancellation Token to cancel the request.
/// The return type.
/// A task eventually representing the response data, decorated with
Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///