All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hn.im.easemob.api.impl.EasemobSendMessage Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.im.easemob.api.impl;

import com.hn.im.easemob.api.EasemobRestAPI;
import com.hn.im.easemob.api.SendMessageAPI;
import com.hn.im.easemob.comm.constant.HTTPMethod;
import com.hn.im.easemob.comm.helper.HeaderHelper;
import com.hn.im.easemob.comm.wrapper.BodyWrapper;
import com.hn.im.easemob.comm.wrapper.HeaderWrapper;

public class EasemobSendMessage extends EasemobRestAPI implements SendMessageAPI {
    private static final String ROOT_URI = "/messages";

    @Override
    public String getResourceRootURI() {
        return ROOT_URI;
    }

    public Object sendMessage(Object payload) {
        String url = getContext().getSeriveURL() + getResourceRootURI();
        HeaderWrapper header = HeaderHelper.getDefaultHeaderWithToken();
        BodyWrapper body = (BodyWrapper) payload;

        return getInvoker().sendRequest(HTTPMethod.METHOD_POST, url, header, body, null);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy