diff --git a/AsbCloudApp/Data/DataSaubBaseDto.cs b/AsbCloudApp/Data/DataSaubBaseDto.cs index b4e86b22..148699cb 100644 --- a/AsbCloudApp/Data/DataSaubBaseDto.cs +++ b/AsbCloudApp/Data/DataSaubBaseDto.cs @@ -9,6 +9,7 @@ namespace AsbCloudApp.Data { //[JsonPropertyName("date")] public DateTime Date { get; set; } + /// /// Режим работы САУБ: /// 0 - "РУЧНОЙ" diff --git a/AsbCloudApp/Data/PaginationContainer.cs b/AsbCloudApp/Data/PaginationContainer.cs index 7ddb3921..ba33eaf3 100644 --- a/AsbCloudApp/Data/PaginationContainer.cs +++ b/AsbCloudApp/Data/PaginationContainer.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; namespace AsbCloudApp.Data { @@ -24,17 +22,17 @@ namespace AsbCloudApp.Data /// Кол-во записей пропущеных с начала таблицы в запросе от api /// public int Skip { get; set; } - + /// /// Кол-во записей в запросе от api /// public int Take { get; set; } - + /// /// Кол-во записей всего в таблице /// public int Count { get; set; } - + /// /// Данные /// diff --git a/AsbCloudApp/Data/TelemetryDto.cs b/AsbCloudApp/Data/TelemetryDto.cs deleted file mode 100644 index ab19052b..00000000 --- a/AsbCloudApp/Data/TelemetryDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace AsbCloudApp.Data -{ - public class TelemetryDto - { - public string HmiVersion { get; set; } - - public T Payload { get; set; } - } -} diff --git a/AsbCloudApp/Data/TelemetryInfoDto.cs b/AsbCloudApp/Data/TelemetryInfoDto.cs index 7d6a964b..93843898 100644 --- a/AsbCloudApp/Data/TelemetryInfoDto.cs +++ b/AsbCloudApp/Data/TelemetryInfoDto.cs @@ -4,11 +4,12 @@ namespace AsbCloudApp.Data { public class TelemetryInfoDto { - public DateTime Date { get; set; } + public DateTime DrillingStartDate { get; set; } public string TimeZoneId { get; set; } public double TimeZoneOffsetTotalHours { get; set; } - public string Caption { get; set; } + public string Well { get; set; } public string Cluster { get; set; } + public string Customer { get; set; } public string Deposit { get; set; } public string HmiVersion { get; set; } public string PlcVersion { get; set; } diff --git a/AsbCloudApp/Data/TelemetryMessageDto.cs b/AsbCloudApp/Data/TelemetryMessageDto.cs index 34f452cd..40a289e8 100644 --- a/AsbCloudApp/Data/TelemetryMessageDto.cs +++ b/AsbCloudApp/Data/TelemetryMessageDto.cs @@ -8,15 +8,9 @@ namespace AsbCloudApp.Data public class TelemetryMessageDto { public int Id { get; set; } - public DateTime Date { get; set; } - public int IdEvent { get; set; } - - public int? State { get; set; } - public int? IdTelemetryUser { get; set; } - public string Arg0 { get; set; } public string Arg1 { get; set; } public string Arg2 { get; set; } diff --git a/AsbCloudDb/Model/Message.cs b/AsbCloudDb/Model/Message.cs index d263b26a..e8bcee04 100644 --- a/AsbCloudDb/Model/Message.cs +++ b/AsbCloudDb/Model/Message.cs @@ -26,9 +26,6 @@ namespace AsbCloudDb.Model [Column("date", TypeName = "timestamp with time zone")] public DateTime Date { get; set; } - [Column("state"), Comment("1 - сработало событие. 0 - событие пропало.")] - public int? State { get; set; } - [Column("arg0"), Comment("Аргумент №0 для вставки в шаблон сообщения")] [StringLength(255)] public string Arg0 { get; set; } diff --git a/AsbCloudDb/Model/TelemetryInfo.cs b/AsbCloudDb/Model/TelemetryInfo.cs index 9a592443..8e0f3ebf 100644 --- a/AsbCloudDb/Model/TelemetryInfo.cs +++ b/AsbCloudDb/Model/TelemetryInfo.cs @@ -1,16 +1,15 @@ using System; -using System.Collections.Generic; -using System.Text; namespace AsbCloudDb.Model { public class TelemetryInfo { - public DateTime Date { get; set; } + public DateTime DrillingStartDate { get; set; } public string TimeZoneId { get; set; } public double TimeZoneOffsetTotalHours { get; set; } - public string Caption { get; set; } + public string Well { get; set; } public string Cluster { get; set; } + public string Customer { get; set; } public string Deposit { get; set; } public string HmiVersion { get; set; } public string PlcVersion { get; set; } diff --git a/AsbCloudInfrastructure/Services/MessageService.cs b/AsbCloudInfrastructure/Services/MessageService.cs index e4eed486..1a6c57a8 100644 --- a/AsbCloudInfrastructure/Services/MessageService.cs +++ b/AsbCloudInfrastructure/Services/MessageService.cs @@ -48,7 +48,6 @@ namespace AsbCloudInfrastructure.Services var messages = from m in db.Messages where m.IdTelemetry == telemetry.Id - && m.State == 1 select m; if ((categoryids != default) && (categoryids.Count() > 0)) @@ -63,7 +62,7 @@ namespace AsbCloudInfrastructure.Services messages = messages.Where(m => eventIds.Contains(m.IdEvent)); } - var result = new PaginationContainer() { Skip = skip, Take = take}; + var result = new PaginationContainer() { Skip = skip, Take = take }; messages = messages.OrderByDescending(m => m.Date); @@ -117,6 +116,7 @@ namespace AsbCloudInfrastructure.Services foreach (var dto in dtos) { var entity = mapper.Map(dto); + entity.Id = 0; entity.IdTelemetry = telemetryId; db.Messages.Add(entity); } diff --git a/AsbCloudInfrastructure/Services/TelemetryService.cs b/AsbCloudInfrastructure/Services/TelemetryService.cs index 2eb58845..e81f80e1 100644 --- a/AsbCloudInfrastructure/Services/TelemetryService.cs +++ b/AsbCloudInfrastructure/Services/TelemetryService.cs @@ -24,7 +24,7 @@ namespace AsbCloudInfrastructure.Services public int? GetWellIdByTelemetryUid(string uid) => GetWellByTelemetryUid(uid)?.Id; - + public void UpdateInfo(string uid, TelemetryInfoDto info) { var telemetry = GetOrCreateTelemetryByUid(uid); diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index feb98403..13ede118 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -1,7 +1,6 @@ using AsbCloudApp.Data; using AsbCloudApp.Services; using AsbCloudDb.Model; -using AutoMapper; using System.Collections.Generic; using System.Linq; diff --git a/AsbCloudWebApi/Controllers/DataController.cs b/AsbCloudWebApi/Controllers/DataController.cs index fe3a0d64..171d3d28 100644 --- a/AsbCloudWebApi/Controllers/DataController.cs +++ b/AsbCloudWebApi/Controllers/DataController.cs @@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Controllers [HttpGet] [Route("{wellId}/data")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] - public IActionResult Get(int wellId, DateTime begin = default, int intervalSec = 600, int approxPointsCount = 1024) + public IActionResult GetData(int wellId, DateTime begin = default, int intervalSec = 600, int approxPointsCount = 1024) { if (begin == default) begin = DateTime.Now.AddSeconds(-intervalSec); diff --git a/AsbCloudWebApi/Controllers/MessageController.cs b/AsbCloudWebApi/Controllers/MessageController.cs index be3c02ea..de7ab106 100644 --- a/AsbCloudWebApi/Controllers/MessageController.cs +++ b/AsbCloudWebApi/Controllers/MessageController.cs @@ -30,7 +30,7 @@ namespace AsbCloudWebApi.Controllers [HttpGet] [Route("{wellId}/message")] [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] - public IActionResult Get(int wellId, [FromQuery] IEnumerable categoryids = default, DateTime begin = default, DateTime end = default, int skip = 0, int take = 32) + public IActionResult GetMessage(int wellId, int skip = 0, int take = 32, [FromQuery] IEnumerable categoryids = default, DateTime begin = default, DateTime end = default) { if (take > 1024) return BadRequest("limit mast be less then 1024"); diff --git a/AsbCloudWebApi/Controllers/TelemetryController.cs b/AsbCloudWebApi/Controllers/TelemetryController.cs index 39a8aa1f..b066e9e1 100644 --- a/AsbCloudWebApi/Controllers/TelemetryController.cs +++ b/AsbCloudWebApi/Controllers/TelemetryController.cs @@ -24,11 +24,11 @@ namespace AsbCloudWebApi.Controllers private readonly IHubContext telemetryHubContext; public TelemetryController( - ITelemetryService telemetryService, - IDataService DataService, - IMessageService messageService, - IEventService eventService, - ITelemetryUserService telemetryUserService, + ITelemetryService telemetryService, + IDataService DataService, + IMessageService messageService, + IEventService eventService, + ITelemetryUserService telemetryUserService, IHubContext telemetryHubContext) { this.DataService = DataService; @@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Route("{uid}/info")] - public IActionResult Info(string uid, [FromBody] TelemetryInfoDto info) + public IActionResult PostInfo(string uid, [FromBody] TelemetryInfoDto info) { telemetryService.UpdateInfo(uid, info); return Ok(); @@ -61,7 +61,7 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Route("{uid}/data")] - public IActionResult Data(string uid, [FromBody] IEnumerable dtos) + public IActionResult PostData(string uid, [FromBody] IEnumerable dtos) { var wellId = telemetryService.GetWellIdByTelemetryUid(uid); DataService.UpdateData(uid, dtos); @@ -80,7 +80,7 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Route("{uid}/message")] - public IActionResult Message(string uid, [FromBody] IEnumerable dtos) + public IActionResult PostMessages(string uid, [FromBody] IEnumerable dtos) { var wellId = telemetryService.GetWellIdByTelemetryUid(uid); messageService.Insert(uid, dtos); @@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Route("{uid}/event")] - public IActionResult Events(string uid, [FromBody] List events) + public IActionResult PostEvents(string uid, [FromBody] List events) { eventService.Upsert(uid, events); return Ok(); @@ -113,10 +113,37 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Route("{uid}/user")] - public IActionResult Users(string uid, [FromBody] List users) + public IActionResult PostUsers(string uid, [FromBody] List users) { telemetryUserService.Upsert(uid, users); return Ok(); } + + /// + /// Загрузка архива (sqlite3). + /// + /// 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<FileParameter> { file }).Wait(); + /// + /// + /// + /// + /// + //[HttpPost] + //[Route("{uid}/db")] + //public IActionResult PostDb(string uid, IFormFileCollection files) + //{ + // foreach (var file in files) + // { + // var fileName = string.IsNullOrEmpty(file.FileName) + // ? System.IO.Path.GetTempFileName() + // : file.FileName; + // using (var stream = System.IO.File.Create(fileName)) + // file.CopyTo(stream); + // } + // return Ok(); + //} } } diff --git a/AsbCloudWebApi/Controllers/WellController.cs b/AsbCloudWebApi/Controllers/WellController.cs index dd9d36cc..8f55dc49 100644 --- a/AsbCloudWebApi/Controllers/WellController.cs +++ b/AsbCloudWebApi/Controllers/WellController.cs @@ -20,7 +20,7 @@ namespace AsbCloudWebApi.Controllers [HttpGet] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] - public IActionResult Get() + public IActionResult GetWells() { var claimIdCustomer = User.FindFirst("IdCustomer"); diff --git a/ConsoleApp1/Connected Services/OpenAPIService/ConnectedService.json b/ConsoleApp1/Connected Services/OpenAPIService/ConnectedService.json new file mode 100644 index 00000000..08e9f151 --- /dev/null +++ b/ConsoleApp1/Connected Services/OpenAPIService/ConnectedService.json @@ -0,0 +1,162 @@ +{ + "ProviderId": "Unchase.OpenAPI.ConnectedService", + "Version": "1.5.20.0", + "GettingStartedDocument": { + "Uri": "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/" + }, + "ExtendedData": { + "ServiceName": "OpenAPIService", + "GeneratedFileName": "OpenAPI", + "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": 1, + "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": "ConsoleApp1.OpenAPIService", + "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": 0, + "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": "OpenAPI.cs", + "newLineBehavior": 0 + }, + "ExcludeTypeNamesLater": true, + "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/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.cs b/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.cs new file mode 100644 index 00000000..b7a17a86 --- /dev/null +++ b/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.cs @@ -0,0 +1,1788 @@ +//---------------------- +// +// 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 ConsoleApp1.OpenAPIService +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")] + public partial class AuthClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public AuthClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + /// Аутентификация пользователя + /// новый токен + /// A server side error occurred. + public System.Threading.Tasks.Task LoginAsync(AuthDto body) + { + return LoginAsync(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 LoginAsync(AuthDto body, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/auth/login"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(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 RefreshAsync() + { + return RefreshAsync(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 RefreshAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/auth/refresh"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + 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 = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")] + public partial class WellClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public WellClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + /// Возвращает данные САУБ по скважине. + /// По умолчанию за последние 10 минут. + /// id скважины + /// дата начала выборки. По умолчанию: текущее время - intervalSec + /// интервал времени даты начала выборки, секунды + /// желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена. + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task> DataAsync(int wellId, System.DateTimeOffset? begin, int? intervalSec, int? approxPointsCount) + { + return DataAsync(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> DataAsync(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 MessageAsync(int wellId, int? skip, int? take, System.Collections.Generic.IEnumerable categoryids, System.DateTimeOffset? begin, System.DateTimeOffset? end) + { + return MessageAsync(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 MessageAsync(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(); + } + } + + 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 = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")] + public partial class TelemetryClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public TelemetryClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + /// Принимает общую информацию по скважине + /// Уникальный идентификатор отправителя + /// нформация об отправителе + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task InfoAsync(string uid, TelemetryInfoDto body) + { + return InfoAsync(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 InfoAsync(string uid, TelemetryInfoDto body, System.Threading.CancellationToken cancellationToken) + { + if (uid == null) + throw new System.ArgumentNullException("uid"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/telemetry/{uid}/info"); + urlBuilder_.Replace("{uid}", System.Uri.EscapeDataString(ConvertToString(uid, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// Принимает данные от разных систем по скважине + /// Уникальный идентификатор отправителя + /// Данные + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task DataAsync(string uid, System.Collections.Generic.IEnumerable body) + { + return DataAsync(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 DataAsync(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(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// Принимает список новых сообщений от телеметрии + /// Уникальный идентификатор отправителя + /// сообщения + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task MessageAsync(string uid, System.Collections.Generic.IEnumerable body) + { + return MessageAsync(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 MessageAsync(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(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// Принимает справочник событий + /// Уникальный идентификатор отправителя + /// справочник событий + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task EventAsync(string uid, System.Collections.Generic.IEnumerable body) + { + return EventAsync(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 EventAsync(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(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// Принимает справочник пользователей телеметрии + /// Уникальный идентификатор отправителя + /// справочник пользователей телеметрии + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task UserAsync(string uid, System.Collections.Generic.IEnumerable body) + { + return UserAsync(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 UserAsync(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(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + 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 = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")] + public partial class ApiClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public ApiClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + /// Success + /// A server side error occurred. + public System.Threading.Tasks.Task> WellAsync() + { + return WellAsync(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> WellAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/well"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(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 = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class AuthDto + { + [Newtonsoft.Json.JsonProperty("login", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Login { get; set; } + + [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Password { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class DataSaubBaseDto + { + [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset Date { get; set; } + + [Newtonsoft.Json.JsonProperty("mode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? Mode { get; set; } + + [Newtonsoft.Json.JsonProperty("user", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string User { get; set; } + + [Newtonsoft.Json.JsonProperty("wellDepth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? WellDepth { get; set; } + + [Newtonsoft.Json.JsonProperty("bitDepth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BitDepth { get; set; } + + [Newtonsoft.Json.JsonProperty("blockPosition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockPosition { get; set; } + + [Newtonsoft.Json.JsonProperty("blockPositionMin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockPositionMin { get; set; } + + [Newtonsoft.Json.JsonProperty("blockPositionMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockPositionMax { get; set; } + + [Newtonsoft.Json.JsonProperty("blockSpeed", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockSpeed { get; set; } + + [Newtonsoft.Json.JsonProperty("blockSpeedSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockSpeedSp { get; set; } + + [Newtonsoft.Json.JsonProperty("blockSpeedSpRotor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockSpeedSpRotor { get; set; } + + [Newtonsoft.Json.JsonProperty("blockSpeedSpSlide", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockSpeedSpSlide { get; set; } + + [Newtonsoft.Json.JsonProperty("blockSpeedSpDevelop", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? BlockSpeedSpDevelop { get; set; } + + [Newtonsoft.Json.JsonProperty("pressure", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Pressure { get; set; } + + [Newtonsoft.Json.JsonProperty("pressureIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? PressureIdle { get; set; } + + [Newtonsoft.Json.JsonProperty("pressureSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? PressureSp { get; set; } + + [Newtonsoft.Json.JsonProperty("pressureSpRotor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? PressureSpRotor { get; set; } + + [Newtonsoft.Json.JsonProperty("pressureSpSlide", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? PressureSpSlide { get; set; } + + [Newtonsoft.Json.JsonProperty("pressureSpDevelop", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? PressureSpDevelop { get; set; } + + [Newtonsoft.Json.JsonProperty("pressureDeltaLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? PressureDeltaLimitMax { get; set; } + + [Newtonsoft.Json.JsonProperty("axialLoad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? AxialLoad { get; set; } + + [Newtonsoft.Json.JsonProperty("axialLoadSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? AxialLoadSp { get; set; } + + [Newtonsoft.Json.JsonProperty("axialLoadLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? AxialLoadLimitMax { get; set; } + + [Newtonsoft.Json.JsonProperty("hookWeight", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? HookWeight { get; set; } + + [Newtonsoft.Json.JsonProperty("hookWeightIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? HookWeightIdle { get; set; } + + [Newtonsoft.Json.JsonProperty("hookWeightLimitMin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? HookWeightLimitMin { get; set; } + + [Newtonsoft.Json.JsonProperty("hookWeightLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? HookWeightLimitMax { get; set; } + + [Newtonsoft.Json.JsonProperty("rotorTorque", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? RotorTorque { get; set; } + + [Newtonsoft.Json.JsonProperty("rotorTorqueIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? RotorTorqueIdle { get; set; } + + [Newtonsoft.Json.JsonProperty("rotorTorqueSp", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? RotorTorqueSp { get; set; } + + [Newtonsoft.Json.JsonProperty("rotorTorqueLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? RotorTorqueLimitMax { get; set; } + + [Newtonsoft.Json.JsonProperty("rotorSpeed", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? RotorSpeed { get; set; } + + [Newtonsoft.Json.JsonProperty("flow", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Flow { get; set; } + + [Newtonsoft.Json.JsonProperty("flowIdle", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? FlowIdle { get; set; } + + [Newtonsoft.Json.JsonProperty("flowDeltaLimitMax", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? FlowDeltaLimitMax { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class EventDto + { + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Message { get; set; } + + [Newtonsoft.Json.JsonProperty("idCategory", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int IdCategory { get; set; } + + [Newtonsoft.Json.JsonProperty("tag", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Tag { get; set; } + + [Newtonsoft.Json.JsonProperty("eventType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int EventType { get; set; } + + [Newtonsoft.Json.JsonProperty("idSound", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int IdSound { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class MessageDto + { + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset Date { get; set; } + + [Newtonsoft.Json.JsonProperty("categoryId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int CategoryId { get; set; } + + [Newtonsoft.Json.JsonProperty("user", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string User { get; set; } + + [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Message { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class MessageDtoPaginationContainer + { + [Newtonsoft.Json.JsonProperty("skip", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Skip { get; set; } + + [Newtonsoft.Json.JsonProperty("take", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Take { get; set; } + + [Newtonsoft.Json.JsonProperty("count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Count { get; set; } + + [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Items { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class TelemetryInfoDto + { + [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset Date { get; set; } + + [Newtonsoft.Json.JsonProperty("timeZoneId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TimeZoneId { get; set; } + + [Newtonsoft.Json.JsonProperty("timeZoneOffsetTotalHours", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double TimeZoneOffsetTotalHours { get; set; } + + [Newtonsoft.Json.JsonProperty("caption", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Caption { get; set; } + + [Newtonsoft.Json.JsonProperty("cluster", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Cluster { get; set; } + + [Newtonsoft.Json.JsonProperty("deposit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Deposit { get; set; } + + [Newtonsoft.Json.JsonProperty("hmiVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string HmiVersion { get; set; } + + [Newtonsoft.Json.JsonProperty("plcVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PlcVersion { get; set; } + + [Newtonsoft.Json.JsonProperty("comment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Comment { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class TelemetryMessageDto + { + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset Date { get; set; } + + [Newtonsoft.Json.JsonProperty("idEvent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int IdEvent { get; set; } + + [Newtonsoft.Json.JsonProperty("state", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? State { get; set; } + + [Newtonsoft.Json.JsonProperty("idTelemetryUser", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? IdTelemetryUser { get; set; } + + [Newtonsoft.Json.JsonProperty("arg0", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Arg0 { get; set; } + + [Newtonsoft.Json.JsonProperty("arg1", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Arg1 { get; set; } + + [Newtonsoft.Json.JsonProperty("arg2", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Arg2 { get; set; } + + [Newtonsoft.Json.JsonProperty("arg3", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Arg3 { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class TelemetryUserDto + { + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("surname", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Surname { get; set; } + + [Newtonsoft.Json.JsonProperty("patronymic", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Patronymic { get; set; } + + [Newtonsoft.Json.JsonProperty("level", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Level { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class UserTokenDto + { + [Newtonsoft.Json.JsonProperty("login", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Login { get; set; } + + [Newtonsoft.Json.JsonProperty("level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? Level { get; set; } + + [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("surname", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Surname { get; set; } + + [Newtonsoft.Json.JsonProperty("patronymic", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Patronymic { get; set; } + + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + [Newtonsoft.Json.JsonProperty("customerName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CustomerName { get; set; } + + [Newtonsoft.Json.JsonProperty("roleName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string RoleName { get; set; } + + [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Token { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.1.0 (Newtonsoft.Json v12.0.0.2)")] + public partial class WellDto + { + [Newtonsoft.Json.JsonProperty("caption", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Caption { get; set; } + + [Newtonsoft.Json.JsonProperty("cluster", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Cluster { get; set; } + + [Newtonsoft.Json.JsonProperty("deposit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Deposit { get; set; } + + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int Id { get; set; } + + [Newtonsoft.Json.JsonProperty("lastData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object LastData { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> 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/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag b/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag new file mode 100644 index 00000000..bb45f73e --- /dev/null +++ b/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag @@ -0,0 +1,99 @@ +{ + "runtime": "NetCore21", + "defaultVariables": null, + "documentGenerator": { + "fromDocument": { + "url": "https://localhost:5001/swagger/v1/swagger.json", + "output": "OpenAPI.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": "MultipleClientsFromPathSegments", + "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": "ConsoleApp1.OpenAPIService", + "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": "NewtonsoftJson", + "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": "OpenAPI.cs", + "newLineBehavior": "Auto" + } + } +} \ No newline at end of file diff --git a/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag.json b/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag.json new file mode 100644 index 00000000..77e1a983 --- /dev/null +++ b/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag.json @@ -0,0 +1,1022 @@ +{ + "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/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/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj index 0f15dd87..18a52da0 100644 --- a/ConsoleApp1/ConsoleApp1.csproj +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -9,6 +9,9 @@ + + + @@ -17,4 +20,8 @@ + + + + diff --git a/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.cs b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.cs new file mode 100644 index 00000000..e6b4f571 --- /dev/null +++ b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.cs @@ -0,0 +1,1487 @@ +//---------------------- +// +// 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 new file mode 100644 index 00000000..ba266aac --- /dev/null +++ b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag @@ -0,0 +1,99 @@ +{ + "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 new file mode 100644 index 00000000..3b40d113 --- /dev/null +++ b/SyncDicts/Connected Services/AsbCloudApi/AsbCloudApi.nswag.json @@ -0,0 +1,1069 @@ +{ + "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 new file mode 100644 index 00000000..97ae5be9 --- /dev/null +++ b/SyncDicts/Connected Services/AsbCloudApi/ConnectedService.json @@ -0,0 +1,162 @@ +{ + "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 index 272b7c30..f0e0e9dc 100644 --- a/SyncDicts/Program.cs +++ b/SyncDicts/Program.cs @@ -1,7 +1,5 @@ -using AsbCloudApp.Data; -using AsbSaubDbModel.V3; -using System; -using System.Linq; +using SyncDicts.AsbCloudApi; +using System.Collections.Generic; using System.Net; using System.Text; using System.Text.Json; @@ -16,59 +14,69 @@ namespace SyncDicts /// static void Main(/*string[] args*/) { - bool res; - var context = new ArchiveDbContext(@"c:\temp\default.sqlite3"); + //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, - }); + //// 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 = "скв 32", - Deposit = "мр 2", - Cluster = "куст 22", - TimeZoneId = TimeZoneInfo.Local.Id, - TimeZoneOffsetTotalHours = TimeZoneInfo.Local.BaseUtcOffset.TotalHours, - Date = DateTime.Now, - }; + //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 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 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); + //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages); } private static bool Send(string url, T obj) diff --git a/SyncDicts/SyncDicts.csproj b/SyncDicts/SyncDicts.csproj index 07f869ed..a2b53ec3 100644 --- a/SyncDicts/SyncDicts.csproj +++ b/SyncDicts/SyncDicts.csproj @@ -8,6 +8,17 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + @@ -20,4 +31,8 @@ + + + +