Senparc.Weixin.Work.AdvancedAPIs.KFApi.SendVoiceAsync C# (CSharp) Method

SendVoiceAsync() public static method

【异步方法】发送语音信息
public static SendVoiceAsync ( string accessToken, KF_User_Type senderType, string senderId, KF_User_Type receiverType, string receiverId, string mediaId, int timeOut = Config.TIME_OUT ) : Task
accessToken string 调用接口凭证
senderType KF_User_Type 发送人类型
senderId string 发送人标志
receiverType KF_User_Type 接收人类型
receiverId string 接收人标志
mediaId string 语音的mediaId
timeOut int 代理请求超时时间(毫秒)
return Task
        public static async Task<QyJsonResult> SendVoiceAsync(string accessToken, KF_User_Type senderType, string senderId, KF_User_Type receiverType,
            string receiverId, string mediaId, int timeOut = Config.TIME_OUT)
        {
            var data = new
            {
                sender = new
                {
                    type = senderType.ToString(),
                    id = senderId
                },
                receiver = new
                {
                    type = receiverType.ToString(),
                    id = receiverId
                },
                msgtype = "voice",
                voice = new
                {
                    media_id = mediaId
                }
            };
            return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<QyJsonResult>(accessToken, URL_FORMAT, data, CommonJsonSendType.POST, timeOut);
        }