feat: 新增某人可见接口
This commit is contained in:
parent
b5522acd20
commit
1f1d1f9d1c
@ -39,7 +39,6 @@ const getHeaders = async () => {
|
||||
* @param {string} receive_id 消息接收者的ID,ID类型应与查询参数receive_id_type 对应
|
||||
* @param {MsgType} msg_type 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user
|
||||
* @param {string} content 消息内容,JSON结构序列化后的字符串。不同msg_type对应不同内容
|
||||
* @returns {string} 消息id
|
||||
*/
|
||||
export const sendMsg = async (
|
||||
receive_id_type: ReceiveIDType,
|
||||
@ -61,7 +60,7 @@ export const sendMsg = async (
|
||||
/**
|
||||
* 更新卡片
|
||||
* @param {string} message_id 消息id
|
||||
* @param {*} content 消息内容,JSON结构序列化后的字符串。不同msg_type对应不同内容
|
||||
* @param {string} content 消息内容,JSON结构序列化后的字符串。不同msg_type对应不同内容
|
||||
*/
|
||||
export const updateCard = async (message_id: string, content: string) => {
|
||||
const URL = `https://open.f.mioffice.cn/open-apis/im/v1/messages/${message_id}`;
|
||||
@ -74,3 +73,43 @@ export const updateCard = async (message_id: string, content: string) => {
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* 发送某人可见的卡片
|
||||
* @param {string} chat_id 对话流ID
|
||||
* @param {string} open_id 消息接收者的ID
|
||||
* @param {MsgType} msg_type 消息类型 包括:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user
|
||||
* @param {*} card 消息卡片的描述内容,注意不是String
|
||||
*/
|
||||
export const sendEphemeralMsg = async (
|
||||
chat_id: string,
|
||||
open_id: string,
|
||||
msg_type: MsgType,
|
||||
card: any
|
||||
) => {
|
||||
const URL = `https://open.f.mioffice.cn/open-apis/ephemeral/v1/send`;
|
||||
const headers = await getHeaders();
|
||||
return await manageFetch(() =>
|
||||
fetch(URL, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({ chat_id, open_id, msg_type, card }),
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除某人可见的卡片
|
||||
* @param message_id 消息id
|
||||
*/
|
||||
export const delEphemeralMsg = async (message_id: string) => {
|
||||
const URL = `https://open.f.mioffice.cn/open-apis/ephemeral/v1/delete`;
|
||||
const headers = await getHeaders();
|
||||
return await manageFetch(() =>
|
||||
fetch(URL, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({ message_id }),
|
||||
})
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user