Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handled requesting metadata for partitions with id containing / #67

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

using Neuroglia;
using Neuroglia.Eventing.CloudEvents;
using Neuroglia.Serialization;

namespace CloudStreams.Core.Api.Client.Services;

Expand Down Expand Up @@ -45,7 +44,7 @@ public partial class CloudStreamsCoreApiClient
public virtual async Task<PartitionMetadata?> GetPartitionMetadataAsync(CloudEventPartitionType type, string id, CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(id)) throw new ArgumentNullException(nameof(id));
using var request = await this.ProcessRequestAsync(new HttpRequestMessage(HttpMethod.Get, $"{CloudEventPartitionsApiPath}{type}/{id}"), cancellationToken).ConfigureAwait(false);
using var request = await this.ProcessRequestAsync(new HttpRequestMessage(HttpMethod.Get, $"{CloudEventPartitionsApiPath}{type}/byId?id={Uri.EscapeDataString(id)}"), cancellationToken).ConfigureAwait(false);
using var response = await this.ProcessResponseAsync(await this.HttpClient.SendAsync(request, cancellationToken).ConfigureAwait(false), cancellationToken).ConfigureAwait(false);
var json = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
return this.Serializer.Deserialize<PartitionMetadata>(json);
Expand Down
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public virtual async Task<IActionResult> ListPartitionsByType(CloudEventPartitio
/// <param name="id">The id of the partition to get the metadata of</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
/// <returns>A new <see cref="IActionResult"/></returns>
[HttpGet("{type}/{id}")]
[HttpGet("{type}/byId")]
[ProducesResponseType(typeof(PartitionMetadata), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(Neuroglia.ProblemDetails), (int)HttpStatusCode.BadRequest)]
public virtual async Task<IActionResult> GetPartitionMetadata(CloudEventPartitionType type, string id, CancellationToken cancellationToken)
public virtual async Task<IActionResult> GetPartitionMetadata(CloudEventPartitionType type, [FromQuery]string id, CancellationToken cancellationToken)
{
if (!this.ModelState.IsValid) return this.ValidationProblem(this.ModelState);
return this.Process(await this.Mediator.ExecuteAsync(new GetEventPartitionMetadataQuery(new(type, id)), cancellationToken).ConfigureAwait(false));
Expand Down
Loading