added functionality to show own votes in polls

This commit is contained in:
2025-10-10 02:01:43 +02:00
parent 7b7ab2e82e
commit 81f65750b7
6 changed files with 227 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import 'dart:convert';
import 'dart:developer';
import 'package:http/http.dart' as http;
import '../talkApi.dart';
import 'getPollStateResponse.dart';
class GetPollState extends TalkApi<GetPollStateResponse> {
String token;
int pollId;
GetPollState({required this.token, required this.pollId}) : super('v1/poll/$token/$pollId', null);
@override
GetPollStateResponse assemble(String raw) {
log(raw);
return GetPollStateResponse.fromJson(jsonDecode(raw)['ocs']);
}
@override
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.get(uri, headers: headers);
}