0.0.3 • Published 10 months ago

tcchatsdk v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

chat-tool

chat-tool bridge

usage

import { sdk } from 'tcchatsdk'
sdk.getWorkInfo() // Promise<WorkInfo>
getWorkInfo(): Promise<WorkInfo>;
/**
 * 获取客户信息
 * @returns {Promise<CustomerInfo>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getCustomerInfo().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getCustomerInfo(): Promise<CustomerInfo>;
/**
 * 获取会话信息
 * @returns {Promise<ChatInfo>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getChatInfo().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getChatInfo(): Promise<ChatInfo>;
/**
 * 获取账号信息
 * @returns {Promise<AccountInfo>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getAccountInfo().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getAccountInfo(): Promise<AccountInfo>;
/**
 * 获取会话工具状态
 * @returns {Promise<{ isOnline: boolean }>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getChatToolStatus().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getChatToolStatus(): Promise<{
    isOnline: boolean;
}>;
/**
 * 发送文本消息
 * @param text 文本
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendText('hello world')
 * ```
 */
sendText(text: string): Promise<Record<string, unknown>>;
/**
 * 发送图片消息
 * @param options 图片信息
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendImage({
 *   fileName: '图片名称',
 *   picUrl: '图片地址'
 * })
 * ```
 */
sendImage(options: {
    fileName: string;
    picUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 发送链接消息
 * @param options 链接信息
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendLink({
 *   title: '链接标题',
 *   description: '链接描述',
 *   link: '链接地址',
 *   imageUrl: '链接图片地址'
 * })
 * ```
 */
sendLink(options: {
    title: string;
    description: string;
    link: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 发送小程序消息
 * @param options 小程序数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendMiniProgram({
 *   title: '小程序标题',
 *   appId: '小程序appId',
 *   appName: '小程序名称',
 *   wxUsername: '小程序原始id',
 *   pagePath: '小程序页面路径',
 *   imageUrl: '小程序图片地址'
 * })
 * ```
 */
sendMiniProgram(options: {
    title: string;
    appId: string;
    appName: string;
    wxUsername: string;
    pagePath: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 发送视频消息
 * @param options 视频数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendVideo({
 *   videoName: '视频名称',
 *   videoThumbImageUrl: '视频缩略图地址',
 *   videoUrl: '视频地址'
 * })
 * ```
 */
sendVideo(options: {
    videoName: string;
    videoThumbImageUrl: string;
    videoUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入图片
 * @param url 图片地址
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertImg('图片地址')
 * ```
 */
insertImg(url: string): Promise<Record<string, unknown>>;
/**
 * 插入视频
 * @param options 视频数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertVideo({
 *   url: '视频地址',
 *   videoUrl: '视频缩略图地址'
 * })
 * ```
 */
insertVideo(options: {
    url: string;
    videoUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入艾特消息
 * @param options 艾特消息数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertAt({
 *   label: '艾特消息',
 *   id: 123
 * })
 * ```
 */
insertAt(options: {
    label: string;
    id: number;
}): Promise<Record<string, unknown>>;
/**
 * 插入小程序
 * @param options 小程序数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertProgram({
 *   title: '小程序标题',
 *   appId: '小程序appId',
 *   appName: '小程序名称',
 *   wxUsername: '小程序原始id',
 *   pagePath: '小程序页面路径',
 *   imageUrl: '小程序图片地址'
 * })
 * ```
 */
insertProgram(options: {
    title: string;
    appId: string;
    appName: string;
    wxUsername: string;
    pagePath: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入链接
 * @param options 链接数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertLink({
 *   title: '链接标题',
 *   description: '链接描述',
 *   link: '链接地址',
 *   imageUrl: '链接图片地址'
 * })
 * ```
 */
insertLink(options: {
    title: string;
    description: string;
    link: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入文件链接
 * @param options 文件链接数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertFileLink({
 *   title: '文件链接标题',
 *   description: '文件链接描述',
 *   link: '文件链接地址'
 * })
 * ```
 */
insertFileLink(options: {
    title: string;
    description: string;
    link: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入文本
 * @param text 文本
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertText('文本')
 * ```
 */
insertText(text: string): Promise<Record<string, unknown>>;
/**
 * 显示商品卡片
 * @param target 目标元素,用于定位商品卡片
 * @param speechId 商品id
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.showProductCard(123)
 * ```
 */
showProductSpeech(target: HTMLElement, speechId: string | number): void | Promise<Record<string, unknown>>;
/**
 * 打开新窗口
 * @param url 地址
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.openWindow('https://www.baidu.com')
 * ```
 */
openWindow(url: string): Promise<Record<string, unknown>>;
/**
 * 打开webview弹窗
 * @param url 地址
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.openWebView('https://www.baidu.com')
 * ```
 */
openWebView(url: string): Promise<Record<string, unknown>>;
0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago

1.0.0

10 months ago