import 'package:http/http.dart' as http;

import '../../nextcloud_ocs.dart';
import '../talk_api.dart';
import 'get_poll_state_response.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) =>
      GetPollStateResponse.fromJson(NextcloudOcs.decode(raw));

  @override
  Future<http.Response> request(
    Uri uri,
    Object? body,
    Map<String, String>? headers,
  ) => http.get(uri, headers: headers);
}
