feat(reward): 新增客户端奖励中心
This commit is contained in:
1 parent
67670d46b1
commit
bea08110c9
68 files changed
+3987
-332
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import '../models/reward.dart';
|
||||
import 'api_client.dart';
|
||||
import 'response_decoders.dart';
|
||||
|
||||
/// 奖励中心接口,对应契约 §1.8.1。
|
||||
class RewardApi {
|
||||
const RewardApi(this._client);
|
||||
|
||||
final ApiClient _client;
|
||||
|
||||
Future<RewardOverview> overview(String locale) async {
|
||||
final data = await _client.get(
|
||||
'/app/rewards/overview',
|
||||
query: {'locale': locale},
|
||||
);
|
||||
return RewardOverview.fromJson(ResponseDecoders.asMap(data));
|
||||
}
|
||||
|
||||
Future<RewardActionResult> checkIn() async {
|
||||
final data = await _client.post('/app/rewards/check-in');
|
||||
return RewardActionResult.fromCheckin(ResponseDecoders.asMap(data));
|
||||
}
|
||||
|
||||
Future<RewardActionResult> claim(String taskId) async {
|
||||
final data = await _client.post('/app/rewards/tasks/$taskId/claim');
|
||||
return RewardActionResult.fromClaim(ResponseDecoders.asMap(data));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user