From db1d6f4faa9623d7e2d95e16790cc99504ea11b0 Mon Sep 17 00:00:00 2001 From: Timo Schauties Date: Mon, 16 Dec 2024 20:02:22 +0100 Subject: [PATCH 1/6] [Add] 61 Add DataGrid to ResourceView - added MudDataGrid to ResourceView - modified CatalogItemViewModel --- src/Nexus.UI/Components/ResourceView.razor | 293 +++++++----------- .../ViewModels/CatalogItemViewModel.cs | 79 ++++- 2 files changed, 189 insertions(+), 183 deletions(-) diff --git a/src/Nexus.UI/Components/ResourceView.razor b/src/Nexus.UI/Components/ResourceView.razor index 9e50d296..af48d581 100644 --- a/src/Nexus.UI/Components/ResourceView.razor +++ b/src/Nexus.UI/Components/ResourceView.razor @@ -2,11 +2,10 @@ @inject AppState AppState
-
@if (AppState.CatalogItemsMap is not null) { - @foreach (var entry in AppState.CatalogItemsMap) + @foreach (var entry in AppState.CatalogItemsMap) //String = GruppenName, Val = Gruppe selbst { - @if (entry.Value == AppState.CatalogItemsGroup) + @if (entry.Value == AppState.CatalogItemsGroup) //AppState.CatalogItemsGroup aktuelle gewählte gruppe {
@entry.Key @@ -42,95 +41,31 @@
- @if (AppState.CatalogItemsGroup is not null) - { - @if (AppState.EditModeCatalogMap.ContainsKey(AppState.SelectedCatalog!.Id)) - { - -
- - @foreach (var catalogItem in catalogItemPair) - { -
- -
- - @catalogItem.Resource.Id - - - - - - - - @Utilities.ToUnitString(catalogItem.Representation.SamplePeriod) - -
- -
- -
- -
- } -
-
- } - else - { - -
- - @foreach (var catalogItem in catalogItemPair) - { -
- -
- - @catalogItem.Resource.Id - - @catalogItem.Unit - @if (catalogItem.Warning is not null) - { - - - - } - - @Utilities.ToUnitString(catalogItem.Representation.SamplePeriod) - -
- -
- - @if (string.IsNullOrWhiteSpace(@catalogItem.Description)) - { -   - } - else - { - @catalogItem.Description - } - -
- -
- } -
-
- } - } + + + + + + + + + + + +
-
@@ -164,10 +99,10 @@ { - @@ -178,7 +113,7 @@ argument.TryGetStringValue("default", out var defaultValue2)) { - - @@ -209,8 +144,6 @@ } @code { - - private Virtualize>? _virtualizeComponent; private PropertyChangedEventHandler _handler; private string _searchIcon = Icons.Material.Filled.Search; private bool _isPropertiesViewDialogOpen; @@ -224,26 +157,13 @@ public ResourceView() { - _handler = async (sender, e) => + _handler = async (sender, e) => { - if (e.PropertyName == nameof(AppState.CatalogItemsMap)) - { - if (_virtualizeComponent is not null) - { - await _virtualizeComponent.RefreshDataAsync(); - StateHasChanged(); - } - } - - else if (e.PropertyName == nameof(AppState.SearchString)) + if (e.PropertyName == nameof(AppState.SearchString)) { _searchIcon = string.IsNullOrWhiteSpace(AppState.SearchString) ? Icons.Material.Filled.Search - : Icons.Material.Filled.Close; - - if (_virtualizeComponent is not null) - await _virtualizeComponent.RefreshDataAsync(); - } + : Icons.Material.Filled.Close; } else if (e.PropertyName == nameof(AppState.Settings.SelectedCatalogItems)) { @@ -257,54 +177,10 @@ }; } - private async Task SelectCatalogItemsGroupAsync(List catalogItems) - { - AppState.CatalogItemsGroup = catalogItems; - - if (_virtualizeComponent is not null) - await _virtualizeComponent.RefreshDataAsync(); - } - - private ValueTask>> LoadItems(ItemsProviderRequest request) - { - var catalogItemsGroup = AppState.CatalogItemsGroup; - - if (catalogItemsGroup is null) - return ValueTask.FromResult(new ItemsProviderResult>(Enumerable.Empty>(), 0)); - - var groupSize = 4; - var total = (int)Math.Ceiling(catalogItemsGroup.Count / (double)groupSize); - - var source = catalogItemsGroup - .Skip(request.StartIndex * groupSize) - .Take(request.Count * groupSize); - - var index = 0; - - var groups = source - .GroupBy(item => - { - var result = index / groupSize; - index++; - return result; - }) - .Select(group => group.ToList()) - .ToList(); - - return ValueTask.FromResult(new ItemsProviderResult>(groups, total)); - } - - private void OpenPropertiesModal() - { - _isPropertiesViewDialogOpen = true; - } - - private void OpenContextMenu(MouseEventArgs args, CatalogItemViewModel catalogItem) + public void Dispose() { - _contextMenuLeft = args.PageX; - _contextMenuTop = args.PageY; - _contextMenuCatalogItem = catalogItem; - _isContextMenuOpen = true; + AppState.PropertyChanged -= _handler; + AppState.Settings.PropertyChanged -= _handler; } protected override void OnInitialized() @@ -313,28 +189,24 @@ AppState.Settings.PropertyChanged += _handler; } - private void SetMetadataOverridesValue(ChangeEventArgs e, string resourceId, string propertyKey) + + private async Task SelectCatalogItemsGroupAsync(List catalogItems) { - if (AppState.EditModeCatalogMap.TryGetValue(AppState.SelectedCatalog!.Id, out var map)) - { - var key = new EditModeItem(resourceId, propertyKey); - var value = e.Value?.ToString(); + AppState.CatalogItemsGroup = catalogItems; + } - map[key] = value; - } + private void OpenPropertiesModal() + { + _isPropertiesViewDialogOpen = true; } - private string? GetMetadataOverridesValue(string resourceId, string propertyKey) + private void SetNewMetaDataValue(string resourceId, string newValue, string propertyKey) { if (AppState.EditModeCatalogMap.TryGetValue(AppState.SelectedCatalog!.Id, out var map)) { var key = new EditModeItem(resourceId, propertyKey); - - if (map.TryGetValue(key, out var value)) - return value; + map[key] = newValue; } - - return default; } private void SelectParameterizedCatalogItem() @@ -359,9 +231,76 @@ } } - public void Dispose() + private void CommittedItemChanges(CatalogItemViewModel item) { - AppState.PropertyChanged -= _handler; - AppState.Settings.PropertyChanged -= _handler; + var id = item.Resource.Id; + if(item.DescriptionHasChanged) + { + SetNewMetaDataValue(id, item.Description, CatalogItemViewModel.DESCRIPTION_KEY); + } + else if(item.UnitHasChanged) + { + SetNewMetaDataValue(id, item.Unit, CatalogItemViewModel.UNIT_KEY); + } + else if(item.WarningHasChanged) + { + SetNewMetaDataValue(id, item.Warning, CatalogItemViewModel.WARNING_KEY); + } + item.ResetHasChangedState(); + } + + // quick filter - filter globally across multiple columns with the same input + private Func QuickFilter => x => + { + var searchString = AppState.SearchString != null ? AppState.SearchString : ""; + + if (string.IsNullOrWhiteSpace(searchString)) + return true; + + if (x.Resource.Id.Contains(searchString, StringComparison.OrdinalIgnoreCase)) + return true; + + if (Utilities.ToUnitString(x.Representation.SamplePeriod).Contains(searchString, StringComparison.OrdinalIgnoreCase)) + return true; + + var description = x.Description != null ? x.Description : ""; + if (description.Contains(searchString, StringComparison.OrdinalIgnoreCase)) + return true; + + var unit = x.Unit != null ? x.Unit : ""; + if (unit.Contains(searchString, StringComparison.OrdinalIgnoreCase)) + return true; + + var warning = x.Warning != null ? x.Warning : ""; + if (warning.Contains(searchString, StringComparison.OrdinalIgnoreCase)) + return true; + + return false; + }; + + private void RowClicked(DataGridRowClickEventArgs args) + { + if(!AppState.EditModeCatalogMap.ContainsKey(AppState.SelectedCatalog!.Id)) + { + ToggleCatalogItemSelection(args.Item); + } + } + + private void OpenGridContextMenu(DataGridRowClickEventArgs args) + { + _contextMenuLeft = args.MouseEventArgs.PageX; + _contextMenuTop = args.MouseEventArgs.PageY; + _contextMenuCatalogItem = args.Item; + _isContextMenuOpen = true; } + + + // style the rows where the Element.Position == 0 to have italic text. + private Func RowStyleFunc => (x, i) => + { + if (AppState.Settings.IsSelected(x)) + return "background-color:#EACE5D"; + + return ""; + }; } \ No newline at end of file diff --git a/src/Nexus.UI/ViewModels/CatalogItemViewModel.cs b/src/Nexus.UI/ViewModels/CatalogItemViewModel.cs index 2be4e5a0..64b66422 100644 --- a/src/Nexus.UI/ViewModels/CatalogItemViewModel.cs +++ b/src/Nexus.UI/ViewModels/CatalogItemViewModel.cs @@ -10,11 +10,21 @@ namespace Nexus.UI.ViewModels; public class CatalogItemViewModel { public const string README_KEY = "readme"; + public const string LICENSE_KEY = "license"; + public const string DESCRIPTION_KEY = "description"; + public const string WARNING_KEY = "warning"; + public const string UNIT_KEY = "unit"; + private string? _description; + + private string? _warning; + + private string? _unit; + public CatalogItemViewModel(ResourceCatalog resourceCatalog, Resource resource, Representation representation) { Catalog = resourceCatalog; @@ -23,9 +33,9 @@ public CatalogItemViewModel(ResourceCatalog resourceCatalog, Resource resource, if (resource.Properties is not null) { - Description = resource.Properties.GetStringValue(DESCRIPTION_KEY); - Warning = resource.Properties.GetStringValue(WARNING_KEY); - Unit = resource.Properties.GetStringValue(UNIT_KEY); + _description = Resource.Properties.GetStringValue(DESCRIPTION_KEY); + _warning = Resource.Properties.GetStringValue(WARNING_KEY); + _unit = Resource.Properties.GetStringValue(UNIT_KEY); } } @@ -35,7 +45,64 @@ public CatalogItemViewModel(ResourceCatalog resourceCatalog, Resource resource, public Representation Representation { get; } - public string? Description; - public string? Warning; - public string? Unit; + public string? Description + { + get + { + return _description; + } + set + { + if (value != _description) + { + _description = value; + DescriptionHasChanged = true; + } + } + } + + public string? Warning + { + get + { + return _warning; + } + set + { + if (value != _warning) + { + _warning = value; + WarningHasChanged = true; + } + } + } + + public string? Unit + { + get + { + return _unit; + } + set + { + if (value != _unit) + { + _unit = value; + UnitHasChanged = true; + } + } + } + + public bool DescriptionHasChanged { get; private set; } + + public bool WarningHasChanged { get; private set; } + + public bool UnitHasChanged { get; private set; } + + public void ResetHasChangedState() + { + DescriptionHasChanged = false; + WarningHasChanged = false; + UnitHasChanged = false; + } } \ No newline at end of file From ad3ff8534692e31d3682c7ba14ae687ee83237b8 Mon Sep 17 00:00:00 2001 From: Vincent Wilms Date: Mon, 16 Dec 2024 20:29:03 +0100 Subject: [PATCH 2/6] Fix unwanted scroll bar --- src/Nexus.UI/Routes.razor | 11 +++++----- src/Nexus/Extensions/Sources/Sample.cs | 28 +++++++++++++++----------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Nexus.UI/Routes.razor b/src/Nexus.UI/Routes.razor index 36757b76..110ecf26 100644 --- a/src/Nexus.UI/Routes.razor +++ b/src/Nexus.UI/Routes.razor @@ -1,11 +1,12 @@ - + + + + + + - - - - Not found diff --git a/src/Nexus/Extensions/Sources/Sample.cs b/src/Nexus/Extensions/Sources/Sample.cs index 7a4cc826..e600a3e1 100644 --- a/src/Nexus/Extensions/Sources/Sample.cs +++ b/src/Nexus/Extensions/Sources/Sample.cs @@ -219,36 +219,40 @@ public async Task ReadAsync( internal static ResourceCatalog LoadCatalog( string catalogId) { - var resourceBuilderA = new ResourceBuilder(id: "T1") + var resourceA = new ResourceBuilder(id: "T1") .WithUnit("°C") .WithDescription("Test Resource A") .WithGroups("Group 1") - .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromSeconds(1))); + .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromSeconds(1))) + .Build(); - var resourceBuilderB = new ResourceBuilder(id: "V1") + var resourceB = new ResourceBuilder(id: "V1") .WithUnit("m/s") .WithDescription("Test Resource B") .WithGroups("Group 1") - .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromSeconds(1))); + .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromSeconds(1))) + .Build(); - var resourceBuilderC = new ResourceBuilder(id: "unix_time1") + var resourceC = new ResourceBuilder(id: "unix_time1") .WithDescription("Test Resource C") .WithGroups("Group 2") - .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromMilliseconds(40))); + .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromMilliseconds(40))) + .Build(); - var resourceBuilderD = new ResourceBuilder(id: "unix_time2") + var resourceD = new ResourceBuilder(id: "unix_time2") .WithDescription("Test Resource D") .WithGroups("Group 2") - .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromSeconds(1))); + .AddRepresentation(new Representation(dataType: NexusDataType.FLOAT64, samplePeriod: TimeSpan.FromSeconds(1))) + .Build(); var catalogBuilder = new ResourceCatalogBuilder(catalogId); catalogBuilder.AddResources(new List() { - resourceBuilderA.Build(), - resourceBuilderB.Build(), - resourceBuilderC.Build(), - resourceBuilderD.Build() + resourceA, + resourceB, + resourceC, + resourceD }); if (catalogId == RemoteCatalogId) From 014a281da6f422f4fbf4bf629f75de399cd047f5 Mon Sep 17 00:00:00 2001 From: Vincent Wilms Date: Mon, 16 Dec 2024 20:34:56 +0100 Subject: [PATCH 3/6] Fix CSS --- src/Nexus/wwwroot/css/app.css | 48 ++++++----------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/src/Nexus/wwwroot/css/app.css b/src/Nexus/wwwroot/css/app.css index 1f120f5e..5112cf52 100644 --- a/src/Nexus/wwwroot/css/app.css +++ b/src/Nexus/wwwroot/css/app.css @@ -954,10 +954,6 @@ video { white-space: nowrap; } -.whitespace-nowrap { - white-space: nowrap; -} - .break-all { word-break: break-all; } @@ -1191,10 +1187,6 @@ video { padding-bottom: 0.75rem; } -.pb-1 { - padding-bottom: 0.25rem; -} - .pb-2 { padding-bottom: 0.5rem; } @@ -1282,6 +1274,10 @@ video { text-transform: uppercase; } +.italic { + font-style: italic; +} + .tracking-widest { letter-spacing: 0.1em; } @@ -1326,11 +1322,6 @@ video { color: rgb(75 85 99 / var(--tw-text-opacity)); } -.text-gray-700 { - --tw-text-opacity: 1; - color: rgb(55 65 81 / var(--tw-text-opacity)); -} - .text-orange-500 { --tw-text-opacity: 1; color: rgb(249 115 22 / var(--tw-text-opacity)); @@ -1385,6 +1376,10 @@ video { box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); } +.filter { + filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); +} + html, body { font-family: Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji; } @@ -1577,11 +1572,6 @@ html { background-color: rgb(243 244 246 / var(--tw-bg-opacity)); } -.hover\:bg-gray-50:hover { - --tw-bg-opacity: 1; - background-color: rgb(249 250 251 / var(--tw-bg-opacity)); -} - .hover\:bg-teal-500:hover { --tw-bg-opacity: 1; background-color: rgb(20 184 166 / var(--tw-bg-opacity)); @@ -1602,12 +1592,6 @@ html { color: rgb(220 38 38 / var(--tw-text-opacity)); } -.hover\:shadow-lg:hover { - --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - .focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; @@ -1693,12 +1677,6 @@ html { } } -@media (min-width: 768px) { - .md\:w-1\/2 { - width: 50%; - } -} - @media (min-width: 1280px) { .xl\:inline { display: inline; @@ -1711,14 +1689,4 @@ html { .xl\:hidden { display: none; } - - .xl\:w-full { - width: 100%; - } -} - -@media (min-width: 1536px) { - .\32xl\:w-1\/4 { - width: 25%; - } } \ No newline at end of file From fe0e5ce3f1dea61529d0be6231df36e66c7587b9 Mon Sep 17 00:00:00 2001 From: Vincent Wilms Date: Mon, 16 Dec 2024 20:41:40 +0100 Subject: [PATCH 4/6] Fix warnings --- src/Nexus.UI/Components/ResourceView.razor | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Nexus.UI/Components/ResourceView.razor b/src/Nexus.UI/Components/ResourceView.razor index af48d581..183a435c 100644 --- a/src/Nexus.UI/Components/ResourceView.razor +++ b/src/Nexus.UI/Components/ResourceView.razor @@ -17,9 +17,9 @@
@if (AppState.CatalogItemsMap is not null) { - @foreach (var entry in AppState.CatalogItemsMap) //String = GruppenName, Val = Gruppe selbst + @foreach (var entry in AppState.CatalogItemsMap) { - @if (entry.Value == AppState.CatalogItemsGroup) //AppState.CatalogItemsGroup aktuelle gewählte gruppe + @if (entry.Value == AppState.CatalogItemsGroup) {
@entry.Key @@ -29,7 +29,7 @@ else {
+ @onclick="() => AppState.CatalogItemsGroup = entry.Value"> @entry.Key @entry.Value.Count
@@ -54,7 +54,7 @@ RowStyleFunc="@RowStyleFunc" RowContextMenuClick="@OpenGridContextMenu"> - + @@ -157,7 +157,7 @@ public ResourceView() { - _handler = async (sender, e) => + _handler = (sender, e) => { if (e.PropertyName == nameof(AppState.SearchString)) { @@ -190,17 +190,12 @@ } - private async Task SelectCatalogItemsGroupAsync(List catalogItems) - { - AppState.CatalogItemsGroup = catalogItems; - } - private void OpenPropertiesModal() { _isPropertiesViewDialogOpen = true; } - private void SetNewMetaDataValue(string resourceId, string newValue, string propertyKey) + private void SetNewMetaDataValue(string resourceId, string? newValue, string propertyKey) { if (AppState.EditModeCatalogMap.TryGetValue(AppState.SelectedCatalog!.Id, out var map)) { From cf7168965fc4558b2484f74c7b5913c29abc27dd Mon Sep 17 00:00:00 2001 From: Vincent Wilms Date: Mon, 16 Dec 2024 20:42:22 +0100 Subject: [PATCH 5/6] Fix code style --- src/Nexus.UI/Components/ResourceView.razor | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Nexus.UI/Components/ResourceView.razor b/src/Nexus.UI/Components/ResourceView.razor index 183a435c..2cebc895 100644 --- a/src/Nexus.UI/Components/ResourceView.razor +++ b/src/Nexus.UI/Components/ResourceView.razor @@ -289,7 +289,6 @@ _isContextMenuOpen = true; } - // style the rows where the Element.Position == 0 to have italic text. private Func RowStyleFunc => (x, i) => { From b6c17a28bc6a200cef7c1db6d07ca93eaa72613d Mon Sep 17 00:00:00 2001 From: Vincent Wilms Date: Mon, 16 Dec 2024 20:51:55 +0100 Subject: [PATCH 6/6] Fix exception being thrown when trying to update metadata --- src/Nexus/API/v1/CatalogsController.cs | 4 +- src/clients/dotnet-client/NexusClient.g.cs | 4972 ++++++++++---------- 2 files changed, 2488 insertions(+), 2488 deletions(-) diff --git a/src/Nexus/API/v1/CatalogsController.cs b/src/Nexus/API/v1/CatalogsController.cs index bee33959..da08ba4b 100644 --- a/src/Nexus/API/v1/CatalogsController.cs +++ b/src/Nexus/API/v1/CatalogsController.cs @@ -488,11 +488,11 @@ public async Task> [FromBody] CatalogMetadata metadata, CancellationToken cancellationToken) { + catalogId = WebUtility.UrlDecode(catalogId); + if (metadata.Overrides?.Id != catalogId) return UnprocessableEntity("The catalog ID does not match the ID of the catalog to update."); - catalogId = WebUtility.UrlDecode(catalogId); - var response = await ProtectCatalogAsync(catalogId, ensureReadable: false, ensureWritable: true, async catalogContainer => { await catalogContainer.UpdateMetadataAsync(metadata); diff --git a/src/clients/dotnet-client/NexusClient.g.cs b/src/clients/dotnet-client/NexusClient.g.cs index 93f6218c..3011e053 100644 --- a/src/clients/dotnet-client/NexusClient.g.cs +++ b/src/clients/dotnet-client/NexusClient.g.cs @@ -12,3183 +12,3183 @@ using System.Text.Json.Serialization; namespace Nexus.Api +{ +/// +/// A client for the Nexus system. +/// +public interface INexusClient { /// - /// A client for the Nexus system. + /// Gets the V1 client. /// - public interface INexusClient - { - /// - /// Gets the V1 client. - /// - Nexus.Api.V1.IV1 V1 { get; } + Nexus.Api.V1.IV1 V1 { get; } + + + /// + /// Signs in the user. + /// + /// The access token. + /// A task. + void SignIn(string accessToken); + + /// + /// Attaches configuration data to subsequent API requests. + /// + /// The configuration data. + IDisposable AttachConfiguration(object configuration); + /// + /// Clears configuration data for all subsequent API requests. + /// + void ClearConfiguration(); +} - /// - /// Signs in the user. - /// - /// The access token. - /// A task. - void SignIn(string accessToken); +/// +public class NexusClient : INexusClient, IDisposable +{ + private const string ConfigurationHeaderKey = "Nexus-Configuration"; + private const string AuthorizationHeaderKey = "Authorization"; - /// - /// Attaches configuration data to subsequent API requests. - /// - /// The configuration data. - IDisposable AttachConfiguration(object configuration); + private string? __token; + private HttpClient __httpClient; - /// - /// Clears configuration data for all subsequent API requests. - /// - void ClearConfiguration(); + /// + /// Initializes a new instance of the . + /// + /// The base URL to connect to. + public NexusClient(Uri baseUrl) : this(new HttpClient() { BaseAddress = baseUrl, Timeout = TimeSpan.FromSeconds(60) }) + { + // } - /// - public class NexusClient : INexusClient, IDisposable + /// + /// Initializes a new instance of the . + /// + /// The HTTP client to use. + public NexusClient(HttpClient httpClient) { - private const string ConfigurationHeaderKey = "Nexus-Configuration"; - private const string AuthorizationHeaderKey = "Authorization"; + if (httpClient.BaseAddress is null) + throw new Exception("The base address of the HTTP client must be set."); - private string? __token; - private HttpClient __httpClient; + __httpClient = httpClient; - /// - /// Initializes a new instance of the . - /// - /// The base URL to connect to. - public NexusClient(Uri baseUrl) : this(new HttpClient() { BaseAddress = baseUrl, Timeout = TimeSpan.FromSeconds(60) }) - { - // - } + V1 = new Nexus.Api.V1.V1(this); - /// - /// Initializes a new instance of the . - /// - /// The HTTP client to use. - public NexusClient(HttpClient httpClient) - { - if (httpClient.BaseAddress is null) - throw new Exception("The base address of the HTTP client must be set."); + } - __httpClient = httpClient; + /// + /// Gets a value which indicates if the user is authenticated. + /// + public bool IsAuthenticated => __token is not null; - V1 = new Nexus.Api.V1.V1(this); + /// + public Nexus.Api.V1.IV1 V1 { get; } - } - /// - /// Gets a value which indicates if the user is authenticated. - /// - public bool IsAuthenticated => __token is not null; - /// - public Nexus.Api.V1.IV1 V1 { get; } + /// + public void SignIn(string accessToken) + { + var authorizationHeaderValue = $"Bearer {accessToken}"; + __httpClient.DefaultRequestHeaders.Remove(AuthorizationHeaderKey); + __httpClient.DefaultRequestHeaders.Add(AuthorizationHeaderKey, authorizationHeaderValue); + __token = accessToken; + } + /// + public IDisposable AttachConfiguration(object configuration) + { + var encodedJson = Convert.ToBase64String(JsonSerializer.SerializeToUtf8Bytes(configuration)); - /// - public void SignIn(string accessToken) - { - var authorizationHeaderValue = $"Bearer {accessToken}"; - __httpClient.DefaultRequestHeaders.Remove(AuthorizationHeaderKey); - __httpClient.DefaultRequestHeaders.Add(AuthorizationHeaderKey, authorizationHeaderValue); + __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); + __httpClient.DefaultRequestHeaders.Add(ConfigurationHeaderKey, encodedJson); - __token = accessToken; - } + return new DisposableConfiguration(this); + } - /// - public IDisposable AttachConfiguration(object configuration) - { - var encodedJson = Convert.ToBase64String(JsonSerializer.SerializeToUtf8Bytes(configuration)); + /// + public void ClearConfiguration() + { + __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); + } - __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); - __httpClient.DefaultRequestHeaders.Add(ConfigurationHeaderKey, encodedJson); + internal T Invoke(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content) + { + // prepare request + using var request = BuildRequestMessage(method, relativeUrl, content, contentTypeValue, acceptHeaderValue); - return new DisposableConfiguration(this); - } + // send request + var response = __httpClient.Send(request, HttpCompletionOption.ResponseHeadersRead); - /// - public void ClearConfiguration() + // process response + if (!response.IsSuccessStatusCode) { - __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); - } + var message = new StreamReader(response.Content.ReadAsStream()).ReadToEnd(); + var statusCode = $"00.{(int)response.StatusCode}"; - internal T Invoke(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content) - { - // prepare request - using var request = BuildRequestMessage(method, relativeUrl, content, contentTypeValue, acceptHeaderValue); + if (string.IsNullOrWhiteSpace(message)) + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}."); - // send request - var response = __httpClient.Send(request, HttpCompletionOption.ResponseHeadersRead); + else + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); + } - // process response - if (!response.IsSuccessStatusCode) + try + { + if (typeof(T) == typeof(object)) { - var message = new StreamReader(response.Content.ReadAsStream()).ReadToEnd(); - var statusCode = $"00.{(int)response.StatusCode}"; - - if (string.IsNullOrWhiteSpace(message)) - throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}."); + return default!; + } - else - throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); + else if (typeof(T) == typeof(HttpResponseMessage)) + { + return (T)(object)(response); } - try + else { - if (typeof(T) == typeof(object)) - { - return default!; - } + var stream = response.Content.ReadAsStream(); - else if (typeof(T) == typeof(HttpResponseMessage)) + try { - return (T)(object)(response); + return JsonSerializer.Deserialize(stream, Utilities.JsonOptions)!; } - - else + catch (Exception ex) { - var stream = response.Content.ReadAsStream(); - - try - { - return JsonSerializer.Deserialize(stream, Utilities.JsonOptions)!; - } - catch (Exception ex) - { - throw new NexusException("01", "Response data could not be deserialized.", ex); - } + throw new NexusException("01", "Response data could not be deserialized.", ex); } } - finally - { - if (typeof(T) != typeof(HttpResponseMessage)) - response.Dispose(); - } } + finally + { + if (typeof(T) != typeof(HttpResponseMessage)) + response.Dispose(); + } + } + + internal async Task InvokeAsync(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content, CancellationToken cancellationToken) + { + // prepare request + using var request = BuildRequestMessage(method, relativeUrl, content, contentTypeValue, acceptHeaderValue); + + // send request + var response = await __httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - internal async Task InvokeAsync(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content, CancellationToken cancellationToken) + // process response + if (!response.IsSuccessStatusCode) { - // prepare request - using var request = BuildRequestMessage(method, relativeUrl, content, contentTypeValue, acceptHeaderValue); + var message = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var statusCode = $"00.{(int)response.StatusCode}"; - // send request - var response = await __httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (string.IsNullOrWhiteSpace(message)) + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}."); - // process response - if (!response.IsSuccessStatusCode) - { - var message = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - var statusCode = $"00.{(int)response.StatusCode}"; + else + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); + } - if (string.IsNullOrWhiteSpace(message)) - throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}."); + try + { + if (typeof(T) == typeof(object)) + { + return default!; + } - else - throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); + else if (typeof(T) == typeof(HttpResponseMessage)) + { + return (T)(object)(response); } - try + else { - if (typeof(T) == typeof(object)) - { - return default!; - } + var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - else if (typeof(T) == typeof(HttpResponseMessage)) + try { - return (T)(object)(response); + return (await JsonSerializer.DeserializeAsync(stream, Utilities.JsonOptions).ConfigureAwait(false))!; } - - else + catch (Exception ex) { - var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - - try - { - return (await JsonSerializer.DeserializeAsync(stream, Utilities.JsonOptions).ConfigureAwait(false))!; - } - catch (Exception ex) - { - throw new NexusException("01", "Response data could not be deserialized.", ex); - } + throw new NexusException("01", "Response data could not be deserialized.", ex); } } - finally - { - if (typeof(T) != typeof(HttpResponseMessage)) - response.Dispose(); - } } + finally + { + if (typeof(T) != typeof(HttpResponseMessage)) + response.Dispose(); + } + } - private static readonly HttpRequestOptionsKey WebAssemblyEnableStreamingResponseKey = new HttpRequestOptionsKey("WebAssemblyEnableStreamingResponse"); + private static readonly HttpRequestOptionsKey WebAssemblyEnableStreamingResponseKey = new HttpRequestOptionsKey("WebAssemblyEnableStreamingResponse"); - private HttpRequestMessage BuildRequestMessage(string method, string relativeUrl, HttpContent? content, string? contentTypeHeaderValue, string? acceptHeaderValue) + private HttpRequestMessage BuildRequestMessage(string method, string relativeUrl, HttpContent? content, string? contentTypeHeaderValue, string? acceptHeaderValue) + { + var requestMessage = new HttpRequestMessage() { - var requestMessage = new HttpRequestMessage() - { - Method = new HttpMethod(method), - RequestUri = new Uri(relativeUrl, UriKind.Relative), - Content = content - }; - - if (contentTypeHeaderValue is not null && requestMessage.Content is not null) - requestMessage.Content.Headers.ContentType = MediaTypeWithQualityHeaderValue.Parse(contentTypeHeaderValue); + Method = new HttpMethod(method), + RequestUri = new Uri(relativeUrl, UriKind.Relative), + Content = content + }; - if (acceptHeaderValue is not null) - requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse(acceptHeaderValue)); + if (contentTypeHeaderValue is not null && requestMessage.Content is not null) + requestMessage.Content.Headers.ContentType = MediaTypeWithQualityHeaderValue.Parse(contentTypeHeaderValue); - // For web assembly - // https://docs.microsoft.com/de-de/dotnet/api/microsoft.aspnetcore.components.webassembly.http.webassemblyhttprequestmessageextensions.setbrowserresponsestreamingenabled?view=aspnetcore-6.0 - // https://github.com/dotnet/aspnetcore/blob/0ee742c53f2669fd7233df6da89db5e8ab944585/src/Components/WebAssembly/WebAssembly/src/Http/WebAssemblyHttpRequestMessageExtensions.cs - requestMessage.Options.Set(WebAssemblyEnableStreamingResponseKey, true); + if (acceptHeaderValue is not null) + requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse(acceptHeaderValue)); - return requestMessage; - } + // For web assembly + // https://docs.microsoft.com/de-de/dotnet/api/microsoft.aspnetcore.components.webassembly.http.webassemblyhttprequestmessageextensions.setbrowserresponsestreamingenabled?view=aspnetcore-6.0 + // https://github.com/dotnet/aspnetcore/blob/0ee742c53f2669fd7233df6da89db5e8ab944585/src/Components/WebAssembly/WebAssembly/src/Http/WebAssemblyHttpRequestMessageExtensions.cs + requestMessage.Options.Set(WebAssemblyEnableStreamingResponseKey, true); - /// - public void Dispose() - { - __httpClient?.Dispose(); - } + return requestMessage; + } - /// - /// This high-level methods simplifies loading multiple resources at once. - /// - /// Start date/time. - /// End date/time. - /// The resource paths. - /// A callback which accepts the current progress. - public IReadOnlyDictionary Load( - DateTime begin, - DateTime end, - IEnumerable resourcePaths, - Action? onProgress = default) - { - var catalogItemMap = V1.Catalogs.SearchCatalogItems(resourcePaths.ToList()); - var result = new Dictionary(); - var progress = 0.0; + /// + public void Dispose() + { + __httpClient?.Dispose(); + } - foreach (var (resourcePath, catalogItem) in catalogItemMap) - { - using var responseMessage = V1.Data.GetStream(resourcePath, begin, end); + /// + /// This high-level methods simplifies loading multiple resources at once. + /// + /// Start date/time. + /// End date/time. + /// The resource paths. + /// A callback which accepts the current progress. + public IReadOnlyDictionary Load( + DateTime begin, + DateTime end, + IEnumerable resourcePaths, + Action? onProgress = default) + { + var catalogItemMap = V1.Catalogs.SearchCatalogItems(resourcePaths.ToList()); + var result = new Dictionary(); + var progress = 0.0; - var doubleData = ReadAsDoubleAsync(responseMessage, useAsync: false) - .GetAwaiter() - .GetResult(); + foreach (var (resourcePath, catalogItem) in catalogItemMap) + { + using var responseMessage = V1.Data.GetStream(resourcePath, begin, end); - var resource = catalogItem.Resource; + var doubleData = ReadAsDoubleAsync(responseMessage, useAsync: false) + .GetAwaiter() + .GetResult(); - string? unit = default; + var resource = catalogItem.Resource; - if (resource.Properties is not null && - resource.Properties.TryGetValue("unit", out var unitElement) && - unitElement.ValueKind == JsonValueKind.String) - unit = unitElement.GetString(); + string? unit = default; - string? description = default; + if (resource.Properties is not null && + resource.Properties.TryGetValue("unit", out var unitElement) && + unitElement.ValueKind == JsonValueKind.String) + unit = unitElement.GetString(); - if (resource.Properties is not null && - resource.Properties.TryGetValue("description", out var descriptionElement) && - descriptionElement.ValueKind == JsonValueKind.String) - description = descriptionElement.GetString(); + string? description = default; - var samplePeriod = catalogItem.Representation.SamplePeriod; + if (resource.Properties is not null && + resource.Properties.TryGetValue("description", out var descriptionElement) && + descriptionElement.ValueKind == JsonValueKind.String) + description = descriptionElement.GetString(); - result[resourcePath] = new DataResponse( - CatalogItem: catalogItem, - Name: resource.Id, - Unit: unit, - Description: description, - SamplePeriod: samplePeriod, - Values: doubleData - ); + var samplePeriod = catalogItem.Representation.SamplePeriod; - progress += 1.0 / catalogItemMap.Count; - onProgress?.Invoke(progress); - } + result[resourcePath] = new DataResponse( + CatalogItem: catalogItem, + Name: resource.Id, + Unit: unit, + Description: description, + SamplePeriod: samplePeriod, + Values: doubleData + ); - return result; + progress += 1.0 / catalogItemMap.Count; + onProgress?.Invoke(progress); } - /// - /// This high-level methods simplifies loading multiple resources at once. - /// - /// Start date/time. - /// End date/time. - /// The resource paths. - /// A callback which accepts the current progress. - /// A token to cancel the current operation. - public async Task> LoadAsync( - DateTime begin, - DateTime end, - IEnumerable resourcePaths, - Action? onProgress = default, - CancellationToken cancellationToken = default) - { - var catalogItemMap = await V1.Catalogs.SearchCatalogItemsAsync(resourcePaths.ToList()).ConfigureAwait(false); - var result = new Dictionary(); - var progress = 0.0; + return result; + } - foreach (var (resourcePath, catalogItem) in catalogItemMap) - { - using var responseMessage = await V1.Data.GetStreamAsync(resourcePath, begin, end, cancellationToken).ConfigureAwait(false); - var doubleData = await ReadAsDoubleAsync(responseMessage, useAsync: true, cancellationToken).ConfigureAwait(false); - var resource = catalogItem.Resource; + /// + /// This high-level methods simplifies loading multiple resources at once. + /// + /// Start date/time. + /// End date/time. + /// The resource paths. + /// A callback which accepts the current progress. + /// A token to cancel the current operation. + public async Task> LoadAsync( + DateTime begin, + DateTime end, + IEnumerable resourcePaths, + Action? onProgress = default, + CancellationToken cancellationToken = default) + { + var catalogItemMap = await V1.Catalogs.SearchCatalogItemsAsync(resourcePaths.ToList()).ConfigureAwait(false); + var result = new Dictionary(); + var progress = 0.0; - string? unit = default; + foreach (var (resourcePath, catalogItem) in catalogItemMap) + { + using var responseMessage = await V1.Data.GetStreamAsync(resourcePath, begin, end, cancellationToken).ConfigureAwait(false); + var doubleData = await ReadAsDoubleAsync(responseMessage, useAsync: true, cancellationToken).ConfigureAwait(false); + var resource = catalogItem.Resource; - if (resource.Properties is not null && - resource.Properties.TryGetValue("unit", out var unitElement) && - unitElement.ValueKind == JsonValueKind.String) - unit = unitElement.GetString(); + string? unit = default; - string? description = default; + if (resource.Properties is not null && + resource.Properties.TryGetValue("unit", out var unitElement) && + unitElement.ValueKind == JsonValueKind.String) + unit = unitElement.GetString(); - if (resource.Properties is not null && - resource.Properties.TryGetValue("description", out var descriptionElement) && - descriptionElement.ValueKind == JsonValueKind.String) - description = descriptionElement.GetString(); + string? description = default; - var samplePeriod = catalogItem.Representation.SamplePeriod; + if (resource.Properties is not null && + resource.Properties.TryGetValue("description", out var descriptionElement) && + descriptionElement.ValueKind == JsonValueKind.String) + description = descriptionElement.GetString(); - result[resourcePath] = new DataResponse( - CatalogItem: catalogItem, - Name: resource.Id, - Unit: unit, - Description: description, - SamplePeriod: samplePeriod, - Values: doubleData - ); + var samplePeriod = catalogItem.Representation.SamplePeriod; - progress += 1.0 / catalogItemMap.Count; - onProgress?.Invoke(progress); - } + result[resourcePath] = new DataResponse( + CatalogItem: catalogItem, + Name: resource.Id, + Unit: unit, + Description: description, + SamplePeriod: samplePeriod, + Values: doubleData + ); - return result; + progress += 1.0 / catalogItemMap.Count; + onProgress?.Invoke(progress); } - private async Task ReadAsDoubleAsync(HttpResponseMessage responseMessage, bool useAsync, CancellationToken cancellationToken = default) - { - int? length = default; + return result; + } - if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && - values.Any() && - int.TryParse(values.First(), out var contentLength)) - { - length = contentLength; - } + private async Task ReadAsDoubleAsync(HttpResponseMessage responseMessage, bool useAsync, CancellationToken cancellationToken = default) + { + int? length = default; - if (!length.HasValue) - throw new Exception("The data length is unknown."); + if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && + values.Any() && + int.TryParse(values.First(), out var contentLength)) + { + length = contentLength; + } - if (length.Value % 8 != 0) - throw new Exception("The data length is invalid."); + if (!length.HasValue) + throw new Exception("The data length is unknown."); - var elementCount = length.Value / 8; - var doubleBuffer = new double[elementCount]; - var byteBuffer = new CastMemoryManager(doubleBuffer).Memory; + if (length.Value % 8 != 0) + throw new Exception("The data length is invalid."); - Stream stream = useAsync - ? await responseMessage.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false) - : responseMessage.Content.ReadAsStream(cancellationToken); + var elementCount = length.Value / 8; + var doubleBuffer = new double[elementCount]; + var byteBuffer = new CastMemoryManager(doubleBuffer).Memory; - var remainingBuffer = byteBuffer; + Stream stream = useAsync + ? await responseMessage.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false) + : responseMessage.Content.ReadAsStream(cancellationToken); - while (!remainingBuffer.IsEmpty) - { - var bytesRead = await stream.ReadAsync(remainingBuffer, cancellationToken).ConfigureAwait(false); + var remainingBuffer = byteBuffer; - if (bytesRead == 0) - throw new Exception("The stream ended early."); + while (!remainingBuffer.IsEmpty) + { + var bytesRead = await stream.ReadAsync(remainingBuffer, cancellationToken).ConfigureAwait(false); - remainingBuffer = remainingBuffer.Slice(bytesRead); - } + if (bytesRead == 0) + throw new Exception("The stream ended early."); - return doubleBuffer; + remainingBuffer = remainingBuffer.Slice(bytesRead); } - private async Task ReadAsDoubleAsync(HttpResponseMessage responseMessage, CancellationToken cancellationToken = default) - { - int? length = default; + return doubleBuffer; + } - if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && - values.Any() && - int.TryParse(values.First(), out var contentLength)) - { - length = contentLength; - } + private async Task ReadAsDoubleAsync(HttpResponseMessage responseMessage, CancellationToken cancellationToken = default) + { + int? length = default; - if (!length.HasValue) - throw new Exception("The data length is unknown."); + if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && + values.Any() && + int.TryParse(values.First(), out var contentLength)) + { + length = contentLength; + } - if (length.Value % 8 != 0) - throw new Exception("The data length is invalid."); + if (!length.HasValue) + throw new Exception("The data length is unknown."); - var elementCount = length.Value / 8; - var doubleBuffer = new double[elementCount]; - var byteBuffer = new CastMemoryManager(doubleBuffer).Memory; - var stream = await responseMessage.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - var remainingBuffer = byteBuffer; + if (length.Value % 8 != 0) + throw new Exception("The data length is invalid."); - while (!remainingBuffer.IsEmpty) - { - var bytesRead = await stream.ReadAsync(remainingBuffer, cancellationToken).ConfigureAwait(false); + var elementCount = length.Value / 8; + var doubleBuffer = new double[elementCount]; + var byteBuffer = new CastMemoryManager(doubleBuffer).Memory; + var stream = await responseMessage.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + var remainingBuffer = byteBuffer; - if (bytesRead == 0) - throw new Exception("The stream ended early."); + while (!remainingBuffer.IsEmpty) + { + var bytesRead = await stream.ReadAsync(remainingBuffer, cancellationToken).ConfigureAwait(false); - remainingBuffer = remainingBuffer.Slice(bytesRead); - } + if (bytesRead == 0) + throw new Exception("The stream ended early."); - return doubleBuffer; + remainingBuffer = remainingBuffer.Slice(bytesRead); } - /// - /// This high-level methods simplifies exporting multiple resources at once. - /// - /// The begin date/time. - /// The end date/time. - /// The file period. Use TimeSpan.Zero to get a single file. - /// The target file format. If null, data will be read (and possibly cached) but not returned. This is useful for data pre-aggregation. - /// The resource paths to export. - /// The configuration. - /// The target folder for the files to extract. - /// A callback which accepts the current progress and the progress message. - public void Export( - DateTime begin, - DateTime end, - TimeSpan filePeriod, - string? fileFormat, - IEnumerable resourcePaths, - IReadOnlyDictionary? configuration, - string targetFolder, - Action? onProgress = default) - { - var actualConfiguration = configuration is null - ? default - : JsonSerializer.Deserialize?>(JsonSerializer.Serialize(configuration)); + return doubleBuffer; + } + + /// + /// This high-level methods simplifies exporting multiple resources at once. + /// + /// The begin date/time. + /// The end date/time. + /// The file period. Use TimeSpan.Zero to get a single file. + /// The target file format. If null, data will be read (and possibly cached) but not returned. This is useful for data pre-aggregation. + /// The resource paths to export. + /// The configuration. + /// The target folder for the files to extract. + /// A callback which accepts the current progress and the progress message. + public void Export( + DateTime begin, + DateTime end, + TimeSpan filePeriod, + string? fileFormat, + IEnumerable resourcePaths, + IReadOnlyDictionary? configuration, + string targetFolder, + Action? onProgress = default) + { + var actualConfiguration = configuration is null + ? default + : JsonSerializer.Deserialize?>(JsonSerializer.Serialize(configuration)); - var exportParameters = new V1.ExportParameters( - begin, - end, - filePeriod, - fileFormat, - resourcePaths.ToList(), - actualConfiguration); + var exportParameters = new V1.ExportParameters( + begin, + end, + filePeriod, + fileFormat, + resourcePaths.ToList(), + actualConfiguration); - // Start Job - var job = V1.Jobs.Export(exportParameters); + // Start Job + var job = V1.Jobs.Export(exportParameters); - // Wait for job to finish - string? artifactId = default; + // Wait for job to finish + string? artifactId = default; - while (true) - { - Thread.Sleep(TimeSpan.FromSeconds(1)); + while (true) + { + Thread.Sleep(TimeSpan.FromSeconds(1)); - var jobStatus = V1.Jobs.GetJobStatus(job.Id); + var jobStatus = V1.Jobs.GetJobStatus(job.Id); - if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Canceled) - throw new OperationCanceledException("The job has been cancelled."); + if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Canceled) + throw new OperationCanceledException("The job has been cancelled."); - else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Faulted) - throw new OperationCanceledException($"The job has failed. Reason: {jobStatus.ExceptionMessage}"); + else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Faulted) + throw new OperationCanceledException($"The job has failed. Reason: {jobStatus.ExceptionMessage}"); - else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.RanToCompletion) + else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.RanToCompletion) + { + if (jobStatus.Result.HasValue && + jobStatus.Result.Value.ValueKind == JsonValueKind.String) { - if (jobStatus.Result.HasValue && - jobStatus.Result.Value.ValueKind == JsonValueKind.String) - { - artifactId = jobStatus.Result.Value.GetString(); - break; - } + artifactId = jobStatus.Result.Value.GetString(); + break; } - - if (jobStatus.Progress < 1) - onProgress?.Invoke(jobStatus.Progress, "export"); } - onProgress?.Invoke(1, "export"); + if (jobStatus.Progress < 1) + onProgress?.Invoke(jobStatus.Progress, "export"); + } - if (artifactId is null) - throw new Exception("The job result is invalid."); + onProgress?.Invoke(1, "export"); - if (fileFormat is null) - return; + if (artifactId is null) + throw new Exception("The job result is invalid."); - // Download zip file - var responseMessage = V1.Artifacts.Download(artifactId); - var sourceStream = responseMessage.Content.ReadAsStream(); + if (fileFormat is null) + return; - long? length = default; + // Download zip file + var responseMessage = V1.Artifacts.Download(artifactId); + var sourceStream = responseMessage.Content.ReadAsStream(); - if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && - values.Any() && - int.TryParse(values.First(), out var contentLength)) - { - length = contentLength; - } + long? length = default; + + if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && + values.Any() && + int.TryParse(values.First(), out var contentLength)) + { + length = contentLength; + } - var tmpFilePath = Path.GetTempFileName(); + var tmpFilePath = Path.GetTempFileName(); - try + try + { + using (var targetStream = File.OpenWrite(tmpFilePath)) { - using (var targetStream = File.OpenWrite(tmpFilePath)) - { - var buffer = new byte[32768]; - var consumed = 0; - var sw = Stopwatch.StartNew(); - var maxTicks = TimeSpan.FromSeconds(1).Ticks; + var buffer = new byte[32768]; + var consumed = 0; + var sw = Stopwatch.StartNew(); + var maxTicks = TimeSpan.FromSeconds(1).Ticks; + + int receivedBytes; - int receivedBytes; + while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) + { + targetStream.Write(buffer, 0, receivedBytes); + consumed += receivedBytes; - while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) + if (sw.ElapsedTicks > maxTicks) { - targetStream.Write(buffer, 0, receivedBytes); - consumed += receivedBytes; + sw.Reset(); - if (sw.ElapsedTicks > maxTicks) + if (length.HasValue) { - sw.Reset(); - - if (length.HasValue) - { - if (consumed < length) - onProgress?.Invoke(consumed / (double)length, "download"); - } + if (consumed < length) + onProgress?.Invoke(consumed / (double)length, "download"); } } } + } - onProgress?.Invoke(1, "download"); + onProgress?.Invoke(1, "download"); - // Extract file (do not use stream overload: https://github.com/dotnet/runtime/issues/59027) - ZipFile.ExtractToDirectory(tmpFilePath, targetFolder, overwriteFiles: true); - onProgress?.Invoke(1, "extract"); + // Extract file (do not use stream overload: https://github.com/dotnet/runtime/issues/59027) + ZipFile.ExtractToDirectory(tmpFilePath, targetFolder, overwriteFiles: true); + onProgress?.Invoke(1, "extract"); + } + finally + { + try + { + File.Delete(tmpFilePath); } - finally + catch { - try - { - File.Delete(tmpFilePath); - } - catch - { - // - } + // } } + } - /// - /// This high-level methods simplifies exporting multiple resources at once. - /// - /// The begin date/time. - /// The end date/time. - /// The file period. Use TimeSpan.Zero to get a single file. - /// The target file format. If null, data will be read (and possibly cached) but not returned. This is useful for data pre-aggregation. - /// The resource paths to export. - /// The configuration. - /// The target folder for the files to extract. - /// A callback which accepts the current progress and the progress message. - /// A token to cancel the current operation. - public async Task ExportAsync( - DateTime begin, - DateTime end, - TimeSpan filePeriod, - string? fileFormat, - IEnumerable resourcePaths, - IReadOnlyDictionary? configuration, - string targetFolder, - Action? onProgress = default, - CancellationToken cancellationToken = default) - { - var actualConfiguration = configuration is null - ? default - : JsonSerializer.Deserialize?>(JsonSerializer.Serialize(configuration)); + /// + /// This high-level methods simplifies exporting multiple resources at once. + /// + /// The begin date/time. + /// The end date/time. + /// The file period. Use TimeSpan.Zero to get a single file. + /// The target file format. If null, data will be read (and possibly cached) but not returned. This is useful for data pre-aggregation. + /// The resource paths to export. + /// The configuration. + /// The target folder for the files to extract. + /// A callback which accepts the current progress and the progress message. + /// A token to cancel the current operation. + public async Task ExportAsync( + DateTime begin, + DateTime end, + TimeSpan filePeriod, + string? fileFormat, + IEnumerable resourcePaths, + IReadOnlyDictionary? configuration, + string targetFolder, + Action? onProgress = default, + CancellationToken cancellationToken = default) + { + var actualConfiguration = configuration is null + ? default + : JsonSerializer.Deserialize?>(JsonSerializer.Serialize(configuration)); - var exportParameters = new V1.ExportParameters( - begin, - end, - filePeriod, - fileFormat, - resourcePaths.ToList(), - actualConfiguration); + var exportParameters = new V1.ExportParameters( + begin, + end, + filePeriod, + fileFormat, + resourcePaths.ToList(), + actualConfiguration); - // Start Job - var job = await V1.Jobs.ExportAsync(exportParameters).ConfigureAwait(false); + // Start Job + var job = await V1.Jobs.ExportAsync(exportParameters).ConfigureAwait(false); - // Wait for job to finish - string? artifactId = default; + // Wait for job to finish + string? artifactId = default; - while (true) - { - await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false); + while (true) + { + await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false); - var jobStatus = await V1.Jobs.GetJobStatusAsync(job.Id, cancellationToken).ConfigureAwait(false); + var jobStatus = await V1.Jobs.GetJobStatusAsync(job.Id, cancellationToken).ConfigureAwait(false); - if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Canceled) - throw new OperationCanceledException("The job has been cancelled."); + if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Canceled) + throw new OperationCanceledException("The job has been cancelled."); - else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Faulted) - throw new OperationCanceledException($"The job has failed. Reason: {jobStatus.ExceptionMessage}"); + else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Faulted) + throw new OperationCanceledException($"The job has failed. Reason: {jobStatus.ExceptionMessage}"); - else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.RanToCompletion) + else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.RanToCompletion) + { + if (jobStatus.Result.HasValue && + jobStatus.Result.Value.ValueKind == JsonValueKind.String) { - if (jobStatus.Result.HasValue && - jobStatus.Result.Value.ValueKind == JsonValueKind.String) - { - artifactId = jobStatus.Result.Value.GetString(); - break; - } + artifactId = jobStatus.Result.Value.GetString(); + break; } - - if (jobStatus.Progress < 1) - onProgress?.Invoke(jobStatus.Progress, "export"); } - onProgress?.Invoke(1, "export"); + if (jobStatus.Progress < 1) + onProgress?.Invoke(jobStatus.Progress, "export"); + } - if (artifactId is null) - throw new Exception("The job result is invalid."); + onProgress?.Invoke(1, "export"); - if (fileFormat is null) - return; + if (artifactId is null) + throw new Exception("The job result is invalid."); - // Download zip file - var responseMessage = await V1.Artifacts.DownloadAsync(artifactId, cancellationToken).ConfigureAwait(false); - var sourceStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); + if (fileFormat is null) + return; - long? length = default; + // Download zip file + var responseMessage = await V1.Artifacts.DownloadAsync(artifactId, cancellationToken).ConfigureAwait(false); + var sourceStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); - if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && - values.Any() && - int.TryParse(values.First(), out var contentLength)) - { - length = contentLength; - } + long? length = default; - var tmpFilePath = Path.GetTempFileName(); + if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && + values.Any() && + int.TryParse(values.First(), out var contentLength)) + { + length = contentLength; + } - try + var tmpFilePath = Path.GetTempFileName(); + + try + { + using (var targetStream = File.OpenWrite(tmpFilePath)) { - using (var targetStream = File.OpenWrite(tmpFilePath)) - { - var buffer = new byte[32768]; - var consumed = 0; - var sw = Stopwatch.StartNew(); - var maxTicks = TimeSpan.FromSeconds(1).Ticks; + var buffer = new byte[32768]; + var consumed = 0; + var sw = Stopwatch.StartNew(); + var maxTicks = TimeSpan.FromSeconds(1).Ticks; - int receivedBytes; + int receivedBytes; + + while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) + { + targetStream.Write(buffer, 0, receivedBytes); + consumed += receivedBytes; - while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) + if (sw.ElapsedTicks > maxTicks) { - targetStream.Write(buffer, 0, receivedBytes); - consumed += receivedBytes; + sw.Reset(); - if (sw.ElapsedTicks > maxTicks) + if (length.HasValue) { - sw.Reset(); - - if (length.HasValue) - { - if (consumed < length) - onProgress?.Invoke(consumed / (double)length, "download"); - } + if (consumed < length) + onProgress?.Invoke(consumed / (double)length, "download"); } } } + } - onProgress?.Invoke(1, "download"); + onProgress?.Invoke(1, "download"); - // Extract file (do not use stream overload: https://github.com/dotnet/runtime/issues/59027) - ZipFile.ExtractToDirectory(tmpFilePath, targetFolder, overwriteFiles: true); - onProgress?.Invoke(1, "extract"); + // Extract file (do not use stream overload: https://github.com/dotnet/runtime/issues/59027) + ZipFile.ExtractToDirectory(tmpFilePath, targetFolder, overwriteFiles: true); + onProgress?.Invoke(1, "extract"); + } + finally + { + try + { + File.Delete(tmpFilePath); } - finally + catch { - try - { - File.Delete(tmpFilePath); - } - catch - { - // - } + // } } } +} - internal class CastMemoryManager : MemoryManager - where TFrom : struct - where TTo : struct - { - private readonly Memory _from; +internal class CastMemoryManager : MemoryManager + where TFrom : struct + where TTo : struct +{ + private readonly Memory _from; - public CastMemoryManager(Memory from) => _from = from; + public CastMemoryManager(Memory from) => _from = from; - public override Span GetSpan() => MemoryMarshal.Cast(_from.Span); + public override Span GetSpan() => MemoryMarshal.Cast(_from.Span); - protected override void Dispose(bool disposing) - { - // - } + protected override void Dispose(bool disposing) + { + // + } + + public override MemoryHandle Pin(int elementIndex = 0) => throw new NotSupportedException(); + + public override void Unpin() => throw new NotSupportedException(); +} - public override MemoryHandle Pin(int elementIndex = 0) => throw new NotSupportedException(); +/// +/// A NexusException. +/// +public class NexusException : Exception +{ + internal NexusException(string statusCode, string message) : base(message) + { + StatusCode = statusCode; + } - public override void Unpin() => throw new NotSupportedException(); + internal NexusException(string statusCode, string message, Exception innerException) : base(message, innerException) + { + StatusCode = statusCode; } /// - /// A NexusException. + /// The exception status code. /// - public class NexusException : Exception - { - internal NexusException(string statusCode, string message) : base(message) - { - StatusCode = statusCode; - } + public string StatusCode { get; } +} - internal NexusException(string statusCode, string message, Exception innerException) : base(message, innerException) - { - StatusCode = statusCode; - } +internal class DisposableConfiguration : IDisposable +{ + private NexusClient ___client; - /// - /// The exception status code. - /// - public string StatusCode { get; } + public DisposableConfiguration(NexusClient client) + { + ___client = client; } - internal class DisposableConfiguration : IDisposable + public void Dispose() { - private NexusClient ___client; - - public DisposableConfiguration(NexusClient client) - { - ___client = client; - } - - public void Dispose() - { - ___client.ClearConfiguration(); - } + ___client.ClearConfiguration(); } +} - internal static class Utilities - { - internal static JsonSerializerOptions JsonOptions { get; } +internal static class Utilities +{ + internal static JsonSerializerOptions JsonOptions { get; } - static Utilities() + static Utilities() + { + JsonOptions = new JsonSerializerOptions() { - JsonOptions = new JsonSerializerOptions() - { - PropertyNameCaseInsensitive = true, - WriteIndented = true - }; + PropertyNameCaseInsensitive = true, + WriteIndented = true + }; - JsonOptions.Converters.Add(new JsonStringEnumConverter()); - } + JsonOptions.Converters.Add(new JsonStringEnumConverter()); } +} - /// - /// Result of a data request with a certain resource path. - /// - /// The catalog item. - /// The resource name. - /// The optional resource unit. - /// The optional resource description. - /// The sample period. - /// The data. - public record DataResponse( - V1.CatalogItem CatalogItem, - string? Name, - string? Unit, - string? Description, - TimeSpan SamplePeriod, - double[] Values); +/// +/// Result of a data request with a certain resource path. +/// +/// The catalog item. +/// The resource name. +/// The optional resource unit. +/// The optional resource description. +/// The sample period. +/// The data. +public record DataResponse( + V1.CatalogItem CatalogItem, + string? Name, + string? Unit, + string? Description, + TimeSpan SamplePeriod, + double[] Values); } namespace Nexus.Api.V1 { +/// +/// A client for version V1. +/// +public interface IV1 +{ /// - /// A client for version V1. + /// Gets the . /// - public interface IV1 - { - /// - /// Gets the . - /// - IArtifactsClient Artifacts { get; } + IArtifactsClient Artifacts { get; } - /// - /// Gets the . - /// - ICatalogsClient Catalogs { get; } + /// + /// Gets the . + /// + ICatalogsClient Catalogs { get; } - /// - /// Gets the . - /// - IDataClient Data { get; } + /// + /// Gets the . + /// + IDataClient Data { get; } - /// - /// Gets the . - /// - IJobsClient Jobs { get; } + /// + /// Gets the . + /// + IJobsClient Jobs { get; } - /// - /// Gets the . - /// - IPackageReferencesClient PackageReferences { get; } + /// + /// Gets the . + /// + IPackageReferencesClient PackageReferences { get; } - /// - /// Gets the . - /// - ISourcesClient Sources { get; } + /// + /// Gets the . + /// + ISourcesClient Sources { get; } - /// - /// Gets the . - /// - ISystemClient System { get; } + /// + /// Gets the . + /// + ISystemClient System { get; } - /// - /// Gets the . - /// - IUsersClient Users { get; } + /// + /// Gets the . + /// + IUsersClient Users { get; } - /// - /// Gets the . - /// - IWritersClient Writers { get; } + /// + /// Gets the . + /// + IWritersClient Writers { get; } - } +} - /// - public class V1 : IV1 +/// +public class V1 : IV1 +{ + /// + /// Initializes a new instance of the . + /// + /// The client to use. + public V1(NexusClient client) { - /// - /// Initializes a new instance of the . - /// - /// The client to use. - public V1(NexusClient client) - { - Artifacts = new ArtifactsClient(client); - Catalogs = new CatalogsClient(client); - Data = new DataClient(client); - Jobs = new JobsClient(client); - PackageReferences = new PackageReferencesClient(client); - Sources = new SourcesClient(client); - System = new SystemClient(client); - Users = new UsersClient(client); - Writers = new WritersClient(client); + Artifacts = new ArtifactsClient(client); + Catalogs = new CatalogsClient(client); + Data = new DataClient(client); + Jobs = new JobsClient(client); + PackageReferences = new PackageReferencesClient(client); + Sources = new SourcesClient(client); + System = new SystemClient(client); + Users = new UsersClient(client); + Writers = new WritersClient(client); - } + } - /// - public IArtifactsClient Artifacts { get; } + /// + public IArtifactsClient Artifacts { get; } - /// - public ICatalogsClient Catalogs { get; } + /// + public ICatalogsClient Catalogs { get; } - /// - public IDataClient Data { get; } + /// + public IDataClient Data { get; } - /// - public IJobsClient Jobs { get; } + /// + public IJobsClient Jobs { get; } - /// - public IPackageReferencesClient PackageReferences { get; } + /// + public IPackageReferencesClient PackageReferences { get; } - /// - public ISourcesClient Sources { get; } + /// + public ISourcesClient Sources { get; } - /// - public ISystemClient System { get; } + /// + public ISystemClient System { get; } - /// - public IUsersClient Users { get; } + /// + public IUsersClient Users { get; } - /// - public IWritersClient Writers { get; } + /// + public IWritersClient Writers { get; } - } +} + +/// +/// Provides methods to interact with artifacts. +/// +public interface IArtifactsClient +{ + /// + /// Gets the specified artifact. + /// + /// The artifact identifier. + HttpResponseMessage Download(string artifactId); /// - /// Provides methods to interact with artifacts. + /// Gets the specified artifact. /// - public interface IArtifactsClient + /// The artifact identifier. + /// The token to cancel the current operation. + Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default); + +} + +/// +public class ArtifactsClient : IArtifactsClient +{ + private NexusClient ___client; + + internal ArtifactsClient(NexusClient client) { - /// - /// Gets the specified artifact. - /// - /// The artifact identifier. - HttpResponseMessage Download(string artifactId); + ___client = client; + } - /// - /// Gets the specified artifact. - /// - /// The artifact identifier. - /// The token to cancel the current operation. - Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default); + /// + public HttpResponseMessage Download(string artifactId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); + __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/octet-stream", default, default); } /// - public class ArtifactsClient : IArtifactsClient + public Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default) { - private NexusClient ___client; + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); + __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); - internal ArtifactsClient(NexusClient client) - { - ___client = client; - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); + } - /// - public HttpResponseMessage Download(string artifactId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); - __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); +} - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/octet-stream", default, default); - } +/// +/// Provides methods to interact with catalogs. +/// +public interface ICatalogsClient +{ + /// + /// Searches for the given resource paths and returns the corresponding catalog items. + /// + /// The list of resource paths. + IReadOnlyDictionary SearchCatalogItems(IReadOnlyList resourcePaths); - /// - public Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); - __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); + /// + /// Searches for the given resource paths and returns the corresponding catalog items. + /// + /// The list of resource paths. + /// The token to cancel the current operation. + Task> SearchCatalogItemsAsync(IReadOnlyList resourcePaths, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + /// Gets the specified catalog. + /// + /// The catalog identifier. + ResourceCatalog Get(string catalogId); - } + /// + /// Gets the specified catalog. + /// + /// The catalog identifier. + /// The token to cancel the current operation. + Task GetAsync(string catalogId, CancellationToken cancellationToken = default); /// - /// Provides methods to interact with catalogs. - /// - public interface ICatalogsClient - { - /// - /// Searches for the given resource paths and returns the corresponding catalog items. - /// - /// The list of resource paths. - IReadOnlyDictionary SearchCatalogItems(IReadOnlyList resourcePaths); - - /// - /// Searches for the given resource paths and returns the corresponding catalog items. - /// - /// The list of resource paths. - /// The token to cancel the current operation. - Task> SearchCatalogItemsAsync(IReadOnlyList resourcePaths, CancellationToken cancellationToken = default); - - /// - /// Gets the specified catalog. - /// - /// The catalog identifier. - ResourceCatalog Get(string catalogId); - - /// - /// Gets the specified catalog. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task GetAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Gets a list of child catalog info for the provided parent catalog identifier. - /// - /// The parent catalog identifier. - IReadOnlyList GetChildCatalogInfos(string catalogId); - - /// - /// Gets a list of child catalog info for the provided parent catalog identifier. - /// - /// The parent catalog identifier. - /// The token to cancel the current operation. - Task> GetChildCatalogInfosAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Gets the specified catalog's time range. - /// - /// The catalog identifier. - CatalogTimeRange GetTimeRange(string catalogId); - - /// - /// Gets the specified catalog's time range. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task GetTimeRangeAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Gets the specified catalog's availability. - /// - /// The catalog identifier. - /// Start date/time. - /// End date/time. - /// Step period. - CatalogAvailability GetAvailability(string catalogId, DateTime begin, DateTime end, TimeSpan step); - - /// - /// Gets the specified catalog's availability. - /// - /// The catalog identifier. - /// Start date/time. - /// End date/time. - /// Step period. - /// The token to cancel the current operation. - Task GetAvailabilityAsync(string catalogId, DateTime begin, DateTime end, TimeSpan step, CancellationToken cancellationToken = default); - - /// - /// Gets the license of the catalog if available. - /// - /// The catalog identifier. - string? GetLicense(string catalogId); - - /// - /// Gets the license of the catalog if available. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task GetLicenseAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Gets all attachments for the specified catalog. - /// - /// The catalog identifier. - IReadOnlyList GetAttachments(string catalogId); - - /// - /// Gets all attachments for the specified catalog. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task> GetAttachmentsAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Uploads the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - /// The binary file content. - HttpResponseMessage UploadAttachment(string catalogId, string attachmentId, Stream content); - - /// - /// Uploads the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - /// The binary file content. - /// The token to cancel the current operation. - Task UploadAttachmentAsync(string catalogId, string attachmentId, Stream content, CancellationToken cancellationToken = default); - - /// - /// Deletes the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - HttpResponseMessage DeleteAttachment(string catalogId, string attachmentId); - - /// - /// Deletes the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - /// The token to cancel the current operation. - Task DeleteAttachmentAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default); - - /// - /// Gets the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - HttpResponseMessage GetAttachmentStream(string catalogId, string attachmentId); - - /// - /// Gets the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - /// The token to cancel the current operation. - Task GetAttachmentStreamAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default); - - /// - /// Gets the catalog metadata. - /// - /// The catalog identifier. - CatalogMetadata GetMetadata(string catalogId); - - /// - /// Gets the catalog metadata. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task GetMetadataAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Puts the catalog metadata. - /// - /// The catalog identifier. - /// The catalog metadata to set. - HttpResponseMessage SetMetadata(string catalogId, CatalogMetadata metadata); - - /// - /// Puts the catalog metadata. - /// - /// The catalog identifier. - /// The catalog metadata to set. - /// The token to cancel the current operation. - Task SetMetadataAsync(string catalogId, CatalogMetadata metadata, CancellationToken cancellationToken = default); - - } - - /// - public class CatalogsClient : ICatalogsClient - { - private NexusClient ___client; - - internal CatalogsClient(NexusClient client) - { - ___client = client; - } + /// Gets a list of child catalog info for the provided parent catalog identifier. + /// + /// The parent catalog identifier. + IReadOnlyList GetChildCatalogInfos(string catalogId); - /// - public IReadOnlyDictionary SearchCatalogItems(IReadOnlyList resourcePaths) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/search-items"); + /// + /// Gets a list of child catalog info for the provided parent catalog identifier. + /// + /// The parent catalog identifier. + /// The token to cancel the current operation. + Task> GetChildCatalogInfosAsync(string catalogId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions)); - } + /// + /// Gets the specified catalog's time range. + /// + /// The catalog identifier. + CatalogTimeRange GetTimeRange(string catalogId); - /// - public Task> SearchCatalogItemsAsync(IReadOnlyList resourcePaths, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/search-items"); + /// + /// Gets the specified catalog's time range. + /// + /// The catalog identifier. + /// The token to cancel the current operation. + Task GetTimeRangeAsync(string catalogId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions), cancellationToken); - } + /// + /// Gets the specified catalog's availability. + /// + /// The catalog identifier. + /// Start date/time. + /// End date/time. + /// Step period. + CatalogAvailability GetAvailability(string catalogId, DateTime begin, DateTime end, TimeSpan step); - /// - public ResourceCatalog Get(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Gets the specified catalog's availability. + /// + /// The catalog identifier. + /// Start date/time. + /// End date/time. + /// Step period. + /// The token to cancel the current operation. + Task GetAvailabilityAsync(string catalogId, DateTime begin, DateTime end, TimeSpan step, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + /// Gets the license of the catalog if available. + /// + /// The catalog identifier. + string? GetLicense(string catalogId); - /// - public Task GetAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Gets the license of the catalog if available. + /// + /// The catalog identifier. + /// The token to cancel the current operation. + Task GetLicenseAsync(string catalogId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Gets all attachments for the specified catalog. + /// + /// The catalog identifier. + IReadOnlyList GetAttachments(string catalogId); - /// - public IReadOnlyList GetChildCatalogInfos(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/child-catalog-infos"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Gets all attachments for the specified catalog. + /// + /// The catalog identifier. + /// The token to cancel the current operation. + Task> GetAttachmentsAsync(string catalogId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + /// Uploads the specified attachment. + /// + /// The catalog identifier. + /// The attachment identifier. + /// The binary file content. + HttpResponseMessage UploadAttachment(string catalogId, string attachmentId, Stream content); - /// - public Task> GetChildCatalogInfosAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/child-catalog-infos"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Uploads the specified attachment. + /// + /// The catalog identifier. + /// The attachment identifier. + /// The binary file content. + /// The token to cancel the current operation. + Task UploadAttachmentAsync(string catalogId, string attachmentId, Stream content, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Deletes the specified attachment. + /// + /// The catalog identifier. + /// The attachment identifier. + HttpResponseMessage DeleteAttachment(string catalogId, string attachmentId); - /// - public CatalogTimeRange GetTimeRange(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/timerange"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Deletes the specified attachment. + /// + /// The catalog identifier. + /// The attachment identifier. + /// The token to cancel the current operation. + Task DeleteAttachmentAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + /// Gets the specified attachment. + /// + /// The catalog identifier. + /// The attachment identifier. + HttpResponseMessage GetAttachmentStream(string catalogId, string attachmentId); - /// - public Task GetTimeRangeAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/timerange"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Gets the specified attachment. + /// + /// The catalog identifier. + /// The attachment identifier. + /// The token to cancel the current operation. + Task GetAttachmentStreamAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Gets the catalog metadata. + /// + /// The catalog identifier. + CatalogMetadata GetMetadata(string catalogId); - /// - public CatalogAvailability GetAvailability(string catalogId, DateTime begin, DateTime end, TimeSpan step) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/availability"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + /// Gets the catalog metadata. + /// + /// The catalog identifier. + /// The token to cancel the current operation. + Task GetMetadataAsync(string catalogId, CancellationToken cancellationToken = default); - var __queryValues = new Dictionary(); + /// + /// Puts the catalog metadata. + /// + /// The catalog identifier. + /// The catalog metadata to set. + HttpResponseMessage SetMetadata(string catalogId, CatalogMetadata metadata); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + /// + /// Puts the catalog metadata. + /// + /// The catalog identifier. + /// The catalog metadata to set. + /// The token to cancel the current operation. + Task SetMetadataAsync(string catalogId, CatalogMetadata metadata, CancellationToken cancellationToken = default); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); +} - __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, CultureInfo.InvariantCulture)!); +/// +public class CatalogsClient : ICatalogsClient +{ + private NexusClient ___client; + + internal CatalogsClient(NexusClient client) + { + ___client = client; + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + public IReadOnlyDictionary SearchCatalogItems(IReadOnlyList resourcePaths) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/search-items"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions)); + } - /// - public Task GetAvailabilityAsync(string catalogId, DateTime begin, DateTime end, TimeSpan step, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/availability"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + /// + public Task> SearchCatalogItemsAsync(IReadOnlyList resourcePaths, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/search-items"); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions), cancellationToken); + } - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + /// + public ResourceCatalog Get(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, CultureInfo.InvariantCulture)!); + /// + public Task GetAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public IReadOnlyList GetChildCatalogInfos(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/child-catalog-infos"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public string? GetLicense(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/license"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + public Task> GetChildCatalogInfosAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/child-catalog-infos"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public Task GetLicenseAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/license"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public CatalogTimeRange GetTimeRange(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/timerange"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public IReadOnlyList GetAttachments(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public Task GetTimeRangeAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/timerange"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public Task> GetAttachmentsAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public CatalogAvailability GetAvailability(string catalogId, DateTime begin, DateTime end, TimeSpan step) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/availability"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public HttpResponseMessage UploadAttachment(string catalogId, string attachmentId, Stream content) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("PUT", __url, "application/octet-stream", "application/octet-stream", new StreamContent(content)); - } + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - /// - public Task UploadAttachmentAsync(string catalogId, string attachmentId, Stream content, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("PUT", __url, "application/octet-stream", "application/octet-stream", new StreamContent(content), cancellationToken); - } + __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, CultureInfo.InvariantCulture)!); - /// - public HttpResponseMessage DeleteAttachment(string catalogId, string attachmentId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - /// - public Task DeleteAttachmentAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + /// + public Task GetAvailabilityAsync(string catalogId, DateTime begin, DateTime end, TimeSpan step, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/availability"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + var __queryValues = new Dictionary(); - /// - public HttpResponseMessage GetAttachmentStream(string catalogId, string attachmentId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}/content"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/octet-stream", default, default); - } + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - /// - public Task GetAttachmentStreamAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}/content"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, CultureInfo.InvariantCulture)!); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public CatalogMetadata GetMetadata(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + public string? GetLicense(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/license"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public Task GetMetadataAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public Task GetLicenseAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/license"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public HttpResponseMessage SetMetadata(string catalogId, CatalogMetadata metadata) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("PUT", __url, "application/octet-stream", "application/json", JsonContent.Create(metadata, options: Utilities.JsonOptions)); - } + /// + public IReadOnlyList GetAttachments(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public Task SetMetadataAsync(string catalogId, CatalogMetadata metadata, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); - __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("PUT", __url, "application/octet-stream", "application/json", JsonContent.Create(metadata, options: Utilities.JsonOptions), cancellationToken); - } + /// + public Task> GetAttachmentsAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } + + /// + public HttpResponseMessage UploadAttachment(string catalogId, string attachmentId, Stream content) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("PUT", __url, "application/octet-stream", "application/octet-stream", new StreamContent(content)); } + /// + public Task UploadAttachmentAsync(string catalogId, string attachmentId, Stream content, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("PUT", __url, "application/octet-stream", "application/octet-stream", new StreamContent(content), cancellationToken); + } + + /// + public HttpResponseMessage DeleteAttachment(string catalogId, string attachmentId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } + + /// + public Task DeleteAttachmentAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } + + /// + public HttpResponseMessage GetAttachmentStream(string catalogId, string attachmentId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}/content"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/octet-stream", default, default); + } + + /// + public Task GetAttachmentStreamAsync(string catalogId, string attachmentId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments/{attachmentId}/content"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + __urlBuilder.Replace("{attachmentId}", Uri.EscapeDataString(attachmentId)); + + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); + } + + /// + public CatalogMetadata GetMetadata(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } + + /// + public Task GetMetadataAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } + + /// + public HttpResponseMessage SetMetadata(string catalogId, CatalogMetadata metadata) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + + var __url = __urlBuilder.ToString(); + return ___client.Invoke("PUT", __url, "application/octet-stream", "application/json", JsonContent.Create(metadata, options: Utilities.JsonOptions)); + } + + /// + public Task SetMetadataAsync(string catalogId, CatalogMetadata metadata, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/metadata"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); + + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("PUT", __url, "application/octet-stream", "application/json", JsonContent.Create(metadata, options: Utilities.JsonOptions), cancellationToken); + } + +} + +/// +/// Provides methods to interact with data. +/// +public interface IDataClient +{ + /// + /// Gets the requested data. + /// + /// The path to the resource data to stream. + /// Start date/time. + /// End date/time. + HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end); + /// - /// Provides methods to interact with data. + /// Gets the requested data. /// - public interface IDataClient + /// The path to the resource data to stream. + /// Start date/time. + /// End date/time. + /// The token to cancel the current operation. + Task GetStreamAsync(string resourcePath, DateTime begin, DateTime end, CancellationToken cancellationToken = default); + +} + +/// +public class DataClient : IDataClient +{ + private NexusClient ___client; + + internal DataClient(NexusClient client) { - /// - /// Gets the requested data. - /// - /// The path to the resource data to stream. - /// Start date/time. - /// End date/time. - HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end); + ___client = client; + } + + /// + public HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/data"); + + var __queryValues = new Dictionary(); - /// - /// Gets the requested data. - /// - /// The path to the resource data to stream. - /// Start date/time. - /// End date/time. - /// The token to cancel the current operation. - Task GetStreamAsync(string resourcePath, DateTime begin, DateTime end, CancellationToken cancellationToken = default); + __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); + + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/octet-stream", default, default); } /// - public class DataClient : IDataClient + public Task GetStreamAsync(string resourcePath, DateTime begin, DateTime end, CancellationToken cancellationToken = default) { - private NexusClient ___client; + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/data"); - internal DataClient(NexusClient client) - { - ___client = client; - } + var __queryValues = new Dictionary(); - /// - public HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/data"); + __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); - var __queryValues = new Dictionary(); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); +} - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/octet-stream", default, default); - } +/// +/// Provides methods to interact with jobs. +/// +public interface IJobsClient +{ + /// + /// Gets a list of jobs. + /// + IReadOnlyList GetJobs(); - /// - public Task GetStreamAsync(string resourcePath, DateTime begin, DateTime end, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/data"); + /// + /// Gets a list of jobs. + /// + /// The token to cancel the current operation. + Task> GetJobsAsync(CancellationToken cancellationToken = default); + + /// + /// Cancels the specified job. + /// + /// + HttpResponseMessage CancelJob(Guid jobId); + + /// + /// Cancels the specified job. + /// + /// + /// The token to cancel the current operation. + Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken = default); - var __queryValues = new Dictionary(); + /// + /// Gets the status of the specified job. + /// + /// + JobStatus GetJobStatus(Guid jobId); - __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); + /// + /// Gets the status of the specified job. + /// + /// + /// The token to cancel the current operation. + Task GetJobStatusAsync(Guid jobId, CancellationToken cancellationToken = default); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + /// + /// Creates a new export job. + /// + /// Export parameters. + Job Export(ExportParameters parameters); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + /// + /// Creates a new export job. + /// + /// Export parameters. + /// The token to cancel the current operation. + Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + /// Creates a new job which reloads all extensions and resets the resource catalog. + /// + Job RefreshDatabase(); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + /// Creates a new job which reloads all extensions and resets the resource catalog. + /// + /// The token to cancel the current operation. + Task RefreshDatabaseAsync(CancellationToken cancellationToken = default); - } + /// + /// Clears the aggregation data cache for the specified period of time. + /// + /// The catalog identifier. + /// Start date/time. + /// End date/time. + Job ClearCache(string catalogId, DateTime begin, DateTime end); /// - /// Provides methods to interact with jobs. + /// Clears the aggregation data cache for the specified period of time. /// - public interface IJobsClient - { - /// - /// Gets a list of jobs. - /// - IReadOnlyList GetJobs(); + /// The catalog identifier. + /// Start date/time. + /// End date/time. + /// The token to cancel the current operation. + Task ClearCacheAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken = default); - /// - /// Gets a list of jobs. - /// - /// The token to cancel the current operation. - Task> GetJobsAsync(CancellationToken cancellationToken = default); +} - /// - /// Cancels the specified job. - /// - /// - HttpResponseMessage CancelJob(Guid jobId); +/// +public class JobsClient : IJobsClient +{ + private NexusClient ___client; + + internal JobsClient(NexusClient client) + { + ___client = client; + } - /// - /// Cancels the specified job. - /// - /// - /// The token to cancel the current operation. - Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken = default); + /// + public IReadOnlyList GetJobs() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs"); - /// - /// Gets the status of the specified job. - /// - /// - JobStatus GetJobStatus(Guid jobId); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - /// - /// Gets the status of the specified job. - /// - /// - /// The token to cancel the current operation. - Task GetJobStatusAsync(Guid jobId, CancellationToken cancellationToken = default); + /// + public Task> GetJobsAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs"); - /// - /// Creates a new export job. - /// - /// Export parameters. - Job Export(ExportParameters parameters); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// Creates a new export job. - /// - /// Export parameters. - /// The token to cancel the current operation. - Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default); + /// + public HttpResponseMessage CancelJob(Guid jobId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/{jobId}"); + __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); - /// - /// Creates a new job which reloads all extensions and resets the resource catalog. - /// - Job RefreshDatabase(); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - /// - /// Creates a new job which reloads all extensions and resets the resource catalog. - /// - /// The token to cancel the current operation. - Task RefreshDatabaseAsync(CancellationToken cancellationToken = default); + /// + public Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/{jobId}"); + __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); - /// - /// Clears the aggregation data cache for the specified period of time. - /// - /// The catalog identifier. - /// Start date/time. - /// End date/time. - Job ClearCache(string catalogId, DateTime begin, DateTime end); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - /// - /// Clears the aggregation data cache for the specified period of time. - /// - /// The catalog identifier. - /// Start date/time. - /// End date/time. - /// The token to cancel the current operation. - Task ClearCacheAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken = default); + /// + public JobStatus GetJobStatus(Guid jobId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/{jobId}/status"); + __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); } /// - public class JobsClient : IJobsClient + public Task GetJobStatusAsync(Guid jobId, CancellationToken cancellationToken = default) { - private NexusClient ___client; + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/{jobId}/status"); + __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); - internal JobsClient(NexusClient client) - { - ___client = client; - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - /// - public IReadOnlyList GetJobs() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs"); + /// + public Job Export(ExportParameters parameters) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/export"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions)); + } - /// - public Task> GetJobsAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs"); + /// + public Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/export"); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions), cancellationToken); + } - /// - public HttpResponseMessage CancelJob(Guid jobId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/{jobId}"); - __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); + /// + public Job RefreshDatabase() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/refresh-database"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", default, default); + } - /// - public Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/{jobId}"); - __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); + /// + public Task RefreshDatabaseAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/refresh-database"); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); + } - /// - public JobStatus GetJobStatus(Guid jobId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/{jobId}/status"); - __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); + /// + public Job ClearCache(string catalogId, DateTime begin, DateTime end) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/clear-cache"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + var __queryValues = new Dictionary(); - /// - public Task GetJobStatusAsync(Guid jobId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/{jobId}/status"); - __urlBuilder.Replace("{jobId}", Uri.EscapeDataString(Convert.ToString(jobId, CultureInfo.InvariantCulture)!)); + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - /// - public Job Export(ExportParameters parameters) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/export"); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions)); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/export"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions), cancellationToken); - } + /// + public Task ClearCacheAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/clear-cache"); - /// - public Job RefreshDatabase() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/refresh-database"); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", default, default); - } + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); - /// - public Task RefreshDatabaseAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/refresh-database"); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); - } + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - /// - public Job ClearCache(string catalogId, DateTime begin, DateTime end) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/clear-cache"); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); + } - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); +} - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); +/// +/// Provides methods to interact with package references. +/// +public interface IPackageReferencesClient +{ + /// + /// Gets the list of package references. + /// + IReadOnlyDictionary Get(); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + /// + /// Gets the list of package references. + /// + /// The token to cancel the current operation. + Task> GetAsync(CancellationToken cancellationToken = default); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + /// Creates a package reference. + /// + /// The package reference to create. + Guid Create(PackageReference packageReference); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", default, default); - } + /// + /// Creates a package reference. + /// + /// The package reference to create. + /// The token to cancel the current operation. + Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default); - /// - public Task ClearCacheAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/clear-cache"); + /// + /// Deletes a package reference. + /// + /// The ID of the package reference. + void Delete(Guid id); - var __queryValues = new Dictionary(); + /// + /// Deletes a package reference. + /// + /// The ID of the package reference. + /// The token to cancel the current operation. + Task DeleteAsync(Guid id, CancellationToken cancellationToken = default); - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + /// + /// Gets package versions. + /// + /// The ID of the package reference. + IReadOnlyList GetVersions(Guid id); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + /// + /// Gets package versions. + /// + /// The ID of the package reference. + /// The token to cancel the current operation. + Task> GetVersionsAsync(Guid id, CancellationToken cancellationToken = default); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); +} - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); +/// +public class PackageReferencesClient : IPackageReferencesClient +{ + private NexusClient ___client; + + internal PackageReferencesClient(NexusClient client) + { + ___client = client; + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); - } + /// + public IReadOnlyDictionary Get() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); } - /// - /// Provides methods to interact with package references. - /// - public interface IPackageReferencesClient + /// + public Task> GetAsync(CancellationToken cancellationToken = default) { - /// - /// Gets the list of package references. - /// - IReadOnlyDictionary Get(); + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); - /// - /// Gets the list of package references. - /// - /// The token to cancel the current operation. - Task> GetAsync(CancellationToken cancellationToken = default); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } + + /// + public Guid Create(PackageReference packageReference) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); - /// - /// Creates a package reference. - /// - /// The package reference to create. - Guid Create(PackageReference packageReference); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(packageReference, options: Utilities.JsonOptions)); + } - /// - /// Creates a package reference. - /// - /// The package reference to create. - /// The token to cancel the current operation. - Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default); + /// + public Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); - /// - /// Deletes a package reference. - /// - /// The ID of the package reference. - void Delete(Guid id); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(packageReference, options: Utilities.JsonOptions), cancellationToken); + } - /// - /// Deletes a package reference. - /// - /// The ID of the package reference. - /// The token to cancel the current operation. - Task DeleteAsync(Guid id, CancellationToken cancellationToken = default); + /// + public void Delete(Guid id) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences/{id}"); + __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); - /// - /// Gets package versions. - /// - /// The ID of the package reference. - IReadOnlyList GetVersions(Guid id); + var __url = __urlBuilder.ToString(); + ___client.Invoke("DELETE", __url, default, default, default); + } - /// - /// Gets package versions. - /// - /// The ID of the package reference. - /// The token to cancel the current operation. - Task> GetVersionsAsync(Guid id, CancellationToken cancellationToken = default); + /// + public Task DeleteAsync(Guid id, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences/{id}"); + __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, default, default, default, cancellationToken); } /// - public class PackageReferencesClient : IPackageReferencesClient + public IReadOnlyList GetVersions(Guid id) { - private NexusClient ___client; + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences/{id}/versions"); + __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); - internal PackageReferencesClient(NexusClient client) - { - ___client = client; - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - /// - public IReadOnlyDictionary Get() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); + /// + public Task> GetVersionsAsync(Guid id, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences/{id}/versions"); + __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - public Task> GetAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); +} - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } +/// +/// Provides methods to interact with sources. +/// +public interface ISourcesClient +{ + /// + /// Gets the list of source descriptions. + /// + IReadOnlyList GetDescriptions(); - /// - public Guid Create(PackageReference packageReference) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); + /// + /// Gets the list of source descriptions. + /// + /// The token to cancel the current operation. + Task> GetDescriptionsAsync(CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(packageReference, options: Utilities.JsonOptions)); - } + /// + /// Gets the list of data source pipelines. + /// + /// The optional user identifier. If not specified, the current user will be used. + IReadOnlyDictionary GetPipelines(string? userId = default); - /// - public Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); + /// + /// Gets the list of data source pipelines. + /// + /// The optional user identifier. If not specified, the current user will be used. + /// The token to cancel the current operation. + Task> GetPipelinesAsync(string? userId = default, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(packageReference, options: Utilities.JsonOptions), cancellationToken); - } + /// + /// Creates a data source pipeline. + /// + /// The optional user identifier. If not specified, the current user will be used. + /// The pipeline to create. + Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = default); - /// - public void Delete(Guid id) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences/{id}"); - __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); + /// + /// Creates a data source pipeline. + /// + /// The optional user identifier. If not specified, the current user will be used. + /// The pipeline to create. + /// The token to cancel the current operation. + Task CreatePipelineAsync(DataSourcePipeline pipeline, string? userId = default, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - ___client.Invoke("DELETE", __url, default, default, default); - } + /// + /// Deletes a data source pipeline. + /// + /// The identifier of the pipeline. + /// The optional user identifier. If not specified, the current user will be used. + /// + HttpResponseMessage DeletePipeline(string registrationId, Guid? pipelineId = default, string? userId = default); - /// - public Task DeleteAsync(Guid id, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences/{id}"); - __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); + /// + /// Deletes a data source pipeline. + /// + /// The identifier of the pipeline. + /// The optional user identifier. If not specified, the current user will be used. + /// + /// The token to cancel the current operation. + Task DeletePipelineAsync(string registrationId, Guid? pipelineId = default, string? userId = default, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, default, default, default, cancellationToken); - } +} - /// - public IReadOnlyList GetVersions(Guid id) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences/{id}/versions"); - __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); +/// +public class SourcesClient : ISourcesClient +{ + private NexusClient ___client; + + internal SourcesClient(NexusClient client) + { + ___client = client; + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public IReadOnlyList GetDescriptions() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/descriptions"); - /// - public Task> GetVersionsAsync(Guid id, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences/{id}/versions"); - __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/descriptions"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); } - /// - /// Provides methods to interact with sources. - /// - public interface ISourcesClient + /// + public IReadOnlyDictionary GetPipelines(string? userId = default) { - /// - /// Gets the list of source descriptions. - /// - IReadOnlyList GetDescriptions(); + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); + + var __queryValues = new Dictionary(); - /// - /// Gets the list of source descriptions. - /// - /// The token to cancel the current operation. - Task> GetDescriptionsAsync(CancellationToken cancellationToken = default); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - /// - /// Gets the list of data source pipelines. - /// - /// The optional user identifier. If not specified, the current user will be used. - IReadOnlyDictionary GetPipelines(string? userId = default); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - /// Gets the list of data source pipelines. - /// - /// The optional user identifier. If not specified, the current user will be used. - /// The token to cancel the current operation. - Task> GetPipelinesAsync(string? userId = default, CancellationToken cancellationToken = default); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - /// - /// Creates a data source pipeline. - /// - /// The optional user identifier. If not specified, the current user will be used. - /// The pipeline to create. - Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = default); + /// + public Task> GetPipelinesAsync(string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); - /// - /// Creates a data source pipeline. - /// - /// The optional user identifier. If not specified, the current user will be used. - /// The pipeline to create. - /// The token to cancel the current operation. - Task CreatePipelineAsync(DataSourcePipeline pipeline, string? userId = default, CancellationToken cancellationToken = default); + var __queryValues = new Dictionary(); - /// - /// Deletes a data source pipeline. - /// - /// The identifier of the pipeline. - /// The optional user identifier. If not specified, the current user will be used. - /// - HttpResponseMessage DeletePipeline(string registrationId, Guid? pipelineId = default, string? userId = default); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - /// - /// Deletes a data source pipeline. - /// - /// The identifier of the pipeline. - /// The optional user identifier. If not specified, the current user will be used. - /// - /// The token to cancel the current operation. - Task DeletePipelineAsync(string registrationId, Guid? pipelineId = default, string? userId = default, CancellationToken cancellationToken = default); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); } /// - public class SourcesClient : ISourcesClient + public Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = default) { - private NexusClient ___client; + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); - internal SourcesClient(NexusClient client) - { - ___client = client; - } + var __queryValues = new Dictionary(); - /// - public IReadOnlyList GetDescriptions() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/descriptions"); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/descriptions"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions)); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public Task CreatePipelineAsync(DataSourcePipeline pipeline, string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); - /// - public IReadOnlyDictionary GetPipelines(string? userId = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines"); + var __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions), cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public HttpResponseMessage DeletePipeline(string registrationId, Guid? pipelineId = default, string? userId = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines/{registrationId}"); + __urlBuilder.Replace("{registrationId}", Uri.EscapeDataString(registrationId)); - /// - public Task> GetPipelinesAsync(string? userId = default, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines"); + var __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + if (pipelineId is not null) + __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - /// - public Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines"); + /// + public Task DeletePipelineAsync(string registrationId, Guid? pipelineId = default, string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines/{registrationId}"); + __urlBuilder.Replace("{registrationId}", Uri.EscapeDataString(registrationId)); - var __queryValues = new Dictionary(); + var __queryValues = new Dictionary(); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + if (pipelineId is not null) + __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions)); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public Task CreatePipelineAsync(DataSourcePipeline pipeline, string? userId = default, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - var __queryValues = new Dictionary(); +} - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); +/// +/// Provides methods to interact with system. +/// +public interface ISystemClient +{ + /// + /// Gets the default file type. + /// + string GetDefaultFileType(); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + /// Gets the default file type. + /// + /// The token to cancel the current operation. + Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions), cancellationToken); - } + /// + /// Gets the configured help link. + /// + string GetHelpLink(); - /// - public HttpResponseMessage DeletePipeline(string registrationId, Guid? pipelineId = default, string? userId = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines/{registrationId}"); - __urlBuilder.Replace("{registrationId}", Uri.EscapeDataString(registrationId)); + /// + /// Gets the configured help link. + /// + /// The token to cancel the current operation. + Task GetHelpLinkAsync(CancellationToken cancellationToken = default); - var __queryValues = new Dictionary(); + /// + /// Gets the system configuration. + /// + IReadOnlyDictionary? GetConfiguration(); - if (pipelineId is not null) - __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); + /// + /// Gets the system configuration. + /// + /// The token to cancel the current operation. + Task?> GetConfigurationAsync(CancellationToken cancellationToken = default); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + /// + /// Sets the system configuration. + /// + /// + void SetConfiguration(IReadOnlyDictionary? configuration); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + /// Sets the system configuration. + /// + /// + /// The token to cancel the current operation. + Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } +} - /// - public Task DeletePipelineAsync(string registrationId, Guid? pipelineId = default, string? userId = default, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines/{registrationId}"); - __urlBuilder.Replace("{registrationId}", Uri.EscapeDataString(registrationId)); +/// +public class SystemClient : ISystemClient +{ + private NexusClient ___client; + + internal SystemClient(NexusClient client) + { + ___client = client; + } - var __queryValues = new Dictionary(); + /// + public string GetDefaultFileType() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/file-type"); - if (pipelineId is not null) - __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + /// + public Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/file-type"); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public string GetHelpLink() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/help-link"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); } - /// - /// Provides methods to interact with system. - /// - public interface ISystemClient + /// + public Task GetHelpLinkAsync(CancellationToken cancellationToken = default) { - /// - /// Gets the default file type. - /// - string GetDefaultFileType(); + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/help-link"); - /// - /// Gets the default file type. - /// - /// The token to cancel the current operation. - Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default); - - /// - /// Gets the configured help link. - /// - string GetHelpLink(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// Gets the configured help link. - /// - /// The token to cancel the current operation. - Task GetHelpLinkAsync(CancellationToken cancellationToken = default); + /// + public IReadOnlyDictionary? GetConfiguration() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - /// - /// Gets the system configuration. - /// - IReadOnlyDictionary? GetConfiguration(); + var __url = __urlBuilder.ToString(); + return ___client.Invoke?>("GET", __url, "application/json", default, default); + } - /// - /// Gets the system configuration. - /// - /// The token to cancel the current operation. - Task?> GetConfigurationAsync(CancellationToken cancellationToken = default); + /// + public Task?> GetConfigurationAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - /// - /// Sets the system configuration. - /// - /// - void SetConfiguration(IReadOnlyDictionary? configuration); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync?>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// Sets the system configuration. - /// - /// - /// The token to cancel the current operation. - Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default); + /// + public void SetConfiguration(IReadOnlyDictionary? configuration) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); + var __url = __urlBuilder.ToString(); + ___client.Invoke("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions)); } /// - public class SystemClient : ISystemClient + public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) { - private NexusClient ___client; + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - internal SystemClient(NexusClient client) - { - ___client = client; - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions), cancellationToken); + } - /// - public string GetDefaultFileType() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/file-type"); +} + +/// +/// Provides methods to interact with users. +/// +public interface IUsersClient +{ + /// + /// Authenticates the user. + /// + /// The authentication scheme to challenge. + /// The URL to return after successful authentication. + HttpResponseMessage Authenticate(string scheme, string returnUrl); + + /// + /// Authenticates the user. + /// + /// The authentication scheme to challenge. + /// The URL to return after successful authentication. + /// The token to cancel the current operation. + Task AuthenticateAsync(string scheme, string returnUrl, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + /// Logs out the user. + /// + /// The URL to return after logout. + void SignOut(string returnUrl); - /// - public Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/file-type"); + /// + /// Logs out the user. + /// + /// The URL to return after logout. + /// The token to cancel the current operation. + Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Deletes a personal access token. + /// + /// The personal access token to delete. + HttpResponseMessage DeleteTokenByValue(string value); - /// - public string GetHelpLink() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/help-link"); + /// + /// Deletes a personal access token. + /// + /// The personal access token to delete. + /// The token to cancel the current operation. + Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + /// Gets the current user. + /// + MeResponse GetMe(); - /// - public Task GetHelpLinkAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/help-link"); + /// + /// Gets the current user. + /// + /// The token to cancel the current operation. + Task GetMeAsync(CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Creates a personal access token. + /// + /// The optional user identifier. If not specified, the current user will be used. + /// The personal access token to create. + string CreateToken(PersonalAccessToken token, string? userId = default); - /// - public IReadOnlyDictionary? GetConfiguration() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Creates a personal access token. + /// + /// The optional user identifier. If not specified, the current user will be used. + /// The personal access token to create. + /// The token to cancel the current operation. + Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke?>("GET", __url, "application/json", default, default); - } + /// + /// Deletes a personal access token. + /// + /// The identifier of the personal access token. + HttpResponseMessage DeleteToken(Guid tokenId); - /// - public Task?> GetConfigurationAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Deletes a personal access token. + /// + /// The identifier of the personal access token. + /// The token to cancel the current operation. + Task DeleteTokenAsync(Guid tokenId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync?>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Accepts the license of the specified catalog. + /// + /// The catalog identifier. + HttpResponseMessage AcceptLicense(string catalogId); - /// - public void SetConfiguration(IReadOnlyDictionary? configuration) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Accepts the license of the specified catalog. + /// + /// The catalog identifier. + /// The token to cancel the current operation. + Task AcceptLicenseAsync(string catalogId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - ___client.Invoke("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions)); - } + /// + /// Gets a list of users. + /// + IReadOnlyDictionary GetUsers(); - /// - public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Gets a list of users. + /// + /// The token to cancel the current operation. + Task> GetUsersAsync(CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions), cancellationToken); - } + /// + /// Creates a user. + /// + /// The user to create. + string CreateUser(NexusUser user); - } + /// + /// Creates a user. + /// + /// The user to create. + /// The token to cancel the current operation. + Task CreateUserAsync(NexusUser user, CancellationToken cancellationToken = default); /// - /// Provides methods to interact with users. - /// - public interface IUsersClient - { - /// - /// Authenticates the user. - /// - /// The authentication scheme to challenge. - /// The URL to return after successful authentication. - HttpResponseMessage Authenticate(string scheme, string returnUrl); - - /// - /// Authenticates the user. - /// - /// The authentication scheme to challenge. - /// The URL to return after successful authentication. - /// The token to cancel the current operation. - Task AuthenticateAsync(string scheme, string returnUrl, CancellationToken cancellationToken = default); - - /// - /// Logs out the user. - /// - /// The URL to return after logout. - void SignOut(string returnUrl); - - /// - /// Logs out the user. - /// - /// The URL to return after logout. - /// The token to cancel the current operation. - Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default); - - /// - /// Deletes a personal access token. - /// - /// The personal access token to delete. - HttpResponseMessage DeleteTokenByValue(string value); - - /// - /// Deletes a personal access token. - /// - /// The personal access token to delete. - /// The token to cancel the current operation. - Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default); - - /// - /// Gets the current user. - /// - MeResponse GetMe(); - - /// - /// Gets the current user. - /// - /// The token to cancel the current operation. - Task GetMeAsync(CancellationToken cancellationToken = default); - - /// - /// Creates a personal access token. - /// - /// The optional user identifier. If not specified, the current user will be used. - /// The personal access token to create. - string CreateToken(PersonalAccessToken token, string? userId = default); - - /// - /// Creates a personal access token. - /// - /// The optional user identifier. If not specified, the current user will be used. - /// The personal access token to create. - /// The token to cancel the current operation. - Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default); - - /// - /// Deletes a personal access token. - /// - /// The identifier of the personal access token. - HttpResponseMessage DeleteToken(Guid tokenId); - - /// - /// Deletes a personal access token. - /// - /// The identifier of the personal access token. - /// The token to cancel the current operation. - Task DeleteTokenAsync(Guid tokenId, CancellationToken cancellationToken = default); - - /// - /// Accepts the license of the specified catalog. - /// - /// The catalog identifier. - HttpResponseMessage AcceptLicense(string catalogId); - - /// - /// Accepts the license of the specified catalog. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task AcceptLicenseAsync(string catalogId, CancellationToken cancellationToken = default); - - /// - /// Gets a list of users. - /// - IReadOnlyDictionary GetUsers(); - - /// - /// Gets a list of users. - /// - /// The token to cancel the current operation. - Task> GetUsersAsync(CancellationToken cancellationToken = default); - - /// - /// Creates a user. - /// - /// The user to create. - string CreateUser(NexusUser user); - - /// - /// Creates a user. - /// - /// The user to create. - /// The token to cancel the current operation. - Task CreateUserAsync(NexusUser user, CancellationToken cancellationToken = default); - - /// - /// Deletes a user. - /// - /// The identifier of the user. - HttpResponseMessage DeleteUser(string userId); - - /// - /// Deletes a user. - /// - /// The identifier of the user. - /// The token to cancel the current operation. - Task DeleteUserAsync(string userId, CancellationToken cancellationToken = default); - - /// - /// Gets all claims. - /// - /// The identifier of the user. - IReadOnlyDictionary GetClaims(string userId); - - /// - /// Gets all claims. - /// - /// The identifier of the user. - /// The token to cancel the current operation. - Task> GetClaimsAsync(string userId, CancellationToken cancellationToken = default); - - /// - /// Creates a claim. - /// - /// The identifier of the user. - /// The claim to create. - Guid CreateClaim(string userId, NexusClaim claim); - - /// - /// Creates a claim. - /// - /// The identifier of the user. - /// The claim to create. - /// The token to cancel the current operation. - Task CreateClaimAsync(string userId, NexusClaim claim, CancellationToken cancellationToken = default); - - /// - /// Deletes a claim. - /// - /// The identifier of the claim. - HttpResponseMessage DeleteClaim(Guid claimId); - - /// - /// Deletes a claim. - /// - /// The identifier of the claim. - /// The token to cancel the current operation. - Task DeleteClaimAsync(Guid claimId, CancellationToken cancellationToken = default); - - /// - /// Gets all personal access tokens. - /// - /// The identifier of the user. - IReadOnlyDictionary GetTokens(string userId); - - /// - /// Gets all personal access tokens. - /// - /// The identifier of the user. - /// The token to cancel the current operation. - Task> GetTokensAsync(string userId, CancellationToken cancellationToken = default); - - } - - /// - public class UsersClient : IUsersClient - { - private NexusClient ___client; - - internal UsersClient(NexusClient client) - { - ___client = client; - } + /// Deletes a user. + /// + /// The identifier of the user. + HttpResponseMessage DeleteUser(string userId); - /// - public HttpResponseMessage Authenticate(string scheme, string returnUrl) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/authenticate"); + /// + /// Deletes a user. + /// + /// The identifier of the user. + /// The token to cancel the current operation. + Task DeleteUserAsync(string userId, CancellationToken cancellationToken = default); - var __queryValues = new Dictionary(); + /// + /// Gets all claims. + /// + /// The identifier of the user. + IReadOnlyDictionary GetClaims(string userId); - __queryValues["scheme"] = Uri.EscapeDataString(scheme); + /// + /// Gets all claims. + /// + /// The identifier of the user. + /// The token to cancel the current operation. + Task> GetClaimsAsync(string userId, CancellationToken cancellationToken = default); - __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); + /// + /// Creates a claim. + /// + /// The identifier of the user. + /// The claim to create. + Guid CreateClaim(string userId, NexusClaim claim); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + /// Creates a claim. + /// + /// The identifier of the user. + /// The claim to create. + /// The token to cancel the current operation. + Task CreateClaimAsync(string userId, NexusClaim claim, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/octet-stream", default, default); - } + /// + /// Deletes a claim. + /// + /// The identifier of the claim. + HttpResponseMessage DeleteClaim(Guid claimId); - /// - public Task AuthenticateAsync(string scheme, string returnUrl, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/authenticate"); + /// + /// Deletes a claim. + /// + /// The identifier of the claim. + /// The token to cancel the current operation. + Task DeleteClaimAsync(Guid claimId, CancellationToken cancellationToken = default); - var __queryValues = new Dictionary(); + /// + /// Gets all personal access tokens. + /// + /// The identifier of the user. + IReadOnlyDictionary GetTokens(string userId); - __queryValues["scheme"] = Uri.EscapeDataString(scheme); + /// + /// Gets all personal access tokens. + /// + /// The identifier of the user. + /// The token to cancel the current operation. + Task> GetTokensAsync(string userId, CancellationToken cancellationToken = default); - __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); +} - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); +/// +public class UsersClient : IUsersClient +{ + private NexusClient ___client; + + internal UsersClient(NexusClient client) + { + ___client = client; + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public HttpResponseMessage Authenticate(string scheme, string returnUrl) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/authenticate"); - /// - public void SignOut(string returnUrl) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/signout"); + var __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + __queryValues["scheme"] = Uri.EscapeDataString(scheme); - __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); + __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __url = __urlBuilder.ToString(); - ___client.Invoke("POST", __url, default, default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/octet-stream", default, default); + } - /// - public Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/signout"); + /// + public Task AuthenticateAsync(string scheme, string returnUrl, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/authenticate"); - var __queryValues = new Dictionary(); + var __queryValues = new Dictionary(); - __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); + __queryValues["scheme"] = Uri.EscapeDataString(scheme); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, default, default, default, cancellationToken); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public HttpResponseMessage DeleteTokenByValue(string value) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/delete"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/octet-stream", default, default, cancellationToken); + } - var __queryValues = new Dictionary(); + /// + public void SignOut(string returnUrl) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/signout"); - __queryValues["value"] = Uri.EscapeDataString(value); + var __queryValues = new Dictionary(); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/delete"); + var __url = __urlBuilder.ToString(); + ___client.Invoke("POST", __url, default, default, default); + } - var __queryValues = new Dictionary(); + /// + public Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/signout"); - __queryValues["value"] = Uri.EscapeDataString(value); + var __queryValues = new Dictionary(); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public MeResponse GetMe() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/me"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, default, default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + public HttpResponseMessage DeleteTokenByValue(string value) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/delete"); - /// - public Task GetMeAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/me"); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + __queryValues["value"] = Uri.EscapeDataString(value); - /// - public string CreateToken(PersonalAccessToken token, string? userId = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/create"); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + /// + public Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/delete"); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions)); - } + __queryValues["value"] = Uri.EscapeDataString(value); - /// - public Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/create"); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + /// + public MeResponse GetMe() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/me"); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions), cancellationToken); - } + /// + public Task GetMeAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/me"); - /// - public HttpResponseMessage DeleteToken(Guid tokenId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/{tokenId}"); - __urlBuilder.Replace("{tokenId}", Uri.EscapeDataString(Convert.ToString(tokenId, CultureInfo.InvariantCulture)!)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + /// + public string CreateToken(PersonalAccessToken token, string? userId = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/create"); - /// - public Task DeleteTokenAsync(Guid tokenId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/{tokenId}"); - __urlBuilder.Replace("{tokenId}", Uri.EscapeDataString(Convert.ToString(tokenId, CultureInfo.InvariantCulture)!)); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - /// - public HttpResponseMessage AcceptLicense(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/accept-license"); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions)); + } - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + /// + public Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/create"); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/octet-stream", default, default); - } + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - /// - public Task AcceptLicenseAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/accept-license"); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions), cancellationToken); + } - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + /// + public HttpResponseMessage DeleteToken(Guid tokenId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/{tokenId}"); + __urlBuilder.Replace("{tokenId}", Uri.EscapeDataString(Convert.ToString(tokenId, CultureInfo.InvariantCulture)!)); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public Task DeleteTokenAsync(Guid tokenId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/{tokenId}"); + __urlBuilder.Replace("{tokenId}", Uri.EscapeDataString(Convert.ToString(tokenId, CultureInfo.InvariantCulture)!)); - /// - public IReadOnlyDictionary GetUsers() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public HttpResponseMessage AcceptLicense(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/accept-license"); - /// - public Task> GetUsersAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); - /// - public string CreateUser(NexusUser user) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions)); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/octet-stream", default, default); + } - /// - public Task CreateUserAsync(NexusUser user, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + /// + public Task AcceptLicenseAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/accept-license"); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions), cancellationToken); - } + var __queryValues = new Dictionary(); - /// - public HttpResponseMessage DeleteUser(string userId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public Task DeleteUserAsync(string userId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public IReadOnlyDictionary GetUsers() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - /// - public IReadOnlyDictionary GetClaims(string userId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/claims"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public Task> GetUsersAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - /// - public Task> GetClaimsAsync(string userId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/claims"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public string CreateUser(NexusUser user) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - /// - public Guid CreateClaim(string userId, NexusClaim claim) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/claims"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions)); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions)); - } + /// + public Task CreateUserAsync(NexusUser user, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - /// - public Task CreateClaimAsync(string userId, NexusClaim claim, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/claims"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions), cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions), cancellationToken); - } + /// + public HttpResponseMessage DeleteUser(string userId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public HttpResponseMessage DeleteClaim(Guid claimId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/claims/{claimId}"); - __urlBuilder.Replace("{claimId}", Uri.EscapeDataString(Convert.ToString(claimId, CultureInfo.InvariantCulture)!)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + /// + public Task DeleteUserAsync(string userId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public Task DeleteClaimAsync(Guid claimId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/claims/{claimId}"); - __urlBuilder.Replace("{claimId}", Uri.EscapeDataString(Convert.ToString(claimId, CultureInfo.InvariantCulture)!)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public IReadOnlyDictionary GetClaims(string userId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public IReadOnlyDictionary GetTokens(string userId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/tokens"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public Task> GetClaimsAsync(string userId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public Task> GetTokensAsync(string userId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/tokens"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public Guid CreateClaim(string userId, NexusClaim claim) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions)); } - /// - /// Provides methods to interact with writers. - /// - public interface IWritersClient + /// + public Task CreateClaimAsync(string userId, NexusClaim claim, CancellationToken cancellationToken = default) { - /// - /// Gets the list of writer descriptions. - /// - IReadOnlyList GetDescriptions(); - - /// - /// Gets the list of writer descriptions. - /// - /// The token to cancel the current operation. - Task> GetDescriptionsAsync(CancellationToken cancellationToken = default); + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions), cancellationToken); } /// - public class WritersClient : IWritersClient + public HttpResponseMessage DeleteClaim(Guid claimId) { - private NexusClient ___client; - - internal WritersClient(NexusClient client) - { - ___client = client; - } + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/claims/{claimId}"); + __urlBuilder.Replace("{claimId}", Uri.EscapeDataString(Convert.ToString(claimId, CultureInfo.InvariantCulture)!)); - /// - public IReadOnlyList GetDescriptions() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/writers/descriptions"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public Task DeleteClaimAsync(Guid claimId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/claims/{claimId}"); + __urlBuilder.Replace("{claimId}", Uri.EscapeDataString(Convert.ToString(claimId, CultureInfo.InvariantCulture)!)); - /// - public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/writers/descriptions"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public IReadOnlyDictionary GetTokens(string userId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/tokens"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); } + /// + public Task> GetTokensAsync(string userId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/tokens"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// A catalog item consists of a catalog, a resource and a representation. - /// - /// The catalog. - /// The resource. - /// The representation. - /// The optional dictionary of representation parameters and its arguments. - public record CatalogItem(ResourceCatalog Catalog, Resource Resource, Representation Representation, IReadOnlyDictionary? Parameters); +} +/// +/// Provides methods to interact with writers. +/// +public interface IWritersClient +{ /// - /// A catalog is a top level element and holds a list of resources. + /// Gets the list of writer descriptions. /// - /// Gets the identifier. - /// Gets the properties. - /// Gets the list of representations. - public record ResourceCatalog(string Id, IReadOnlyDictionary? Properties, IReadOnlyList? Resources); + IReadOnlyList GetDescriptions(); /// - /// A resource is part of a resource catalog and holds a list of representations. + /// Gets the list of writer descriptions. /// - /// Gets the identifier. - /// Gets the properties. - /// Gets the list of representations. - public record Resource(string Id, IReadOnlyDictionary? Properties, IReadOnlyList? Representations); + /// The token to cancel the current operation. + Task> GetDescriptionsAsync(CancellationToken cancellationToken = default); - /// - /// A representation is part of a resource. - /// - /// The data type. - /// The sample period. - /// The optional list of parameters. - public record Representation(NexusDataType DataType, TimeSpan SamplePeriod, IReadOnlyDictionary? Parameters); +} - /// - /// Specifies the Nexus data type. - /// - public enum NexusDataType +/// +public class WritersClient : IWritersClient +{ + private NexusClient ___client; + + internal WritersClient(NexusClient client) { - /// - /// UINT8 - /// - UINT8, - - /// - /// UINT16 - /// - UINT16, - - /// - /// UINT32 - /// - UINT32, - - /// - /// UINT64 - /// - UINT64, + ___client = client; + } - /// - /// INT8 - /// - INT8, + /// + public IReadOnlyList GetDescriptions() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/writers/descriptions"); - /// - /// INT16 - /// - INT16, + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - /// - /// INT32 - /// - INT32, + /// + public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/writers/descriptions"); - /// - /// INT64 - /// - INT64, + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// FLOAT32 - /// - FLOAT32, +} - /// - /// FLOAT64 - /// - FLOAT64 - } +/// +/// A catalog item consists of a catalog, a resource and a representation. +/// +/// The catalog. +/// The resource. +/// The representation. +/// The optional dictionary of representation parameters and its arguments. +public record CatalogItem(ResourceCatalog Catalog, Resource Resource, Representation Representation, IReadOnlyDictionary? Parameters); + +/// +/// A catalog is a top level element and holds a list of resources. +/// +/// Gets the identifier. +/// Gets the properties. +/// Gets the list of representations. +public record ResourceCatalog(string Id, IReadOnlyDictionary? Properties, IReadOnlyList? Resources); + +/// +/// A resource is part of a resource catalog and holds a list of representations. +/// +/// Gets the identifier. +/// Gets the properties. +/// Gets the list of representations. +public record Resource(string Id, IReadOnlyDictionary? Properties, IReadOnlyList? Representations); + +/// +/// A representation is part of a resource. +/// +/// The data type. +/// The sample period. +/// The optional list of parameters. +public record Representation(NexusDataType DataType, TimeSpan SamplePeriod, IReadOnlyDictionary? Parameters); + +/// +/// Specifies the Nexus data type. +/// +public enum NexusDataType +{ /// - /// A structure for catalog information. + /// UINT8 /// - /// The identifier. - /// A nullable title. - /// A nullable contact. - /// A nullable readme. - /// A nullable license. - /// A boolean which indicates if the catalog is accessible. - /// A boolean which indicates if the catalog is editable. - /// A boolean which indicates if the catalog is released. - /// A boolean which indicates if the catalog is visible. - /// A boolean which indicates if the catalog is owned by the current user. - /// The package reference identifiers. - /// A structure for pipeline info. - public record CatalogInfo(string Id, string? Title, string? Contact, string? Readme, string? License, bool IsReadable, bool IsWritable, bool IsReleased, bool IsVisible, bool IsOwner, IReadOnlyList PackageReferenceIds, PipelineInfo PipelineInfo); + UINT8, /// - /// A structure for pipeline information. + /// UINT16 /// - /// The pipeline identifier. - /// An array of data source types. - /// An array of data source info URLs. - public record PipelineInfo(Guid Id, IReadOnlyList Types, IReadOnlyList InfoUrls); + UINT16, /// - /// A catalog time range. + /// UINT32 /// - /// The date/time of the first data in the catalog. - /// The date/time of the last data in the catalog. - public record CatalogTimeRange(DateTime Begin, DateTime End); + UINT32, /// - /// The catalog availability. + /// UINT64 /// - /// The actual availability data. - public record CatalogAvailability(IReadOnlyList Data); + UINT64, /// - /// A structure for catalog metadata. + /// INT8 /// - /// The contact. - /// A list of groups the catalog is part of. - /// Overrides for the catalog. - public record CatalogMetadata(string? Contact, IReadOnlyList? GroupMemberships, ResourceCatalog? Overrides); + INT8, /// - /// Description of a job. + /// INT16 /// - /// The global unique identifier. - /// The job type. - /// The owner of the job. - /// The job parameters. - public record Job(Guid Id, string Type, string Owner, JsonElement? Parameters); + INT16, /// - /// Describes the status of the job. + /// INT32 /// - /// The start date/time. - /// The status. - /// The progress from 0 to 1. - /// The nullable exception message. - /// The nullable result. - public record JobStatus(DateTime Start, TaskStatus Status, double Progress, string? ExceptionMessage, JsonElement? Result); + INT32, /// - /// + /// INT64 /// - public enum TaskStatus - { - /// - /// Created - /// - Created, - - /// - /// WaitingForActivation - /// - WaitingForActivation, - - /// - /// WaitingToRun - /// - WaitingToRun, - - /// - /// Running - /// - Running, - - /// - /// WaitingForChildrenToComplete - /// - WaitingForChildrenToComplete, - - /// - /// RanToCompletion - /// - RanToCompletion, - - /// - /// Canceled - /// - Canceled, - - /// - /// Faulted - /// - Faulted - } - + INT64, /// - /// A structure for export parameters. + /// FLOAT32 /// - /// The start date/time. - /// The end date/time. - /// The file period. - /// The writer type. If null, data will be read (and possibly cached) but not returned. This is useful for data pre-aggregation. - /// The resource paths to export. - /// The configuration. - public record ExportParameters(DateTime Begin, DateTime End, TimeSpan FilePeriod, string? Type, IReadOnlyList ResourcePaths, IReadOnlyDictionary? Configuration); + FLOAT32, /// - /// A package reference. + /// FLOAT64 /// - /// The provider which loads the package. - /// The configuration of the package reference. - public record PackageReference(string Provider, IReadOnlyDictionary Configuration); + FLOAT64 +} + +/// +/// A structure for catalog information. +/// +/// The identifier. +/// A nullable title. +/// A nullable contact. +/// A nullable readme. +/// A nullable license. +/// A boolean which indicates if the catalog is accessible. +/// A boolean which indicates if the catalog is editable. +/// A boolean which indicates if the catalog is released. +/// A boolean which indicates if the catalog is visible. +/// A boolean which indicates if the catalog is owned by the current user. +/// The package reference identifiers. +/// A structure for pipeline info. +public record CatalogInfo(string Id, string? Title, string? Contact, string? Readme, string? License, bool IsReadable, bool IsWritable, bool IsReleased, bool IsVisible, bool IsOwner, IReadOnlyList PackageReferenceIds, PipelineInfo PipelineInfo); + +/// +/// A structure for pipeline information. +/// +/// The pipeline identifier. +/// An array of data source types. +/// An array of data source info URLs. +public record PipelineInfo(Guid Id, IReadOnlyList Types, IReadOnlyList InfoUrls); + +/// +/// A catalog time range. +/// +/// The date/time of the first data in the catalog. +/// The date/time of the last data in the catalog. +public record CatalogTimeRange(DateTime Begin, DateTime End); + +/// +/// The catalog availability. +/// +/// The actual availability data. +public record CatalogAvailability(IReadOnlyList Data); + +/// +/// A structure for catalog metadata. +/// +/// The contact. +/// A list of groups the catalog is part of. +/// Overrides for the catalog. +public record CatalogMetadata(string? Contact, IReadOnlyList? GroupMemberships, ResourceCatalog? Overrides); + +/// +/// Description of a job. +/// +/// The global unique identifier. +/// The job type. +/// The owner of the job. +/// The job parameters. +public record Job(Guid Id, string Type, string Owner, JsonElement? Parameters); + +/// +/// Describes the status of the job. +/// +/// The start date/time. +/// The status. +/// The progress from 0 to 1. +/// The nullable exception message. +/// The nullable result. +public record JobStatus(DateTime Start, TaskStatus Status, double Progress, string? ExceptionMessage, JsonElement? Result); + +/// +/// +/// +public enum TaskStatus +{ /// - /// An extension description. + /// Created /// - /// The extension type. - /// The extension version. - /// A nullable description. - /// A nullable project website URL. - /// A nullable source repository URL. - /// Additional information about the extension. - public record ExtensionDescription(string Type, string Version, string? Description, string? ProjectUrl, string? RepositoryUrl, IReadOnlyDictionary? AdditionalInformation); + Created, /// - /// A data source pipeline. + /// WaitingForActivation /// - /// The list of pipeline elements (data source registrations). - /// An optional regular expressions pattern to select the catalogs to be released. By default, all catalogs will be released. - /// An optional regular expressions pattern to select the catalogs to be visible. By default, all catalogs will be visible. - public record DataSourcePipeline(IReadOnlyList Registrations, string? ReleasePattern, string? VisibilityPattern); + WaitingForActivation, /// - /// A data source registration. + /// WaitingToRun /// - /// The type of the data source. - /// An optional URL which points to the data. - /// Configuration parameters for the instantiated source. - /// An optional info URL. - public record DataSourceRegistration(string Type, Uri? ResourceLocator, IReadOnlyDictionary? Configuration, string? InfoUrl); + WaitingToRun, /// - /// A me response. + /// Running /// - /// The user id. - /// The user. - /// A boolean which indicates if the user is an administrator. - /// A list of personal access tokens. - public record MeResponse(string UserId, NexusUser User, bool IsAdmin, IReadOnlyDictionary PersonalAccessTokens); + Running, /// - /// Represents a user. + /// WaitingForChildrenToComplete /// - /// The user name. - public record NexusUser(string Name); + WaitingForChildrenToComplete, /// - /// A personal access token. + /// RanToCompletion /// - /// The token description. - /// The date/time when the token expires. - /// The claims that will be part of the token. - public record PersonalAccessToken(string Description, DateTime Expires, IReadOnlyList Claims); + RanToCompletion, /// - /// A revoke token request. + /// Canceled /// - /// The claim type. - /// The claim value. - public record TokenClaim(string Type, string Value); + Canceled, /// - /// Represents a claim. + /// Faulted /// - /// The claim type. - /// The claim value. - public record NexusClaim(string Type, string Value); + Faulted +} + + +/// +/// A structure for export parameters. +/// +/// The start date/time. +/// The end date/time. +/// The file period. +/// The writer type. If null, data will be read (and possibly cached) but not returned. This is useful for data pre-aggregation. +/// The resource paths to export. +/// The configuration. +public record ExportParameters(DateTime Begin, DateTime End, TimeSpan FilePeriod, string? Type, IReadOnlyList ResourcePaths, IReadOnlyDictionary? Configuration); + +/// +/// A package reference. +/// +/// The provider which loads the package. +/// The configuration of the package reference. +public record PackageReference(string Provider, IReadOnlyDictionary Configuration); + +/// +/// An extension description. +/// +/// The extension type. +/// The extension version. +/// A nullable description. +/// A nullable project website URL. +/// A nullable source repository URL. +/// Additional information about the extension. +public record ExtensionDescription(string Type, string Version, string? Description, string? ProjectUrl, string? RepositoryUrl, IReadOnlyDictionary? AdditionalInformation); + +/// +/// A data source pipeline. +/// +/// The list of pipeline elements (data source registrations). +/// An optional regular expressions pattern to select the catalogs to be released. By default, all catalogs will be released. +/// An optional regular expressions pattern to select the catalogs to be visible. By default, all catalogs will be visible. +public record DataSourcePipeline(IReadOnlyList Registrations, string? ReleasePattern, string? VisibilityPattern); + +/// +/// A data source registration. +/// +/// The type of the data source. +/// An optional URL which points to the data. +/// Configuration parameters for the instantiated source. +/// An optional info URL. +public record DataSourceRegistration(string Type, Uri? ResourceLocator, IReadOnlyDictionary? Configuration, string? InfoUrl); + +/// +/// A me response. +/// +/// The user id. +/// The user. +/// A boolean which indicates if the user is an administrator. +/// A list of personal access tokens. +public record MeResponse(string UserId, NexusUser User, bool IsAdmin, IReadOnlyDictionary PersonalAccessTokens); + +/// +/// Represents a user. +/// +/// The user name. +public record NexusUser(string Name); + +/// +/// A personal access token. +/// +/// The token description. +/// The date/time when the token expires. +/// The claims that will be part of the token. +public record PersonalAccessToken(string Description, DateTime Expires, IReadOnlyList Claims); + +/// +/// A revoke token request. +/// +/// The claim type. +/// The claim value. +public record TokenClaim(string Type, string Value); + +/// +/// Represents a claim. +/// +/// The claim type. +/// The claim value. +public record NexusClaim(string Type, string Value);