diff --git a/src/BeeNet.Client/BeeClient.cs b/src/BeeNet.Client/BeeClient.cs index e0ca152..b609ddc 100644 --- a/src/BeeNet.Client/BeeClient.cs +++ b/src/BeeNet.Client/BeeClient.cs @@ -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 DeleteTransactionAsync( string txHash, @@ -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 UploadChunkAsync(PostageBatchId batchId, Stream chunkData, diff --git a/src/BeeNet.Client/Clients/BeeGeneratedClient.cs b/src/BeeNet.Client/Clients/BeeGeneratedClient.cs index dc2dd03..6dc175e 100644 --- a/src/BeeNet.Client/Clients/BeeGeneratedClient.cs +++ b/src/BeeNet.Client/Clients/BeeGeneratedClient.cs @@ -245,19 +245,21 @@ internal partial interface IBeeGeneratedClient /// Delete Tag information using Uid /// /// Uid + /// ID of Postage Batch that is used to upload data with /// The resource was deleted successfully. /// A server side error occurred. - 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)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update Total Count and swarm hash for a tag of an input stream of unknown size using Uid /// /// Uid + /// ID of Postage Batch that is used to upload data with /// Can contain swarm hash to use for the tag /// Ok /// A server side error occurred. - System.Threading.Tasks.Task TagsPatchAsync(ulong uid, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TagsPatchAsync(ulong uid, string? swarm_postage_batch_id = null, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// @@ -2847,9 +2849,10 @@ public string BaseUrl /// Delete Tag information using Uid /// /// Uid + /// ID of Postage Batch that is used to upload data with /// The resource was deleted successfully. /// A server side error occurred. - 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"); @@ -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(); @@ -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 /// /// Uid + /// ID of Postage Batch that is used to upload data with /// Can contain swarm hash to use for the tag /// Ok /// A server side error occurred. - public virtual async System.Threading.Tasks.Task TagsPatchAsync(ulong uid, Body4? body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public virtual async System.Threading.Tasks.Task 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"); @@ -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"); diff --git a/src/BeeNet.Util/IBeeClient.cs b/src/BeeNet.Util/IBeeClient.cs index 9fda218..e01e185 100644 --- a/src/BeeNet.Util/IBeeClient.cs +++ b/src/BeeNet.Util/IBeeClient.cs @@ -153,6 +153,7 @@ Task DeletePinAsync( /// A server side error occurred. Task DeleteTagAsync( TagId id, + PostageBatchId? batchId = null, CancellationToken cancellationToken = default); /// Cancel existing transaction @@ -795,6 +796,7 @@ Task TryConnectToPeerAsync( /// A server side error occurred. Task UpdateTagAsync( TagId id, + PostageBatchId? batchId = null, SwarmHash? hash = null, CancellationToken cancellationToken = default); diff --git a/tools/GatewaySwarm.yaml b/tools/GatewaySwarm.yaml index 860a34e..037f4c4 100644 --- a/tools/GatewaySwarm.yaml +++ b/tools/GatewaySwarm.yaml @@ -948,6 +948,7 @@ paths: schema: *a28 required: true description: Uid + - *a5 responses: "204": description: The resource was deleted successfully. @@ -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 diff --git a/tools/openapi/Swarm.yaml b/tools/openapi/Swarm.yaml index 0ebf2c1..7a69adf 100644 --- a/tools/openapi/Swarm.yaml +++ b/tools/openapi/Swarm.yaml @@ -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" @@ -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