Skip to content
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 @@ -176,8 +176,8 @@ public async Task UpdateTopicAsync(Identifier streamId, Identifier topicId, stri
ulong maxTopicSize = 0, TimeSpan? messageExpiry = null, byte? replicationFactor = null,
CancellationToken token = default)
{
var json = JsonSerializer.Serialize(
new UpdateTopicRequest(name, compressionAlgorithm, maxTopicSize, DurationHelpers.ToDuration(messageExpiry),
var json = JsonSerializer.Serialize(new UpdateTopicRequest(name, compressionAlgorithm, maxTopicSize,
DurationHelpers.ToDuration(messageExpiry),
replicationFactor),
_jsonSerializerOptions);
var data = new StringContent(json, Encoding.UTF8, "application/json");
Expand Down Expand Up @@ -690,8 +690,8 @@ public async Task ChangePassword(Identifier userId, string currentPassword, stri
/// <inheritdoc />
public async Task<AuthResponse?> LoginUser(string userName, string password, CancellationToken token = default)
{
// TODO: get version
var json = JsonSerializer.Serialize(new LoginUserRequest(userName, password, "", Context),
// TODO: Add binary protocol version
var json = JsonSerializer.Serialize(new LoginUserRequest(userName, password, SdkVersion.Value, Context),
_jsonSerializerOptions);

var data = new StringContent(json, Encoding.UTF8, "application/json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ public async Task ChangePassword(Identifier userId, string currentPassword, stri
throw new NotConnectedException();
}

var message = TcpContracts.LoginUser(userName, password, "0.5.0", "csharp-sdk");
// TODO: Add binary protocol version
var message = TcpContracts.LoginUser(userName, password, SdkVersion.Value, "csharp-sdk");
var payload = new byte[4 + BufferSizes.INITIAL_BYTES_LENGTH + message.Length];
TcpMessageStreamHelpers.CreatePayload(payload, message, CommandCodes.LOGIN_USER_CODE);

Expand Down
2 changes: 1 addition & 1 deletion foreign/csharp/Iggy_SDK/Iggy_SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<AssemblyName>Apache.Iggy</AssemblyName>
<RootNamespace>Apache.Iggy</RootNamespace>
<PackageVersion>0.7.1-edge.1</PackageVersion>
<Version>0.7.1-edge.2</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand Down
27 changes: 27 additions & 0 deletions foreign/csharp/Iggy_SDK/Utils/SdkVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

using System.Reflection;

namespace Apache.Iggy.Utils;

internal static class SdkVersion
{
internal static readonly string Value = (typeof(SdkVersion).Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion ?? "unknown").Split('+')[0];
}
32 changes: 32 additions & 0 deletions foreign/csharp/Iggy_SDK_Tests/UtilityTests/SdkVersionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

using Apache.Iggy.Utils;

namespace Apache.Iggy.Tests.UtilityTests;

public sealed class SdkVersionTests
{
[Fact]
public void SdkVersion_ShouldNotBeNullOrUnknown()
{
var version = SdkVersion.Value;

Assert.NotNull(version);
Assert.NotEqual("unknown", version);
}
}
Loading