package com.ym.controller;

import com.ym.service.MessageService;
import io.rong.models.message.PrivateMessage;
import io.rong.models.message.RecallMessage;
import io.rong.models.message.TemplateMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by weiqinxiao on 2019/2/25.
 */
@RestController
@RequestMapping("/private")
public class PrivateController {

    @Autowired
    MessageService messageService;

    @RequestMapping(value = "/send", method = RequestMethod.POST)
    public Object send(@RequestBody PrivateMessage privateMessage) throws Exception {
        return messageService.privateSend(privateMessage);
    }

    @RequestMapping(value = "/recall", method = RequestMethod.POST)
    public Object recall(@RequestBody RecallMessage recallMessage) throws Exception {
        return messageService.privateRecall(recallMessage);
    }

    @RequestMapping(value = "/sendTemplate", method = RequestMethod.POST)
    public Object sendTemplate(@RequestBody TemplateMessage templateMessage) throws Exception {
        return messageService.privateSendTemplate(templateMessage);
    }
}
