@@ -15,101 +15,172 @@ NS_ASSUME_NONNULL_BEGIN
1515
1616@interface LCLeaderboardStatistic : NSObject
1717
18+ // / The name of the leaderboard.
1819@property (nonatomic , readonly , nullable ) NSString *name;
20+ // / The version of the leaderboard.
1921@property (nonatomic , readonly ) NSInteger version;
22+ // / The value of this statistic.
2023@property (nonatomic , readonly ) double value;
24+ // / If this statistic belongs to one user, this property is nonnull.
2125@property (nonatomic , readonly , nullable ) LCUser *user;
26+ // / If this statistic belongs to one object, this property is nonnull.
2227@property (nonatomic , readonly , nullable ) LCObject *object;
28+ // / If this statistic belongs to one entity, this property is nonnull.
2329@property (nonatomic , readonly , nullable ) NSString *entity;
2430
2531@end
2632
2733@interface LCLeaderboardRanking : NSObject
2834
35+ // / The name of the leaderboard.
2936@property (nonatomic , readonly , nullable ) NSString *statisticName;
37+ // / The ranking on the leaderboard.
3038@property (nonatomic , readonly ) NSInteger rank;
39+ // / The value of the statistic.
3140@property (nonatomic , readonly ) double value;
41+ // / The statistics on the other leaderboards.
3242@property (nonatomic , readonly , nullable ) NSArray <LCLeaderboardStatistic *> *includedStatistics;
43+ // / If this ranking belongs to one user, this property is nonnull.
3344@property (nonatomic , readonly , nullable ) LCUser *user;
45+ // / If this ranking belongs to one object, this property is nonnull.
3446@property (nonatomic , readonly , nullable ) LCObject *object;
47+ // / If this ranking belongs to one entity, this property is nonnull.
3548@property (nonatomic , readonly , nullable ) NSString *entity;
3649
3750@end
3851
3952@interface LCLeaderboardQueryOption : NSObject
4053
54+ // / Select which key-value will be returned.
4155@property (nonatomic , nullable ) NSArray <NSString *> *selectKeys;
56+ // / Select which pointer's all value will be returned.
4257@property (nonatomic , nullable ) NSArray <NSString *> *includeKeys;
4358
4459@end
4560
4661@interface LCLeaderboard : NSObject
4762
63+ // / The name of this leaderboard.
4864@property (nonatomic , readonly ) NSString *statisticName;
65+ // / The start positon of the query, default is `0`.
4966@property (nonatomic ) NSInteger skip;
67+ // / The max results count of the query, default is `20`.
5068@property (nonatomic ) NSInteger limit;
69+ // / The statistics of the other leaderboards will be returned, default is `nil`.
5170@property (nonatomic , nullable ) NSArray <NSString *> *includeStatistics;
71+ // / The version of the leaderboard, default is `0`.
5272@property (nonatomic ) NSInteger version;
73+ // / Whether to return the count of this leaderboard, default is `false`.
5374@property (nonatomic ) BOOL returnCount;
5475
5576+ (instancetype )new NS_UNAVAILABLE;
5677- (instancetype )init NS_UNAVAILABLE;
5778
79+ // / Initializing with a name.
80+ // / @param statisticName The name of the leaderboard.
5881- (instancetype )initWithStatisticName : (NSString *)statisticName ;
5982
6083// MARK: Update & Delete Statistics
6184
85+ // / Update the statistics of the current user.
86+ // / @param statistics The statistics of the current user.
87+ // / @param callback Result callback.
6288+ (void )updateCurrentUserStatistics : (NSDictionary *)statistics
6389 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
6490
91+ // / Delete the statistics of the current user on the leaderboards.
92+ // / @param statisticNames The name of the leaderboards.
93+ // / @param callback Result callback.
6594+ (void )deleteCurrentUserStatistics : (NSArray <NSString *> *)statisticNames
6695 callback : (void (^)(BOOL succeeded, NSError * _Nullable error))callback ;
6796
6897// MARK: Get One Statistics
6998
99+ // / Get the statistics of the user on the leaderboards.
100+ // / @param userId The object id of the user.
101+ // / @param statisticNames The name of the leaderboards.
102+ // / @param callback Result callback.
70103+ (void )getStatisticsWithUserId : (NSString *)userId
71104 statisticNames : (NSArray <NSString *> * _Nullable)statisticNames
72105 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
73106
107+ // / Get the statistics of the object on the leaderboards.
108+ // / @param objectId The object id of the object.
109+ // / @param statisticNames The name of the leaderboards.
110+ // / @param option The query option.
111+ // / @param callback Result callback.
74112+ (void )getStatisticsWithObjectId : (NSString *)objectId
75113 statisticNames : (NSArray <NSString *> * _Nullable)statisticNames
76114 option : (LCLeaderboardQueryOption * _Nullable)option
77115 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
78116
117+ // / Get the statistics of the entity on the leaderboards.
118+ // / @param entity The string of the entity.
119+ // / @param statisticNames The name of the leaderboards.
120+ // / @param callback Result callback.
79121+ (void )getStatisticsWithEntity : (NSString *)entity
80122 statisticNames : (NSArray <NSString *> * _Nullable)statisticNames
81123 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
82124
83125// MARK: Get Group Statistics
84126
127+ // / Get the statistics of one group users on this leaderboard.
128+ // / @param userIds The object id array of the users.
129+ // / @param callback Result callback.
85130- (void )getStatisticsWithUserIds : (NSArray <NSString *> *)userIds
86131 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
87132
133+ // / Get the statistics of one group objects on this leaderboard.
134+ // / @param objectIds The object id array of the objects.
135+ // / @param option The query option.
136+ // / @param callback Result callback.
88137- (void )getStatisticsWithObjectIds : (NSArray <NSString *> *)objectIds
89138 option : (LCLeaderboardQueryOption * _Nullable)option
90139 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
91140
141+ // / Get the statistics of one group entities on this leaderboard.
142+ // / @param entities The string array of the entities.
143+ // / @param callback Result callback.
92144- (void )getStatisticsWithEntities : (NSArray <NSString *> *)entities
93145 callback : (void (^)(NSArray <LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback ;
94146
95147// MARK: Get Rankings
96148
149+ // / Get rankings of the user on this leaderboard from top.
150+ // / @param option The query option.
151+ // / @param callback Result callback.
97152- (void )getUserResultsWithOption : (LCLeaderboardQueryOption * _Nullable)option
98153 callback : (void (^)(NSArray <LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback ;
99154
155+ // / Get rankings around one user on this leaderboard.
156+ // / @param userId The object id of the user.
157+ // / @param option The query option.
158+ // / @param callback Result callback.
100159- (void )getUserResultsAroundUser : (NSString * _Nullable)userId
101160 option : (LCLeaderboardQueryOption * _Nullable)option
102161 callback : (void (^)(NSArray <LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback ;
103162
163+ // / Get rankings of the object on this leaderboard from top.
164+ // / @param option The query option.
165+ // / @param callback Result callback.
104166- (void )getObjectResultsWithOption : (LCLeaderboardQueryOption * _Nullable)option
105167 callback : (void (^)(NSArray <LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback ;
106168
169+ // / Get rankings around one object on this leaderboard.
170+ // / @param objectId The object id of the object.
171+ // / @param option The query option.
172+ // / @param callback Result callback.
107173- (void )getObjectResultsAroundObject : (NSString * _Nullable)objectId
108174 option : (LCLeaderboardQueryOption * _Nullable)option
109175 callback : (void (^)(NSArray <LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback ;
110176
177+ // / Get rankings of the entity on this leaderboard from top.
178+ // / @param callback Result callback.
111179- (void )getEntityResultsWithCallback : (void (^)(NSArray <LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback ;
112180
181+ // / Get rankings around one entity on this leaderboard.
182+ // / @param entity The string of the entity.
183+ // / @param callback Result callback.
113184- (void )getEntityResultsAroundEntity : (NSString * _Nullable)entity
114185 callback : (void (^)(NSArray <LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback ;
115186
0 commit comments