2021-04-30 17:35:35 +05:00
//----------------------
// <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 ConsoleApp1.OpenAPIService
{
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 AuthClient
{
private string _baseUrl = "" ;
private System . Net . Http . HttpClient _httpClient ;
private System . Lazy < Newtonsoft . Json . JsonSerializerSettings > _settings ;
public AuthClient ( string baseUrl , System . Net . Http . HttpClient httpClient )
{
BaseUrl = baseUrl ;
_httpClient = httpClient ;
_settings = new System . Lazy < Newtonsoft . Json . JsonSerializerSettings > ( CreateSerializerSettings ) ;
}
private Newtonsoft . Json . JsonSerializerSettings CreateSerializerSettings ( )
{
var settings = new Newtonsoft . Json . JsonSerializerSettings ( ) ;
UpdateJsonSerializerSettings ( settings ) ;
return settings ;
}
public string BaseUrl
{
get { return _baseUrl ; }
set { _baseUrl = value ; }
}
protected Newtonsoft . Json . JsonSerializerSettings JsonSerializerSettings { get { return _settings . Value ; } }
partial void UpdateJsonSerializerSettings ( Newtonsoft . Json . JsonSerializerSettings settings ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , string url ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , System . Text . StringBuilder urlBuilder ) ;
partial void ProcessResponse ( System . Net . Http . HttpClient client , System . Net . Http . HttpResponseMessage response ) ;
/// <summary>Аутентификация пользователя</summary>
/// <returns>новый токен</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public System . Threading . Tasks . Task < UserTokenDto > LoginAsync ( AuthDto body )
{
return LoginAsync ( 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 > LoginAsync ( 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 ( Newtonsoft . Json . JsonConvert . SerializeObject ( 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 RefreshAsync ( )
{
return RefreshAsync ( 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 RefreshAsync ( 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 ( ) ;
}
}
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 = Newtonsoft . Json . JsonConvert . DeserializeObject < T > ( responseText , JsonSerializerSettings ) ;
return new ObjectResponseResult < T > ( typedBody , responseText ) ;
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body string as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , responseText , headers , exception ) ;
}
}
else
{
try
{
using ( var responseStream = await response . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) )
using ( var streamReader = new System . IO . StreamReader ( responseStream ) )
using ( var jsonTextReader = new Newtonsoft . Json . JsonTextReader ( streamReader ) )
{
var serializer = Newtonsoft . Json . JsonSerializer . Create ( JsonSerializerSettings ) ;
var typedBody = serializer . Deserialize < T > ( jsonTextReader ) ;
return new ObjectResponseResult < T > ( typedBody , string . Empty ) ;
}
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body stream as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , string . Empty , headers , exception ) ;
}
}
}
private string ConvertToString ( object value , System . Globalization . CultureInfo cultureInfo )
{
if ( value = = null )
{
return "" ;
}
if ( value is System . Enum )
{
var name = System . Enum . GetName ( value . GetType ( ) , value ) ;
if ( name ! = null )
{
var field = System . Reflection . IntrospectionExtensions . GetTypeInfo ( value . GetType ( ) ) . GetDeclaredField ( name ) ;
if ( field ! = null )
{
var attribute = System . Reflection . CustomAttributeExtensions . GetCustomAttribute ( field , typeof ( System . Runtime . Serialization . EnumMemberAttribute ) )
as System . Runtime . Serialization . EnumMemberAttribute ;
if ( attribute ! = null )
{
return attribute . Value ! = null ? attribute . Value : name ;
}
}
var converted = System . Convert . ToString ( System . Convert . ChangeType ( value , System . Enum . GetUnderlyingType ( value . GetType ( ) ) , cultureInfo ) ) ;
return converted = = null ? string . Empty : converted ;
}
}
else if ( value is bool )
{
return System . Convert . ToString ( ( bool ) value , cultureInfo ) . ToLowerInvariant ( ) ;
}
else if ( value is byte [ ] )
{
return System . Convert . ToBase64String ( ( byte [ ] ) value ) ;
}
else if ( value . GetType ( ) . IsArray )
{
var array = System . Linq . Enumerable . OfType < 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("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
public partial class WellClient
{
private string _baseUrl = "" ;
private System . Net . Http . HttpClient _httpClient ;
private System . Lazy < Newtonsoft . Json . JsonSerializerSettings > _settings ;
public WellClient ( string baseUrl , System . Net . Http . HttpClient httpClient )
{
BaseUrl = baseUrl ;
_httpClient = httpClient ;
_settings = new System . Lazy < Newtonsoft . Json . JsonSerializerSettings > ( CreateSerializerSettings ) ;
}
private Newtonsoft . Json . JsonSerializerSettings CreateSerializerSettings ( )
{
var settings = new Newtonsoft . Json . JsonSerializerSettings ( ) ;
UpdateJsonSerializerSettings ( settings ) ;
return settings ;
}
public string BaseUrl
{
get { return _baseUrl ; }
set { _baseUrl = value ; }
}
protected Newtonsoft . Json . JsonSerializerSettings JsonSerializerSettings { get { return _settings . Value ; } }
partial void UpdateJsonSerializerSettings ( Newtonsoft . Json . JsonSerializerSettings settings ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , string url ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , System . Text . StringBuilder urlBuilder ) ;
partial void ProcessResponse ( System . Net . Http . HttpClient client , System . Net . Http . HttpResponseMessage response ) ;
/// <summary>Возвращает данные САУБ по скважине.
/// По умолчанию за последние 10 минут.</summary>
2021-07-27 14:43:30 +05:00
/// <param name="idWell">id скважины</param>
2021-04-30 17:35:35 +05:00
/// <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>
2021-07-27 14:43:30 +05:00
public System . Threading . Tasks . Task < System . Collections . Generic . ICollection < DataSaubBaseDto > > DataAsync ( int idWell , System . DateTimeOffset ? begin , int? intervalSec , int? approxPointsCount )
2021-04-30 17:35:35 +05:00
{
2021-07-27 14:43:30 +05:00
return DataAsync ( idWell , begin , intervalSec , approxPointsCount , System . Threading . CancellationToken . None ) ;
2021-04-30 17:35:35 +05:00
}
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Возвращает данные САУБ по скважине.
/// По умолчанию за последние 10 минут.</summary>
2021-07-27 14:43:30 +05:00
/// <param name="idWell">id скважины</param>
2021-04-30 17:35:35 +05:00
/// <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>
2021-07-27 14:43:30 +05:00
public async System . Threading . Tasks . Task < System . Collections . Generic . ICollection < DataSaubBaseDto > > DataAsync ( int idWell , System . DateTimeOffset ? begin , int? intervalSec , int? approxPointsCount , System . Threading . CancellationToken cancellationToken )
2021-04-30 17:35:35 +05:00
{
2021-07-27 14:43:30 +05:00
if ( idWell = = null )
throw new System . ArgumentNullException ( "idWell" ) ;
2021-04-30 17:35:35 +05:00
var urlBuilder_ = new System . Text . StringBuilder ( ) ;
2021-07-27 14:43:30 +05:00
urlBuilder_ . Append ( BaseUrl ! = null ? BaseUrl . TrimEnd ( '/' ) : "" ) . Append ( "/api/well/{idWell}/data?" ) ;
urlBuilder_ . Replace ( "{idWell}" , System . Uri . EscapeDataString ( ConvertToString ( idWell , System . Globalization . CultureInfo . InvariantCulture ) ) ) ;
2021-04-30 17:35:35 +05:00
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>
2021-07-27 14:43:30 +05:00
/// <param name="idWell">id скважины</param>
2021-04-30 17:35:35 +05:00
/// <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>
2021-07-27 14:43:30 +05:00
public System . Threading . Tasks . Task < MessageDtoPaginationContainer > MessageAsync ( int idWell , int? skip , int? take , System . Collections . Generic . IEnumerable < int > categoryids , System . DateTimeOffset ? begin , System . DateTimeOffset ? end )
2021-04-30 17:35:35 +05:00
{
2021-07-27 14:43:30 +05:00
return MessageAsync ( idWell , skip , take , categoryids , begin , end , System . Threading . CancellationToken . None ) ;
2021-04-30 17:35:35 +05:00
}
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Выдает список сообщений по скважине</summary>
2021-07-27 14:43:30 +05:00
/// <param name="idWell">id скважины</param>
2021-04-30 17:35:35 +05:00
/// <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>
2021-07-27 14:43:30 +05:00
public async System . Threading . Tasks . Task < MessageDtoPaginationContainer > MessageAsync ( int idWell , int? skip , int? take , System . Collections . Generic . IEnumerable < int > categoryids , System . DateTimeOffset ? begin , System . DateTimeOffset ? end , System . Threading . CancellationToken cancellationToken )
2021-04-30 17:35:35 +05:00
{
2021-07-27 14:43:30 +05:00
if ( idWell = = null )
throw new System . ArgumentNullException ( "idWell" ) ;
2021-04-30 17:35:35 +05:00
var urlBuilder_ = new System . Text . StringBuilder ( ) ;
2021-07-27 14:43:30 +05:00
urlBuilder_ . Append ( BaseUrl ! = null ? BaseUrl . TrimEnd ( '/' ) : "" ) . Append ( "/api/well/{idWell}/message?" ) ;
urlBuilder_ . Replace ( "{idWell}" , System . Uri . EscapeDataString ( ConvertToString ( idWell , System . Globalization . CultureInfo . InvariantCulture ) ) ) ;
2021-04-30 17:35:35 +05:00
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 ( ) ;
}
}
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 = Newtonsoft . Json . JsonConvert . DeserializeObject < T > ( responseText , JsonSerializerSettings ) ;
return new ObjectResponseResult < T > ( typedBody , responseText ) ;
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body string as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , responseText , headers , exception ) ;
}
}
else
{
try
{
using ( var responseStream = await response . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) )
using ( var streamReader = new System . IO . StreamReader ( responseStream ) )
using ( var jsonTextReader = new Newtonsoft . Json . JsonTextReader ( streamReader ) )
{
var serializer = Newtonsoft . Json . JsonSerializer . Create ( JsonSerializerSettings ) ;
var typedBody = serializer . Deserialize < T > ( jsonTextReader ) ;
return new ObjectResponseResult < T > ( typedBody , string . Empty ) ;
}
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body stream as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , string . Empty , headers , exception ) ;
}
}
}
private string ConvertToString ( object value , System . Globalization . CultureInfo cultureInfo )
{
if ( value = = null )
{
return "" ;
}
if ( value is System . Enum )
{
var name = System . Enum . GetName ( value . GetType ( ) , value ) ;
if ( name ! = null )
{
var field = System . Reflection . IntrospectionExtensions . GetTypeInfo ( value . GetType ( ) ) . GetDeclaredField ( name ) ;
if ( field ! = null )
{
var attribute = System . Reflection . CustomAttributeExtensions . GetCustomAttribute ( field , typeof ( System . Runtime . Serialization . EnumMemberAttribute ) )
as System . Runtime . Serialization . EnumMemberAttribute ;
if ( attribute ! = null )
{
return attribute . Value ! = null ? attribute . Value : name ;
}
}
var converted = System . Convert . ToString ( System . Convert . ChangeType ( value , System . Enum . GetUnderlyingType ( value . GetType ( ) ) , cultureInfo ) ) ;
return converted = = null ? string . Empty : converted ;
}
}
else if ( value is bool )
{
return System . Convert . ToString ( ( bool ) value , cultureInfo ) . ToLowerInvariant ( ) ;
}
else if ( value is byte [ ] )
{
return System . Convert . ToBase64String ( ( byte [ ] ) value ) ;
}
else if ( value . GetType ( ) . IsArray )
{
var array = System . Linq . Enumerable . OfType < 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("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
public partial class TelemetryClient
{
private string _baseUrl = "" ;
private System . Net . Http . HttpClient _httpClient ;
private System . Lazy < Newtonsoft . Json . JsonSerializerSettings > _settings ;
public TelemetryClient ( string baseUrl , System . Net . Http . HttpClient httpClient )
{
BaseUrl = baseUrl ;
_httpClient = httpClient ;
_settings = new System . Lazy < Newtonsoft . Json . JsonSerializerSettings > ( CreateSerializerSettings ) ;
}
private Newtonsoft . Json . JsonSerializerSettings CreateSerializerSettings ( )
{
var settings = new Newtonsoft . Json . JsonSerializerSettings ( ) ;
UpdateJsonSerializerSettings ( settings ) ;
return settings ;
}
public string BaseUrl
{
get { return _baseUrl ; }
set { _baseUrl = value ; }
}
protected Newtonsoft . Json . JsonSerializerSettings JsonSerializerSettings { get { return _settings . Value ; } }
partial void UpdateJsonSerializerSettings ( Newtonsoft . Json . JsonSerializerSettings settings ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , string url ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , System . Text . StringBuilder urlBuilder ) ;
partial void ProcessResponse ( System . Net . Http . HttpClient client , System . Net . Http . HttpResponseMessage response ) ;
/// <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 InfoAsync ( string uid , TelemetryInfoDto body )
{
return InfoAsync ( 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 InfoAsync ( 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 ( Newtonsoft . Json . JsonConvert . SerializeObject ( 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 DataAsync ( string uid , System . Collections . Generic . IEnumerable < DataSaubBaseDto > body )
{
return DataAsync ( 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 DataAsync ( 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 ( Newtonsoft . Json . JsonConvert . SerializeObject ( 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 MessageAsync ( string uid , System . Collections . Generic . IEnumerable < TelemetryMessageDto > body )
{
return MessageAsync ( 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 MessageAsync ( 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 ( Newtonsoft . Json . JsonConvert . SerializeObject ( 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 EventAsync ( string uid , System . Collections . Generic . IEnumerable < EventDto > body )
{
return EventAsync ( 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 EventAsync ( 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 ( Newtonsoft . Json . JsonConvert . SerializeObject ( 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 UserAsync ( string uid , System . Collections . Generic . IEnumerable < TelemetryUserDto > body )
{
return UserAsync ( 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 UserAsync ( 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 ( Newtonsoft . Json . JsonConvert . SerializeObject ( 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 ( ) ;
}
}
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 = Newtonsoft . Json . JsonConvert . DeserializeObject < T > ( responseText , JsonSerializerSettings ) ;
return new ObjectResponseResult < T > ( typedBody , responseText ) ;
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body string as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , responseText , headers , exception ) ;
}
}
else
{
try
{
using ( var responseStream = await response . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) )
using ( var streamReader = new System . IO . StreamReader ( responseStream ) )
using ( var jsonTextReader = new Newtonsoft . Json . JsonTextReader ( streamReader ) )
{
var serializer = Newtonsoft . Json . JsonSerializer . Create ( JsonSerializerSettings ) ;
var typedBody = serializer . Deserialize < T > ( jsonTextReader ) ;
return new ObjectResponseResult < T > ( typedBody , string . Empty ) ;
}
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body stream as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , string . Empty , headers , exception ) ;
}
}
}
private string ConvertToString ( object value , System . Globalization . CultureInfo cultureInfo )
{
if ( value = = null )
{
return "" ;
}
if ( value is System . Enum )
{
var name = System . Enum . GetName ( value . GetType ( ) , value ) ;
if ( name ! = null )
{
var field = System . Reflection . IntrospectionExtensions . GetTypeInfo ( value . GetType ( ) ) . GetDeclaredField ( name ) ;
if ( field ! = null )
{
var attribute = System . Reflection . CustomAttributeExtensions . GetCustomAttribute ( field , typeof ( System . Runtime . Serialization . EnumMemberAttribute ) )
as System . Runtime . Serialization . EnumMemberAttribute ;
if ( attribute ! = null )
{
return attribute . Value ! = null ? attribute . Value : name ;
}
}
var converted = System . Convert . ToString ( System . Convert . ChangeType ( value , System . Enum . GetUnderlyingType ( value . GetType ( ) ) , cultureInfo ) ) ;
return converted = = null ? string . Empty : converted ;
}
}
else if ( value is bool )
{
return System . Convert . ToString ( ( bool ) value , cultureInfo ) . ToLowerInvariant ( ) ;
}
else if ( value is byte [ ] )
{
return System . Convert . ToBase64String ( ( byte [ ] ) value ) ;
}
else if ( value . GetType ( ) . IsArray )
{
var array = System . Linq . Enumerable . OfType < 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("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")]
public partial class ApiClient
{
private string _baseUrl = "" ;
private System . Net . Http . HttpClient _httpClient ;
private System . Lazy < Newtonsoft . Json . JsonSerializerSettings > _settings ;
public ApiClient ( string baseUrl , System . Net . Http . HttpClient httpClient )
{
BaseUrl = baseUrl ;
_httpClient = httpClient ;
_settings = new System . Lazy < Newtonsoft . Json . JsonSerializerSettings > ( CreateSerializerSettings ) ;
}
private Newtonsoft . Json . JsonSerializerSettings CreateSerializerSettings ( )
{
var settings = new Newtonsoft . Json . JsonSerializerSettings ( ) ;
UpdateJsonSerializerSettings ( settings ) ;
return settings ;
}
public string BaseUrl
{
get { return _baseUrl ; }
set { _baseUrl = value ; }
}
protected Newtonsoft . Json . JsonSerializerSettings JsonSerializerSettings { get { return _settings . Value ; } }
partial void UpdateJsonSerializerSettings ( Newtonsoft . Json . JsonSerializerSettings settings ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , string url ) ;
partial void PrepareRequest ( System . Net . Http . HttpClient client , System . Net . Http . HttpRequestMessage request , System . Text . StringBuilder urlBuilder ) ;
partial void ProcessResponse ( System . Net . Http . HttpClient client , System . Net . Http . HttpResponseMessage response ) ;
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public System . Threading . Tasks . Task < System . Collections . Generic . ICollection < WellDto > > WellAsync ( )
{
return WellAsync ( 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 > > WellAsync ( 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 = Newtonsoft . Json . JsonConvert . DeserializeObject < T > ( responseText , JsonSerializerSettings ) ;
return new ObjectResponseResult < T > ( typedBody , responseText ) ;
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body string as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , responseText , headers , exception ) ;
}
}
else
{
try
{
using ( var responseStream = await response . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) )
using ( var streamReader = new System . IO . StreamReader ( responseStream ) )
using ( var jsonTextReader = new Newtonsoft . Json . JsonTextReader ( streamReader ) )
{
var serializer = Newtonsoft . Json . JsonSerializer . Create ( JsonSerializerSettings ) ;
var typedBody = serializer . Deserialize < T > ( jsonTextReader ) ;
return new ObjectResponseResult < T > ( typedBody , string . Empty ) ;
}
}
catch ( Newtonsoft . Json . JsonException exception )
{
var message = "Could not deserialize the response body stream as " + typeof ( T ) . FullName + "." ;
throw new ApiException ( message , ( int ) response . StatusCode , string . Empty , headers , exception ) ;
}
}
}
private string ConvertToString ( object value , System . Globalization . CultureInfo cultureInfo )
{
if ( value = = null )
{
return "" ;
}
if ( value is System . Enum )
{
var name = System . Enum . GetName ( value . GetType ( ) , value ) ;
if ( name ! = null )
{
var field = System . Reflection . IntrospectionExtensions . GetTypeInfo ( value . GetType ( ) ) . GetDeclaredField ( name ) ;
if ( field ! = null )
{
var attribute = System . Reflection . CustomAttributeExtensions . GetCustomAttribute ( field , typeof ( System . Runtime . Serialization . EnumMemberAttribute ) )
as System . Runtime . Serialization . EnumMemberAttribute ;
if ( attribute ! = null )
{
return attribute . Value ! = null ? attribute . Value : name ;
}
}
var converted = System . Convert . ToString ( System . Convert . ChangeType ( value , System . Enum . GetUnderlyingType ( value . GetType ( ) ) , cultureInfo ) ) ;
return converted = = null ? string . Empty : converted ;
}
}
else if ( value is bool )
{
return System . Convert . ToString ( ( bool ) value , cultureInfo ) . ToLowerInvariant ( ) ;
}
else if ( value is byte [ ] )
{
return System . Convert . ToBase64String ( ( byte [ ] ) value ) ;
}
else if ( value . GetType ( ) . IsArray )
{
var array = System . Linq . Enumerable . OfType < 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
{
[Newtonsoft.Json.JsonProperty("login", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Login { get ; set ; }
[Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Password { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class DataSaubBaseDto
{
[Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System . DateTimeOffset Date { get ; set ; }
[Newtonsoft.Json.JsonProperty("mode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? Mode { get ; set ; }
[Newtonsoft.Json.JsonProperty("user", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string User { get ; set ; }
[Newtonsoft.Json.JsonProperty("wellDepth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? WellDepth { get ; set ; }
[Newtonsoft.Json.JsonProperty("bitDepth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BitDepth { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockPosition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockPosition { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockPositionMin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockPositionMin { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockPositionMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockPositionMax { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockSpeed", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockSpeed { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockSpeedSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockSpeedSp { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockSpeedSpRotor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockSpeedSpRotor { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockSpeedSpSlide", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockSpeedSpSlide { get ; set ; }
[Newtonsoft.Json.JsonProperty("blockSpeedSpDevelop", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? BlockSpeedSpDevelop { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressure", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? Pressure { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressureIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PressureIdle { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressureSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PressureSp { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressureSpRotor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PressureSpRotor { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressureSpSlide", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PressureSpSlide { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressureSpDevelop", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PressureSpDevelop { get ; set ; }
[Newtonsoft.Json.JsonProperty("pressureDeltaLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? PressureDeltaLimitMax { get ; set ; }
[Newtonsoft.Json.JsonProperty("axialLoad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? AxialLoad { get ; set ; }
[Newtonsoft.Json.JsonProperty("axialLoadSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? AxialLoadSp { get ; set ; }
[Newtonsoft.Json.JsonProperty("axialLoadLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? AxialLoadLimitMax { get ; set ; }
[Newtonsoft.Json.JsonProperty("hookWeight", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? HookWeight { get ; set ; }
[Newtonsoft.Json.JsonProperty("hookWeightIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? HookWeightIdle { get ; set ; }
[Newtonsoft.Json.JsonProperty("hookWeightLimitMin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? HookWeightLimitMin { get ; set ; }
[Newtonsoft.Json.JsonProperty("hookWeightLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? HookWeightLimitMax { get ; set ; }
[Newtonsoft.Json.JsonProperty("rotorTorque", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? RotorTorque { get ; set ; }
[Newtonsoft.Json.JsonProperty("rotorTorqueIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? RotorTorqueIdle { get ; set ; }
[Newtonsoft.Json.JsonProperty("rotorTorqueSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? RotorTorqueSp { get ; set ; }
[Newtonsoft.Json.JsonProperty("rotorTorqueLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? RotorTorqueLimitMax { get ; set ; }
[Newtonsoft.Json.JsonProperty("rotorSpeed", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? RotorSpeed { get ; set ; }
[Newtonsoft.Json.JsonProperty("flow", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? Flow { get ; set ; }
[Newtonsoft.Json.JsonProperty("flowIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? FlowIdle { get ; set ; }
[Newtonsoft.Json.JsonProperty("flowDeltaLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? FlowDeltaLimitMax { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class EventDto
{
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get ; set ; }
[Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Message { get ; set ; }
[Newtonsoft.Json.JsonProperty("idCategory", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int IdCategory { get ; set ; }
[Newtonsoft.Json.JsonProperty("tag", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Tag { get ; set ; }
[Newtonsoft.Json.JsonProperty("eventType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int EventType { get ; set ; }
[Newtonsoft.Json.JsonProperty("idSound", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int IdSound { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class MessageDto
{
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get ; set ; }
[Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System . DateTimeOffset Date { get ; set ; }
[Newtonsoft.Json.JsonProperty("categoryId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int CategoryId { get ; set ; }
[Newtonsoft.Json.JsonProperty("user", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string User { get ; set ; }
[Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Message { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class MessageDtoPaginationContainer
{
[Newtonsoft.Json.JsonProperty("skip", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Skip { get ; set ; }
[Newtonsoft.Json.JsonProperty("take", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Take { get ; set ; }
[Newtonsoft.Json.JsonProperty("count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Count { get ; set ; }
[Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
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
{
[Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System . DateTimeOffset Date { get ; set ; }
[Newtonsoft.Json.JsonProperty("timeZoneId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string TimeZoneId { get ; set ; }
[Newtonsoft.Json.JsonProperty("timeZoneOffsetTotalHours", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double TimeZoneOffsetTotalHours { get ; set ; }
[Newtonsoft.Json.JsonProperty("caption", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Caption { get ; set ; }
[Newtonsoft.Json.JsonProperty("cluster", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Cluster { get ; set ; }
[Newtonsoft.Json.JsonProperty("deposit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Deposit { get ; set ; }
[Newtonsoft.Json.JsonProperty("hmiVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HmiVersion { get ; set ; }
[Newtonsoft.Json.JsonProperty("plcVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PlcVersion { get ; set ; }
[Newtonsoft.Json.JsonProperty("comment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Comment { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class TelemetryMessageDto
{
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get ; set ; }
[Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System . DateTimeOffset Date { get ; set ; }
[Newtonsoft.Json.JsonProperty("idEvent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int IdEvent { get ; set ; }
[Newtonsoft.Json.JsonProperty("state", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? State { get ; set ; }
[Newtonsoft.Json.JsonProperty("idTelemetryUser", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? IdTelemetryUser { get ; set ; }
[Newtonsoft.Json.JsonProperty("arg0", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Arg0 { get ; set ; }
[Newtonsoft.Json.JsonProperty("arg1", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Arg1 { get ; set ; }
[Newtonsoft.Json.JsonProperty("arg2", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Arg2 { get ; set ; }
[Newtonsoft.Json.JsonProperty("arg3", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Arg3 { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class TelemetryUserDto
{
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get ; set ; }
[Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Name { get ; set ; }
[Newtonsoft.Json.JsonProperty("surname", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Surname { get ; set ; }
[Newtonsoft.Json.JsonProperty("patronymic", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Patronymic { get ; set ; }
[Newtonsoft.Json.JsonProperty("level", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Level { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class UserTokenDto
{
[Newtonsoft.Json.JsonProperty("login", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Login { get ; set ; }
[Newtonsoft.Json.JsonProperty("level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? Level { get ; set ; }
[Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Name { get ; set ; }
[Newtonsoft.Json.JsonProperty("surname", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Surname { get ; set ; }
[Newtonsoft.Json.JsonProperty("patronymic", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Patronymic { get ; set ; }
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get ; set ; }
[Newtonsoft.Json.JsonProperty("customerName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CustomerName { get ; set ; }
[Newtonsoft.Json.JsonProperty("roleName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string RoleName { get ; set ; }
[Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Token { get ; set ; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")]
public partial class WellDto
{
[Newtonsoft.Json.JsonProperty("caption", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Caption { get ; set ; }
[Newtonsoft.Json.JsonProperty("cluster", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Cluster { get ; set ; }
[Newtonsoft.Json.JsonProperty("deposit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Deposit { get ; set ; }
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Id { get ; set ; }
[Newtonsoft.Json.JsonProperty("lastData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
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 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