From d4f48fef506a08aeef1cf273ac977a12d58a49c8 Mon Sep 17 00:00:00 2001 From: Apollo3zehn <20972129+Apollo3zehn@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:22:22 +0100 Subject: [PATCH] 160 fix plotting (#163) * Add missing ConfigureAwait(false) calls * Done * Fix API --------- Co-authored-by: Vincent Wilms --- .github/workflows/build-and-publish.yml | 1 - openapi.json | 12 +- .../Charts/AvailabilityChart.razor.cs | 59 +- src/Nexus.UI/Charts/Chart.razor.cs | 66 +- src/Nexus.UI/Core/NexusDemoClient.cs | 4 +- src/Nexus.UI/Nexus.UI.csproj | 4 +- src/Nexus/API/v1/CatalogsController.cs | 9 +- src/Nexus/Core/CatalogContainer.cs | 6 +- src/clients/dotnet-client/NexusClient.g.cs | 4978 ++++++++--------- src/clients/python-client/nexus_api/V1.py | 8 +- 10 files changed, 2614 insertions(+), 2533 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index ed555b93..9340594e 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -42,7 +42,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: "9.0.x" - dotnet-quality: "preview" - name: Set up Python uses: actions/setup-python@v3 diff --git a/openapi.json b/openapi.json index ba710cbf..8103216a 100644 --- a/openapi.json +++ b/openapi.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0))", + "x-generator": "NSwag v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))", "openapi": "3.0.0", "info": { "title": "Nexus REST API", @@ -534,7 +534,15 @@ }, "responses": { "200": { - "description": "" + "description": "", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } } } } diff --git a/src/Nexus.UI/Charts/AvailabilityChart.razor.cs b/src/Nexus.UI/Charts/AvailabilityChart.razor.cs index a436c6c8..2137289f 100644 --- a/src/Nexus.UI/Charts/AvailabilityChart.razor.cs +++ b/src/Nexus.UI/Charts/AvailabilityChart.razor.cs @@ -11,6 +11,7 @@ namespace Nexus.UI.Charts; public partial class AvailabilityChart { private const float LINE_HEIGHT = 7.0f; + private const float HALF_LINE_HEIGHT = LINE_HEIGHT / 2; [Inject] @@ -43,27 +44,37 @@ private void PaintSurface(SKPaintGLSurfaceEventArgs e) Color = new SKColor(249, 115, 22, 0x19) }; + using var axisTitleFont = new SKFont + { + Size = 17 + }; + using var axisTitlePaint = new SKPaint { - TextSize = 17, IsAntialias = true, - Color = new SKColor(0x55, 0x55, 0x55), - TextAlign = SKTextAlign.Center + Color = new SKColor(0x55, 0x55, 0x55) + }; + + using var axisLabelFont = new SKFont + { + Typeface = TypeFaceService.GetTTF("Courier New Bold") }; using var axisLabelPaint = new SKPaint { IsAntialias = true, - Typeface = TypeFaceService.GetTTF("Courier New Bold"), Color = new SKColor(0x55, 0x55, 0x55) }; + using var axisLabelCenteredFont = new SKFont + { + Typeface = TypeFaceService.GetTTF("Courier New Bold") + }; + using var axisLabelCenteredPaint = new SKPaint { IsAntialias = true, - Typeface = TypeFaceService.GetTTF("Courier New Bold"), - Color = new SKColor(0x55, 0x55, 0x55), - TextAlign = SKTextAlign.Center + Color = new SKColor(0x55, 0x55, 0x55) }; using var axisTickPaint = new SKPaint @@ -79,12 +90,19 @@ private void PaintSurface(SKPaintGLSurfaceEventArgs e) using (var canvasRestore = new SKAutoCanvasRestore(canvas)) { canvas.RotateDegrees(270, xMin, yMin + yRange / 2); - canvas.DrawText("Availability / %", new SKPoint(xMin, yMin + yRange / 2), axisTitlePaint); + + canvas.DrawText( + "Availability / %", + new SKPoint(xMin, yMin + yRange / 2), + SKTextAlign.Center, + axisTitleFont, + axisTitlePaint + ); } xMin += 10; - var widthPerCharacter = axisLabelPaint.MeasureText(" "); + var widthPerCharacter = axisLabelFont.MeasureText(" "); var desiredYLabelCount = 11; var maxYLabelCount = yRange / 50; var ySkip = (int)(desiredYLabelCount / (float)maxYLabelCount) + 1; @@ -98,7 +116,7 @@ private void PaintSurface(SKPaintGLSurfaceEventArgs e) var label = $"{(int)(relative * 100),3:D0}"; var lineOffset = widthPerCharacter * 3; - canvas.DrawText(label, new SKPoint(xMin, y + HALF_LINE_HEIGHT), axisLabelPaint); + canvas.DrawText(label, new SKPoint(xMin, y + HALF_LINE_HEIGHT), axisLabelFont, axisLabelPaint); canvas.DrawLine(new SKPoint(xMin + lineOffset, y), new SKPoint(xMax, y), axisTickPaint); } } @@ -137,10 +155,27 @@ private void PaintSurface(SKPaintGLSurfaceEventArgs e) if ((i + xSkip) % xSkip == 0) { var currentBegin = AvailabilityData.Begin.AddDays(i); - canvas.DrawText(currentBegin.ToString("dd.MM"), xMin + (i + 0.5f) * valueWidth, yMax - 20, axisLabelCenteredPaint); + + canvas.DrawText( + currentBegin.ToString("dd.MM"), + xMin + (i + 0.5f) * valueWidth, + yMax - 20, + SKTextAlign.Center, + axisLabelCenteredFont, + axisLabelCenteredPaint + ); if (lastBegin.Year != currentBegin.Year) - canvas.DrawText(currentBegin.ToString("yyyy"), xMin + (i + 0.5f) * valueWidth, yMax, axisLabelCenteredPaint); + { + canvas.DrawText( + currentBegin.ToString("yyyy"), + xMin + (i + 0.5f) * valueWidth, + yMax, + SKTextAlign.Center, + axisLabelCenteredFont, + axisLabelCenteredPaint + ); + } lastBegin = currentBegin; } diff --git a/src/Nexus.UI/Charts/Chart.razor.cs b/src/Nexus.UI/Charts/Chart.razor.cs index 306f9c7b..515cbf2b 100644 --- a/src/Nexus.UI/Charts/Chart.razor.cs +++ b/src/Nexus.UI/Charts/Chart.razor.cs @@ -142,7 +142,8 @@ protected override void OnParametersSet() .GroupBy(lineSeries => lineSeries.Unit) .ToDictionary(group => GetAxisInfo(group.Key, group), group => group.ToArray()); - _skiaView.Invalidate(); + if (OperatingSystem.IsBrowser()) + _skiaView.Invalidate(); }); } } @@ -189,7 +190,9 @@ public void OnMouseUp() zoomBox.Height > 0) { ApplyZoom(zoomBox); - _skiaView.Invalidate(); + + if (OperatingSystem.IsBrowser()) + _skiaView.Invalidate(); } } @@ -218,7 +221,8 @@ private void OnDoubleClick(MouseEventArgs e) var relativePosition = JSRuntime.Invoke("nexus.chart.toRelative", _chartId, e.ClientX, e.ClientY); DrawAuxiliary(relativePosition); - _skiaView.Invalidate(); + if (OperatingSystem.IsBrowser()) + _skiaView.Invalidate(); } private void OnWheel(WheelEventArgs e) @@ -250,13 +254,16 @@ private void OnWheel(WheelEventArgs e) ApplyZoom(zoomBox); DrawAuxiliary(relativePosition); - _skiaView.Invalidate(); + if (OperatingSystem.IsBrowser()) + _skiaView.Invalidate(); } private void ToggleSeriesEnabled(LineSeries series) { series.Show = !series.Show; - _skiaView.Invalidate(); + + if (OperatingSystem.IsBrowser()) + _skiaView.Invalidate(); } #region Draw @@ -546,9 +553,13 @@ private void ResetZoom() private float DrawYAxes(SKCanvas canvas, float xMin, float yMin, float yMax, Dictionary axesMap) { + using var axisLabelFont = new SKFont + { + Typeface = TypeFaceService.GetTTF("Courier New Bold") + }; + using var axisLabelPaint = new SKPaint { - Typeface = TypeFaceService.GetTTF("Courier New Bold"), IsAntialias = true, Color = new SKColor(0x55, 0x55, 0x55) }; @@ -562,7 +573,7 @@ private float DrawYAxes(SKCanvas canvas, float xMin, float yMin, float yMax, Dic var currentOffset = xMin; var canvasRange = yMax - yMin; var maxTickCount = Math.Max(1, (int)Math.Round(canvasRange / 50, MidpointRounding.AwayFromZero)); - var widthPerCharacter = axisLabelPaint.MeasureText(" "); + var widthPerCharacter = axisLabelFont.MeasureText(" "); foreach (var axesEntry in axesMap) { @@ -593,7 +604,7 @@ private float DrawYAxes(SKCanvas canvas, float xMin, float yMin, float yMax, Dic var localUnitOffset = maxChars - axisInfo.Unit.Length; var xUnit = currentOffset + localUnitOffset * widthPerCharacter; var yUnit = yMin; - canvas.DrawText(axisInfo.Unit, new SKPoint(xUnit, yUnit), axisLabelPaint); + canvas.DrawText(axisInfo.Unit, new SKPoint(xUnit, yUnit), axisLabelFont, axisLabelPaint); /* draw labels and ticks */ for (int i = 0; i < ticks.Length; i++) @@ -608,7 +619,7 @@ private float DrawYAxes(SKCanvas canvas, float xMin, float yMin, float yMax, Dic var x = currentOffset + localLabelOffset * widthPerCharacter; var y = yMax - (tick - axisInfo.Min) * scaleFactor; - canvas.DrawText(label, new SKPoint(x, y + HALF_LINE_HEIGHT), axisLabelPaint); + canvas.DrawText(label, new SKPoint(x, y + HALF_LINE_HEIGHT), axisLabelFont, axisLabelPaint); var tickX = currentOffset + textWidth + TICK_MARGIN_LEFT; canvas.DrawLine(tickX, y, tickX + TICK_SIZE, y, axisTickPaint); @@ -710,10 +721,13 @@ private float[] GetYTicks(float min, float max, int maxTickCount) private void DrawTimeAxis(SKCanvas canvas, float xMin, float yMin, float xMax, float yMax, DateTime begin, DateTime end) { + using var axisLabelFont = new SKFont + { + Typeface = TypeFaceService.GetTTF("Courier New Bold") + }; + using var axisLabelPaint = new SKPaint { - Typeface = TypeFaceService.GetTTF("Courier New Bold"), - TextAlign = SKTextAlign.Center, IsAntialias = true, Color = new SKColor(0x55, 0x55, 0x55) }; @@ -727,6 +741,7 @@ private void DrawTimeAxis(SKCanvas canvas, float xMin, float yMin, float xMax, f var canvasRange = xMax - xMin; var maxTickCount = Math.Max(1, (int)Math.Round(canvasRange / 130, MidpointRounding.AwayFromZero)); var (config, ticks) = GetTimeTicks(begin, end, maxTickCount); + _timeAxisConfig = config; var timeRange = (end - begin).Ticks; @@ -741,7 +756,14 @@ private void DrawTimeAxis(SKCanvas canvas, float xMin, float yMin, float xMax, f /* fast tick */ var tickLabel = tick.ToString(config.FastTickLabelFormat); - canvas.DrawText(tickLabel, x, yMax + TICK_SIZE + TIME_AXIS_MARGIN_TOP, axisLabelPaint); + + canvas.DrawText( + tickLabel, + x, yMax + TICK_SIZE + TIME_AXIS_MARGIN_TOP, + SKTextAlign.Center, + axisLabelFont, + axisLabelPaint + ); /* slow tick */ var addSlowTick = IsSlowTickRequired(previousTick, tick, config.SlowTickTrigger); @@ -751,13 +773,29 @@ private void DrawTimeAxis(SKCanvas canvas, float xMin, float yMin, float xMax, f if (config.SlowTickLabelFormat1 is not null) { var slowTickLabel1 = tick.ToString(config.SlowTickLabelFormat1); - canvas.DrawText(slowTickLabel1, x, yMax + TICK_SIZE + TIME_AXIS_MARGIN_TOP + TIME_FAST_LABEL_OFFSET, axisLabelPaint); + + canvas.DrawText( + slowTickLabel1, + x, + yMax + TICK_SIZE + TIME_AXIS_MARGIN_TOP + TIME_FAST_LABEL_OFFSET, + SKTextAlign.Center, + axisLabelFont, + axisLabelPaint + ); } if (config.SlowTickLabelFormat2 is not null) { var slowTickLabel2 = tick.ToString(config.SlowTickLabelFormat2); - canvas.DrawText(slowTickLabel2, x, yMax + TICK_SIZE + TIME_AXIS_MARGIN_TOP + TIME_FAST_LABEL_OFFSET * 2, axisLabelPaint); + + canvas.DrawText( + slowTickLabel2, + x, + yMax + TICK_SIZE + TIME_AXIS_MARGIN_TOP + TIME_FAST_LABEL_OFFSET * 2, + SKTextAlign.Center, + axisLabelFont, + axisLabelPaint + ); } } diff --git a/src/Nexus.UI/Core/NexusDemoClient.cs b/src/Nexus.UI/Core/NexusDemoClient.cs index 2e66db3e..a57e35b4 100644 --- a/src/Nexus.UI/Core/NexusDemoClient.cs +++ b/src/Nexus.UI/Core/NexusDemoClient.cs @@ -248,12 +248,12 @@ public Task> SearchCatalogItemsAsync(IR throw new NotImplementedException(); } - public void SetMetadata(string catalogId, CatalogMetadata metadata) + public HttpResponseMessage SetMetadata(string catalogId, CatalogMetadata metadata) { throw new NotImplementedException(); } - public Task SetMetadataAsync(string catalogId, CatalogMetadata metadata, CancellationToken cancellationToken = default) + public Task SetMetadataAsync(string catalogId, CatalogMetadata metadata, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } diff --git a/src/Nexus.UI/Nexus.UI.csproj b/src/Nexus.UI/Nexus.UI.csproj index 7f29e6df..f2b82406 100644 --- a/src/Nexus.UI/Nexus.UI.csproj +++ b/src/Nexus.UI/Nexus.UI.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/src/Nexus/API/v1/CatalogsController.cs b/src/Nexus/API/v1/CatalogsController.cs index 1cefd2a2..bee33959 100644 --- a/src/Nexus/API/v1/CatalogsController.cs +++ b/src/Nexus/API/v1/CatalogsController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.ModelBinding; using Nexus.Core; using Nexus.Core.V1; @@ -481,22 +482,22 @@ public Task> /// The catalog metadata to set. /// A token to cancel the current operation. [HttpPut("{catalogId}/metadata")] - public async Task> + public async Task> SetMetadataAsync( string catalogId, [FromBody] CatalogMetadata metadata, CancellationToken cancellationToken) { if (metadata.Overrides?.Id != catalogId) - return (ActionResult)UnprocessableEntity("The catalog ID does not match the ID of the catalog to update."); + 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 => + var response = await ProtectCatalogAsync(catalogId, ensureReadable: false, ensureWritable: true, async catalogContainer => { await catalogContainer.UpdateMetadataAsync(metadata); - return new object(); + return default!; }, cancellationToken); diff --git a/src/Nexus/Core/CatalogContainer.cs b/src/Nexus/Core/CatalogContainer.cs index cdb945c3..e9eb475c 100644 --- a/src/Nexus/Core/CatalogContainer.cs +++ b/src/Nexus/Core/CatalogContainer.cs @@ -91,7 +91,7 @@ public static CatalogContainer CreateRoot(ICatalogManager catalogManager, IDatab public async Task> GetChildCatalogContainersAsync( CancellationToken cancellationToken) { - await _semaphore.WaitAsync(cancellationToken); + await _semaphore.WaitAsync(cancellationToken).ConfigureAwait(false); try { @@ -109,7 +109,7 @@ public async Task> GetChildCatalogContainersAsync( // TODO: Use Lazy instead? public async Task GetLazyCatalogInfoAsync(CancellationToken cancellationToken) { - await _semaphore.WaitAsync(cancellationToken); + await _semaphore.WaitAsync(cancellationToken).ConfigureAwait(false); try { @@ -127,7 +127,7 @@ public async Task GetLazyCatalogInfoAsync(CancellationToken can public async Task UpdateMetadataAsync(CatalogMetadata metadata) { - await _semaphore.WaitAsync(); + await _semaphore.WaitAsync().ConfigureAwait(false); try { diff --git a/src/clients/dotnet-client/NexusClient.g.cs b/src/clients/dotnet-client/NexusClient.g.cs index c00756f2..93f6218c 100644 --- a/src/clients/dotnet-client/NexusClient.g.cs +++ b/src/clients/dotnet-client/NexusClient.g.cs @@ -13,3182 +13,3182 @@ namespace Nexus.Api { -/// -/// A client for the Nexus system. -/// -public interface INexusClient -{ - /// - /// Gets the V1 client. - /// - Nexus.Api.V1.IV1 V1 { get; } - - - /// - /// Signs in the user. + /// A client for the Nexus system. /// - /// The access token. - /// A task. - void SignIn(string accessToken); + public interface INexusClient + { + /// + /// Gets the V1 client. + /// + Nexus.Api.V1.IV1 V1 { get; } - /// - /// Attaches configuration data to subsequent API requests. - /// - /// The configuration data. - IDisposable AttachConfiguration(object configuration); - /// - /// Clears configuration data for all subsequent API requests. - /// - void ClearConfiguration(); -} -/// -public class NexusClient : INexusClient, IDisposable -{ - private const string ConfigurationHeaderKey = "Nexus-Configuration"; - private const string AuthorizationHeaderKey = "Authorization"; + /// + /// Signs in the user. + /// + /// The access token. + /// A task. + void SignIn(string accessToken); - private string? __token; - private HttpClient __httpClient; + /// + /// Attaches configuration data to subsequent API requests. + /// + /// The configuration data. + IDisposable AttachConfiguration(object configuration); - /// - /// 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) }) - { - // + /// + /// Clears configuration data for all subsequent API requests. + /// + void ClearConfiguration(); } - /// - /// Initializes a new instance of the . - /// - /// The HTTP client to use. - public NexusClient(HttpClient httpClient) + /// + public class NexusClient : INexusClient, IDisposable { - if (httpClient.BaseAddress is null) - throw new Exception("The base address of the HTTP client must be set."); + private const string ConfigurationHeaderKey = "Nexus-Configuration"; + private const string AuthorizationHeaderKey = "Authorization"; - __httpClient = httpClient; + private string? __token; + private HttpClient __httpClient; - V1 = new Nexus.Api.V1.V1(this); + /// + /// 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) }) + { + // + } - } + /// + /// 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."); - /// - /// Gets a value which indicates if the user is authenticated. - /// - public bool IsAuthenticated => __token is not null; + __httpClient = httpClient; - /// - public Nexus.Api.V1.IV1 V1 { get; } + V1 = new Nexus.Api.V1.V1(this); + } + /// + /// Gets a value which indicates if the user is authenticated. + /// + public bool IsAuthenticated => __token is not null; - /// - public void SignIn(string accessToken) - { - var authorizationHeaderValue = $"Bearer {accessToken}"; - __httpClient.DefaultRequestHeaders.Remove(AuthorizationHeaderKey); - __httpClient.DefaultRequestHeaders.Add(AuthorizationHeaderKey, authorizationHeaderValue); + /// + public Nexus.Api.V1.IV1 V1 { get; } - __token = accessToken; - } - /// - public IDisposable AttachConfiguration(object configuration) - { - var encodedJson = Convert.ToBase64String(JsonSerializer.SerializeToUtf8Bytes(configuration)); - __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); - __httpClient.DefaultRequestHeaders.Add(ConfigurationHeaderKey, encodedJson); + /// + public void SignIn(string accessToken) + { + var authorizationHeaderValue = $"Bearer {accessToken}"; + __httpClient.DefaultRequestHeaders.Remove(AuthorizationHeaderKey); + __httpClient.DefaultRequestHeaders.Add(AuthorizationHeaderKey, authorizationHeaderValue); - return new DisposableConfiguration(this); - } + __token = accessToken; + } - /// - public void ClearConfiguration() - { - __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); - } + /// + public IDisposable AttachConfiguration(object configuration) + { + var encodedJson = Convert.ToBase64String(JsonSerializer.SerializeToUtf8Bytes(configuration)); - internal T Invoke(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content) - { - // prepare request - using var request = BuildRequestMessage(method, relativeUrl, content, contentTypeValue, acceptHeaderValue); + __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); + __httpClient.DefaultRequestHeaders.Add(ConfigurationHeaderKey, encodedJson); - // send request - var response = __httpClient.Send(request, HttpCompletionOption.ResponseHeadersRead); + return new DisposableConfiguration(this); + } - // process response - if (!response.IsSuccessStatusCode) + /// + public void ClearConfiguration() { - 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}."); - - else - throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); + __httpClient.DefaultRequestHeaders.Remove(ConfigurationHeaderKey); } - try + internal T Invoke(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content) { - if (typeof(T) == typeof(object)) - { - return default!; - } + // prepare request + using var request = BuildRequestMessage(method, relativeUrl, content, contentTypeValue, acceptHeaderValue); + + // send request + var response = __httpClient.Send(request, HttpCompletionOption.ResponseHeadersRead); - else if (typeof(T) == typeof(HttpResponseMessage)) + // process response + if (!response.IsSuccessStatusCode) { - return (T)(object)(response); + 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}."); + + else + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); } - else + try { - var stream = response.Content.ReadAsStream(); + if (typeof(T) == typeof(object)) + { + return default!; + } - try + else if (typeof(T) == typeof(HttpResponseMessage)) { - return JsonSerializer.Deserialize(stream, Utilities.JsonOptions)!; + return (T)(object)(response); } - catch (Exception ex) + + else { - throw new NexusException("01", "Response data could not be deserialized.", 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); + } } } + 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); - // process response - if (!response.IsSuccessStatusCode) + internal async Task InvokeAsync(string method, string relativeUrl, string? acceptHeaderValue, string? contentTypeValue, HttpContent? content, CancellationToken cancellationToken) { - var message = await response.Content.ReadAsStringAsync().ConfigureAwait(false); - var statusCode = $"00.{(int)response.StatusCode}"; + // 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}."); - - else - throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); - } + // send request + var response = await __httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - try - { - if (typeof(T) == typeof(object)) + // process response + if (!response.IsSuccessStatusCode) { - return default!; - } + var message = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var statusCode = $"00.{(int)response.StatusCode}"; - else if (typeof(T) == typeof(HttpResponseMessage)) - { - return (T)(object)(response); + if (string.IsNullOrWhiteSpace(message)) + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}."); + + else + throw new NexusException(statusCode, $"The HTTP request failed with status code {response.StatusCode}. The response message is: {message}"); } - else + try { - var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + if (typeof(T) == typeof(object)) + { + return default!; + } - try + else if (typeof(T) == typeof(HttpResponseMessage)) { - return (await JsonSerializer.DeserializeAsync(stream, Utilities.JsonOptions).ConfigureAwait(false))!; + return (T)(object)(response); } - catch (Exception ex) + + else { - throw new NexusException("01", "Response data could not be deserialized.", 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); + } } } + 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) - { - var requestMessage = new HttpRequestMessage() + private HttpRequestMessage BuildRequestMessage(string method, string relativeUrl, HttpContent? content, string? contentTypeHeaderValue, string? acceptHeaderValue) { - 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); + var requestMessage = new HttpRequestMessage() + { + 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) + /// + /// 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) { - using var responseMessage = V1.Data.GetStream(resourcePath, begin, end); + 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) + /// + /// 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) { - 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; + 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)) + private async Task ReadAsDoubleAsync(HttpResponseMessage responseMessage, bool useAsync, CancellationToken cancellationToken = default) { - length = contentLength; - } + 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)) + private async Task ReadAsDoubleAsync(HttpResponseMessage responseMessage, CancellationToken cancellationToken = default) { - length = contentLength; - } + 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; + } - var exportParameters = new V1.ExportParameters( - begin, - end, - filePeriod, - fileFormat, - resourcePaths.ToList(), - actualConfiguration); + /// + /// 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)); - // Start Job - var job = V1.Jobs.Export(exportParameters); + var exportParameters = new V1.ExportParameters( + begin, + end, + filePeriod, + fileFormat, + resourcePaths.ToList(), + actualConfiguration); - // Wait for job to finish - string? artifactId = default; + // Start Job + var job = V1.Jobs.Export(exportParameters); - while (true) - { - Thread.Sleep(TimeSpan.FromSeconds(1)); + // Wait for job to finish + string? artifactId = default; - var jobStatus = V1.Jobs.GetJobStatus(job.Id); + while (true) + { + Thread.Sleep(TimeSpan.FromSeconds(1)); - if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Canceled) - throw new OperationCanceledException("The job has been cancelled."); + var jobStatus = V1.Jobs.GetJobStatus(job.Id); - else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Faulted) - throw new OperationCanceledException($"The job has failed. Reason: {jobStatus.ExceptionMessage}"); + if (jobStatus.Status == Nexus.Api.V1.TaskStatus.Canceled) + throw new OperationCanceledException("The job has been cancelled."); - else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.RanToCompletion) - { - if (jobStatus.Result.HasValue && - jobStatus.Result.Value.ValueKind == JsonValueKind.String) + 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) { - artifactId = jobStatus.Result.Value.GetString(); - break; + if (jobStatus.Result.HasValue && + jobStatus.Result.Value.ValueKind == JsonValueKind.String) + { + artifactId = jobStatus.Result.Value.GetString(); + break; + } } - } - if (jobStatus.Progress < 1) - onProgress?.Invoke(jobStatus.Progress, "export"); - } - - onProgress?.Invoke(1, "export"); - - if (artifactId is null) - throw new Exception("The job result is invalid."); + if (jobStatus.Progress < 1) + onProgress?.Invoke(jobStatus.Progress, "export"); + } - if (fileFormat is null) - return; + onProgress?.Invoke(1, "export"); - // Download zip file - var responseMessage = V1.Artifacts.Download(artifactId); - var sourceStream = responseMessage.Content.ReadAsStream(); + if (artifactId is null) + throw new Exception("The job result is invalid."); - long? length = default; + if (fileFormat is null) + return; - if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && - values.Any() && - int.TryParse(values.First(), out var contentLength)) - { - length = contentLength; - } + // Download zip file + var responseMessage = V1.Artifacts.Download(artifactId); + var sourceStream = responseMessage.Content.ReadAsStream(); - var tmpFilePath = Path.GetTempFileName(); + long? length = default; - try - { - using (var targetStream = File.OpenWrite(tmpFilePath)) + if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && + values.Any() && + int.TryParse(values.First(), out var contentLength)) { - var buffer = new byte[32768]; - var consumed = 0; - var sw = Stopwatch.StartNew(); - var maxTicks = TimeSpan.FromSeconds(1).Ticks; + length = contentLength; + } - int receivedBytes; + var tmpFilePath = Path.GetTempFileName(); - while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) + try + { + using (var targetStream = File.OpenWrite(tmpFilePath)) { - targetStream.Write(buffer, 0, receivedBytes); - consumed += receivedBytes; + var buffer = new byte[32768]; + var consumed = 0; + var sw = Stopwatch.StartNew(); + var maxTicks = TimeSpan.FromSeconds(1).Ticks; - if (sw.ElapsedTicks > maxTicks) + int receivedBytes; + + while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) { - sw.Reset(); + targetStream.Write(buffer, 0, receivedBytes); + consumed += receivedBytes; - if (length.HasValue) + if (sw.ElapsedTicks > maxTicks) { - if (consumed < length) - onProgress?.Invoke(consumed / (double)length, "download"); + sw.Reset(); + + if (length.HasValue) + { + 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"); - } - finally - { - try - { - File.Delete(tmpFilePath); + // Extract file (do not use stream overload: https://github.com/dotnet/runtime/issues/59027) + ZipFile.ExtractToDirectory(tmpFilePath, targetFolder, overwriteFiles: true); + onProgress?.Invoke(1, "extract"); } - catch + finally { - // + 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) - { - if (jobStatus.Result.HasValue && - jobStatus.Result.Value.ValueKind == JsonValueKind.String) + else if (jobStatus.Status == Nexus.Api.V1.TaskStatus.RanToCompletion) { - artifactId = jobStatus.Result.Value.GetString(); - break; + if (jobStatus.Result.HasValue && + jobStatus.Result.Value.ValueKind == JsonValueKind.String) + { + artifactId = jobStatus.Result.Value.GetString(); + break; + } } - } - - if (jobStatus.Progress < 1) - onProgress?.Invoke(jobStatus.Progress, "export"); - } - - onProgress?.Invoke(1, "export"); - if (artifactId is null) - throw new Exception("The job result is invalid."); + if (jobStatus.Progress < 1) + onProgress?.Invoke(jobStatus.Progress, "export"); + } - if (fileFormat is null) - return; + onProgress?.Invoke(1, "export"); - // Download zip file - var responseMessage = await V1.Artifacts.DownloadAsync(artifactId, cancellationToken).ConfigureAwait(false); - var sourceStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); + if (artifactId is null) + throw new Exception("The job result is invalid."); - long? length = default; + if (fileFormat is null) + return; - if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && - values.Any() && - int.TryParse(values.First(), out var contentLength)) - { - length = contentLength; - } + // Download zip file + var responseMessage = await V1.Artifacts.DownloadAsync(artifactId, cancellationToken).ConfigureAwait(false); + var sourceStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); - var tmpFilePath = Path.GetTempFileName(); + long? length = default; - try - { - using (var targetStream = File.OpenWrite(tmpFilePath)) + if (responseMessage.Content.Headers.TryGetValues("Content-Length", out var values) && + values.Any() && + int.TryParse(values.First(), out var contentLength)) { - var buffer = new byte[32768]; - var consumed = 0; - var sw = Stopwatch.StartNew(); - var maxTicks = TimeSpan.FromSeconds(1).Ticks; + length = contentLength; + } - int receivedBytes; + var tmpFilePath = Path.GetTempFileName(); - while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) + try + { + using (var targetStream = File.OpenWrite(tmpFilePath)) { - targetStream.Write(buffer, 0, receivedBytes); - consumed += receivedBytes; + var buffer = new byte[32768]; + var consumed = 0; + var sw = Stopwatch.StartNew(); + var maxTicks = TimeSpan.FromSeconds(1).Ticks; + + int receivedBytes; - if (sw.ElapsedTicks > maxTicks) + while ((receivedBytes = sourceStream.Read(buffer, 0, buffer.Length)) > 0) { - sw.Reset(); + targetStream.Write(buffer, 0, receivedBytes); + consumed += receivedBytes; - if (length.HasValue) + if (sw.ElapsedTicks > maxTicks) { - if (consumed < length) - onProgress?.Invoke(consumed / (double)length, "download"); + sw.Reset(); + + if (length.HasValue) + { + 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"); - } - finally - { - try - { - File.Delete(tmpFilePath); + // Extract file (do not use stream overload: https://github.com/dotnet/runtime/issues/59027) + ZipFile.ExtractToDirectory(tmpFilePath, targetFolder, overwriteFiles: true); + onProgress?.Invoke(1, "extract"); } - catch + finally { - // + try + { + File.Delete(tmpFilePath); + } + catch + { + // + } } } } -} -internal class CastMemoryManager : MemoryManager - where TFrom : struct - where TTo : struct -{ - private readonly Memory _from; - - public CastMemoryManager(Memory from) => _from = from; - - public override Span GetSpan() => MemoryMarshal.Cast(_from.Span); - - protected override void Dispose(bool disposing) + internal class CastMemoryManager : MemoryManager + where TFrom : struct + where TTo : struct { - // - } + private readonly Memory _from; - public override MemoryHandle Pin(int elementIndex = 0) => throw new NotSupportedException(); + public CastMemoryManager(Memory from) => _from = from; - public override void Unpin() => throw new NotSupportedException(); -} + public override Span GetSpan() => MemoryMarshal.Cast(_from.Span); -/// -/// A NexusException. -/// -public class NexusException : Exception -{ - internal NexusException(string statusCode, string message) : base(message) - { - StatusCode = statusCode; - } + protected override void Dispose(bool disposing) + { + // + } - internal NexusException(string statusCode, string message, Exception innerException) : base(message, innerException) - { - StatusCode = statusCode; + public override MemoryHandle Pin(int elementIndex = 0) => throw new NotSupportedException(); + + public override void Unpin() => throw new NotSupportedException(); } /// - /// The exception status code. + /// A NexusException. /// - public string StatusCode { get; } -} + public class NexusException : Exception + { + internal NexusException(string statusCode, string message) : base(message) + { + StatusCode = statusCode; + } -internal class DisposableConfiguration : IDisposable -{ - private NexusClient ___client; + internal NexusException(string statusCode, string message, Exception innerException) : base(message, innerException) + { + StatusCode = statusCode; + } - public DisposableConfiguration(NexusClient client) - { - ___client = client; + /// + /// The exception status code. + /// + public string StatusCode { get; } } - public void Dispose() + internal class DisposableConfiguration : IDisposable { - ___client.ClearConfiguration(); - } -} + private NexusClient ___client; -internal static class Utilities -{ - internal static JsonSerializerOptions JsonOptions { get; } + public DisposableConfiguration(NexusClient client) + { + ___client = client; + } + + public void Dispose() + { + ___client.ClearConfiguration(); + } + } - static Utilities() + internal static class Utilities { - JsonOptions = new JsonSerializerOptions() + internal static JsonSerializerOptions JsonOptions { get; } + + static Utilities() { - PropertyNameCaseInsensitive = true, - WriteIndented = true - }; + JsonOptions = new JsonSerializerOptions() + { + 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 -{ /// - /// Gets the . + /// A client for version V1. /// - IArtifactsClient Artifacts { get; } + public interface IV1 + { + /// + /// Gets the . + /// + 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 -{ - /// - /// Initializes a new instance of the . - /// - /// The client to use. - public V1(NexusClient client) + /// + public class V1 : IV1 { - 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); - - } + /// + /// 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); - /// - public IArtifactsClient Artifacts { get; } + } - /// - public ICatalogsClient Catalogs { get; } + /// + public IArtifactsClient Artifacts { get; } - /// - public IDataClient Data { get; } + /// + public ICatalogsClient Catalogs { get; } - /// - public IJobsClient Jobs { get; } + /// + public IDataClient Data { get; } - /// - public IPackageReferencesClient PackageReferences { get; } + /// + public IJobsClient Jobs { get; } - /// - public ISourcesClient Sources { get; } + /// + public IPackageReferencesClient PackageReferences { get; } - /// - public ISystemClient System { get; } + /// + public ISourcesClient Sources { get; } - /// - public IUsersClient Users { get; } + /// + public ISystemClient System { get; } - /// - public IWritersClient Writers { get; } + /// + public IUsersClient Users { 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); + } /// - /// Gets the specified artifact. + /// Provides methods to interact with artifacts. /// - /// 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) + public interface IArtifactsClient { - ___client = client; - } + /// + /// Gets the specified artifact. + /// + /// The artifact identifier. + HttpResponseMessage Download(string artifactId); - /// - public HttpResponseMessage Download(string artifactId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); - __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); + /// + /// Gets the specified artifact. + /// + /// The artifact identifier. + /// The token to cancel the current operation. + Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/octet-stream", default, default); } /// - public Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default) + public class ArtifactsClient : IArtifactsClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); - __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); - - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); - } - -} - -/// -/// 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); + private NexusClient ___client; - /// - /// 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); + internal ArtifactsClient(NexusClient client) + { + ___client = client; + } - /// - /// Gets the specified attachment. - /// - /// The catalog identifier. - /// The attachment identifier. - HttpResponseMessage GetAttachmentStream(string catalogId, string attachmentId); + /// + public HttpResponseMessage Download(string artifactId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); + __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); - /// - /// 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.Invoke("GET", __url, "application/octet-stream", default, default); + } - /// - /// Gets the catalog metadata. - /// - /// The catalog identifier. - CatalogMetadata GetMetadata(string catalogId); + /// + public Task DownloadAsync(string artifactId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/artifacts/{artifactId}"); + __urlBuilder.Replace("{artifactId}", Uri.EscapeDataString(artifactId)); - /// - /// Gets the catalog metadata. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task GetMetadataAsync(string catalogId, CancellationToken cancellationToken = default); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); + } - /// - /// Puts the catalog metadata. - /// - /// The catalog identifier. - /// The catalog metadata to set. - void 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); - -} + /// 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; + } -/// -public class CatalogsClient : ICatalogsClient -{ - private NexusClient ___client; - - internal CatalogsClient(NexusClient client) - { - ___client = client; - } + /// + public IReadOnlyDictionary SearchCatalogItems(IReadOnlyList resourcePaths) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/search-items"); - /// - public IReadOnlyDictionary SearchCatalogItems(IReadOnlyList resourcePaths) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/search-items"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions)); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions)); - } + /// + public Task> SearchCatalogItemsAsync(IReadOnlyList resourcePaths, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/search-items"); - /// - public Task> SearchCatalogItemsAsync(IReadOnlyList resourcePaths, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/search-items"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions), cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("POST", __url, "application/json", "application/json", JsonContent.Create(resourcePaths, options: Utilities.JsonOptions), cancellationToken); - } + /// + public ResourceCatalog Get(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(catalogId)); - /// - public ResourceCatalog Get(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); - __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 GetAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}"); + __urlBuilder.Replace("{catalogId}", Uri.EscapeDataString(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)); + 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 IReadOnlyList GetChildCatalogInfos(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/child-catalog-infos"); - __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> 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)); + 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 CatalogTimeRange GetTimeRange(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/timerange"); - __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 GetTimeRangeAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/catalogs/{catalogId}/timerange"); - __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 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)); + var __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, CultureInfo.InvariantCulture)!); - __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, 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.Invoke("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + /// + 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 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 __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, CultureInfo.InvariantCulture)!); - __queryValues["step"] = Uri.EscapeDataString(Convert.ToString(step, 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.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + public string? GetLicense(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/license"); + __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 GetLicenseAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/license"); + __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 IReadOnlyList GetAttachments(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments"); + __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> GetAttachmentsAsync(string catalogId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/catalogs/{catalogId}/attachments"); + __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 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)); - /// - 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)); + } - 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)); - /// - 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); + } - 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)); - /// - 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); + } - 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)); - /// - 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); + } - 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)); - /// - 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); + } - 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)); - /// - 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); + } - 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)); - /// - 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); + } - 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)); - /// - 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); + } - 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)); - /// - public void 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)); + } - var __url = __urlBuilder.ToString(); - ___client.Invoke("PUT", __url, default, "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)); - /// - 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); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("PUT", __url, default, "application/json", JsonContent.Create(metadata, options: Utilities.JsonOptions), cancellationToken); } -} - -/// -/// Provides methods to interact with data. -/// -public interface IDataClient -{ /// - /// Gets the requested data. + /// Provides methods to interact with data. /// - /// The path to the resource data to stream. - /// Start date/time. - /// End date/time. - HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end); - - /// - /// 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); - -} - -/// -public class DataClient : IDataClient -{ - private NexusClient ___client; - - internal DataClient(NexusClient client) + public interface IDataClient { - ___client = 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); - /// - public HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/data"); - - var __queryValues = new Dictionary(); - - __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); - - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + /// + /// 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["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 Task GetStreamAsync(string resourcePath, DateTime begin, DateTime end, CancellationToken cancellationToken = default) + public class DataClient : IDataClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/data"); - - var __queryValues = new Dictionary(); - - __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); + private NexusClient ___client; - __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.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); - } - -} + internal DataClient(NexusClient client) + { + ___client = client; + } -/// -/// Provides methods to interact with jobs. -/// -public interface IJobsClient -{ - /// - /// Gets a list of jobs. - /// - IReadOnlyList GetJobs(); + /// + public HttpResponseMessage GetStream(string resourcePath, DateTime begin, DateTime end) + { + 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); + var __queryValues = new Dictionary(); - /// - /// Cancels the specified job. - /// - /// - HttpResponseMessage CancelJob(Guid jobId); + __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); - /// - /// Cancels the specified job. - /// - /// - /// The token to cancel the current operation. - Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken = default); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - /// - /// Gets the status of the specified job. - /// - /// - JobStatus GetJobStatus(Guid jobId); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - /// - /// Gets the status of the specified job. - /// - /// - /// The token to cancel the current operation. - Task GetJobStatusAsync(Guid jobId, CancellationToken cancellationToken = default); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - /// Creates a new export job. - /// - /// Export parameters. - Job Export(ExportParameters parameters); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/octet-stream", default, default); + } - /// - /// Creates a new export job. - /// - /// Export parameters. - /// The token to cancel the current operation. - Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default); + /// + public Task GetStreamAsync(string resourcePath, DateTime begin, DateTime end, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/data"); - /// - /// Creates a new job which reloads all extensions and resets the resource catalog. - /// - Job RefreshDatabase(); + var __queryValues = new Dictionary(); - /// - /// 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); + __queryValues["resourcePath"] = Uri.EscapeDataString(resourcePath); - /// - /// 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); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - /// - /// 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); + __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.InvokeAsync("GET", __url, "application/octet-stream", default, default, cancellationToken); + } -/// -public class JobsClient : IJobsClient -{ - private NexusClient ___client; - - internal JobsClient(NexusClient client) - { - ___client = client; } - /// - public IReadOnlyList GetJobs() + /// + /// Provides methods to interact with jobs. + /// + public interface IJobsClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs"); + /// + /// Gets a list of jobs. + /// + IReadOnlyList GetJobs(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + /// Gets a list of jobs. + /// + /// The token to cancel the current operation. + Task> GetJobsAsync(CancellationToken cancellationToken = default); - /// - public Task> GetJobsAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs"); + /// + /// Cancels the specified job. + /// + /// + HttpResponseMessage CancelJob(Guid jobId); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Cancels the specified job. + /// + /// + /// The token to cancel the current operation. + Task CancelJobAsync(Guid jobId, 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)!)); + /// + /// Gets the status of the specified job. + /// + /// + JobStatus GetJobStatus(Guid jobId); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", 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 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)!)); + /// + /// Creates a new export job. + /// + /// Export parameters. + Job Export(ExportParameters parameters); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", 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 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)!)); + /// + /// Creates a new job which reloads all extensions and resets the resource catalog. + /// + Job RefreshDatabase(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", 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 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)!)); + /// + /// 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); + + /// + /// 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); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); } /// - public Job Export(ExportParameters parameters) + public class JobsClient : IJobsClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/export"); + private NexusClient ___client; - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions)); - } + internal JobsClient(NexusClient client) + { + ___client = client; + } - /// - public Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/export"); + /// + public IReadOnlyList GetJobs() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs"); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions), cancellationToken); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - /// - public Job RefreshDatabase() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/refresh-database"); + /// + public Task> GetJobsAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - public Task RefreshDatabaseAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/refresh-database"); + /// + 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)!)); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - /// - public Job ClearCache(string catalogId, DateTime begin, DateTime end) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/clear-cache"); + /// + 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)!)); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + /// + 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)!)); - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + /// + 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)!)); - 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("POST", __url, "application/json", default, default); - } + /// + public Job Export(ExportParameters parameters) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/export"); - /// - public Task ClearCacheAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/jobs/clear-cache"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions)); + } - var __queryValues = new Dictionary(); + /// + public Task ExportAsync(ExportParameters parameters, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/export"); - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(parameters, options: Utilities.JsonOptions), cancellationToken); + } - __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); + /// + public Job RefreshDatabase() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/refresh-database"); - __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", default, default); + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + public Task RefreshDatabaseAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/refresh-database"); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); + } -} + /// + public Job ClearCache(string catalogId, DateTime begin, DateTime end) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/clear-cache"); -/// -/// Provides methods to interact with package references. -/// -public interface IPackageReferencesClient -{ - /// - /// Gets the list of package references. - /// - IReadOnlyDictionary Get(); + var __queryValues = new Dictionary(); - /// - /// Gets the list of package references. - /// - /// The token to cancel the current operation. - Task> GetAsync(CancellationToken cancellationToken = default); + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); - /// - /// Creates a package reference. - /// - /// The package reference to create. - Guid Create(PackageReference packageReference); + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - /// - /// Creates a package reference. - /// - /// The package reference to create. - /// The token to cancel the current operation. - Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", CultureInfo.InvariantCulture)); - /// - /// Deletes a package reference. - /// - /// The ID of the package reference. - void Delete(Guid id); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - /// Deletes a package reference. - /// - /// The ID of the package reference. - /// The token to cancel the current operation. - Task DeleteAsync(Guid id, CancellationToken cancellationToken = default); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", default, default); + } - /// - /// Gets package versions. - /// - /// The ID of the package reference. - IReadOnlyList GetVersions(Guid id); + /// + public Task ClearCacheAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/jobs/clear-cache"); - /// - /// Gets package versions. - /// - /// The ID of the package reference. - /// The token to cancel the current operation. - Task> GetVersionsAsync(Guid id, CancellationToken cancellationToken = default); + var __queryValues = new Dictionary(); -} + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); -/// -public class PackageReferencesClient : IPackageReferencesClient -{ - private NexusClient ___client; - - internal PackageReferencesClient(NexusClient client) - { - ___client = client; - } + __queryValues["begin"] = Uri.EscapeDataString(begin.ToString("o", CultureInfo.InvariantCulture)); - /// - public IReadOnlyDictionary Get() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); + __queryValues["end"] = Uri.EscapeDataString(end.ToString("o", 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> GetAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); } - /// - public Guid Create(PackageReference packageReference) + /// + /// Provides methods to interact with package references. + /// + public interface IPackageReferencesClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences"); + /// + /// Gets the list of package references. + /// + IReadOnlyDictionary Get(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(packageReference, options: Utilities.JsonOptions)); - } + /// + /// Gets the list of package references. + /// + /// The token to cancel the current operation. + Task> GetAsync(CancellationToken cancellationToken = default); - /// - public Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default) - { - 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.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(packageReference, options: Utilities.JsonOptions), cancellationToken); - } + /// + /// Creates a package reference. + /// + /// The package reference to create. + /// The token to cancel the current operation. + Task CreateAsync(PackageReference packageReference, 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)!)); + /// + /// Deletes a package reference. + /// + /// The ID of the package reference. + void Delete(Guid id); - var __url = __urlBuilder.ToString(); - ___client.Invoke("DELETE", __url, default, default, default); - } + /// + /// 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 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)!)); + /// + /// Gets package versions. + /// + /// The ID of the package reference. + IReadOnlyList GetVersions(Guid id); + + /// + /// Gets package versions. + /// + /// The ID of the package reference. + /// The token to cancel the current operation. + Task> GetVersionsAsync(Guid id, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, default, default, default, cancellationToken); } /// - public IReadOnlyList GetVersions(Guid id) + public class PackageReferencesClient : IPackageReferencesClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/packagereferences/{id}/versions"); - __urlBuilder.Replace("{id}", Uri.EscapeDataString(Convert.ToString(id, CultureInfo.InvariantCulture)!)); + private NexusClient ___client; - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + internal PackageReferencesClient(NexusClient client) + { + ___client = client; + } - /// - 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)!)); + /// + public IReadOnlyDictionary Get() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); - 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 Task> GetAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); -/// -/// Provides methods to interact with sources. -/// -public interface ISourcesClient -{ - /// - /// Gets the list of source descriptions. - /// - IReadOnlyList GetDescriptions(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// Gets the list of source descriptions. - /// - /// The token to cancel the current operation. - Task> GetDescriptionsAsync(CancellationToken cancellationToken = default); + /// + public Guid Create(PackageReference packageReference) + { + 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. - IReadOnlyDictionary GetPipelines(string? userId = 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. - /// The token to cancel the current operation. - Task> GetPipelinesAsync(string? userId = default, CancellationToken cancellationToken = default); + /// + public Task CreateAsync(PackageReference packageReference, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/packagereferences"); - /// - /// 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); + 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. - /// The token to cancel the current operation. - Task CreatePipelineAsync(DataSourcePipeline pipeline, string? userId = default, 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)!)); - /// - /// 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); + 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. - /// - /// The token to cancel the current operation. - Task DeletePipelineAsync(string registrationId, Guid? pipelineId = default, string? userId = default, 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 SourcesClient : ISourcesClient -{ - private NexusClient ___client; - - internal SourcesClient(NexusClient client) - { - ___client = client; - } + /// + 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 IReadOnlyList GetDescriptions() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/descriptions"); + 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> 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)!)); - /// - 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); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); } - /// - public IReadOnlyDictionary GetPipelines(string? userId = default) + /// + /// Provides methods to interact with sources. + /// + public interface ISourcesClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines"); - - var __queryValues = new Dictionary(); + /// + /// Gets the list of source descriptions. + /// + IReadOnlyList GetDescriptions(); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + /// + /// Gets the list of source descriptions. + /// + /// The token to cancel the current operation. + Task> GetDescriptionsAsync(CancellationToken cancellationToken = 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. + IReadOnlyDictionary GetPipelines(string? userId = default); - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + /// 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); - /// - 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. + Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = default); - var __queryValues = new Dictionary(); + /// + /// 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); - 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. + /// + HttpResponseMessage DeletePipeline(string registrationId, Guid? pipelineId = default, string? userId = default); - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + /// 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>("GET", __url, "application/json", default, default, cancellationToken); } /// - public Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = default) + public class SourcesClient : ISourcesClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/sources/pipelines"); + private NexusClient ___client; - var __queryValues = new Dictionary(); + internal SourcesClient(NexusClient client) + { + ___client = client; + } - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + /// + public IReadOnlyList GetDescriptions() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/descriptions"); - 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.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions)); - } + /// + public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/descriptions"); - /// - 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>("GET", __url, "application/json", default, default, cancellationToken); + } - var __queryValues = new Dictionary(); + /// + public IReadOnlyDictionary GetPipelines(string? userId = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + var __queryValues = new Dictionary(); - 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.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions), cancellationToken); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - 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)); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __queryValues = new Dictionary(); + /// + public Task> GetPipelinesAsync(string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); - if (pipelineId is not null) - __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); + 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.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - 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 Guid CreatePipeline(DataSourcePipeline pipeline, string? userId = 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.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(pipeline, options: Utilities.JsonOptions)); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public Task CreatePipelineAsync(DataSourcePipeline pipeline, string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/sources/pipelines"); -} + var __queryValues = new Dictionary(); -/// -/// Provides methods to interact with system. -/// -public interface ISystemClient -{ - /// - /// Gets the default file type. - /// - string GetDefaultFileType(); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - /// - /// Gets the default file type. - /// - /// The token to cancel the current operation. - Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - /// Gets the configured help link. - /// - string GetHelpLink(); + 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. - /// - /// The token to cancel the current operation. - Task GetHelpLinkAsync(CancellationToken cancellationToken = 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)); - /// - /// Gets the system configuration. - /// - IReadOnlyDictionary? GetConfiguration(); + var __queryValues = new Dictionary(); - /// - /// Gets the system configuration. - /// - /// The token to cancel the current operation. - Task?> GetConfigurationAsync(CancellationToken cancellationToken = default); + if (pipelineId is not null) + __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); - /// - /// Sets the system configuration. - /// - /// - void SetConfiguration(IReadOnlyDictionary? configuration); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - /// - /// Sets the system configuration. - /// - /// - /// The token to cancel the current operation. - Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default); + 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); + } -/// -public class SystemClient : ISystemClient -{ - private NexusClient ___client; - - internal SystemClient(NexusClient client) - { - ___client = client; - } + /// + 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 string GetDefaultFileType() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/file-type"); + var __queryValues = new Dictionary(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/json", default, default); - } + if (pipelineId is not null) + __queryValues["pipelineId"] = Uri.EscapeDataString(Convert.ToString(pipelineId, CultureInfo.InvariantCulture)!); - /// - public Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/file-type"); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public string GetHelpLink() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/help-link"); + 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 Task GetHelpLinkAsync(CancellationToken cancellationToken = default) + /// + /// Provides methods to interact with system. + /// + public interface ISystemClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/help-link"); + /// + /// Gets the default file type. + /// + string GetDefaultFileType(); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Gets the default file type. + /// + /// The token to cancel the current operation. + Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default); - /// - public IReadOnlyDictionary? GetConfiguration() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Gets the configured help link. + /// + string GetHelpLink(); - var __url = __urlBuilder.ToString(); - return ___client.Invoke?>("GET", __url, "application/json", default, default); - } + /// + /// Gets the configured help link. + /// + /// The token to cancel the current operation. + Task GetHelpLinkAsync(CancellationToken cancellationToken = default); - /// - public Task?> GetConfigurationAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Gets the system configuration. + /// + IReadOnlyDictionary? GetConfiguration(); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync?>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// Gets the system configuration. + /// + /// The token to cancel the current operation. + Task?> GetConfigurationAsync(CancellationToken cancellationToken = default); - /// - public void SetConfiguration(IReadOnlyDictionary? configuration) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); + /// + /// Sets the system configuration. + /// + /// + void SetConfiguration(IReadOnlyDictionary? configuration); + + /// + /// Sets the system configuration. + /// + /// + /// The token to cancel the current operation. + Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default); - var __url = __urlBuilder.ToString(); - ___client.Invoke("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions)); } /// - public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) + public class SystemClient : ISystemClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/system/configuration"); - - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions), cancellationToken); - } - -} + private NexusClient ___client; -/// -/// 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); + internal SystemClient(NexusClient client) + { + ___client = client; + } - /// - /// 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); + /// + public string GetDefaultFileType() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/file-type"); - /// - /// Logs out the user. - /// - /// The URL to return after logout. - void SignOut(string returnUrl); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - /// - /// Logs out the user. - /// - /// The URL to return after logout. - /// The token to cancel the current operation. - Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default); + /// + public Task GetDefaultFileTypeAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/file-type"); - /// - /// Deletes a personal access token. - /// - /// The personal access token to delete. - HttpResponseMessage DeleteTokenByValue(string value); + 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. - /// The token to cancel the current operation. - Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default); + /// + public string GetHelpLink() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/help-link"); - /// - /// Gets the current user. - /// - MeResponse GetMe(); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - /// - /// Gets the current user. - /// - /// The token to cancel the current operation. - Task GetMeAsync(CancellationToken cancellationToken = default); + /// + public Task GetHelpLinkAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/help-link"); - /// - /// 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); + 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. - /// The token to cancel the current operation. - Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default); + /// + public IReadOnlyDictionary? GetConfiguration() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - /// - /// Deletes a personal access token. - /// - /// The identifier of the personal access token. - HttpResponseMessage DeleteToken(Guid tokenId); + 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. - /// The token to cancel the current operation. - Task DeleteTokenAsync(Guid tokenId, CancellationToken cancellationToken = default); + /// + public Task?> GetConfigurationAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - /// - /// Accepts the license of the specified catalog. - /// - /// The catalog identifier. - HttpResponseMessage AcceptLicense(string catalogId); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync?>("GET", __url, "application/json", default, default, cancellationToken); + } - /// - /// Accepts the license of the specified catalog. - /// - /// The catalog identifier. - /// The token to cancel the current operation. - Task AcceptLicenseAsync(string catalogId, CancellationToken cancellationToken = default); + /// + public void SetConfiguration(IReadOnlyDictionary? configuration) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - /// - /// Gets a list of users. - /// - IReadOnlyDictionary GetUsers(); + var __url = __urlBuilder.ToString(); + ___client.Invoke("PUT", __url, default, "application/json", JsonContent.Create(configuration, options: Utilities.JsonOptions)); + } - /// - /// Gets a list of users. - /// - /// The token to cancel the current operation. - Task> GetUsersAsync(CancellationToken cancellationToken = default); + /// + public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/system/configuration"); - /// - /// Creates a user. - /// - /// The user to create. - string CreateUser(NexusUser user); + 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. - /// 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); + /// 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. - /// The token to cancel the current operation. - Task DeleteUserAsync(string userId, CancellationToken cancellationToken = default); + /// + public HttpResponseMessage Authenticate(string scheme, string returnUrl) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/authenticate"); - /// - /// Gets all claims. - /// - /// The identifier of the user. - IReadOnlyDictionary GetClaims(string userId); + var __queryValues = new Dictionary(); - /// - /// Gets all claims. - /// - /// The identifier of the user. - /// The token to cancel the current operation. - Task> GetClaimsAsync(string userId, CancellationToken cancellationToken = default); + __queryValues["scheme"] = Uri.EscapeDataString(scheme); - /// - /// Creates a claim. - /// - /// The identifier of the user. - /// The claim to create. - Guid CreateClaim(string userId, NexusClaim claim); + __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); - /// - /// 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 __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - /// Deletes a claim. - /// - /// The identifier of the claim. - HttpResponseMessage DeleteClaim(Guid claimId); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/octet-stream", default, default); + } - /// - /// Deletes a claim. - /// - /// The identifier of the claim. - /// The token to cancel the current operation. - Task DeleteClaimAsync(Guid claimId, CancellationToken cancellationToken = default); + /// + public Task AuthenticateAsync(string scheme, string returnUrl, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/authenticate"); - /// - /// Gets all personal access tokens. - /// - /// The identifier of the user. - IReadOnlyDictionary GetTokens(string userId); + var __queryValues = new Dictionary(); - /// - /// 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["scheme"] = Uri.EscapeDataString(scheme); -} + __queryValues["returnUrl"] = Uri.EscapeDataString(returnUrl); -/// -public class UsersClient : IUsersClient -{ - private NexusClient ___client; - - internal UsersClient(NexusClient client) - { - ___client = client; - } + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - /// - public HttpResponseMessage Authenticate(string scheme, string returnUrl) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/authenticate"); + 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["scheme"] = Uri.EscapeDataString(scheme); + var __queryValues = new Dictionary(); - __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(); - return ___client.Invoke("POST", __url, "application/octet-stream", default, default); - } + var __url = __urlBuilder.ToString(); + ___client.Invoke("POST", __url, default, default, default); + } - /// - public Task AuthenticateAsync(string scheme, string returnUrl, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/authenticate"); + /// + public Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default) + { + 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(); + return ___client.InvokeAsync("POST", __url, default, default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + public HttpResponseMessage DeleteTokenByValue(string value) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/delete"); - /// - public void SignOut(string returnUrl) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/signout"); + var __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + __queryValues["value"] = Uri.EscapeDataString(value); - __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(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - var __url = __urlBuilder.ToString(); - ___client.Invoke("POST", __url, default, default, default); - } + /// + public Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/delete"); - /// - public Task SignOutAsync(string returnUrl, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/signout"); + var __queryValues = new Dictionary(); - var __queryValues = new Dictionary(); + __queryValues["value"] = Uri.EscapeDataString(value); - __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(); + return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, default, default, default, cancellationToken); - } + /// + public MeResponse GetMe() + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/me"); - /// - public HttpResponseMessage DeleteTokenByValue(string value) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/delete"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("GET", __url, "application/json", default, default); + } - var __queryValues = new Dictionary(); + /// + public Task GetMeAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/me"); - __queryValues["value"] = Uri.EscapeDataString(value); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + public string CreateToken(PersonalAccessToken token, string? userId = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/create"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + var __queryValues = new Dictionary(); - /// - public Task DeleteTokenByValueAsync(string value, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/delete"); + if (userId is not null) + __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); - var __queryValues = new Dictionary(); + var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); + __urlBuilder.Append(__query); - __queryValues["value"] = Uri.EscapeDataString(value); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions)); + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + public Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/tokens/create"); - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + var __queryValues = new Dictionary(); - /// - public MeResponse GetMe() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/me"); + 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 GetMeAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/me"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions), cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("GET", __url, "application/json", default, default, cancellationToken); - } + /// + 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)!)); - /// - public string CreateToken(PersonalAccessToken token, string? userId = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/create"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - var __queryValues = new Dictionary(); + /// + 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)!)); - if (userId is not null) - __queryValues["userId"] = Uri.EscapeDataString(Convert.ToString(userId, CultureInfo.InvariantCulture)!); + 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 HttpResponseMessage AcceptLicense(string catalogId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/accept-license"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(token, options: Utilities.JsonOptions)); - } + var __queryValues = new Dictionary(); - /// - public Task CreateTokenAsync(PersonalAccessToken token, string? userId = default, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/tokens/create"); + __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); - var __queryValues = new Dictionary(); + 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("GET", __url, "application/octet-stream", default, default); + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + 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(token, options: Utilities.JsonOptions), cancellationToken); - } + var __queryValues = new Dictionary(); - /// - 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)!)); + __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 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 __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 HttpResponseMessage AcceptLicense(string catalogId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/accept-license"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke>("GET", __url, "application/json", default, default); + } - var __queryValues = new Dictionary(); + /// + public Task> GetUsersAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - var __query = "?" + string.Join('&', __queryValues.Select(entry => $"{entry.Key}={entry.Value}")); - __urlBuilder.Append(__query); + /// + public string CreateUser(NexusUser user) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - var __url = __urlBuilder.ToString(); - return ___client.Invoke("GET", __url, "application/octet-stream", default, default); - } + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions)); + } - /// - public Task AcceptLicenseAsync(string catalogId, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/accept-license"); + /// + public Task CreateUserAsync(NexusUser user, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users"); - var __queryValues = new Dictionary(); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions), cancellationToken); + } - __queryValues["catalogId"] = Uri.EscapeDataString(catalogId); + /// + public HttpResponseMessage DeleteUser(string userId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - 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 DeleteUserAsync(string userId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - 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 IReadOnlyDictionary GetClaims(string userId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public Task> GetUsersAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + 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> GetClaimsAsync(string userId, CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public string CreateUser(NexusUser user) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + var __url = __urlBuilder.ToString(); + return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions)); - } + /// + public Guid CreateClaim(string userId, NexusClaim claim) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/claims"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - public Task CreateUserAsync(NexusUser user, CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users"); + var __url = __urlBuilder.ToString(); + return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions)); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(user, options: Utilities.JsonOptions), cancellationToken); - } + /// + 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)); - /// - public HttpResponseMessage DeleteUser(string userId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}"); - __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); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + /// + 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)!)); - /// - 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.Invoke("DELETE", __url, "application/octet-stream", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); - } + /// + 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 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.InvokeAsync("DELETE", __url, "application/octet-stream", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + public IReadOnlyDictionary GetTokens(string userId) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/users/{userId}/tokens"); + __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); - /// - 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.Invoke>("GET", __url, "application/json", default, default); + } - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + 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)); - /// - 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.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); + } - var __url = __urlBuilder.ToString(); - return ___client.Invoke("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions)); } - /// - public Task CreateClaimAsync(string userId, NexusClaim claim, CancellationToken cancellationToken = default) + /// + /// Provides methods to interact with writers. + /// + public interface IWritersClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/claims"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + /// + /// 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 __url = __urlBuilder.ToString(); - return ___client.InvokeAsync("POST", __url, "application/json", "application/json", JsonContent.Create(claim, options: Utilities.JsonOptions), cancellationToken); } /// - public HttpResponseMessage DeleteClaim(Guid claimId) + public class WritersClient : IWritersClient { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/claims/{claimId}"); - __urlBuilder.Replace("{claimId}", Uri.EscapeDataString(Convert.ToString(claimId, CultureInfo.InvariantCulture)!)); + private NexusClient ___client; - var __url = __urlBuilder.ToString(); - return ___client.Invoke("DELETE", __url, "application/octet-stream", default, default); - } + internal WritersClient(NexusClient client) + { + ___client = client; + } - /// - 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 IReadOnlyList GetDescriptions() + { + 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.Invoke>("GET", __url, "application/json", default, default); + } - /// - public IReadOnlyDictionary GetTokens(string userId) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/users/{userId}/tokens"); - __urlBuilder.Replace("{userId}", Uri.EscapeDataString(userId)); + /// + public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) + { + var __urlBuilder = new StringBuilder(); + __urlBuilder.Append("/api/v1/writers/descriptions"); + + 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 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 -{ /// - /// Gets the list of writer descriptions. + /// A catalog is a top level element and holds a list of resources. /// - IReadOnlyList GetDescriptions(); + /// Gets the identifier. + /// Gets the properties. + /// Gets the list of representations. + public record ResourceCatalog(string Id, IReadOnlyDictionary? Properties, IReadOnlyList? Resources); /// - /// Gets the list of writer descriptions. + /// A resource is part of a resource catalog and holds a list of representations. /// - /// The token to cancel the current operation. - Task> GetDescriptionsAsync(CancellationToken cancellationToken = default); + /// 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); -/// -public class WritersClient : IWritersClient -{ - private NexusClient ___client; - - internal WritersClient(NexusClient client) + /// + /// Specifies the Nexus data type. + /// + public enum NexusDataType { - ___client = client; - } + /// + /// UINT8 + /// + UINT8, - /// - public IReadOnlyList GetDescriptions() - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/writers/descriptions"); + /// + /// UINT16 + /// + UINT16, - var __url = __urlBuilder.ToString(); - return ___client.Invoke>("GET", __url, "application/json", default, default); - } + /// + /// UINT32 + /// + UINT32, - /// - public Task> GetDescriptionsAsync(CancellationToken cancellationToken = default) - { - var __urlBuilder = new StringBuilder(); - __urlBuilder.Append("/api/v1/writers/descriptions"); + /// + /// UINT64 + /// + UINT64, - var __url = __urlBuilder.ToString(); - return ___client.InvokeAsync>("GET", __url, "application/json", default, default, cancellationToken); - } + /// + /// INT8 + /// + INT8, -} + /// + /// INT16 + /// + INT16, + /// + /// INT32 + /// + INT32, + + /// + /// INT64 + /// + INT64, + + /// + /// 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 -{ /// - /// UINT8 + /// 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); /// - /// UINT16 + /// 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); /// - /// UINT32 + /// 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); /// - /// UINT64 + /// The catalog availability. /// - UINT64, + /// The actual availability data. + public record CatalogAvailability(IReadOnlyList Data); /// - /// INT8 + /// 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); /// - /// INT16 + /// 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); /// - /// INT32 + /// 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); /// - /// INT64 + /// /// - INT64, + public enum TaskStatus + { + /// + /// Created + /// + Created, + + /// + /// WaitingForActivation + /// + WaitingForActivation, + + /// + /// WaitingToRun + /// + WaitingToRun, + + /// + /// Running + /// + Running, + + /// + /// WaitingForChildrenToComplete + /// + WaitingForChildrenToComplete, + + /// + /// RanToCompletion + /// + RanToCompletion, + + /// + /// Canceled + /// + Canceled, + + /// + /// Faulted + /// + Faulted + } + /// - /// FLOAT32 + /// 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); /// - /// FLOAT64 + /// A package reference. /// - FLOAT64 -} - + /// The provider which loads the package. + /// The configuration of the package reference. + public record PackageReference(string Provider, IReadOnlyDictionary Configuration); -/// -/// 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 -{ /// - /// Created + /// 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); /// - /// WaitingForActivation + /// 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); /// - /// WaitingToRun + /// 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); /// - /// Running + /// 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); /// - /// WaitingForChildrenToComplete + /// Represents a user. /// - WaitingForChildrenToComplete, + /// The user name. + public record NexusUser(string Name); /// - /// RanToCompletion + /// 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); /// - /// Canceled + /// A revoke token request. /// - Canceled, + /// The claim type. + /// The claim value. + public record TokenClaim(string Type, string Value); /// - /// Faulted + /// Represents a claim. /// - 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); + /// The claim type. + /// The claim value. + public record NexusClaim(string Type, string Value); diff --git a/src/clients/python-client/nexus_api/V1.py b/src/clients/python-client/nexus_api/V1.py index f62e8b4a..77449f9f 100644 --- a/src/clients/python-client/nexus_api/V1.py +++ b/src/clients/python-client/nexus_api/V1.py @@ -288,7 +288,7 @@ def get_metadata(self, catalog_id: str) -> CatalogMetadata: return self.___invoke(CatalogMetadata, "GET", __url, "application/json", None, None) - def set_metadata(self, catalog_id: str, metadata: CatalogMetadata) -> None: + def set_metadata(self, catalog_id: str, metadata: CatalogMetadata) -> Response: """ Puts the catalog metadata. @@ -299,7 +299,7 @@ def set_metadata(self, catalog_id: str, metadata: CatalogMetadata) -> None: __url = "/api/v1/catalogs/{catalogId}/metadata" __url = __url.replace("{catalogId}", quote(str(catalog_id), safe="")) - return self.___invoke(type(None), "PUT", __url, None, "application/json", json.dumps(JsonEncoder.encode(metadata, _json_encoder_options))) + return self.___invoke(Response, "PUT", __url, "application/octet-stream", "application/json", json.dumps(JsonEncoder.encode(metadata, _json_encoder_options))) class DataClient: @@ -1136,7 +1136,7 @@ def get_metadata(self, catalog_id: str) -> Awaitable[CatalogMetadata]: return self.___invoke(CatalogMetadata, "GET", __url, "application/json", None, None) - def set_metadata(self, catalog_id: str, metadata: CatalogMetadata) -> Awaitable[None]: + def set_metadata(self, catalog_id: str, metadata: CatalogMetadata) -> Awaitable[Response]: """ Puts the catalog metadata. @@ -1147,7 +1147,7 @@ def set_metadata(self, catalog_id: str, metadata: CatalogMetadata) -> Awaitable[ __url = "/api/v1/catalogs/{catalogId}/metadata" __url = __url.replace("{catalogId}", quote(str(catalog_id), safe="")) - return self.___invoke(type(None), "PUT", __url, None, "application/json", json.dumps(JsonEncoder.encode(metadata, _json_encoder_options))) + return self.___invoke(Response, "PUT", __url, "application/octet-stream", "application/json", json.dumps(JsonEncoder.encode(metadata, _json_encoder_options))) class DataAsyncClient: