发送单聊文件消息

        :param sender: 发送人
        :param receiver: 接收人成员 ID
        :param media_id: 文件id，可以调用上传素材文件接口获取, 文件须大于4字节
        :return: 返回的 JSON 数据包
9222
def send_single_file(self, sender, receiver, media_id):
        
        return self.send_file(sender, 'single', receiver, media_id)
1047468
def _get_sender(self, sender):
        
        if isinstance(sender, tuple):
            return "%s <%s>" % sender, sender[0], sender[1]
        else:
            return sender, sender, sender
407430
def send_document(self, chat_id, data, reply_to_message_id=None, caption=None, reply_markup=None,
                      parse_mode=None, disable_notification=None, timeout=None):
        
        return types.Message.de_json(
            apihelper.send_data(self.token, chat_id, data, 'document', reply_to_message_id, reply_markup,
                                parse_mode, disable_notification, timeout, caption=caption))
1155997
def _get_data(self, file_id):
    
        '''  '''
        
        title = '%s._get_data' % self.__class__.__name__
        
    # request file data
        try:
            record_data = self.drive.get_media(fileId=file_id).execute()
        except:
            raise DriveConnectionError(title)
        
        return record_data
446437
public function getMedia($media_id, $is_video = false)
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $result = Tools::httpGet(self::API_URL_PREFIX . self::MEDIA_GET_URL . "access_token={$this->access_token}" . '&media_id=' . $media_id);
        if ($result) {
            if (is_string($result)) {
                $json = json_decode($result, true);
                if (isset($json['errcode'])) {
                    $this->errCode = $json['errcode'];
                    $this->errMsg = $json['errmsg'];
                    return $this->checkRetry(__FUNCTION__, func_get_args());
                }
            }
            return $result;
        }
        return false;
    }
326097
def send_single_image(self, sender, receiver, media_id):
        
        return self.send_image(sender, 'single', receiver, media_id)
134847
function(id) {
		var file;
		
		if (typeof id === 'number') {
			file = this.uploader.files[id];	
		} else {
			file = this.uploader.getFile(id);	
		}
		return file;
	}
14278
def send_image_message(self, user_id, media_id, kf_account=None):
        
        data = {
            "touser": user_id,
            "msgtype": "image",
            "image": {
                "media_id": media_id
            }
        }
        if kf_account is not None:
            data['customservice'] = {'kf_account': kf_account}
        return self.post(
            url="https://api.weixin.qq.com/cgi-bin/message/custom/send",
            data=data
        )
840624
public function send($type, $id, $sender, $msgtype, $content)
    {
        $params = array(
            'receiver' => array(
                'type' => $type,
                'id' => $id
            ),
            'sender' => $sender,
            'msgtype' => $msgtype,
            $msgtype => $content
        );

        return $this->http->jsonPost(self::API_SEND, $params);
    }
513983
public String receiveVideoFrom(String sender, String sdpOffer) throws IOException {
    JsonObject params = new JsonObject();
    params.addProperty(RECEIVEVIDEO_SENDER_PARAM, sender);
    params.addProperty(RECEIVEVIDEO_SDPOFFER_PARAM, sdpOffer);
    JsonElement result = client.sendRequest(RECEIVEVIDEO_METHOD, params);
    return JsonRoomUtils.getResponseProperty(result, RECEIVEVIDEO_SDPANSWER_PARAM, String.class);
  }
1326575
def send(sender_instance):
    
    m = Mailin(
        "https://api.sendinblue.com/v2.0",
        sender_instance._kwargs.get("api_key")
    )
    data = {
        "to": email_list_to_email_dict(sender_instance._recipient_list),
        "cc": email_list_to_email_dict(sender_instance._cc),
        "bcc": email_list_to_email_dict(sender_instance._bcc),
        "from": email_address_to_list(sender_instance._from_email),
        "subject": sender_instance._subject,
    }
    if sender_instance._template.is_html:
        data.update({
            "html": sender_instance._message,
            "headers": {"Content-Type": "text/html; charset=utf-8"}
        })
    else:
        data.update({"text": sender_instance._message})
    if "attachments" in sender_instance._kwargs:
        data["attachment"] = {}
        for attachment in sender_instance._kwargs["attachments"]:
            data["attachment"][attachment[0]] = base64.b64encode(attachment[1])
    result = m.send_email(data)
    if result["code"] != "success":
        raise SendInBlueError(result["message"])
430845
public function delForeverMedia($media_id){
        if (!$this->access_token && !$this->checkAuth()) return false;
        $data = array('media_id' => $media_id);
        $result = $this->http_post(self::API_URL_PREFIX.self::MEDIA_FOREVER_DEL_URL.'access_token='.$this->access_token,self::json_encode($data));
        if ($result)
        {
            $json = json_decode($result,true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            return true;
        }
        return false;
    }
73221
def send(self, sender: PytgbotApiBot):
        
        return sender.send_document(
            # receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id
            document=self.document, chat_id=self.receiver, reply_to_message_id=self.reply_id, thumb=self.thumb, caption=self.caption, parse_mode=self.parse_mode, disable_notification=self.disable_notification, reply_markup=self.reply_markup
        )
321094
public DownloadMaterialResponse getMaterial(String mediaId) {
		DownloadMaterialResponse materialresponse = null;
        String url = BASE_API_URL + "cgi-bin/material/get_material?access_token=#";
        Map<String, String> param = new HashMap<String, String>();
        param.put("media_id", mediaId);
        BaseResponse r = executePost(url, JSONUtil.toJson(param));
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        materialresponse = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
        return materialresponse;
	}
268096
public function getMedia($media_id){
		if (!$this->access_token && !$this->checkAuth()) return false;
		$result = $this->http_get(self::API_URL_PREFIX.self::MEDIA_GET_URL.'access_token='.$this->access_token.'&media_id='.$media_id);
		if ($result)
		{
			$json = json_decode($result,true);
			if (isset($json['errcode'])) {
				$this->errCode = $json['errcode'];
				$this->errMsg = $json['errmsg'];
				return false;
			}
			return $result;
		}
		return false;
	}
1354268
public UploadMediaResponse uploadMedia(MediaType type, File file) {
        UploadMediaResponse response;
        String url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=#&type=" + type.toString();
        BaseResponse r = executePost(url, null, file);
        response = JSONUtil.toBean(r.getErrmsg(), UploadMediaResponse.class);
        return response;
    }
31863
def get_media_stream(self, media_item, format, quality):
        
        result = self._ajax_api.VideoPlayer_GetStandardConfig(
            media_id=media_item.media_id,
            video_format=format,
            video_quality=quality)
        return MediaStream(result)