Skip to content

Commit

Permalink
Renamed leaderboardId parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
obrunsmann committed Feb 18, 2023
1 parent 325e5a8 commit 30122e2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## unreleased

* **Breaking:** Renamed `ChannelJoinType` enum to `ChannelType`
* **Breaking:** Renamed `leaderboardId` parameter to `leaderboardName` in `writeLeaderboardRecord` and `deleteLeaderboardRecord`
* Added `onPartyData` stream to realtime client

## 1.0.0-dev.3
Expand Down
8 changes: 4 additions & 4 deletions lib/src/nakama_client/nakama_api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -910,15 +910,15 @@ class NakamaRestApiClient extends NakamaBaseClient {
@override
Future<model.LeaderboardRecord> writeLeaderboardRecord({
required model.Session session,
required String leaderboardId,
required String leaderboardName,
int? score,
int? subscore,
String? metadata,
}) async {
_session = session;

final res = await _api.v2LeaderboardLeaderboardIdPost(
leaderboardId: leaderboardId,
leaderboardId: leaderboardName,
body: WriteLeaderboardRecordRequestLeaderboardRecordWrite(
score: score?.toString(),
subscore: subscore?.toString(),
Expand All @@ -931,11 +931,11 @@ class NakamaRestApiClient extends NakamaBaseClient {
@override
Future<void> deleteLeaderboardRecord({
required model.Session session,
required String leaderboardId,
required String leaderboardName,
}) async {
_session = session;

await _api.v2LeaderboardLeaderboardIdDelete(leaderboardId: leaderboardId);
await _api.v2LeaderboardLeaderboardIdDelete(leaderboardId: leaderboardName);
}

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/src/nakama_client/nakama_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ abstract class NakamaBaseClient {
/// for ordering when the scores are the same.
Future<model.LeaderboardRecord> writeLeaderboardRecord({
required model.Session session,
required String leaderboardId,
required String leaderboardName,
int? score,
int? subscore,
String? metadata,
Expand All @@ -388,7 +388,7 @@ abstract class NakamaBaseClient {
/// # Deleting records
Future<void> deleteLeaderboardRecord({
required model.Session session,
required String leaderboardId,
required String leaderboardName,
});

/// # Adding friends
Expand Down
8 changes: 4 additions & 4 deletions lib/src/nakama_client/nakama_grpc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -871,14 +871,14 @@ class NakamaGrpcClient extends NakamaBaseClient {
@override
Future<model.LeaderboardRecord> writeLeaderboardRecord({
required model.Session session,
required String leaderboardId,
required String leaderboardName,
int? score,
int? subscore,
String? metadata,
}) async {
final res = await _client.writeLeaderboardRecord(
api.WriteLeaderboardRecordRequest(
leaderboardId: leaderboardId,
leaderboardId: leaderboardName,
record: api.WriteLeaderboardRecordRequest_LeaderboardRecordWrite(
score: score == null ? null : Int64(score),
subscore: subscore == null ? null : Int64(subscore),
Expand All @@ -894,10 +894,10 @@ class NakamaGrpcClient extends NakamaBaseClient {
@override
Future<void> deleteLeaderboardRecord({
required model.Session session,
required String leaderboardId,
required String leaderboardName,
}) async {
await _client.deleteLeaderboardRecord(api.DeleteLeaderboardRecordRequest(
leaderboardId: leaderboardId,
leaderboardId: leaderboardName,
));
}

Expand Down
2 changes: 1 addition & 1 deletion test/grpc/leaderboard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void main() {

test('write leaderboard record', () async {
final result = await client.writeLeaderboardRecord(
session: session, leaderboardId: 'test', score: 10);
session: session, leaderboardName: 'test', score: 10);

expect(result, isA<LeaderboardRecord>());
expect(result.score, isNotNull);
Expand Down
2 changes: 1 addition & 1 deletion test/rest/leaderboard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void main() {

test('write leaderboard record', () async {
final result = await client.writeLeaderboardRecord(
session: session, leaderboardId: 'test', score: 10);
session: session, leaderboardName: 'test', score: 10);

expect(result, isA<LeaderboardRecord>());
expect(result.score, isNotNull);
Expand Down

0 comments on commit 30122e2

Please sign in to comment.