forked from ddrilling/AsbCloudServer
1487 lines
74 KiB
C#
1487 lines
74 KiB
C#
//----------------------
|
||
// <auto-generated>
|
||
// Generated using the NSwag toolchain v13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2)) (http://NSwag.org)
|
||
// </auto-generated>
|
||
//----------------------
|
||
|
||
#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 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?'"
|
||
|
||
namespace SyncDicts.AsbCloudApi
|
||
{
|
||
using System = global::System;
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
|
||
public partial class Client
|
||
{
|
||
private string _baseUrl = "";
|
||
private System.Net.Http.HttpClient _httpClient;
|
||
private System.Lazy<System.Text.Json.JsonSerializerOptions> _settings;
|
||
|
||
public Client(string baseUrl, System.Net.Http.HttpClient httpClient)
|
||
{
|
||
BaseUrl = baseUrl;
|
||
_httpClient = httpClient;
|
||
_settings = new System.Lazy<System.Text.Json.JsonSerializerOptions>(CreateSerializerSettings);
|
||
}
|
||
|
||
private System.Text.Json.JsonSerializerOptions CreateSerializerSettings()
|
||
{
|
||
var settings = new System.Text.Json.JsonSerializerOptions();
|
||
UpdateJsonSerializerSettings(settings);
|
||
return settings;
|
||
}
|
||
|
||
public string BaseUrl
|
||
{
|
||
get { return _baseUrl; }
|
||
set { _baseUrl = value; }
|
||
}
|
||
|
||
protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } }
|
||
|
||
partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings);
|
||
|
||
|
||
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
|
||
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
|
||
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
|
||
/// <summary>Аутентификация пользователя</summary>
|
||
/// <returns>новый токен</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task<UserTokenDto> AuthLoginAsync(AuthDto body)
|
||
{
|
||
return AuthLoginAsync(body, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Аутентификация пользователя</summary>
|
||
/// <returns>новый токен</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task<UserTokenDto> AuthLoginAsync(AuthDto body, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/auth/login");
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var content_ = new System.Net.Http.StringContent(System.Text.Json.JsonSerializer.Serialize(body, _settings.Value));
|
||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
var objectResponse_ = await ReadObjectResponseAsync<UserTokenDto>(response_, headers_, cancellationToken).ConfigureAwait(false);
|
||
if (objectResponse_.Object == null)
|
||
{
|
||
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
|
||
}
|
||
return objectResponse_.Object;
|
||
}
|
||
else
|
||
if (status_ == 400)
|
||
{
|
||
string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("\u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442", status_, responseText_, headers_, 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>Продление срока действия токена</summary>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task AuthRefreshAsync()
|
||
{
|
||
return AuthRefreshAsync(System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Продление срока действия токена</summary>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task AuthRefreshAsync(System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/auth/refresh");
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
request_.Method = new System.Net.Http.HttpMethod("GET");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <summary>Возвращает данные САУБ по скважине.
|
||
/// По умолчанию за последние 10 минут.</summary>
|
||
/// <param name="wellId">id скважины</param>
|
||
/// <param name="begin">дата начала выборки. По умолчанию: текущее время - intervalSec</param>
|
||
/// <param name="intervalSec">интервал времени даты начала выборки, секунды</param>
|
||
/// <param name="approxPointsCount">желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task<System.Collections.Generic.ICollection<DataSaubBaseDto>> ApiWellDataAsync(int wellId, System.DateTimeOffset? begin, int? intervalSec, int? approxPointsCount)
|
||
{
|
||
return ApiWellDataAsync(wellId, begin, intervalSec, approxPointsCount, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Возвращает данные САУБ по скважине.
|
||
/// По умолчанию за последние 10 минут.</summary>
|
||
/// <param name="wellId">id скважины</param>
|
||
/// <param name="begin">дата начала выборки. По умолчанию: текущее время - intervalSec</param>
|
||
/// <param name="intervalSec">интервал времени даты начала выборки, секунды</param>
|
||
/// <param name="approxPointsCount">желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<DataSaubBaseDto>> ApiWellDataAsync(int wellId, System.DateTimeOffset? begin, int? intervalSec, int? approxPointsCount, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (wellId == null)
|
||
throw new System.ArgumentNullException("wellId");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/well/{wellId}/data?");
|
||
urlBuilder_.Replace("{wellId}", System.Uri.EscapeDataString(ConvertToString(wellId, System.Globalization.CultureInfo.InvariantCulture)));
|
||
if (begin != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("begin") + "=").Append(System.Uri.EscapeDataString(begin.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
if (intervalSec != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("intervalSec") + "=").Append(System.Uri.EscapeDataString(ConvertToString(intervalSec, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
if (approxPointsCount != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("approxPointsCount") + "=").Append(System.Uri.EscapeDataString(ConvertToString(approxPointsCount, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
urlBuilder_.Length--;
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
request_.Method = new System.Net.Http.HttpMethod("GET");
|
||
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
var objectResponse_ = await ReadObjectResponseAsync<System.Collections.Generic.ICollection<DataSaubBaseDto>>(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
|
||
{
|
||
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>Выдает список сообщений по скважине</summary>
|
||
/// <param name="wellId">id скважины</param>
|
||
/// <param name="skip">для пагинации кол-во записей пропустить</param>
|
||
/// <param name="take">для пагинации кол-во записей</param>
|
||
/// <param name="categoryids">список категорий</param>
|
||
/// <param name="begin">дата начала</param>
|
||
/// <param name="end">окончание</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task<MessageDtoPaginationContainer> ApiWellMessageAsync(int wellId, int? skip, int? take, System.Collections.Generic.IEnumerable<int> categoryids, System.DateTimeOffset? begin, System.DateTimeOffset? end)
|
||
{
|
||
return ApiWellMessageAsync(wellId, skip, take, categoryids, begin, end, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Выдает список сообщений по скважине</summary>
|
||
/// <param name="wellId">id скважины</param>
|
||
/// <param name="skip">для пагинации кол-во записей пропустить</param>
|
||
/// <param name="take">для пагинации кол-во записей</param>
|
||
/// <param name="categoryids">список категорий</param>
|
||
/// <param name="begin">дата начала</param>
|
||
/// <param name="end">окончание</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task<MessageDtoPaginationContainer> ApiWellMessageAsync(int wellId, int? skip, int? take, System.Collections.Generic.IEnumerable<int> categoryids, System.DateTimeOffset? begin, System.DateTimeOffset? end, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (wellId == null)
|
||
throw new System.ArgumentNullException("wellId");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/well/{wellId}/message?");
|
||
urlBuilder_.Replace("{wellId}", System.Uri.EscapeDataString(ConvertToString(wellId, System.Globalization.CultureInfo.InvariantCulture)));
|
||
if (skip != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("skip") + "=").Append(System.Uri.EscapeDataString(ConvertToString(skip, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
if (take != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("take") + "=").Append(System.Uri.EscapeDataString(ConvertToString(take, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
if (categoryids != null)
|
||
{
|
||
foreach (var item_ in categoryids) { urlBuilder_.Append(System.Uri.EscapeDataString("categoryids") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); }
|
||
}
|
||
if (begin != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("begin") + "=").Append(System.Uri.EscapeDataString(begin.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
if (end != null)
|
||
{
|
||
urlBuilder_.Append(System.Uri.EscapeDataString("end") + "=").Append(System.Uri.EscapeDataString(end.Value.ToString("s", System.Globalization.CultureInfo.InvariantCulture))).Append("&");
|
||
}
|
||
urlBuilder_.Length--;
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
request_.Method = new System.Net.Http.HttpMethod("GET");
|
||
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
var objectResponse_ = await ReadObjectResponseAsync<MessageDtoPaginationContainer>(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
|
||
{
|
||
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>Принимает общую информацию по скважине</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">нформация об отправителе</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task ApiTelemetryInfoAsync(string uid, TelemetryInfoDto body)
|
||
{
|
||
return ApiTelemetryInfoAsync(uid, body, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Принимает общую информацию по скважине</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">нформация об отправителе</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task ApiTelemetryInfoAsync(string uid, TelemetryInfoDto body, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (uid == null)
|
||
throw new System.ArgumentNullException("uid");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/info");
|
||
urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture)));
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var content_ = new System.Net.Http.StringContent(System.Text.Json.JsonSerializer.Serialize(body, _settings.Value));
|
||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <summary>Принимает данные от разных систем по скважине</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">Данные</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task ApiTelemetryDataAsync(string uid, System.Collections.Generic.IEnumerable<DataSaubBaseDto> body)
|
||
{
|
||
return ApiTelemetryDataAsync(uid, body, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Принимает данные от разных систем по скважине</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">Данные</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task ApiTelemetryDataAsync(string uid, System.Collections.Generic.IEnumerable<DataSaubBaseDto> body, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (uid == null)
|
||
throw new System.ArgumentNullException("uid");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/data");
|
||
urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture)));
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var content_ = new System.Net.Http.StringContent(System.Text.Json.JsonSerializer.Serialize(body, _settings.Value));
|
||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <summary>Принимает список новых сообщений от телеметрии</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">сообщения</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task ApiTelemetryMessageAsync(string uid, System.Collections.Generic.IEnumerable<TelemetryMessageDto> body)
|
||
{
|
||
return ApiTelemetryMessageAsync(uid, body, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Принимает список новых сообщений от телеметрии</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">сообщения</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task ApiTelemetryMessageAsync(string uid, System.Collections.Generic.IEnumerable<TelemetryMessageDto> body, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (uid == null)
|
||
throw new System.ArgumentNullException("uid");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/message");
|
||
urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture)));
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var content_ = new System.Net.Http.StringContent(System.Text.Json.JsonSerializer.Serialize(body, _settings.Value));
|
||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <summary>Принимает справочник событий</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">справочник событий</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task ApiTelemetryEventAsync(string uid, System.Collections.Generic.IEnumerable<EventDto> body)
|
||
{
|
||
return ApiTelemetryEventAsync(uid, body, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Принимает справочник событий</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">справочник событий</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task ApiTelemetryEventAsync(string uid, System.Collections.Generic.IEnumerable<EventDto> body, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (uid == null)
|
||
throw new System.ArgumentNullException("uid");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/event");
|
||
urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture)));
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var content_ = new System.Net.Http.StringContent(System.Text.Json.JsonSerializer.Serialize(body, _settings.Value));
|
||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <summary>Принимает справочник пользователей телеметрии</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">справочник пользователей телеметрии</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task ApiTelemetryUserAsync(string uid, System.Collections.Generic.IEnumerable<TelemetryUserDto> body)
|
||
{
|
||
return ApiTelemetryUserAsync(uid, body, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <summary>Принимает справочник пользователей телеметрии</summary>
|
||
/// <param name="uid">Уникальный идентификатор отправителя</param>
|
||
/// <param name="body">справочник пользователей телеметрии</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task ApiTelemetryUserAsync(string uid, System.Collections.Generic.IEnumerable<TelemetryUserDto> body, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (uid == null)
|
||
throw new System.ArgumentNullException("uid");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/user");
|
||
urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture)));
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var content_ = new System.Net.Http.StringContent(System.Text.Json.JsonSerializer.Serialize(body, _settings.Value));
|
||
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task ApiTelemetryDbAsync(string uid, System.Collections.Generic.IEnumerable<FileParameter> files)
|
||
{
|
||
return ApiTelemetryDbAsync(uid, files, System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task ApiTelemetryDbAsync(string uid, System.Collections.Generic.IEnumerable<FileParameter> files, System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
if (uid == null)
|
||
throw new System.ArgumentNullException("uid");
|
||
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/db");
|
||
urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture)));
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
var boundary_ = System.Guid.NewGuid().ToString();
|
||
var content_ = new System.Net.Http.MultipartFormDataContent(boundary_);
|
||
content_.Headers.Remove("Content-Type");
|
||
content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_);
|
||
if (files == null)
|
||
throw new System.ArgumentNullException("files");
|
||
else
|
||
{
|
||
foreach (var item_ in files)
|
||
{
|
||
var content_files_ = new System.Net.Http.StreamContent(item_.Data);
|
||
if (!string.IsNullOrEmpty(item_.ContentType))
|
||
content_files_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse(item_.ContentType);
|
||
content_.Add(content_files_, "files", item_.FileName ?? "files");
|
||
}
|
||
}
|
||
request_.Content = content_;
|
||
request_.Method = new System.Net.Http.HttpMethod("POST");
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeResponse_)
|
||
response_.Dispose();
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
if (disposeClient_)
|
||
client_.Dispose();
|
||
}
|
||
}
|
||
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public System.Threading.Tasks.Task<System.Collections.Generic.ICollection<WellDto>> ApiWellAsync()
|
||
{
|
||
return ApiWellAsync(System.Threading.CancellationToken.None);
|
||
}
|
||
|
||
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
|
||
/// <returns>Success</returns>
|
||
/// <exception cref="ApiException">A server side error occurred.</exception>
|
||
public async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<WellDto>> ApiWellAsync(System.Threading.CancellationToken cancellationToken)
|
||
{
|
||
var urlBuilder_ = new System.Text.StringBuilder();
|
||
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/well");
|
||
|
||
var client_ = _httpClient;
|
||
var disposeClient_ = false;
|
||
try
|
||
{
|
||
using (var request_ = new System.Net.Http.HttpRequestMessage())
|
||
{
|
||
request_.Method = new System.Net.Http.HttpMethod("GET");
|
||
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
|
||
|
||
PrepareRequest(client_, request_, urlBuilder_);
|
||
|
||
var url_ = urlBuilder_.ToString();
|
||
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
|
||
|
||
PrepareRequest(client_, request_, url_);
|
||
|
||
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
|
||
var disposeResponse_ = true;
|
||
try
|
||
{
|
||
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
|
||
if (response_.Content != null && response_.Content.Headers != null)
|
||
{
|
||
foreach (var item_ in response_.Content.Headers)
|
||
headers_[item_.Key] = item_.Value;
|
||
}
|
||
|
||
ProcessResponse(client_, response_);
|
||
|
||
var status_ = (int)response_.StatusCode;
|
||
if (status_ == 200)
|
||
{
|
||
var objectResponse_ = await ReadObjectResponseAsync<System.Collections.Generic.ICollection<WellDto>>(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
|
||
{
|
||
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 System.Threading.Tasks.Task<ObjectResponseResult<T>> ReadObjectResponseAsync<T>(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, System.Threading.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 = System.Text.Json.JsonSerializer.Deserialize<T>(responseText, JsonSerializerSettings);
|
||
return new ObjectResponseResult<T>(typedBody, responseText);
|
||
}
|
||
catch (System.Text.Json.JsonException exception)
|
||
{
|
||
var message = "Could not deserialize the response body string as " + typeof(T).FullName + ".";
|
||
throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
try
|
||
{
|
||
using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
|
||
{
|
||
var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync<T>(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false);
|
||
return new ObjectResponseResult<T>(typedBody, string.Empty);
|
||
}
|
||
}
|
||
catch (System.Text.Json.JsonException exception)
|
||
{
|
||
var message = "Could not deserialize the response body stream as " + typeof(T).FullName + ".";
|
||
throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception);
|
||
}
|
||
}
|
||
}
|
||
|
||
private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo)
|
||
{
|
||
if (value == null)
|
||
{
|
||
return "";
|
||
}
|
||
|
||
if (value is System.Enum)
|
||
{
|
||
var name = System.Enum.GetName(value.GetType(), value);
|
||
if (name != null)
|
||
{
|
||
var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
|
||
if (field != null)
|
||
{
|
||
var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute))
|
||
as System.Runtime.Serialization.EnumMemberAttribute;
|
||
if (attribute != null)
|
||
{
|
||
return attribute.Value != null ? attribute.Value : name;
|
||
}
|
||
}
|
||
|
||
var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo));
|
||
return converted == null ? string.Empty : converted;
|
||
}
|
||
}
|
||
else if (value is bool)
|
||
{
|
||
return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant();
|
||
}
|
||
else if (value is byte[])
|
||
{
|
||
return System.Convert.ToBase64String((byte[]) value);
|
||
}
|
||
else if (value.GetType().IsArray)
|
||
{
|
||
var array = System.Linq.Enumerable.OfType<object>((System.Array) value);
|
||
return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo)));
|
||
}
|
||
|
||
var result = System.Convert.ToString(value, cultureInfo);
|
||
return result == null ? "" : result;
|
||
}
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class AuthDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("login")]
|
||
public string Login { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("password")]
|
||
public string Password { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class DataSaubBaseDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("date")]
|
||
public System.DateTimeOffset Date { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("mode")]
|
||
public int? Mode { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("user")]
|
||
public string User { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("wellDepth")]
|
||
public double? WellDepth { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("bitDepth")]
|
||
public double? BitDepth { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockPosition")]
|
||
public double? BlockPosition { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockPositionMin")]
|
||
public double? BlockPositionMin { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockPositionMax")]
|
||
public double? BlockPositionMax { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockSpeed")]
|
||
public double? BlockSpeed { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockSpeedSp")]
|
||
public double? BlockSpeedSp { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockSpeedSpRotor")]
|
||
public double? BlockSpeedSpRotor { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockSpeedSpSlide")]
|
||
public double? BlockSpeedSpSlide { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("blockSpeedSpDevelop")]
|
||
public double? BlockSpeedSpDevelop { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressure")]
|
||
public double? Pressure { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressureIdle")]
|
||
public double? PressureIdle { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressureSp")]
|
||
public double? PressureSp { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressureSpRotor")]
|
||
public double? PressureSpRotor { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressureSpSlide")]
|
||
public double? PressureSpSlide { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressureSpDevelop")]
|
||
public double? PressureSpDevelop { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("pressureDeltaLimitMax")]
|
||
public double? PressureDeltaLimitMax { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("axialLoad")]
|
||
public double? AxialLoad { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("axialLoadSp")]
|
||
public double? AxialLoadSp { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("axialLoadLimitMax")]
|
||
public double? AxialLoadLimitMax { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("hookWeight")]
|
||
public double? HookWeight { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("hookWeightIdle")]
|
||
public double? HookWeightIdle { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("hookWeightLimitMin")]
|
||
public double? HookWeightLimitMin { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("hookWeightLimitMax")]
|
||
public double? HookWeightLimitMax { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("rotorTorque")]
|
||
public double? RotorTorque { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("rotorTorqueIdle")]
|
||
public double? RotorTorqueIdle { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("rotorTorqueSp")]
|
||
public double? RotorTorqueSp { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("rotorTorqueLimitMax")]
|
||
public double? RotorTorqueLimitMax { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("rotorSpeed")]
|
||
public double? RotorSpeed { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("flow")]
|
||
public double? Flow { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("flowIdle")]
|
||
public double? FlowIdle { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("flowDeltaLimitMax")]
|
||
public double? FlowDeltaLimitMax { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class EventDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||
public int Id { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("message")]
|
||
public string Message { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("idCategory")]
|
||
public int IdCategory { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("tag")]
|
||
public string Tag { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("eventType")]
|
||
public int EventType { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("idSound")]
|
||
public int IdSound { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class MessageDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||
public int Id { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("date")]
|
||
public System.DateTimeOffset Date { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("categoryId")]
|
||
public int CategoryId { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("user")]
|
||
public string User { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("message")]
|
||
public string Message { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class MessageDtoPaginationContainer
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("skip")]
|
||
public int Skip { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("take")]
|
||
public int Take { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("count")]
|
||
public int Count { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("items")]
|
||
public System.Collections.Generic.ICollection<MessageDto> Items { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class TelemetryInfoDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("date")]
|
||
public System.DateTimeOffset Date { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("timeZoneId")]
|
||
public string TimeZoneId { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("timeZoneOffsetTotalHours")]
|
||
public double TimeZoneOffsetTotalHours { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("caption")]
|
||
public string Caption { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("cluster")]
|
||
public string Cluster { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("deposit")]
|
||
public string Deposit { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("hmiVersion")]
|
||
public string HmiVersion { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("plcVersion")]
|
||
public string PlcVersion { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("comment")]
|
||
public string Comment { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class TelemetryMessageDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||
public int Id { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("date")]
|
||
public System.DateTimeOffset Date { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("idEvent")]
|
||
public int IdEvent { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("state")]
|
||
public int? State { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("idTelemetryUser")]
|
||
public int? IdTelemetryUser { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("arg0")]
|
||
public string Arg0 { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("arg1")]
|
||
public string Arg1 { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("arg2")]
|
||
public string Arg2 { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("arg3")]
|
||
public string Arg3 { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class TelemetryUserDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||
public int Id { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("name")]
|
||
public string Name { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("surname")]
|
||
public string Surname { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("patronymic")]
|
||
public string Patronymic { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("level")]
|
||
public int Level { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class UserTokenDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("login")]
|
||
public string Login { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("level")]
|
||
public int? Level { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("name")]
|
||
public string Name { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("surname")]
|
||
public string Surname { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("patronymic")]
|
||
public string Patronymic { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||
public int Id { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("customerName")]
|
||
public string CustomerName { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("roleName")]
|
||
public string RoleName { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("token")]
|
||
public string Token { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
|
||
public partial class WellDto
|
||
{
|
||
[System.Text.Json.Serialization.JsonPropertyName("caption")]
|
||
public string Caption { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("cluster")]
|
||
public string Cluster { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("deposit")]
|
||
public string Deposit { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||
public int Id { get; set; }
|
||
|
||
[System.Text.Json.Serialization.JsonPropertyName("lastData")]
|
||
public object LastData { get; set; }
|
||
|
||
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
|
||
public partial class FileParameter
|
||
{
|
||
public FileParameter(System.IO.Stream data)
|
||
: this (data, null, null)
|
||
{
|
||
}
|
||
|
||
public FileParameter(System.IO.Stream data, string fileName)
|
||
: this (data, fileName, null)
|
||
{
|
||
}
|
||
|
||
public FileParameter(System.IO.Stream data, string fileName, string contentType)
|
||
{
|
||
Data = data;
|
||
FileName = fileName;
|
||
ContentType = contentType;
|
||
}
|
||
|
||
public System.IO.Stream Data { get; private set; }
|
||
|
||
public string FileName { get; private set; }
|
||
|
||
public string ContentType { get; private set; }
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
|
||
public partial class ApiException : System.Exception
|
||
{
|
||
public int StatusCode { get; private set; }
|
||
|
||
public string Response { get; private set; }
|
||
|
||
public System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> Headers { get; private set; }
|
||
|
||
public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, System.Exception innerException)
|
||
: base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException)
|
||
{
|
||
StatusCode = statusCode;
|
||
Response = response;
|
||
Headers = headers;
|
||
}
|
||
|
||
public override string ToString()
|
||
{
|
||
return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString());
|
||
}
|
||
}
|
||
|
||
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
|
||
public partial class ApiException<TResult> : ApiException
|
||
{
|
||
public TResult Result { get; private set; }
|
||
|
||
public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, TResult result, System.Exception innerException)
|
||
: base(message, statusCode, response, headers, innerException)
|
||
{
|
||
Result = result;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
#pragma warning restore 1591
|
||
#pragma warning restore 1573
|
||
#pragma warning restore 472
|
||
#pragma warning restore 114
|
||
#pragma warning restore 108 |