mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-21 00:28:38 +00:00
feat: edit dyn
feat: set pub setting feat: set reply interaction Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -6,9 +6,11 @@ import 'package:PiliPlus/models_new/emote/data.dart';
|
||||
import 'package:PiliPlus/models_new/emote/package.dart';
|
||||
import 'package:PiliPlus/models_new/reply/data.dart';
|
||||
import 'package:PiliPlus/models_new/reply2reply/data.dart';
|
||||
import 'package:PiliPlus/models_new/reply_interaction/data.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
abstract final class ReplyHttp {
|
||||
static final Options options = Options(
|
||||
@@ -206,4 +208,53 @@ abstract final class ReplyHttp {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<ReplyInteractData>> replyInteraction({
|
||||
required Object oid,
|
||||
required Object type,
|
||||
}) async {
|
||||
final res = await Request().get(
|
||||
Api.replyInteraction,
|
||||
queryParameters: {
|
||||
'oid': oid,
|
||||
'type': type,
|
||||
'web_location': 333.1369,
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
return Success(ReplyInteractData.fromJson(res.data['data']));
|
||||
} catch (e) {
|
||||
return Error(e.toString());
|
||||
}
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<Null>> replySubjectModify({
|
||||
required int oid,
|
||||
required int type,
|
||||
required int action,
|
||||
}) async {
|
||||
final res = await Request().post(
|
||||
Api.replySubjectModify,
|
||||
data: {
|
||||
'oid': oid,
|
||||
'type': type,
|
||||
'action': action,
|
||||
'csrf': Accounts.main.csrf,
|
||||
},
|
||||
options: Options(contentType: Headers.formUrlEncodedContentType),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
if (res.data['data']?['action_toast'] case final String toast) {
|
||||
SmartDialog.showToast(toast);
|
||||
}
|
||||
return const Success(null);
|
||||
} else {
|
||||
SmartDialog.showToast(res.data['message'].toString());
|
||||
return const Error(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user