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

import '../../../api_params.dart';
import '../talk_api.dart';
import 'send_message_params.dart';

class SendMessage extends TalkApi {
  String chatToken;
  SendMessage(this.chatToken, SendMessageParams params)
    : super('v1/chat/$chatToken', params);

  @override
  Null assemble(String raw) => null;

  @override
  Future<Response>? request(
    Uri uri,
    ApiParams? body,
    Map<String, String>? headers,
  ) {
    if (body is SendMessageParams) {
      return http.post(uri, headers: headers, body: body.toJson());
    }
    return null;
  }
}
