package com.wecloud.im.sdk.sample;

import com.alibaba.fastjson.JSONObject;
import com.wecloud.im.sdk.WecloudIm;
import com.wecloud.im.sdk.WecloudImClientBuilder;
import com.wecloud.im.sdk.model.PrivateChatStatusMessage;

/**
 * 发布单聊消息
 * @Author luozh
 * @Date 2022年05月06日 01:37:29
 * @Version 1.0
 */
public class PublishPrivateChatMessageSample {

    public static void main(String[] args) {
//        WecloudIm im = new WecloudImClientBuilder().build("http://139.159.136.86:8082",
//                "QizKVHcILRWp6Td2",
//                "287d04828099fb7de871e9dda845fa8b6b2302faf2ab3737");
        WecloudIm im = new WecloudImClientBuilder().build("http://127.0.0.1:8082",
                "QizKVHcILRWp6Td2",
                "287d04828099fb7de871e9dda845fa8b6b2302faf2ab3737");

        String s = "{\"content\":{\"attrs\":{\"transfer\":\"{\\\"amount\\\":1.000,\\\"drawStatus\\\":2," +
                "\\\"id\\\":1529790517452394496,\\\"liveStatus\\\":1,\\\"payStatus\\\":2,\\\"payTime\\\":1653565456000,\\\"receiverAccountCode\\\":\\\"1529729370233688064\\\",\\\"sponsorAccountCode\\\":\\\"1529733172080857088\\\"}\",\"msgId\":\"1529790517716623360\",\"type\":\"301\"}},\"fromUserId\":\"1529729370233688064\",\"includeBlacklist\":false,\"includeSender\":true,\"messageType\":\"301\",\"toUserIds\":\"1529729370233688064,1529733172080857088\"}";

        PrivateChatStatusMessage message = JSONObject.parseObject(s, PrivateChatStatusMessage.class);


        im.publishPrivateStatusMessage(message);

    }


}
