diff --git a/CHANGELOG.md b/CHANGELOG.md index d69e83dc..2e920b6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- New ListStorageObjectsAsync method and marked ListStorageObjects as obsolete. + +### Changed +- ListUsersStorageObjectsAsync now uses default arguments for optional inputs. ## [2.3.1] - 2019-09-21 ### Changed diff --git a/src/Nakama/Client.cs b/src/Nakama/Client.cs index e2c51e55..ee021f93 100644 --- a/src/Nakama/Client.cs +++ b/src/Nakama/Client.cs @@ -307,7 +307,8 @@ public Task DeleteStorageObjectsAsync(ISession session, params StorageObjectId[] _apiClient.ListFriendsAsync(session.AuthToken, limit, state, cursor); /// - public Task ListGroupUsersAsync(ISession session, string groupId, int? state, int limit, string cursor) => + public Task ListGroupUsersAsync(ISession session, string groupId, int? state, int limit, + string cursor) => _apiClient.ListGroupUsersAsync(session.AuthToken, groupId, limit, state, cursor); /// @@ -317,12 +318,14 @@ public Task DeleteStorageObjectsAsync(ISession session, params StorageObjectId[] /// public Task ListLeaderboardRecordsAsync(ISession session, string leaderboardId, IEnumerable ownerIds = null, long? expiry = null, int limit = 1, string cursor = null) => - _apiClient.ListLeaderboardRecordsAsync(session.AuthToken, leaderboardId, ownerIds, limit, cursor, expiry?.ToString()); + _apiClient.ListLeaderboardRecordsAsync(session.AuthToken, leaderboardId, ownerIds, limit, cursor, + expiry?.ToString()); /// public Task ListLeaderboardRecordsAroundOwnerAsync(ISession session, string leaderboardId, string ownerId, long? expiry = null, int limit = 1) => - _apiClient.ListLeaderboardRecordsAroundOwnerAsync(session.AuthToken, leaderboardId, ownerId, limit, expiry?.ToString()); + _apiClient.ListLeaderboardRecordsAroundOwnerAsync(session.AuthToken, leaderboardId, ownerId, limit, + expiry?.ToString()); /// public Task ListMatchesAsync(ISession session, int min, int max, int limit, bool authoritative, @@ -334,20 +337,27 @@ public Task DeleteStorageObjectsAsync(ISession session, params StorageObjectId[] string cacheableCursor = null) => _apiClient.ListNotificationsAsync(session.AuthToken, limit, cacheableCursor); - /// + [Obsolete("ListStorageObjects is obsolete, please use ListStorageObjectsAsync instead.", false)] public Task ListStorageObjects(ISession session, string collection, int limit = 1, string cursor = null) => _apiClient.ListStorageObjectsAsync(session.AuthToken, collection, string.Empty, limit, cursor); + /// + public Task ListStorageObjectsAsync(ISession session, string collection, int limit = 1, + string cursor = null) => + _apiClient.ListStorageObjectsAsync(session.AuthToken, collection, string.Empty, limit, cursor); + /// public Task ListTournamentRecordsAroundOwnerAsync(ISession session, string tournamentId, string ownerId, long? expiry = null, int limit = 1) => - _apiClient.ListTournamentRecordsAroundOwnerAsync(session.AuthToken, tournamentId, ownerId, limit, expiry?.ToString()); + _apiClient.ListTournamentRecordsAroundOwnerAsync(session.AuthToken, tournamentId, ownerId, limit, + expiry?.ToString()); /// public Task ListTournamentRecordsAsync(ISession session, string tournamentId, IEnumerable ownerIds = null, long? expiry = null, int limit = 1, string cursor = null) => - _apiClient.ListTournamentRecordsAsync(session.AuthToken, tournamentId, ownerIds, limit, cursor, expiry?.ToString()); + _apiClient.ListTournamentRecordsAsync(session.AuthToken, tournamentId, ownerIds, limit, cursor, + expiry?.ToString()); /// public Task ListTournamentsAsync(ISession session, int categoryStart, int categoryEnd, @@ -360,12 +370,13 @@ public Task DeleteStorageObjectsAsync(ISession session, params StorageObjectId[] ListUserGroupsAsync(session, session.UserId, state, limit, cursor); /// - public Task ListUserGroupsAsync(ISession session, string userId, int? state, int limit, string cursor) => + public Task ListUserGroupsAsync(ISession session, string userId, int? state, int limit, + string cursor) => _apiClient.ListUserGroupsAsync(session.AuthToken, userId, limit, state, cursor); /// public Task ListUsersStorageObjectsAsync(ISession session, string collection, - string userId, int limit, string cursor) => + string userId, int limit = 1, string cursor = null) => _apiClient.ListStorageObjects2Async(session.AuthToken, collection, userId, limit, cursor); /// @@ -460,7 +471,8 @@ public override string ToString() }); /// - public Task UpdateGroupAsync(ISession session, string groupId, string name, bool open, string description = null, + public Task UpdateGroupAsync(ISession session, string groupId, string name, bool open, + string description = null, string avatarUrl = null, string langTag = null) => _apiClient.UpdateGroupAsync( session.AuthToken, groupId, new ApiUpdateGroupRequest @@ -474,13 +486,13 @@ public override string ToString() /// public Task WriteLeaderboardRecordAsync(ISession session, string leaderboardId, - long score, long subscore = 0, string metadata = null) => _apiClient.WriteLeaderboardRecordAsync( + long score, long subScore = 0, string metadata = null) => _apiClient.WriteLeaderboardRecordAsync( session.AuthToken, leaderboardId, new WriteLeaderboardRecordRequestLeaderboardRecordWrite { Metadata = metadata, Score = score.ToString(), - Subscore = subscore.ToString() + Subscore = subScore.ToString() }); /// @@ -507,13 +519,13 @@ public override string ToString() /// public Task WriteTournamentRecordAsync(ISession session, string tournamentId, long score, - long subscore = 0, string metadata = null) => _apiClient.WriteTournamentRecordAsync(session.AuthToken, + long subScore = 0, string metadata = null) => _apiClient.WriteTournamentRecordAsync(session.AuthToken, tournamentId, new WriteTournamentRecordRequestTournamentRecordWrite { Metadata = metadata, Score = score.ToString(), - Subscore = subscore.ToString() + Subscore = subScore.ToString() }); } } \ No newline at end of file diff --git a/src/Nakama/IClient.cs b/src/Nakama/IClient.cs index 2b489067..926be5b6 100644 --- a/src/Nakama/IClient.cs +++ b/src/Nakama/IClient.cs @@ -14,6 +14,7 @@ * limitations under the License. */ +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -448,15 +449,19 @@ public interface IClient Task ListNotificationsAsync(ISession session, int limit = 1, string cacheableCursor = null); + [Obsolete("ListStorageObjects is obsolete, please use ListStorageObjectsAsync instead.", false)] + Task ListStorageObjects(ISession session, string collection, int limit = 1, + string cursor = null); + /// /// List storage objects in a collection which have public read access. /// /// The session of the user. /// The collection to list over. - /// The number of objects to list. - /// A cursor to paginate over the collection. + /// The number of objects to list. Maximum 100. + /// A cursor to paginate over the collection. May be null. /// A task which resolves to the storage object list. - Task ListStorageObjects(ISession session, string collection, int limit = 1, + Task ListStorageObjectsAsync(ISession session, string collection, int limit = 1, string cursor = null); /// @@ -531,7 +536,7 @@ public interface IClient /// A cursor to paginate over the collection. /// A task which resolves to the storage object list. Task ListUsersStorageObjectsAsync(ISession session, string collection, string userId, - int limit, string cursor); + int limit = 1, string cursor = null); /// /// Promote one or more users in the group. @@ -573,11 +578,11 @@ public interface IClient /// /// This function is usually used with server side code. DO NOT USE client side. /// - /// The secure HTTP key used to authenticate. + /// The secure HTTP key used to authenticate. /// The id of the function to execute on the server. /// A payload to send with the function call. /// A task to resolve an RPC response. - Task RpcAsync(string httpkey, string id, string payload = null); + Task RpcAsync(string httpKey, string id, string payload = null); /// /// Unlink a custom ID from the user account owned by the session. @@ -679,11 +684,11 @@ public interface IClient /// The session for the user. /// The ID of the leaderboard to write. /// The score for the leaderboard record. - /// The subscore for the leaderboard record. + /// The sub score for the leaderboard record. /// The metadata for the leaderboard record. /// A task which resolves to the leaderboard record object written. Task WriteLeaderboardRecordAsync(ISession session, string leaderboardId, long score, - long subscore = 0L, string metadata = null); + long subScore = 0L, string metadata = null); /// /// Write objects to the storage engine. @@ -699,10 +704,10 @@ public interface IClient /// The session of the user. /// The ID of the tournament to write. /// The score of the tournament record. - /// The subscore for the tournament record. + /// The sub score for the tournament record. /// The metadata for the tournament record. /// A task which resolves to the tournament record object written. Task WriteTournamentRecordAsync(ISession session, string tournamentId, long score, - long subscore = 0L, string metadata = null); + long subScore = 0L, string metadata = null); } }