diff --git a/AsbCloud.sln b/AsbCloud.sln index 7cd3f161..21e8350f 100644 --- a/AsbCloud.sln +++ b/AsbCloud.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDb", "AsbCloudDb\AsbCloudDb.csproj", "{40FBD29B-724B-4496-B5D9-1A5D14102456}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataTable", "DataTable\DataTable.csproj", "{28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudWebApi.Tests", "AsbCloudWebApi.Tests\AsbCloudWebApi.Tests.csproj", "{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDevOperations", "AsbCloudDbDemoData\AsbCloudDevOperations.csproj", "{1208822E-9099-4D13-B72F-8721E5758577}" @@ -45,10 +43,6 @@ Global {40FBD29B-724B-4496-B5D9-1A5D14102456}.Debug|Any CPU.Build.0 = Debug|Any CPU {40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.ActiveCfg = Release|Any CPU {40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.Build.0 = Release|Any CPU - {28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Release|Any CPU.Build.0 = Release|Any CPU {9CF6FBB1-9AF5-45AB-A521-24F11A79B540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9CF6FBB1-9AF5-45AB-A521-24F11A79B540}.Debug|Any CPU.Build.0 = Debug|Any CPU {9CF6FBB1-9AF5-45AB-A521-24F11A79B540}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/AsbCloudWebApi/AsbCloudWebApi.csproj b/AsbCloudWebApi/AsbCloudWebApi.csproj index 738633de..95ae553b 100644 --- a/AsbCloudWebApi/AsbCloudWebApi.csproj +++ b/AsbCloudWebApi/AsbCloudWebApi.csproj @@ -42,5 +42,7 @@ + + diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json index fd0ca1a8..55675a79 100644 --- a/AsbCloudWebApi/appsettings.json +++ b/AsbCloudWebApi/appsettings.json @@ -7,7 +7,7 @@ } }, "ConnectionStrings": { - "DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;", + "DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", "DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", "ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", "LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True" diff --git a/DataTable/DataTable.csproj b/DataTable/DataTable.csproj deleted file mode 100644 index 20827042..00000000 --- a/DataTable/DataTable.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Exe - net5.0 - - - diff --git a/DataTable/Header.cs b/DataTable/Header.cs deleted file mode 100644 index 471ce6cc..00000000 --- a/DataTable/Header.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace DataTable -{ - [Serializable] - public class Header - { - public string Name { get; set; } - public string Desctiption { get; set; } - //public System.Type ColumnType { get; set; } = typeof(object); - public string ColumnType { get; set; } - } -} \ No newline at end of file diff --git a/DataTable/Program.cs b/DataTable/Program.cs deleted file mode 100644 index b7bdb23a..00000000 --- a/DataTable/Program.cs +++ /dev/null @@ -1,83 +0,0 @@ -namespace DataTable -{ - class Program - { - static void Main(/*string[] args*/) - { - //var listDtos = new List(100); - - /* *** Size of TestDto calc *** - * - * ** data binary size (Not implemented) ** - * Date : DateTime : 4b - * Mode : int32? : 4b - * User : string : 2-64b - * WellDepth : double? : 8b - * TOTAL data size = 18-80b - * - * ** header binary size (Not implemented) ** - * - *DateTime : len("DateTime") + 2 + len("Date") + 2 = 16b - * Mode : 14b - * User : 14b - * WellDepth : 20b - * columnsCount : 2b - * TOTAL header size = 66b - * - * ** json as tab ** - * - * header size: 137b - * json row size: 63b - * - * total for 1 record : 200b - * total for 2 records : 263b - * - * ** json as list ** - * - * Raw listItem size: 175b - * total for 2 records : 350b - * - * ** example 100 records ** - * tabJsonBytes: 6602 - * listJsonBytes: 9628 - * tabBinBytes: 7765 (by dangerous BinaryFormatter) - * listBinBytes: 4366 (by dangerous BinaryFormatter) - */ - - //for (int i = 0; i < 100; i++) - // listDtos.Add(new TestDto{ - // Date = DateTime.Now.AddSeconds(i), - // Mode = 1, - // WellDepth = i * Math.PI - // }); - - //var tMapper = new TableMapper(); - - //var tab = tMapper.MakeTable(listDtos); - - //var e = tMapper.AsEnumerable(tab); - - //var tabJson = JsonSerializer.Serialize(tab); - //var listJson = JsonSerializer.Serialize(listDtos); - - //var tabJsonBytes = JsonSerializer.SerializeToUtf8Bytes(tab); - //var listJsonBytes = JsonSerializer.SerializeToUtf8Bytes(listDtos); - - //var formatter = new BinaryFormatter(); - //var mem = new MemoryStream(); - //formatter.Serialize(mem, tab); - //var tabBinBytes = new byte[mem.Length]; - //Array.Copy(mem.GetBuffer(), tabBinBytes, mem.Length); - - //mem = new MemoryStream(); - //formatter.Serialize(mem, listDtos); - //var listBinBytes = new byte[mem.Length]; - //Array.Copy(mem.GetBuffer(), listBinBytes, mem.Length); - - //Console.WriteLine($"tabJsonBytes:{tabJsonBytes.Length}"); - //Console.WriteLine($"listJsonBytes:{listJsonBytes.Length}"); - //Console.WriteLine($"tabBinBytes:{tabBinBytes.Length}"); - //Console.WriteLine($"listBinBytes:{listBinBytes.Length}"); - } - } -} diff --git a/DataTable/PropertyHelper.cs b/DataTable/PropertyHelper.cs deleted file mode 100644 index 9b453051..00000000 --- a/DataTable/PropertyHelper.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq.Expressions; -using System.Reflection; - -namespace DataTable -{ - /// - /// Ускоренный обработчик свойства - /// - class PropertyHelper - { - delegate void SetterDelegate(object instanse, object[] values); - - delegate object GetterDelegate(object instanse); - - public string PropertyName { get; } - public string PropertyDesctiption { get; } - public Type PropertyType { get; } - public string Id { get; } - - SetterDelegate Setter { get; } - GetterDelegate Getter { get; } - public PropertyHelper(PropertyInfo property) - { - PropertyName = property.Name; - PropertyType = property.PropertyType; - Id = MakeIdentity(property.PropertyType.Name, property.Name); - PropertyDesctiption = GetDescription(property); - - var setter = property.SetMethod; - var getter = property.GetMethod; - - var instanceExpression = Expression.Parameter(typeof(object), "instance"); - var argumentsExpression = Expression.Parameter(typeof(object[]), "arguments"); - var argumentExpressions = new List { Expression.Convert(Expression.ArrayIndex(argumentsExpression, Expression.Constant(0)), PropertyType) }; - var callExpression = Expression.Call(Expression.Convert(instanceExpression, setter.ReflectedType), setter, argumentExpressions); - Setter = Expression.Lambda(callExpression, instanceExpression, argumentsExpression).Compile(); - callExpression = Expression.Call(Expression.Convert(instanceExpression, getter.ReflectedType), getter); - Getter = Expression.Lambda(Expression.Convert(callExpression, typeof(object)), instanceExpression).Compile(); - } - - private string GetDescription(PropertyInfo property) - { - var descriptionAttr = property.GetCustomAttribute(); - return descriptionAttr?.Description ?? string.Empty; - } - - void SetValues(object instance, params object[] values) - => Setter(instance, values); - - public void Set(object instance, object value) - => SetValues(instance, value); - - public object Get(object instance) - => Getter(instance); - - public static string MakeIdentity(string propertyTypeName, string propertyName) - => $"{propertyTypeName}_{propertyName}".ToLower(); - } -} diff --git a/DataTable/Table.cs b/DataTable/Table.cs deleted file mode 100644 index b5f8f5ae..00000000 --- a/DataTable/Table.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace DataTable -{ - [Serializable] - public class Table - { - public IEnumerable
Headers { get; set; } - - public IEnumerable> Rows { get; set; } - - } -} diff --git a/DataTable/TableMapper.cs b/DataTable/TableMapper.cs deleted file mode 100644 index 1af75273..00000000 --- a/DataTable/TableMapper.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace DataTable -{ - public class TableMapper - where T : new() - { - private readonly Dictionary props; - - public TableMapper() - { - var props = typeof(T).GetProperties(); - this.props = new Dictionary(props.Length); - foreach (var prop in props) - { - var helper = new PropertyHelper(prop); - this.props.Add(helper.Id, helper); - } - } - - public IEnumerable AsEnumerable(Table table) - { - if ((table?.Headers is null) || - (table?.Rows is null) || - (!table.Headers.Any()) || - (!table.Rows.Any()) || - (!props.Any())) - yield break; - - var headerIdToProp = new Dictionary(props.Count); - foreach (var (_, propHelper) in props) - for (var i = 0; i < table.Headers.Count(); i++) - { - var header = table.Headers.ElementAt(i); - var columnType = System.Type.GetType(header.ColumnType); - if (columnType.IsAssignableTo(propHelper.PropertyType) && - ((header.Name == propHelper.PropertyName) || - (header.Name.ToLower() == propHelper.PropertyName.ToLower()))) - headerIdToProp.Add(i, propHelper); - } - - if (!headerIdToProp.Any()) - yield break; - - foreach (var row in table.Rows) - { - var obj = new T(); - foreach (var (i, propHelper) in headerIdToProp) - propHelper.Set(obj, row.ElementAt(i)); - yield return obj; - } - - yield break; - } - - public Table MakeTable(IEnumerable data) - { - var table = new Table(); - table.Headers = props.Select(pair => new Header - { - Name = pair.Value.PropertyName, - ColumnType = pair.Value.PropertyType.Name, - }).ToArray(); - - var rows = new List>(data.Count()); - foreach (var dataItem in data) - rows.Add(MakeRow(dataItem)); - - table.Rows = rows; - - return table; - } - - private List MakeRow(T dataItem) - { - var colunms = new List(props.Count); - foreach (var (_, propHelper) in props) - { - var propValue = propHelper.Get(dataItem); - colunms.Add(propValue); - } - return colunms; - } - - } -} diff --git a/DataTable/TestDto.cs b/DataTable/TestDto.cs deleted file mode 100644 index 78824ba1..00000000 --- a/DataTable/TestDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.ComponentModel; - -namespace DataTable -{ - [Serializable] - public class TestDto - { - [Description("Дата")] - public DateTime Date { get; set; } = DateTime.Now; - - public int? Mode { get; set; } - - [Description("Пользователь")] - public string User { get; set; } - - [Description("Глубина забоя")] - public double? WellDepth { get; set; } - } -} diff --git a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.cs b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.cs deleted file mode 100644 index e6b4f571..00000000 --- a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.cs +++ /dev/null @@ -1,1487 +0,0 @@ -//---------------------- -// -// Generated using the NSwag toolchain v13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2)) (http://NSwag.org) -// -//---------------------- - -#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 _settings; - - public Client(string baseUrl, System.Net.Http.HttpClient httpClient) - { - BaseUrl = baseUrl; - _httpClient = httpClient; - _settings = new System.Lazy(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); - /// Аутентификация пользователя - /// новый токен - /// A server side error occurred. - public System.Threading.Tasks.Task AuthLoginAsync(AuthDto body) - { - return AuthLoginAsync(body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Аутентификация пользователя - /// новый токен - /// A server side error occurred. - public async System.Threading.Tasks.Task 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(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(); - } - } - - /// Продление срока действия токена - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task AuthRefreshAsync() - { - return AuthRefreshAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Продление срока действия токена - /// Success - /// A server side error occurred. - 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(); - } - } - - /// Возвращает данные САУБ по скважине. - /// По умолчанию за последние 10 минут. - /// id скважины - /// дата начала выборки. По умолчанию: текущее время - intervalSec - /// интервал времени даты начала выборки, секунды - /// желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task> ApiWellDataAsync(int wellId, System.DateTimeOffset? begin, int? intervalSec, int? approxPointsCount) - { - return ApiWellDataAsync(wellId, begin, intervalSec, approxPointsCount, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Возвращает данные САУБ по скважине. - /// По умолчанию за последние 10 минут. - /// id скважины - /// дата начала выборки. По умолчанию: текущее время - intervalSec - /// интервал времени даты начала выборки, секунды - /// желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task> 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>(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(); - } - } - - /// Выдает список сообщений по скважине - /// id скважины - /// для пагинации кол-во записей пропустить - /// для пагинации кол-во записей - /// список категорий - /// дата начала - /// окончание - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiWellMessageAsync(int wellId, int? skip, int? take, System.Collections.Generic.IEnumerable categoryids, System.DateTimeOffset? begin, System.DateTimeOffset? end) - { - return ApiWellMessageAsync(wellId, skip, take, categoryids, begin, end, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Выдает список сообщений по скважине - /// id скважины - /// для пагинации кол-во записей пропустить - /// для пагинации кол-во записей - /// список категорий - /// дата начала - /// окончание - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task ApiWellMessageAsync(int wellId, int? skip, int? take, System.Collections.Generic.IEnumerable 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(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(); - } - } - - /// Принимает общую информацию по скважине - /// Уникальный идентификатор отправителя - /// нформация об отправителе - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiTelemetryInfoAsync(string uid, TelemetryInfoDto body) - { - return ApiTelemetryInfoAsync(uid, body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Принимает общую информацию по скважине - /// Уникальный идентификатор отправителя - /// нформация об отправителе - /// Success - /// A server side error occurred. - 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(); - } - } - - /// Принимает данные от разных систем по скважине - /// Уникальный идентификатор отправителя - /// Данные - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiTelemetryDataAsync(string uid, System.Collections.Generic.IEnumerable body) - { - return ApiTelemetryDataAsync(uid, body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Принимает данные от разных систем по скважине - /// Уникальный идентификатор отправителя - /// Данные - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task ApiTelemetryDataAsync(string uid, System.Collections.Generic.IEnumerable 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(); - } - } - - /// Принимает список новых сообщений от телеметрии - /// Уникальный идентификатор отправителя - /// сообщения - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiTelemetryMessageAsync(string uid, System.Collections.Generic.IEnumerable body) - { - return ApiTelemetryMessageAsync(uid, body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Принимает список новых сообщений от телеметрии - /// Уникальный идентификатор отправителя - /// сообщения - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task ApiTelemetryMessageAsync(string uid, System.Collections.Generic.IEnumerable 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(); - } - } - - /// Принимает справочник событий - /// Уникальный идентификатор отправителя - /// справочник событий - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiTelemetryEventAsync(string uid, System.Collections.Generic.IEnumerable body) - { - return ApiTelemetryEventAsync(uid, body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Принимает справочник событий - /// Уникальный идентификатор отправителя - /// справочник событий - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task ApiTelemetryEventAsync(string uid, System.Collections.Generic.IEnumerable 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(); - } - } - - /// Принимает справочник пользователей телеметрии - /// Уникальный идентификатор отправителя - /// справочник пользователей телеметрии - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiTelemetryUserAsync(string uid, System.Collections.Generic.IEnumerable body) - { - return ApiTelemetryUserAsync(uid, body, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Принимает справочник пользователей телеметрии - /// Уникальный идентификатор отправителя - /// справочник пользователей телеметрии - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task ApiTelemetryUserAsync(string uid, System.Collections.Generic.IEnumerable 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(); - } - } - - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task ApiTelemetryDbAsync(string uid, System.Collections.Generic.IEnumerable files) - { - return ApiTelemetryDbAsync(uid, files, System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task ApiTelemetryDbAsync(string uid, System.Collections.Generic.IEnumerable 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(); - } - } - - /// Success - /// A server side error occurred. - public System.Threading.Tasks.Task> ApiWellAsync() - { - return ApiWellAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// Success - /// A server side error occurred. - public async System.Threading.Tasks.Task> 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>(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 - { - 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> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) - { - if (response == null || response.Content == null) - { - return new ObjectResponseResult(default(T), string.Empty); - } - - if (ReadResponseAsString) - { - var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); - return new ObjectResponseResult(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(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); - return new ObjectResponseResult(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((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 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> Headers { get; private set; } - - public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> 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 : ApiException - { - public TResult Result { get; private set; } - - public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> 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 \ No newline at end of file diff --git a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag deleted file mode 100644 index ba266aac..00000000 --- a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag +++ /dev/null @@ -1,99 +0,0 @@ -{ - "runtime": "NetCore21", - "defaultVariables": null, - "documentGenerator": { - "fromDocument": { - "url": "https://localhost:5001/swagger/v1/swagger.json", - "output": "AsbCloudApi.nswag.json", - "newLineBehavior": "Auto" - } - }, - "codeGenerators": { - "openApiToCSharpClient": { - "clientBaseClass": null, - "configurationClass": null, - "generateClientClasses": true, - "generateClientInterfaces": false, - "clientBaseInterface": null, - "injectHttpClient": true, - "disposeHttpClient": true, - "protectedMethods": [], - "generateExceptionClasses": true, - "exceptionClass": "ApiException", - "wrapDtoExceptions": true, - "useHttpClientCreationMethod": false, - "httpClientType": "System.Net.Http.HttpClient", - "useHttpRequestMessageCreationMethod": false, - "useBaseUrl": true, - "generateBaseUrlProperty": true, - "generateSyncMethods": false, - "generatePrepareRequestAndProcessResponseAsAsyncMethods": false, - "exposeJsonSerializerSettings": false, - "clientClassAccessModifier": "public", - "typeAccessModifier": "public", - "generateContractsOutput": false, - "contractsNamespace": null, - "contractsOutputFilePath": null, - "parameterDateTimeFormat": "s", - "parameterDateFormat": "yyyy-MM-dd", - "generateUpdateJsonSerializerSettingsMethod": true, - "useRequestAndResponseSerializationSettings": false, - "serializeTypeInformation": false, - "queryNullValue": "", - "className": "{controller}Client", - "operationGenerationMode": "SingleClientFromPathSegments", - "additionalNamespaceUsages": [], - "additionalContractNamespaceUsages": [], - "generateOptionalParameters": false, - "generateJsonMethods": false, - "enforceFlagEnums": false, - "parameterArrayType": "System.Collections.Generic.IEnumerable", - "parameterDictionaryType": "System.Collections.Generic.IDictionary", - "responseArrayType": "System.Collections.Generic.ICollection", - "responseDictionaryType": "System.Collections.Generic.IDictionary", - "wrapResponses": false, - "wrapResponseMethods": [], - "generateResponseClasses": true, - "responseClass": "SwaggerResponse", - "namespace": "SyncDicts.AsbCloudApi", - "requiredPropertiesMustBeDefined": true, - "dateType": "System.DateTimeOffset", - "jsonConverters": null, - "anyType": "object", - "dateTimeType": "System.DateTimeOffset", - "timeType": "System.TimeSpan", - "timeSpanType": "System.TimeSpan", - "arrayType": "System.Collections.Generic.ICollection", - "arrayInstanceType": "System.Collections.ObjectModel.Collection", - "dictionaryType": "System.Collections.Generic.IDictionary", - "dictionaryInstanceType": "System.Collections.Generic.Dictionary", - "arrayBaseType": "System.Collections.ObjectModel.Collection", - "dictionaryBaseType": "System.Collections.Generic.Dictionary", - "classStyle": "Poco", - "jsonLibrary": "SystemTextJson", - "generateDefaultValues": true, - "generateDataAnnotations": true, - "excludedTypeNames": [], - "excludedParameterNames": [], - "handleReferences": false, - "generateImmutableArrayProperties": false, - "generateImmutableDictionaryProperties": false, - "jsonSerializerSettingsTransformationMethod": null, - "inlineNamedArrays": false, - "inlineNamedDictionaries": false, - "inlineNamedTuples": true, - "inlineNamedAny": false, - "generateDtoTypes": true, - "generateOptionalPropertiesAsNullable": false, - "generateNullableReferenceTypes": false, - "templateDirectory": null, - "typeNameGeneratorType": null, - "propertyNameGeneratorType": null, - "enumNameGeneratorType": null, - "serviceHost": null, - "serviceSchemes": null, - "output": "AsbCloudApi.cs", - "newLineBehavior": "Auto" - } - } -} \ No newline at end of file diff --git a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag.json b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag.json deleted file mode 100644 index 3b40d113..00000000 --- a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag.json +++ /dev/null @@ -1,1069 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "ASB cloud web api", - "version": "v1" - }, - "paths": { - "/auth/login": { - "post": { - "tags": [ - "Auth" - ], - "summary": "Аутентификация пользователя", - "operationId": "Login", - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthDto" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/AuthDto" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/AuthDto" - } - } - } - }, - "responses": { - "200": { - "description": "новый токен", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/UserTokenDto" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserTokenDto" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserTokenDto" - } - } - } - }, - "400": { - "description": "логин и пароль не подходят" - } - } - } - }, - "/auth/refresh": { - "get": { - "tags": [ - "Auth" - ], - "summary": "Продление срока действия токена", - "operationId": "Refresh", - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/well/{wellId}/data": { - "get": { - "tags": [ - "Data" - ], - "summary": "Возвращает данные САУБ по скважине.\r\nПо умолчанию за последние 10 минут.", - "operationId": "GetData", - "parameters": [ - { - "name": "wellId", - "in": "path", - "required": true, - "description": "id скважины", - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "begin", - "in": "query", - "description": "дата начала выборки. По умолчанию: текущее время - intervalSec", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "intervalSec", - "in": "query", - "description": "интервал времени даты начала выборки, секунды", - "schema": { - "type": "integer", - "format": "int32", - "default": 600 - } - }, - { - "name": "approxPointsCount", - "in": "query", - "description": "желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.", - "schema": { - "type": "integer", - "format": "int32", - "default": 1024 - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataSaubBaseDto" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataSaubBaseDto" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataSaubBaseDto" - } - } - } - } - } - } - } - }, - "/api/well/{wellId}/message": { - "get": { - "tags": [ - "Message" - ], - "summary": "Выдает список сообщений по скважине", - "operationId": "GetMessage", - "parameters": [ - { - "name": "wellId", - "in": "path", - "required": true, - "description": "id скважины", - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "skip", - "in": "query", - "description": "для пагинации кол-во записей пропустить", - "schema": { - "type": "integer", - "format": "int32", - "default": 0 - } - }, - { - "name": "take", - "in": "query", - "description": "для пагинации кол-во записей", - "schema": { - "type": "integer", - "format": "int32", - "default": 32 - } - }, - { - "name": "categoryids", - "in": "query", - "description": "список категорий", - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "int32" - } - } - }, - { - "name": "begin", - "in": "query", - "description": "дата начала", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end", - "in": "query", - "description": "окончание", - "schema": { - "type": "string", - "format": "date-time" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/MessageDtoPaginationContainer" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageDtoPaginationContainer" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/MessageDtoPaginationContainer" - } - } - } - } - } - } - }, - "/api/telemetry/{uid}/info": { - "post": { - "tags": [ - "Telemetry" - ], - "summary": "Принимает общую информацию по скважине", - "operationId": "PostInfo", - "parameters": [ - { - "name": "uid", - "in": "path", - "required": true, - "description": "Уникальный идентификатор отправителя", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "нформация об отправителе", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TelemetryInfoDto" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/TelemetryInfoDto" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/TelemetryInfoDto" - } - } - } - }, - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/telemetry/{uid}/data": { - "post": { - "tags": [ - "Telemetry" - ], - "summary": "Принимает данные от разных систем по скважине", - "operationId": "PostData", - "parameters": [ - { - "name": "uid", - "in": "path", - "required": true, - "description": "Уникальный идентификатор отправителя", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "Данные", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataSaubBaseDto" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataSaubBaseDto" - } - } - }, - "application/*+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/DataSaubBaseDto" - } - } - } - } - }, - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/telemetry/{uid}/message": { - "post": { - "tags": [ - "Telemetry" - ], - "summary": "Принимает список новых сообщений от телеметрии", - "operationId": "PostMessages", - "parameters": [ - { - "name": "uid", - "in": "path", - "required": true, - "description": "Уникальный идентификатор отправителя", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "сообщения", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TelemetryMessageDto" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TelemetryMessageDto" - } - } - }, - "application/*+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TelemetryMessageDto" - } - } - } - } - }, - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/telemetry/{uid}/event": { - "post": { - "tags": [ - "Telemetry" - ], - "summary": "Принимает справочник событий", - "operationId": "PostEvents", - "parameters": [ - { - "name": "uid", - "in": "path", - "required": true, - "description": "Уникальный идентификатор отправителя", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "справочник событий", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EventDto" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EventDto" - } - } - }, - "application/*+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EventDto" - } - } - } - } - }, - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/telemetry/{uid}/user": { - "post": { - "tags": [ - "Telemetry" - ], - "summary": "Принимает справочник пользователей телеметрии", - "operationId": "PostUsers", - "parameters": [ - { - "name": "uid", - "in": "path", - "required": true, - "description": "Уникальный идентификатор отправителя", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "description": "справочник пользователей телеметрии", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TelemetryUserDto" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TelemetryUserDto" - } - } - }, - "application/*+json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TelemetryUserDto" - } - } - } - } - }, - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/telemetry/{uid}/db": { - "post": { - "tags": [ - "Telemetry" - ], - "summary": "", - "operationId": "PostDb", - "parameters": [ - { - "name": "uid", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "files": { - "type": "array", - "items": { - "type": "string", - "format": "binary" - } - } - } - }, - "encoding": { - "files": { - "style": "form" - } - } - } - } - }, - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/well": { - "get": { - "tags": [ - "Well" - ], - "operationId": "GetWells", - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WellDto" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WellDto" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WellDto" - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "AuthDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "login": { - "type": "string", - "nullable": true - }, - "password": { - "type": "string", - "nullable": true - } - } - }, - "DataSaubBaseDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "date": { - "type": "string", - "format": "date-time" - }, - "mode": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "user": { - "type": "string", - "nullable": true - }, - "wellDepth": { - "type": "number", - "format": "double", - "nullable": true - }, - "bitDepth": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockPosition": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockPositionMin": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockPositionMax": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockSpeed": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockSpeedSp": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockSpeedSpRotor": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockSpeedSpSlide": { - "type": "number", - "format": "double", - "nullable": true - }, - "blockSpeedSpDevelop": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressure": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressureIdle": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressureSp": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressureSpRotor": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressureSpSlide": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressureSpDevelop": { - "type": "number", - "format": "double", - "nullable": true - }, - "pressureDeltaLimitMax": { - "type": "number", - "format": "double", - "nullable": true - }, - "axialLoad": { - "type": "number", - "format": "double", - "nullable": true - }, - "axialLoadSp": { - "type": "number", - "format": "double", - "nullable": true - }, - "axialLoadLimitMax": { - "type": "number", - "format": "double", - "nullable": true - }, - "hookWeight": { - "type": "number", - "format": "double", - "nullable": true - }, - "hookWeightIdle": { - "type": "number", - "format": "double", - "nullable": true - }, - "hookWeightLimitMin": { - "type": "number", - "format": "double", - "nullable": true - }, - "hookWeightLimitMax": { - "type": "number", - "format": "double", - "nullable": true - }, - "rotorTorque": { - "type": "number", - "format": "double", - "nullable": true - }, - "rotorTorqueIdle": { - "type": "number", - "format": "double", - "nullable": true - }, - "rotorTorqueSp": { - "type": "number", - "format": "double", - "nullable": true - }, - "rotorTorqueLimitMax": { - "type": "number", - "format": "double", - "nullable": true - }, - "rotorSpeed": { - "type": "number", - "format": "double", - "nullable": true - }, - "flow": { - "type": "number", - "format": "double", - "nullable": true - }, - "flowIdle": { - "type": "number", - "format": "double", - "nullable": true - }, - "flowDeltaLimitMax": { - "type": "number", - "format": "double", - "nullable": true - } - } - }, - "EventDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string", - "nullable": true - }, - "idCategory": { - "type": "integer", - "format": "int32" - }, - "tag": { - "type": "string", - "nullable": true - }, - "eventType": { - "type": "integer", - "format": "int32" - }, - "idSound": { - "type": "integer", - "format": "int32" - } - } - }, - "MessageDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "date": { - "type": "string", - "format": "date-time" - }, - "categoryId": { - "type": "integer", - "format": "int32" - }, - "user": { - "type": "string", - "nullable": true - }, - "message": { - "type": "string", - "nullable": true - } - } - }, - "MessageDtoPaginationContainer": { - "type": "object", - "additionalProperties": false, - "properties": { - "skip": { - "type": "integer", - "format": "int32" - }, - "take": { - "type": "integer", - "format": "int32" - }, - "count": { - "type": "integer", - "format": "int32" - }, - "items": { - "type": "array", - "nullable": true, - "items": { - "$ref": "#/components/schemas/MessageDto" - } - } - } - }, - "TelemetryInfoDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "date": { - "type": "string", - "format": "date-time" - }, - "timeZoneId": { - "type": "string", - "nullable": true - }, - "timeZoneOffsetTotalHours": { - "type": "number", - "format": "double" - }, - "caption": { - "type": "string", - "nullable": true - }, - "cluster": { - "type": "string", - "nullable": true - }, - "deposit": { - "type": "string", - "nullable": true - }, - "hmiVersion": { - "type": "string", - "nullable": true - }, - "plcVersion": { - "type": "string", - "nullable": true - }, - "comment": { - "type": "string", - "nullable": true - } - } - }, - "TelemetryMessageDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "date": { - "type": "string", - "format": "date-time" - }, - "idEvent": { - "type": "integer", - "format": "int32" - }, - "state": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "idTelemetryUser": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "arg0": { - "type": "string", - "nullable": true - }, - "arg1": { - "type": "string", - "nullable": true - }, - "arg2": { - "type": "string", - "nullable": true - }, - "arg3": { - "type": "string", - "nullable": true - } - } - }, - "TelemetryUserDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string", - "nullable": true - }, - "surname": { - "type": "string", - "nullable": true - }, - "patronymic": { - "type": "string", - "nullable": true - }, - "level": { - "type": "integer", - "format": "int32" - } - } - }, - "UserTokenDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "login": { - "type": "string", - "nullable": true - }, - "level": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "name": { - "type": "string", - "nullable": true - }, - "surname": { - "type": "string", - "nullable": true - }, - "patronymic": { - "type": "string", - "nullable": true - }, - "id": { - "type": "integer", - "format": "int32" - }, - "customerName": { - "type": "string", - "nullable": true - }, - "roleName": { - "type": "string", - "nullable": true - }, - "token": { - "type": "string", - "nullable": true - } - } - }, - "WellDto": { - "type": "object", - "additionalProperties": false, - "properties": { - "caption": { - "type": "string", - "nullable": true - }, - "cluster": { - "type": "string", - "nullable": true - }, - "deposit": { - "type": "string", - "nullable": true - }, - "id": { - "type": "integer", - "format": "int32" - }, - "lastData": { - "nullable": true - } - } - } - }, - "securitySchemes": { - "Bearer": { - "type": "apiKey", - "description": "JWT Authorization header using the Bearer scheme. Enter 'Bearer' [space] and then your token in the text input below. Example: 'Bearer 12345abcdef'", - "name": "Authorization", - "in": "header" - } - } - }, - "security": [ - { - "Bearer": [] - } - ] -} \ No newline at end of file diff --git a/SyncDicts/Connected Services/AsbCloudApi/ConnectedService.json b/SyncDicts/Connected Services/AsbCloudApi/ConnectedService.json deleted file mode 100644 index 97ae5be9..00000000 --- a/SyncDicts/Connected Services/AsbCloudApi/ConnectedService.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "ProviderId": "Unchase.OpenAPI.ConnectedService", - "Version": "1.5.20.0", - "GettingStartedDocument": { - "Uri": "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/" - }, - "ExtendedData": { - "ServiceName": "AsbCloudApi", - "GeneratedFileName": "AsbCloudApi", - "Endpoint": "https://localhost:5001/swagger/v1/swagger.json", - "GeneratedFileNamePrefix": null, - "GenerateCSharpClient": true, - "GenerateTypeScriptClient": false, - "GenerateCSharpController": false, - "OpenApiToCSharpClientCommand": { - "ClientBaseClass": null, - "ConfigurationClass": null, - "GenerateClientClasses": true, - "GenerateClientInterfaces": false, - "ClientBaseInterface": null, - "InjectHttpClient": true, - "DisposeHttpClient": true, - "ProtectedMethods": [], - "GenerateExceptionClasses": true, - "ExceptionClass": "ApiException", - "WrapDtoExceptions": true, - "UseHttpClientCreationMethod": false, - "HttpClientType": "System.Net.Http.HttpClient", - "UseHttpRequestMessageCreationMethod": false, - "UseBaseUrl": true, - "GenerateBaseUrlProperty": true, - "GenerateSyncMethods": false, - "GeneratePrepareRequestAndProcessResponseAsAsyncMethods": false, - "ExposeJsonSerializerSettings": false, - "ClientClassAccessModifier": "public", - "TypeAccessModifier": "public", - "GenerateContractsOutput": false, - "ContractsNamespace": null, - "ContractsOutputFilePath": null, - "ParameterDateTimeFormat": "s", - "ParameterDateFormat": "yyyy-MM-dd", - "GenerateUpdateJsonSerializerSettingsMethod": true, - "UseRequestAndResponseSerializationSettings": false, - "SerializeTypeInformation": false, - "QueryNullValue": "", - "ClassName": "{controller}Client", - "OperationGenerationMode": 5, - "AdditionalNamespaceUsages": [], - "AdditionalContractNamespaceUsages": [], - "GenerateOptionalParameters": false, - "GenerateJsonMethods": false, - "EnforceFlagEnums": false, - "ParameterArrayType": "System.Collections.Generic.IEnumerable", - "ParameterDictionaryType": "System.Collections.Generic.IDictionary", - "ResponseArrayType": "System.Collections.Generic.ICollection", - "ResponseDictionaryType": "System.Collections.Generic.IDictionary", - "WrapResponses": false, - "WrapResponseMethods": [], - "GenerateResponseClasses": true, - "ResponseClass": "SwaggerResponse", - "Namespace": "SyncDicts.AsbCloudApi", - "RequiredPropertiesMustBeDefined": true, - "DateType": "System.DateTimeOffset", - "JsonConverters": null, - "AnyType": "object", - "DateTimeType": "System.DateTimeOffset", - "TimeType": "System.TimeSpan", - "TimeSpanType": "System.TimeSpan", - "ArrayType": "System.Collections.Generic.ICollection", - "ArrayInstanceType": "System.Collections.ObjectModel.Collection", - "DictionaryType": "System.Collections.Generic.IDictionary", - "DictionaryInstanceType": "System.Collections.Generic.Dictionary", - "ArrayBaseType": "System.Collections.ObjectModel.Collection", - "DictionaryBaseType": "System.Collections.Generic.Dictionary", - "ClassStyle": 0, - "JsonLibrary": 1, - "GenerateDefaultValues": true, - "GenerateDataAnnotations": true, - "ExcludedTypeNames": [], - "ExcludedParameterNames": [], - "HandleReferences": false, - "GenerateImmutableArrayProperties": false, - "GenerateImmutableDictionaryProperties": false, - "JsonSerializerSettingsTransformationMethod": null, - "InlineNamedArrays": false, - "InlineNamedDictionaries": false, - "InlineNamedTuples": true, - "InlineNamedAny": false, - "GenerateDtoTypes": true, - "GenerateOptionalPropertiesAsNullable": false, - "GenerateNullableReferenceTypes": false, - "TemplateDirectory": null, - "TypeNameGeneratorType": null, - "PropertyNameGeneratorType": null, - "EnumNameGeneratorType": null, - "ServiceHost": null, - "ServiceSchemes": null, - "output": "AsbCloudApi.cs", - "newLineBehavior": 0 - }, - "ExcludeTypeNamesLater": false, - "OpenApiToTypeScriptClientCommand": null, - "OpenApiToCSharpControllerCommand": null, - "Variables": null, - "Runtime": 0, - "CopySpecification": false, - "OpenGeneratedFilesOnComplete": false, - "UseRelativePath": false, - "ConvertFromOdata": false, - "OpenApiConvertSettings": { - "ServiceRoot": "http://localhost", - "Version": { - "Major": 1, - "Minor": 0, - "Build": 1, - "Revision": -1, - "MajorRevision": -1, - "MinorRevision": -1 - }, - "EnableKeyAsSegment": null, - "EnableUnqualifiedCall": false, - "EnableOperationPath": true, - "EnableOperationImportPath": true, - "EnableNavigationPropertyPath": true, - "TagDepth": 4, - "PrefixEntityTypeNameBeforeKey": false, - "OpenApiSpecVersion": 1, - "EnableOperationId": true, - "EnableUriEscapeFunctionCall": false, - "VerifyEdmModel": false, - "IEEE754Compatible": false, - "TopExample": 50, - "EnablePagination": false, - "PageableOperationName": "listMore", - "EnableDiscriminatorValue": false, - "EnableDerivedTypesReferencesForResponses": false, - "EnableDerivedTypesReferencesForRequestBody": false, - "PathPrefix": "OData", - "RoutePathPrefixProvider": { - "PathPrefix": "OData", - "Parameters": null - }, - "ShowLinks": false, - "ShowSchemaExamples": false, - "RequireDerivedTypesConstraintForBoundOperations": false, - "ShowRootPath": false, - "ShowMsDosGroupPath": true, - "PathProvider": null - }, - "OpenApiSpecVersion": 0, - "UseNetworkCredentials": false, - "NetworkCredentialsUserName": null, - "NetworkCredentialsPassword": null, - "NetworkCredentialsDomain": null, - "WebProxyUri": null, - "UseWebProxy": false, - "UseWebProxyCredentials": false, - "WebProxyNetworkCredentialsUserName": null, - "WebProxyNetworkCredentialsPassword": null, - "WebProxyNetworkCredentialsDomain": null - } -} \ No newline at end of file diff --git a/SyncDicts/Program.cs b/SyncDicts/Program.cs deleted file mode 100644 index 3410f1c8..00000000 --- a/SyncDicts/Program.cs +++ /dev/null @@ -1,120 +0,0 @@ -using SyncDicts.AsbCloudApi; -using System.Collections.Generic; -using System.Net; -using System.Text; -using System.Text.Json; - -namespace SyncDicts -{ - class Program - { - /// - /// Описывает процесс синхронизации словарей БД - /// - /// - static void Main(/*string[] args*/) - { - //bool res; - //var context = new ArchiveDbContext(@"c:\temp\default.sqlite3"); - - //// sync Events - //var events = context.EventsDictionary.ToList() - // .Select(e => new EventDto - // { - // EventType = e.EventType, - // Id = e.Id, - // IdCategory = e.CategoryId, - // IdSound = e.SoundId, - // Message = e.MessageTemplate, - // Tag = e.Tag, - // }); - - //var info = new TelemetryInfoDto - //{ - // Caption = "скв 111", - // Deposit = "мр 111", - // Cluster = "куст 111", - // TimeZoneId = TimeZoneInfo.Local.Id, - // TimeZoneOffsetTotalHours = TimeZoneInfo.Local.BaseUtcOffset.TotalHours, - // Date = DateTime.Now, - //}; - - //var users = context.Users.ToList() - // .Select(u => new TelemetryUserDto - // { - // Id = u.Id, - // Level = u.Level, - // Name = u.Name, - // Patronymic = u.Patronymic, - // Surname = u.Surname, - // }); - - //var messages = context.Messages.Take(1024).ToList() - // .Select(m => new TelemetryMessageDto - // { - // Id = m.Id, - // Date = DateTime.UnixEpoch.AddSeconds(m.TimeStamp), - // IdEvent = m.EventItemId, - // IdTelemetryUser = m.UserId, - // State = m.State, - // Arg0 = m.Arg0, - // Arg1 = m.Arg1, - // Arg2 = m.Arg2, - // Arg3 = m.Arg3, - // }); - - var cli = new AsbCloudApi.Client("https://localhost:5001/", new System.Net.Http.HttpClient()); - - var fileName = @"C:\temp\default.sqlite3"; - var fileStream = System.IO.File.OpenRead(fileName); - var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName)); - cli.ApiTelemetryDbAsync("1", new List { file }).Wait(); - - //var cli = new swaggerClient("https://localhost:5001/", new System.Net.Http.HttpClient()); - //cli.InfoAsync("aaa",info).Wait(); - - //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/event", events); - //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/info", info); - //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/user", users); - //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages); - } - - //private static bool Send(string url, T obj) - //{ - // // sending data - // var requestBodyJson = JsonSerializer.Serialize(obj); - // var data = Encoding.UTF8.GetBytes(requestBodyJson); - - // var request = MakeRequest(url); - // using var streamWriter = request.GetRequestStream(); - // streamWriter.Write(data); - // streamWriter.Close(); - - // // getting response - // if (request.GetResponse() is not HttpWebResponse response) - // {//FAILED - // return false; - // } - - // if (response.StatusCode == HttpStatusCode.OK) - // {// sent succesfilly - // return true; - // } - // else - // {//failed - // return false; - // } - //} - - private static HttpWebRequest MakeRequest(string url, string contentType = "application/json") - { - var request = WebRequest.CreateHttp(url); - request.Method = "POST"; - request.Timeout = 4900; - request.ContentType = contentType; - request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; - request.ServicePoint.Expect100Continue = false; - return request; - } - } -} diff --git a/SyncDicts/SyncDicts.csproj b/SyncDicts/SyncDicts.csproj deleted file mode 100644 index a2b53ec3..00000000 --- a/SyncDicts/SyncDicts.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - Exe - net5.0 - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - ..\..\..\SAUB\asbsaub3\AsbSaubDbModel\bin\Release\netcoreapp3.1\AsbSaubDbModel.dll - - - - - - - -