Skip to content

Commit

Permalink
Added listTournamentRecordsAroundOwner to client
Browse files Browse the repository at this point in the history
  • Loading branch information
obrunsmann committed Feb 18, 2023
1 parent 30122e2 commit a05e56a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* **Breaking:** Renamed `ChannelJoinType` enum to `ChannelType`
* **Breaking:** Renamed `leaderboardId` parameter to `leaderboardName` in `writeLeaderboardRecord` and `deleteLeaderboardRecord`
* Added `onPartyData` stream to realtime client
* Added `listTournamentRecordsAroundOwner` to client

## 1.0.0-dev.3

Expand Down
20 changes: 20 additions & 0 deletions lib/src/nakama_client/nakama_api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,26 @@ class NakamaRestApiClient extends NakamaBaseClient {
return model.TournamentRecordList.fromJson(res.body!.toJson());
}

@override
Future<model.TournamentRecordList> listTournamentRecordsAroundOwner({
required model.Session session,
required String tournamentId,
required String ownerId,
int? expiry,
int limit = defaultLimit,
}) async {
_session = session;

final res = await _api.v2TournamentTournamentIdOwnerOwnerIdGet(
ownerId: ownerId,
tournamentId: tournamentId,
expiry: expiry?.toString(),
limit: limit,
);

return model.TournamentRecordList.fromJson(res.body!.toJson());
}

@override
Future<model.LeaderboardRecord> writeTournamentRecord({
required model.Session session,
Expand Down
12 changes: 12 additions & 0 deletions lib/src/nakama_client/nakama_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,18 @@ abstract class NakamaBaseClient {
String? cursor,
});

/// # Listing records around a user**
///
/// Similarly to leaderboards, Sagi-shi players can get other player scores
/// around them.
Future<model.TournamentRecordList> listTournamentRecordsAroundOwner({
required model.Session session,
required String tournamentId,
required String ownerId,
int? expiry,
int limit = defaultLimit,
});

/// # Submitting scores
///
/// Players can submit scores, subscores and metadata to the tournament.
Expand Down
19 changes: 19 additions & 0 deletions lib/src/nakama_client/nakama_grpc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,25 @@ class NakamaGrpcClient extends NakamaBaseClient {
return model.TournamentRecordList.fromDto(res);
}

@override
Future<model.TournamentRecordList> listTournamentRecordsAroundOwner({
required model.Session session,
required String tournamentId,
required String ownerId,
int? expiry,
int limit = defaultLimit,
}) async {
final res = await _client.listTournamentRecordsAroundOwner(
api.ListTournamentRecordsAroundOwnerRequest(
expiry: expiry == null ? null : api.Int64Value(value: Int64(expiry)),
limit: api.UInt32Value(value: limit),
ownerId: ownerId,
tournamentId: tournamentId,
));

return model.TournamentRecordList.fromDto(res);
}

@override
Future<model.LeaderboardRecord> writeTournamentRecord({
required model.Session session,
Expand Down

0 comments on commit a05e56a

Please sign in to comment.