2967 lines
141 KiB
C#
2967 lines
141 KiB
C#
//----------------------
|
|
// <auto-generated>
|
|
// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
|
|
// </auto-generated>
|
|
//----------------------
|
|
|
|
#nullable enable
|
|
|
|
using System.CodeDom.Compiler;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Globalization;
|
|
using System.Net.Http.Headers;
|
|
using System.Reflection;
|
|
using System.Runtime.Serialization;
|
|
using System.Text;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
|
|
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
|
|
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
|
|
#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
|
|
#pragma warning disable 612 // Disable "CS0612 '...' is obsolete"
|
|
#pragma warning disable 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null"
|
|
#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
|
|
#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
|
|
#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
|
|
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
|
|
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
|
|
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
|
|
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"
|
|
#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)."
|
|
|
|
namespace VisaApiClient
|
|
{
|
|
using System = System;
|
|
|
|
[GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial interface IClient : IClientBase
|
|
{
|
|
/// <summary>
|
|
/// Adds applicant with user account
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task RegisterAsync(RegisterApplicantRequest? body);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Adds applicant with user account
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task RegisterAsync(RegisterApplicantRequest? body, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Adds approving authority with user account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task RegisterAuthorityAsync(RegisterRequest? body);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Adds approving authority with user account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task RegisterAuthorityAsync(RegisterRequest? body, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns list of authority accounts
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ICollection<UserModel>> GetAuthorityAccountsAsync();
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns list of authority accounts
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ICollection<UserModel>> GetAuthorityAccountsAsync(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Changes authority's account authentication data
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task ChangeAuthorityAuthDataAsync(ChangeUserAuthDataRequest? body);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Changes authority's account authentication data
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task ChangeAuthorityAuthDataAsync(ChangeUserAuthDataRequest? body, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns JWT-token for authentication
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<AuthToken> LoginAsync(string? email, string? password);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns JWT-token for authentication
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<AuthToken> LoginAsync(string? email, string? password, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Removes authority's account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task RemoveAuthorityAccountAsync(Guid authorityAccountId);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Removes authority's account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task RemoveAuthorityAccountAsync(Guid authorityAccountId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns applicant info
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ApplicantModel> GetApplicantAsync();
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns applicant info
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ApplicantModel> GetApplicantAsync(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns pending applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ICollection<VisaApplicationPreview>> GetPendingAsync();
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns pending applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ICollection<VisaApplicationPreview>> GetPendingAsync(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<VisaApplicationModel> GetApplicationForAuthorityAsync(Guid applicationId);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<VisaApplicationModel> GetApplicationForAuthorityAsync(Guid applicationId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<VisaApplicationModel> GetApplicationForApplicantAsync(Guid applicationId);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<VisaApplicationModel> GetApplicationForApplicantAsync(Guid applicationId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns all applications of one applicant
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns applications of authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ICollection<VisaApplicationPreview>> GetApplicationsForApplicantAsync();
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns all applications of one applicant
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns applications of authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<ICollection<VisaApplicationPreview>> GetApplicationsForApplicantAsync(CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Adds new application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Adds application for authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task CreateApplicationAsync(VisaApplicationCreateRequest? body);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Adds new application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Adds application for authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task CreateApplicationAsync(VisaApplicationCreateRequest? body, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Sets application status to closed
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task CloseApplicationAsync(Guid applicationId);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Sets application status to closed
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task CloseApplicationAsync(Guid applicationId, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Approve or reject applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task SetStatusFromAuthorityAsync(Guid applicationId, AuthorityRequestStatuses? status);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Approve or reject applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task SetStatusFromAuthorityAsync(Guid applicationId, AuthorityRequestStatuses? status, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<FileResponse> DownloadApplicationForApplicantAsync(Guid applicationId);
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
Task<FileResponse> DownloadApplicationForApplicantAsync(Guid applicationId, CancellationToken cancellationToken);
|
|
|
|
}
|
|
|
|
[GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class Client : IClient
|
|
{
|
|
#pragma warning disable 8618
|
|
private string _baseUrl;
|
|
#pragma warning restore 8618
|
|
|
|
private HttpClient _httpClient;
|
|
private static Lazy<JsonSerializerSettings> _settings = new Lazy<JsonSerializerSettings>(CreateSerializerSettings, true);
|
|
private JsonSerializerSettings _instanceSettings;
|
|
|
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
|
public Client(string baseUrl, HttpClient httpClient)
|
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
|
{
|
|
BaseUrl = baseUrl;
|
|
_httpClient = httpClient;
|
|
Initialize();
|
|
}
|
|
|
|
private static JsonSerializerSettings CreateSerializerSettings()
|
|
{
|
|
var settings = new JsonSerializerSettings();
|
|
UpdateJsonSerializerSettings(settings);
|
|
return settings;
|
|
}
|
|
|
|
public string BaseUrl
|
|
{
|
|
get { return _baseUrl; }
|
|
set
|
|
{
|
|
_baseUrl = value;
|
|
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
|
|
_baseUrl += '/';
|
|
}
|
|
}
|
|
|
|
protected JsonSerializerSettings JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } }
|
|
|
|
static partial void UpdateJsonSerializerSettings(JsonSerializerSettings settings);
|
|
|
|
partial void Initialize();
|
|
|
|
/// <summary>
|
|
/// Adds applicant with user account
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task RegisterAsync(RegisterApplicantRequest? body)
|
|
{
|
|
return RegisterAsync(body, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Adds applicant with user account
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task RegisterAsync(RegisterApplicantRequest? body, CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
var json_ = JsonConvert.SerializeObject(body, JsonSerializerSettings);
|
|
var content_ = new StringContent(json_);
|
|
content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
|
request_.Content = content_;
|
|
request_.Method = new HttpMethod("POST");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/register"
|
|
urlBuilder_.Append("users/register");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 400)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds approving authority with user account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task RegisterAuthorityAsync(RegisterRequest? body)
|
|
{
|
|
return RegisterAuthorityAsync(body, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Adds approving authority with user account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task RegisterAuthorityAsync(RegisterRequest? body, CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
var json_ = JsonConvert.SerializeObject(body, JsonSerializerSettings);
|
|
var content_ = new StringContent(json_);
|
|
content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
|
request_.Content = content_;
|
|
request_.Method = new HttpMethod("POST");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/authorities"
|
|
urlBuilder_.Append("users/authorities");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 400)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns list of authority accounts
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<ICollection<UserModel>> GetAuthorityAccountsAsync()
|
|
{
|
|
return GetAuthorityAccountsAsync(CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns list of authority accounts
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<ICollection<UserModel>> GetAuthorityAccountsAsync(CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/authorities"
|
|
urlBuilder_.Append("users/authorities");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ICollection<UserModel>>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Changes authority's account authentication data
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task ChangeAuthorityAuthDataAsync(ChangeUserAuthDataRequest? body)
|
|
{
|
|
return ChangeAuthorityAuthDataAsync(body, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Changes authority's account authentication data
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task ChangeAuthorityAuthDataAsync(ChangeUserAuthDataRequest? body, CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
var json_ = JsonConvert.SerializeObject(body, JsonSerializerSettings);
|
|
var content_ = new StringContent(json_);
|
|
content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
|
request_.Content = content_;
|
|
request_.Method = new HttpMethod("PUT");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/authorities"
|
|
urlBuilder_.Append("users/authorities");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 400)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns JWT-token for authentication
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<AuthToken> LoginAsync(string? email, string? password)
|
|
{
|
|
return LoginAsync(email, password, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns JWT-token for authentication
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<AuthToken> LoginAsync(string? email, string? password, CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/login"
|
|
urlBuilder_.Append("users/login");
|
|
urlBuilder_.Append('?');
|
|
if (email != null)
|
|
{
|
|
urlBuilder_.Append(Uri.EscapeDataString("email")).Append('=').Append(Uri.EscapeDataString(ConvertToString(email, CultureInfo.InvariantCulture))).Append('&');
|
|
}
|
|
if (password != null)
|
|
{
|
|
urlBuilder_.Append(Uri.EscapeDataString("password")).Append('=').Append(Uri.EscapeDataString(ConvertToString(password, CultureInfo.InvariantCulture))).Append('&');
|
|
}
|
|
urlBuilder_.Length--;
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<AuthToken>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes authority's account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task RemoveAuthorityAccountAsync(Guid authorityAccountId)
|
|
{
|
|
return RemoveAuthorityAccountAsync(authorityAccountId, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Removes authority's account
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for admins
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task RemoveAuthorityAccountAsync(Guid authorityAccountId, CancellationToken cancellationToken)
|
|
{
|
|
if (authorityAccountId == null)
|
|
throw new ArgumentNullException("authorityAccountId");
|
|
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("DELETE");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/authorities/{authorityAccountId}"
|
|
urlBuilder_.Append("users/authorities/");
|
|
urlBuilder_.Append(Uri.EscapeDataString(ConvertToString(authorityAccountId, CultureInfo.InvariantCulture)));
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns applicant info
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<ApplicantModel> GetApplicantAsync()
|
|
{
|
|
return GetApplicantAsync(CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns applicant info
|
|
/// </summary>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<ApplicantModel> GetApplicantAsync(CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "users/applicant"
|
|
urlBuilder_.Append("users/applicant");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ApplicantModel>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns pending applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<ICollection<VisaApplicationPreview>> GetPendingAsync()
|
|
{
|
|
return GetPendingAsync(CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns pending applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<ICollection<VisaApplicationPreview>> GetPendingAsync(CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "visaApplications/pending"
|
|
urlBuilder_.Append("visaApplications/pending");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ICollection<VisaApplicationPreview>>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<VisaApplicationModel> GetApplicationForAuthorityAsync(Guid applicationId)
|
|
{
|
|
return GetApplicationForAuthorityAsync(applicationId, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for approving authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<VisaApplicationModel> GetApplicationForAuthorityAsync(Guid applicationId, CancellationToken cancellationToken)
|
|
{
|
|
if (applicationId == null)
|
|
throw new ArgumentNullException("applicationId");
|
|
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "forAuthority/{applicationId}"
|
|
urlBuilder_.Append("forAuthority/");
|
|
urlBuilder_.Append(Uri.EscapeDataString(ConvertToString(applicationId, CultureInfo.InvariantCulture)));
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<VisaApplicationModel>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 409)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<VisaApplicationModel> GetApplicationForApplicantAsync(Guid applicationId)
|
|
{
|
|
return GetApplicationForApplicantAsync(applicationId, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<VisaApplicationModel> GetApplicationForApplicantAsync(Guid applicationId, CancellationToken cancellationToken)
|
|
{
|
|
if (applicationId == null)
|
|
throw new ArgumentNullException("applicationId");
|
|
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "forApplicant/{applicationId}"
|
|
urlBuilder_.Append("forApplicant/");
|
|
urlBuilder_.Append(Uri.EscapeDataString(ConvertToString(applicationId, CultureInfo.InvariantCulture)));
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<VisaApplicationModel>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns all applications of one applicant
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns applications of authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<ICollection<VisaApplicationPreview>> GetApplicationsForApplicantAsync()
|
|
{
|
|
return GetApplicationsForApplicantAsync(CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns all applications of one applicant
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns applications of authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<ICollection<VisaApplicationPreview>> GetApplicationsForApplicantAsync(CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "visaApplications/ofApplicant"
|
|
urlBuilder_.Append("visaApplications/ofApplicant");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ICollection<VisaApplicationPreview>>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
return objectResponse_.Object;
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds new application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Adds application for authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task CreateApplicationAsync(VisaApplicationCreateRequest? body)
|
|
{
|
|
return CreateApplicationAsync(body, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Adds new application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Adds application for authorized applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task CreateApplicationAsync(VisaApplicationCreateRequest? body, CancellationToken cancellationToken)
|
|
{
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
var json_ = JsonConvert.SerializeObject(body, JsonSerializerSettings);
|
|
var content_ = new StringContent(json_);
|
|
content_.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
|
request_.Content = content_;
|
|
request_.Method = new HttpMethod("POST");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "visaApplications"
|
|
urlBuilder_.Append("visaApplications");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 400)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets application status to closed
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task CloseApplicationAsync(Guid applicationId)
|
|
{
|
|
return CloseApplicationAsync(applicationId, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Sets application status to closed
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task CloseApplicationAsync(Guid applicationId, CancellationToken cancellationToken)
|
|
{
|
|
if (applicationId == null)
|
|
throw new ArgumentNullException("applicationId");
|
|
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
|
|
request_.Method = new HttpMethod("PATCH");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "visaApplications/{applicationId}"
|
|
urlBuilder_.Append("visaApplications/");
|
|
urlBuilder_.Append(Uri.EscapeDataString(ConvertToString(applicationId, CultureInfo.InvariantCulture)));
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 400)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Approve or reject applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task SetStatusFromAuthorityAsync(Guid applicationId, AuthorityRequestStatuses? status)
|
|
{
|
|
return SetStatusFromAuthorityAsync(applicationId, status, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Approve or reject applications
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for authorities
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task SetStatusFromAuthorityAsync(Guid applicationId, AuthorityRequestStatuses? status, CancellationToken cancellationToken)
|
|
{
|
|
if (applicationId == null)
|
|
throw new ArgumentNullException("applicationId");
|
|
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
|
|
request_.Method = new HttpMethod("PATCH");
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "visaApplications/approving/{applicationId}"
|
|
urlBuilder_.Append("visaApplications/approving/");
|
|
urlBuilder_.Append(Uri.EscapeDataString(ConvertToString(applicationId, CultureInfo.InvariantCulture)));
|
|
urlBuilder_.Append('?');
|
|
if (status != null)
|
|
{
|
|
urlBuilder_.Append(Uri.EscapeDataString("status")).Append('=').Append(Uri.EscapeDataString(ConvertToString(status, CultureInfo.InvariantCulture))).Append('&');
|
|
}
|
|
urlBuilder_.Length--;
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 409)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual Task<FileResponse> DownloadApplicationForApplicantAsync(Guid applicationId)
|
|
{
|
|
return DownloadApplicationForApplicantAsync(applicationId, CancellationToken.None);
|
|
}
|
|
|
|
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
|
/// <summary>
|
|
/// Returns application
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Accessible only for applicant
|
|
/// </remarks>
|
|
/// <returns>Success</returns>
|
|
/// <exception cref="ApiException">A server side error occurred.</exception>
|
|
public virtual async Task<FileResponse> DownloadApplicationForApplicantAsync(Guid applicationId, CancellationToken cancellationToken)
|
|
{
|
|
if (applicationId == null)
|
|
throw new ArgumentNullException("applicationId");
|
|
|
|
var client_ = _httpClient;
|
|
var disposeClient_ = false;
|
|
try
|
|
{
|
|
using (var request_ = await CreateHttpRequestMessageAsync(cancellationToken).ConfigureAwait(false))
|
|
{
|
|
request_.Method = new HttpMethod("GET");
|
|
request_.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/octet-stream"));
|
|
|
|
var urlBuilder_ = new StringBuilder();
|
|
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
|
|
// Operation Path: "forApplicant/{applicationId}/download"
|
|
urlBuilder_.Append("forApplicant/");
|
|
urlBuilder_.Append(Uri.EscapeDataString(ConvertToString(applicationId, CultureInfo.InvariantCulture)));
|
|
urlBuilder_.Append("/download");
|
|
|
|
await PrepareRequestAsync(client_, request_, urlBuilder_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var url_ = urlBuilder_.ToString();
|
|
request_.RequestUri = new Uri(url_, UriKind.RelativeOrAbsolute);
|
|
|
|
await PrepareRequestAsync(client_, request_, url_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var response_ = await client_.SendAsync(request_, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
|
var disposeResponse_ = true;
|
|
try
|
|
{
|
|
var headers_ = new Dictionary<string, IEnumerable<string>>();
|
|
foreach (var item_ in response_.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
if (response_.Content != null && response_.Content.Headers != null)
|
|
{
|
|
foreach (var item_ in response_.Content.Headers)
|
|
headers_[item_.Key] = item_.Value;
|
|
}
|
|
|
|
await ProcessResponseAsync(client_, response_, cancellationToken).ConfigureAwait(false);
|
|
|
|
var status_ = (int)response_.StatusCode;
|
|
if (status_ == 200 || status_ == 206)
|
|
{
|
|
var responseStream_ = response_.Content == null ? Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
|
var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_);
|
|
disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse
|
|
return fileResponse_;
|
|
}
|
|
else
|
|
if (status_ == 401)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 403)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
if (status_ == 404)
|
|
{
|
|
var objectResponse_ = await ReadObjectResponseAsync<ProblemDetails>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
|
if (objectResponse_.Object == null)
|
|
{
|
|
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
|
}
|
|
throw new ApiException<ProblemDetails>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
|
|
}
|
|
else
|
|
{
|
|
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeResponse_)
|
|
response_.Dispose();
|
|
}
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (disposeClient_)
|
|
client_.Dispose();
|
|
}
|
|
}
|
|
|
|
protected struct ObjectResponseResult<T>
|
|
{
|
|
public ObjectResponseResult(T responseObject, string responseText)
|
|
{
|
|
this.Object = responseObject;
|
|
this.Text = responseText;
|
|
}
|
|
|
|
public T Object { get; }
|
|
|
|
public string Text { get; }
|
|
}
|
|
|
|
public bool ReadResponseAsString { get; set; }
|
|
|
|
protected virtual async Task<ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)
|
|
{
|
|
if (response == null || response.Content == null)
|
|
{
|
|
return new ObjectResponseResult<T>(default(T)!, string.Empty);
|
|
}
|
|
|
|
if (ReadResponseAsString)
|
|
{
|
|
var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
try
|
|
{
|
|
var typedBody = JsonConvert.DeserializeObject<T>(responseText, JsonSerializerSettings);
|
|
return new ObjectResponseResult<T>(typedBody!, responseText);
|
|
}
|
|
catch (JsonException exception)
|
|
{
|
|
var message = "Could not deserialize the response body string as " + typeof(T).FullName + ".";
|
|
throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
|
|
using (var streamReader = new StreamReader(responseStream))
|
|
using (var jsonTextReader = new JsonTextReader(streamReader))
|
|
{
|
|
var serializer = JsonSerializer.Create(JsonSerializerSettings);
|
|
var typedBody = serializer.Deserialize<T>(jsonTextReader);
|
|
return new ObjectResponseResult<T>(typedBody!, string.Empty);
|
|
}
|
|
}
|
|
catch (JsonException exception)
|
|
{
|
|
var message = "Could not deserialize the response body stream as " + typeof(T).FullName + ".";
|
|
throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception);
|
|
}
|
|
}
|
|
}
|
|
|
|
private string ConvertToString(object? value, CultureInfo cultureInfo)
|
|
{
|
|
if (value == null)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
if (value is Enum)
|
|
{
|
|
var name = Enum.GetName(value.GetType(), value);
|
|
if (name != null)
|
|
{
|
|
var field = IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
|
|
if (field != null)
|
|
{
|
|
var attribute = CustomAttributeExtensions.GetCustomAttribute(field, typeof(EnumMemberAttribute))
|
|
as EnumMemberAttribute;
|
|
if (attribute != null)
|
|
{
|
|
return attribute.Value != null ? attribute.Value : name;
|
|
}
|
|
}
|
|
|
|
var converted = Convert.ToString(Convert.ChangeType(value, Enum.GetUnderlyingType(value.GetType()), cultureInfo));
|
|
return converted == null ? string.Empty : converted;
|
|
}
|
|
}
|
|
else if (value is bool)
|
|
{
|
|
return Convert.ToString((bool)value, cultureInfo).ToLowerInvariant();
|
|
}
|
|
else if (value is byte[])
|
|
{
|
|
return Convert.ToBase64String((byte[]) value);
|
|
}
|
|
else if (value is string[])
|
|
{
|
|
return string.Join(",", (string[])value);
|
|
}
|
|
else if (value.GetType().IsArray)
|
|
{
|
|
var valueArray = (Array)value;
|
|
var valueTextArray = new string[valueArray.Length];
|
|
for (var i = 0; i < valueArray.Length; i++)
|
|
{
|
|
valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo);
|
|
}
|
|
return string.Join(",", valueTextArray);
|
|
}
|
|
|
|
var result = Convert.ToString(value, cultureInfo);
|
|
return result == null ? "" : result;
|
|
}
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class AddressModel
|
|
{
|
|
[JsonProperty("country", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string Country { get; set; } = default!;
|
|
|
|
[JsonProperty("city", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string City { get; set; } = default!;
|
|
|
|
[JsonProperty("street", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(100, MinimumLength = 1)]
|
|
public string Street { get; set; } = default!;
|
|
|
|
[JsonProperty("building", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(10, MinimumLength = 1)]
|
|
public string Building { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ApplicantModel
|
|
{
|
|
[JsonProperty("name", Required = Required.Always)]
|
|
[Required]
|
|
public NameModel Name { get; set; } = new NameModel();
|
|
|
|
[JsonProperty("passport", Required = Required.Always)]
|
|
[Required]
|
|
public PassportModel Passport { get; set; } = new PassportModel();
|
|
|
|
[JsonProperty("birthDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset BirthDate { get; set; } = default!;
|
|
|
|
[JsonProperty("countryOfBirth", Required = Required.Always)]
|
|
[Required]
|
|
public string CountryOfBirth { get; set; } = default!;
|
|
|
|
[JsonProperty("cityOfBirth", Required = Required.Always)]
|
|
[Required]
|
|
public string CityOfBirth { get; set; } = default!;
|
|
|
|
[JsonProperty("citizenship", Required = Required.Always)]
|
|
[Required]
|
|
public string Citizenship { get; set; } = default!;
|
|
|
|
[JsonProperty("citizenshipByBirth", Required = Required.Always)]
|
|
[Required]
|
|
public string CitizenshipByBirth { get; set; } = default!;
|
|
|
|
[JsonProperty("gender", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public Gender Gender { get; set; } = default!;
|
|
|
|
[JsonProperty("maritalStatus", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public MaritalStatus MaritalStatus { get; set; } = default!;
|
|
|
|
[JsonProperty("fatherName", Required = Required.Always)]
|
|
[Required]
|
|
public NameModel FatherName { get; set; } = new NameModel();
|
|
|
|
[JsonProperty("motherName", Required = Required.Always)]
|
|
[Required]
|
|
public NameModel MotherName { get; set; } = new NameModel();
|
|
|
|
[JsonProperty("jobTitle", Required = Required.Always)]
|
|
[Required]
|
|
public string JobTitle { get; set; } = default!;
|
|
|
|
[JsonProperty("placeOfWork", Required = Required.Always)]
|
|
[Required]
|
|
public PlaceOfWorkModel PlaceOfWork { get; set; } = new PlaceOfWorkModel();
|
|
|
|
[JsonProperty("isNonResident", Required = Required.Always)]
|
|
public bool IsNonResident { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public enum ApplicationStatus
|
|
{
|
|
|
|
[EnumMember(Value = @"Pending")]
|
|
Pending = 0,
|
|
|
|
[EnumMember(Value = @"Approved")]
|
|
Approved = 1,
|
|
|
|
[EnumMember(Value = @"Rejected")]
|
|
Rejected = 2,
|
|
|
|
[EnumMember(Value = @"Closed")]
|
|
Closed = 3,
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class AuthData
|
|
{
|
|
[JsonProperty("email", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(254, MinimumLength = 1)]
|
|
public string Email { get; set; } = default!;
|
|
|
|
[JsonProperty("password", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(50, MinimumLength = 1)]
|
|
public string Password { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class AuthToken
|
|
{
|
|
[JsonProperty("token", Required = Required.Always)]
|
|
[Required]
|
|
public string Token { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public enum AuthorityRequestStatuses
|
|
{
|
|
|
|
[EnumMember(Value = @"Approved")]
|
|
Approved = 0,
|
|
|
|
[EnumMember(Value = @"Rejected")]
|
|
Rejected = 1,
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ChangeAuthData
|
|
{
|
|
[JsonProperty("email", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(254, MinimumLength = 1)]
|
|
public string Email { get; set; } = default!;
|
|
|
|
[JsonProperty("password", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
[StringLength(50)]
|
|
public string? Password { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ChangeUserAuthDataRequest
|
|
{
|
|
[JsonProperty("userId", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public Guid UserId { get; set; } = default!;
|
|
|
|
[JsonProperty("newAuthData", Required = Required.Always)]
|
|
[Required]
|
|
public ChangeAuthData NewAuthData { get; set; } = new ChangeAuthData();
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public enum Gender
|
|
{
|
|
|
|
[EnumMember(Value = @"Unknown")]
|
|
Unknown = 0,
|
|
|
|
[EnumMember(Value = @"Male")]
|
|
Male = 1,
|
|
|
|
[EnumMember(Value = @"Female")]
|
|
Female = 2,
|
|
|
|
[EnumMember(Value = @"Turkish")]
|
|
Turkish = 3,
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public enum MaritalStatus
|
|
{
|
|
|
|
[EnumMember(Value = @"Other")]
|
|
Other = 0,
|
|
|
|
[EnumMember(Value = @"Married")]
|
|
Married = 1,
|
|
|
|
[EnumMember(Value = @"Unmarried")]
|
|
Unmarried = 2,
|
|
|
|
[EnumMember(Value = @"Separated")]
|
|
Separated = 3,
|
|
|
|
[EnumMember(Value = @"WidowOrWidower")]
|
|
WidowOrWidower = 4,
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class NameModel
|
|
{
|
|
[JsonProperty("firstName", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(50, MinimumLength = 1)]
|
|
public string FirstName { get; set; } = default!;
|
|
|
|
[JsonProperty("surname", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(50, MinimumLength = 1)]
|
|
public string Surname { get; set; } = default!;
|
|
|
|
[JsonProperty("patronymic", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
[StringLength(50)]
|
|
public string? Patronymic { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class PassportModel
|
|
{
|
|
[JsonProperty("number", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(20, MinimumLength = 1)]
|
|
public string Number { get; set; } = default!;
|
|
|
|
[JsonProperty("issuer", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(200, MinimumLength = 1)]
|
|
public string Issuer { get; set; } = default!;
|
|
|
|
[JsonProperty("issueDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset IssueDate { get; set; } = default!;
|
|
|
|
[JsonProperty("expirationDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset ExpirationDate { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class PastVisaModel
|
|
{
|
|
[JsonProperty("issueDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset IssueDate { get; set; } = default!;
|
|
|
|
[JsonProperty("name", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string Name { get; set; } = default!;
|
|
|
|
[JsonProperty("expirationDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset ExpirationDate { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class PastVisitModel
|
|
{
|
|
[JsonProperty("startDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset StartDate { get; set; } = default!;
|
|
|
|
[JsonProperty("endDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset EndDate { get; set; } = default!;
|
|
|
|
[JsonProperty("destinationCountry", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string DestinationCountry { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class PermissionToDestCountryModel
|
|
{
|
|
[JsonProperty("expirationDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset ExpirationDate { get; set; } = default!;
|
|
|
|
[JsonProperty("issuer", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(200, MinimumLength = 1)]
|
|
public string Issuer { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class PlaceOfWorkModel
|
|
{
|
|
[JsonProperty("name", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(200, MinimumLength = 1)]
|
|
public string Name { get; set; } = default!;
|
|
|
|
[JsonProperty("address", Required = Required.Always)]
|
|
[Required]
|
|
public AddressModel Address { get; set; } = new AddressModel();
|
|
|
|
[JsonProperty("phoneNum", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(13, MinimumLength = 11)]
|
|
public string PhoneNum { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ProblemDetails
|
|
{
|
|
[JsonProperty("type", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public string? Type { get; set; } = default!;
|
|
|
|
[JsonProperty("title", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public string? Title { get; set; } = default!;
|
|
|
|
[JsonProperty("status", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public int? Status { get; set; } = default!;
|
|
|
|
[JsonProperty("detail", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public string? Detail { get; set; } = default!;
|
|
|
|
[JsonProperty("instance", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public string? Instance { get; set; } = default!;
|
|
|
|
private IDictionary<string, object>? _additionalProperties;
|
|
|
|
[JsonExtensionData]
|
|
public IDictionary<string, object> AdditionalProperties
|
|
{
|
|
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
|
|
set { _additionalProperties = value; }
|
|
}
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ReentryPermitModel
|
|
{
|
|
[JsonProperty("number", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(25, MinimumLength = 1)]
|
|
public string Number { get; set; } = default!;
|
|
|
|
[JsonProperty("expirationDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset ExpirationDate { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class RegisterApplicantRequest
|
|
{
|
|
[JsonProperty("registerRequest", Required = Required.Always)]
|
|
[Required]
|
|
public RegisterRequest RegisterRequest { get; set; } = new RegisterRequest();
|
|
|
|
[JsonProperty("applicantName", Required = Required.Always)]
|
|
[Required]
|
|
public NameModel ApplicantName { get; set; } = new NameModel();
|
|
|
|
[JsonProperty("passport", Required = Required.Always)]
|
|
[Required]
|
|
public PassportModel Passport { get; set; } = new PassportModel();
|
|
|
|
[JsonProperty("birthDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset BirthDate { get; set; } = default!;
|
|
|
|
[JsonProperty("cityOfBirth", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string CityOfBirth { get; set; } = default!;
|
|
|
|
[JsonProperty("countryOfBirth", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string CountryOfBirth { get; set; } = default!;
|
|
|
|
[JsonProperty("citizenship", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(30, MinimumLength = 1)]
|
|
public string Citizenship { get; set; } = default!;
|
|
|
|
[JsonProperty("citizenshipByBirth", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(30, MinimumLength = 1)]
|
|
public string CitizenshipByBirth { get; set; } = default!;
|
|
|
|
[JsonProperty("gender", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public Gender Gender { get; set; } = default!;
|
|
|
|
[JsonProperty("maritalStatus", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public MaritalStatus MaritalStatus { get; set; } = default!;
|
|
|
|
[JsonProperty("fatherName", Required = Required.Always)]
|
|
[Required]
|
|
public NameModel FatherName { get; set; } = new NameModel();
|
|
|
|
[JsonProperty("motherName", Required = Required.Always)]
|
|
[Required]
|
|
public NameModel MotherName { get; set; } = new NameModel();
|
|
|
|
[JsonProperty("jobTitle", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(50, MinimumLength = 1)]
|
|
public string JobTitle { get; set; } = default!;
|
|
|
|
[JsonProperty("placeOfWork", Required = Required.Always)]
|
|
[Required]
|
|
public PlaceOfWorkModel PlaceOfWork { get; set; } = new PlaceOfWorkModel();
|
|
|
|
[JsonProperty("isNonResident", Required = Required.Always)]
|
|
public bool IsNonResident { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class RegisterRequest
|
|
{
|
|
[JsonProperty("authData", Required = Required.Always)]
|
|
[Required]
|
|
public AuthData AuthData { get; set; } = new AuthData();
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public enum RequestedNumberOfEntries
|
|
{
|
|
|
|
[EnumMember(Value = @"Many")]
|
|
Many = 0,
|
|
|
|
[EnumMember(Value = @"One")]
|
|
One = 1,
|
|
|
|
[EnumMember(Value = @"Two")]
|
|
Two = 2,
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class UserModel
|
|
{
|
|
[JsonProperty("id", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public Guid Id { get; set; } = default!;
|
|
|
|
[JsonProperty("email", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(254, MinimumLength = 1)]
|
|
public string Email { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class VisaApplicationCreateRequest
|
|
{
|
|
[JsonProperty("reentryPermit", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public ReentryPermitModel? ReentryPermit { get; set; } = default!;
|
|
|
|
[JsonProperty("destinationCountry", Required = Required.Always)]
|
|
[Required]
|
|
[StringLength(70, MinimumLength = 1)]
|
|
public string DestinationCountry { get; set; } = default!;
|
|
|
|
[JsonProperty("visaCategory", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public VisaCategory VisaCategory { get; set; } = default!;
|
|
|
|
[JsonProperty("isForGroup", Required = Required.Always)]
|
|
public bool IsForGroup { get; set; } = default!;
|
|
|
|
[JsonProperty("requestedNumberOfEntries", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public RequestedNumberOfEntries RequestedNumberOfEntries { get; set; } = default!;
|
|
|
|
[JsonProperty("validDaysRequested", Required = Required.Always)]
|
|
[Range(0, 90)]
|
|
public int ValidDaysRequested { get; set; } = default!;
|
|
|
|
[JsonProperty("pastVisas", Required = Required.Always)]
|
|
[Required]
|
|
public ICollection<PastVisaModel> PastVisas { get; set; } = new Collection<PastVisaModel>();
|
|
|
|
[JsonProperty("permissionToDestCountry", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public PermissionToDestCountryModel? PermissionToDestCountry { get; set; } = default!;
|
|
|
|
[JsonProperty("pastVisits", Required = Required.Always)]
|
|
[Required]
|
|
public ICollection<PastVisitModel> PastVisits { get; set; } = new Collection<PastVisitModel>();
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class VisaApplicationModel
|
|
{
|
|
[JsonProperty("id", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public Guid Id { get; set; } = default!;
|
|
|
|
[JsonProperty("applicant", Required = Required.Always)]
|
|
[Required]
|
|
public ApplicantModel Applicant { get; set; } = new ApplicantModel();
|
|
|
|
[JsonProperty("status", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public ApplicationStatus Status { get; set; } = default!;
|
|
|
|
[JsonProperty("reentryPermit", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public ReentryPermitModel? ReentryPermit { get; set; } = default!;
|
|
|
|
[JsonProperty("destinationCountry", Required = Required.Always)]
|
|
[Required]
|
|
public string DestinationCountry { get; set; } = default!;
|
|
|
|
[JsonProperty("pastVisas", Required = Required.Always)]
|
|
[Required]
|
|
public ICollection<PastVisaModel> PastVisas { get; set; } = new Collection<PastVisaModel>();
|
|
|
|
[JsonProperty("permissionToDestCountry", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
|
|
public PermissionToDestCountryModel? PermissionToDestCountry { get; set; } = default!;
|
|
|
|
[JsonProperty("pastVisits", Required = Required.Always)]
|
|
[Required]
|
|
public ICollection<PastVisitModel> PastVisits { get; set; } = new Collection<PastVisitModel>();
|
|
|
|
[JsonProperty("visaCategory", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public VisaCategory VisaCategory { get; set; } = default!;
|
|
|
|
[JsonProperty("forGroup", Required = Required.Always)]
|
|
public bool ForGroup { get; set; } = default!;
|
|
|
|
[JsonProperty("requestedNumberOfEntries", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public RequestedNumberOfEntries RequestedNumberOfEntries { get; set; } = default!;
|
|
|
|
[JsonProperty("requestDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset RequestDate { get; set; } = default!;
|
|
|
|
[JsonProperty("validDaysRequested", Required = Required.Always)]
|
|
public int ValidDaysRequested { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class VisaApplicationPreview
|
|
{
|
|
[JsonProperty("id", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public Guid Id { get; set; } = default!;
|
|
|
|
[JsonProperty("status", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public ApplicationStatus Status { get; set; } = default!;
|
|
|
|
[JsonProperty("destinationCountry", Required = Required.Always)]
|
|
[Required]
|
|
public string DestinationCountry { get; set; } = default!;
|
|
|
|
[JsonProperty("visaCategory", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public VisaCategory VisaCategory { get; set; } = default!;
|
|
|
|
[JsonProperty("requestDate", Required = Required.Always)]
|
|
[Required(AllowEmptyStrings = true)]
|
|
public DateTimeOffset RequestDate { get; set; } = default!;
|
|
|
|
[JsonProperty("validDaysRequested", Required = Required.Always)]
|
|
public int ValidDaysRequested { get; set; } = default!;
|
|
|
|
}
|
|
|
|
[GeneratedCode("NJsonSchema", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public enum VisaCategory
|
|
{
|
|
|
|
[EnumMember(Value = @"Transit")]
|
|
Transit = 0,
|
|
|
|
[EnumMember(Value = @"ShortDated")]
|
|
ShortDated = 1,
|
|
|
|
}
|
|
|
|
[GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class FileResponse : IDisposable
|
|
{
|
|
private IDisposable? _client;
|
|
private IDisposable? _response;
|
|
|
|
public int StatusCode { get; private set; }
|
|
|
|
public IReadOnlyDictionary<string, IEnumerable<string>> Headers { get; private set; }
|
|
|
|
public Stream Stream { get; private set; }
|
|
|
|
public bool IsPartial
|
|
{
|
|
get { return StatusCode == 206; }
|
|
}
|
|
|
|
public FileResponse(int statusCode, IReadOnlyDictionary<string, IEnumerable<string>> headers, Stream stream, IDisposable? client, IDisposable? response)
|
|
{
|
|
StatusCode = statusCode;
|
|
Headers = headers;
|
|
Stream = stream;
|
|
_client = client;
|
|
_response = response;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Stream.Dispose();
|
|
if (_response != null)
|
|
_response.Dispose();
|
|
if (_client != null)
|
|
_client.Dispose();
|
|
}
|
|
}
|
|
|
|
|
|
[GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ApiException : Exception
|
|
{
|
|
public int StatusCode { get; private set; }
|
|
|
|
public string? Response { get; private set; }
|
|
|
|
public IReadOnlyDictionary<string, IEnumerable<string>> Headers { get; private set; }
|
|
|
|
public ApiException(string message, int statusCode, string? response, IReadOnlyDictionary<string, IEnumerable<string>> headers, Exception? innerException)
|
|
: base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException)
|
|
{
|
|
StatusCode = statusCode;
|
|
Response = response;
|
|
Headers = headers;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString());
|
|
}
|
|
}
|
|
|
|
[GeneratedCode("NSwag", "14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
|
public partial class ApiException<TResult> : ApiException
|
|
{
|
|
public TResult Result { get; private set; }
|
|
|
|
public ApiException(string message, int statusCode, string? response, IReadOnlyDictionary<string, IEnumerable<string>> headers, TResult result, Exception? innerException)
|
|
: base(message, statusCode, response, headers, innerException)
|
|
{
|
|
Result = result;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#pragma warning restore 108
|
|
#pragma warning restore 114
|
|
#pragma warning restore 472
|
|
#pragma warning restore 612
|
|
#pragma warning restore 1573
|
|
#pragma warning restore 1591
|
|
#pragma warning restore 8073
|
|
#pragma warning restore 3016
|
|
#pragma warning restore 8603
|
|
#pragma warning restore 8604
|
|
#pragma warning restore 8625
|