Skip to content

Commit

Permalink
add additional required args
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Oct 11, 2024
1 parent 51fb1b6 commit 47a5a96
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
14 changes: 10 additions & 4 deletions src/BeeNet.Client/BeeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,12 @@ public Task DeletePinAsync(

public Task DeleteTagAsync(
TagId id,
PostageBatchId? batchId = null,
CancellationToken cancellationToken = default) =>
generatedClient.TagsDeleteAsync(id.Value, cancellationToken);
generatedClient.TagsDeleteAsync(
uid: id.Value,
swarm_postage_batch_id: batchId?.ToString(),
cancellationToken: cancellationToken);

public async Task<string> DeleteTransactionAsync(
string txHash,
Expand Down Expand Up @@ -1296,14 +1300,16 @@ await generatedClient.BzzHeadAsync(

public Task UpdateTagAsync(
TagId id,
PostageBatchId? batchId = null,
SwarmHash? hash = null,
CancellationToken cancellationToken = default) =>
generatedClient.TagsPatchAsync(
id.Value,
hash.HasValue ?
uid: id.Value,
swarm_postage_batch_id: batchId?.ToString(),
body: hash.HasValue ?
new Body4 { Address = hash.Value.ToString() } :
null,
cancellationToken);
cancellationToken: cancellationToken);

public async Task<SwarmHash> UploadChunkAsync(PostageBatchId batchId,
Stream chunkData,
Expand Down
18 changes: 14 additions & 4 deletions src/BeeNet.Client/Clients/BeeGeneratedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,21 @@ internal partial interface IBeeGeneratedClient
/// Delete Tag information using Uid
/// </summary>
/// <param name="uid">Uid</param>
/// <param name="swarm_postage_batch_id">ID of Postage Batch that is used to upload data with</param>
/// <returns>The resource was deleted successfully.</returns>
/// <exception cref="BeeNetApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task TagsDeleteAsync(ulong uid, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task TagsDeleteAsync(ulong uid, string? swarm_postage_batch_id = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>
/// Update Total Count and swarm hash for a tag of an input stream of unknown size using Uid
/// </summary>
/// <param name="uid">Uid</param>
/// <param name="swarm_postage_batch_id">ID of Postage Batch that is used to upload data with</param>
/// <param name="body">Can contain swarm hash to use for the tag</param>
/// <returns>Ok</returns>
/// <exception cref="BeeNetApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<Response9> TagsPatchAsync(ulong uid, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<Response9> TagsPatchAsync(ulong uid, string? swarm_postage_batch_id = null, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>
Expand Down Expand Up @@ -2847,9 +2849,10 @@ public string BaseUrl
/// Delete Tag information using Uid
/// </summary>
/// <param name="uid">Uid</param>
/// <param name="swarm_postage_batch_id">ID of Postage Batch that is used to upload data with</param>
/// <returns>The resource was deleted successfully.</returns>
/// <exception cref="BeeNetApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task TagsDeleteAsync(ulong uid, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public virtual async System.Threading.Tasks.Task TagsDeleteAsync(ulong uid, string? swarm_postage_batch_id = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
if (uid == null)
throw new System.ArgumentNullException("uid");
Expand All @@ -2860,6 +2863,9 @@ public string BaseUrl
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{

if (swarm_postage_batch_id != null)
request_.Headers.TryAddWithoutValidation("swarm-postage-batch-id", ConvertToString(swarm_postage_batch_id, System.Globalization.CultureInfo.InvariantCulture));
request_.Method = new System.Net.Http.HttpMethod("DELETE");

var urlBuilder_ = new System.Text.StringBuilder();
Expand Down Expand Up @@ -2950,10 +2956,11 @@ public string BaseUrl
/// Update Total Count and swarm hash for a tag of an input stream of unknown size using Uid
/// </summary>
/// <param name="uid">Uid</param>
/// <param name="swarm_postage_batch_id">ID of Postage Batch that is used to upload data with</param>
/// <param name="body">Can contain swarm hash to use for the tag</param>
/// <returns>Ok</returns>
/// <exception cref="BeeNetApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<Response9> TagsPatchAsync(ulong uid, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public virtual async System.Threading.Tasks.Task<Response9> TagsPatchAsync(ulong uid, string? swarm_postage_batch_id = null, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
if (uid == null)
throw new System.ArgumentNullException("uid");
Expand All @@ -2964,6 +2971,9 @@ public string BaseUrl
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{

if (swarm_postage_batch_id != null)
request_.Headers.TryAddWithoutValidation("swarm-postage-batch-id", ConvertToString(swarm_postage_batch_id, System.Globalization.CultureInfo.InvariantCulture));
var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings);
var content_ = new System.Net.Http.ByteArrayContent(json_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
Expand Down
2 changes: 2 additions & 0 deletions src/BeeNet.Util/IBeeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Task DeletePinAsync(
/// <exception cref="BeeNetGatewayApiException">A server side error occurred.</exception>
Task DeleteTagAsync(
TagId id,
PostageBatchId? batchId = null,
CancellationToken cancellationToken = default);

/// <summary>Cancel existing transaction</summary>
Expand Down Expand Up @@ -795,6 +796,7 @@ Task<string> TryConnectToPeerAsync(
/// <exception cref="BeeNetGatewayApiException">A server side error occurred.</exception>
Task UpdateTagAsync(
TagId id,
PostageBatchId? batchId = null,
SwarmHash? hash = null,
CancellationToken cancellationToken = default);

Expand Down
2 changes: 2 additions & 0 deletions tools/GatewaySwarm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ paths:
schema: *a28
required: true
description: Uid
- *a5
responses:
"204":
description: The resource was deleted successfully.
Expand All @@ -967,6 +968,7 @@ paths:
schema: *a28
required: true
description: Uid
- *a5
requestBody:
description: Can contain swarm hash to use for the tag
required: false
Expand Down
2 changes: 2 additions & 0 deletions tools/openapi/Swarm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
required: true
description: Uid
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
responses:
"204":
$ref: "SwarmCommon.yaml#/components/responses/204"
Expand All @@ -656,6 +657,7 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
required: true
description: Uid
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
requestBody:
description: Can contain swarm hash to use for the tag
required: false
Expand Down

0 comments on commit 47a5a96

Please sign in to comment.