diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index 80373e34..602db859 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -20,7 +20,7 @@ namespace AsbCloudInfrastructure.Services private readonly IFileService fileService; private readonly IBackgroundQueue queue; - public ReportService(IAsbCloudDbContext db, IConfiguration configuration, + public ReportService(IAsbCloudDbContext db, IConfiguration configuration, ITelemetryService telemetryService, IFileService fileService, IBackgroundQueue queue) { @@ -29,7 +29,7 @@ namespace AsbCloudInfrastructure.Services this.telemetryService = telemetryService; this.fileService = fileService; this.queue = queue; - ReportCategoryId = db.FileCategories.FirstOrDefault(c => + ReportCategoryId = db.FileCategories.FirstOrDefault(c => c.Name.Equals("Рапорт")).Id; } @@ -96,10 +96,10 @@ namespace AsbCloudInfrastructure.Services var suitableReportsProperties = suitableReportsFromDb.Select(r => new ReportPropertiesDto { Id = r.Id, - Name = Path.GetFileName(r.Name), - FullName = r.Name, + Name = Path.GetFileName(r.File.Name), + FullName = r.File.Name, IdWell = r.IdWell, - Date = r.Date, + Date = r.File.Date, Begin = r.Begin, End = r.End, Step = r.Step, @@ -171,7 +171,7 @@ namespace AsbCloudInfrastructure.Services generator.Step = TimeSpan.FromSeconds(stepSeconds); generator.WithCharts = true; generator.WithEvents = true; - + return generator; } } diff --git a/ConsoleApp1/Connected Services/OpenAPIService/ConnectedService.json b/ConsoleApp1/Connected Services/OpenAPIService/ConnectedService.json deleted file mode 100644 index 08e9f151..00000000 --- a/ConsoleApp1/Connected Services/OpenAPIService/ConnectedService.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "ProviderId": "Unchase.OpenAPI.ConnectedService", - "Version": "1.5.20.0", - "GettingStartedDocument": { - "Uri": "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/" - }, - "ExtendedData": { - "ServiceName": "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 deleted file mode 100644 index 96bd88e8..00000000 --- a/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.cs +++ /dev/null @@ -1,1788 +0,0 @@ -//---------------------- -// -// Generated using the NSwag toolchain v13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.2)) (http://NSwag.org) -// -//---------------------- - -#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." -#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." -#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' -#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... -#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." -#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" - -namespace 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 idWell, System.DateTimeOffset? begin, int? intervalSec, int? approxPointsCount) - { - return DataAsync(idWell, 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 idWell, System.DateTimeOffset? begin, int? intervalSec, int? approxPointsCount, System.Threading.CancellationToken cancellationToken) - { - if (idWell == null) - throw new System.ArgumentNullException("idWell"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/well/{idWell}/data?"); - urlBuilder_.Replace("{idWell}", System.Uri.EscapeDataString(ConvertToString(idWell, 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 idWell, int? skip, int? take, System.Collections.Generic.IEnumerable categoryids, System.DateTimeOffset? begin, System.DateTimeOffset? end) - { - return MessageAsync(idWell, 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 idWell, int? skip, int? take, System.Collections.Generic.IEnumerable categoryids, System.DateTimeOffset? begin, System.DateTimeOffset? end, System.Threading.CancellationToken cancellationToken) - { - if (idWell == null) - throw new System.ArgumentNullException("idWell"); - - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/well/{idWell}/message?"); - urlBuilder_.Replace("{idWell}", System.Uri.EscapeDataString(ConvertToString(idWell, 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 deleted file mode 100644 index bb45f73e..00000000 --- a/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag +++ /dev/null @@ -1,99 +0,0 @@ -{ - "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 deleted file mode 100644 index 802684de..00000000 --- a/ConsoleApp1/Connected Services/OpenAPIService/OpenAPI.nswag.json +++ /dev/null @@ -1,1022 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "ASB cloud web api", - "version": "v1" - }, - "paths": { - "/auth/login": { - "post": { - "tags": [ - "Auth" - ], - "summary": "Аутентификация пользователя", - "operationId": "Login", - "requestBody": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthDto" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/AuthDto" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/AuthDto" - } - } - } - }, - "responses": { - "200": { - "description": "новый токен", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/UserTokenDto" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserTokenDto" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserTokenDto" - } - } - } - }, - "400": { - "description": "логин и пароль не подходят" - } - } - } - }, - "/auth/refresh": { - "get": { - "tags": [ - "Auth" - ], - "summary": "Продление срока действия токена", - "operationId": "Refresh", - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/well/{idWell}/data": { - "get": { - "tags": [ - "Data" - ], - "summary": "Возвращает данные САУБ по скважине.\r\nПо умолчанию за последние 10 минут.", - "operationId": "GetData", - "parameters": [ - { - "name": "idWell", - "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/{idWell}/message": { - "get": { - "tags": [ - "Message" - ], - "summary": "Выдает список сообщений по скважине", - "operationId": "GetMessage", - "parameters": [ - { - "name": "idWell", - "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 0ea94f9a..b780c0f6 100644 --- a/ConsoleApp1/ConsoleApp1.csproj +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -6,23 +6,21 @@ - + - - - - ..\AsbCloudInfrastructure\CommonLibs\AsbSaubReport\AsbSaubReport.dll - - - + + + + + diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs index 48ddd878..6beec835 100644 --- a/ConsoleApp1/Program.cs +++ b/ConsoleApp1/Program.cs @@ -8,14 +8,19 @@ using System; using System.Collections.Generic; using System.IO; +using Mapster; namespace ConsoleApp1 { + + class Program { - static void Main(string[] args) + + static void Main(/*string[] args*/) { + //var options = new DbContextOptionsBuilder() // .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True") // .Options; @@ -42,9 +47,5 @@ namespace ConsoleApp1 Console.ReadKey(); } - private static void Generator_OnProgress(object sender, (float progress, string operation) e) - { - //throw new NotImplementedException(); - } } }