egg_server/types/larkServer.ts
zhaoyingbo b992ee0b21
Some checks failed
Egg Server MIflow / build-image (push) Failing after 5m7s
feat(group-agent): 新增支持群组问答
2024-09-25 09:14:10 +00:00

204 lines
3.6 KiB
TypeScript

export namespace LarkServer {
export interface UserSession {
/**
* 访问令牌
*/
access_token: string
/**
* 员工ID
*/
employee_id: string
/**
* 令牌过期时间
*/
expires_in: number
/**
* 开放ID
*/
open_id: string
/**
* 刷新令牌
*/
refresh_token: string
/**
* 会话密钥
*/
session_key: string
/**
* 租户密钥
*/
tenant_key: string
/**
* 联盟ID
*/
union_id: string
}
export interface SuccessDocMeta {
doc_token: string
doc_type: string
title: string
owner_id: string
create_time: string
latest_modify_user: string
latest_modify_time: string
url: string
sec_label_name: string
}
export interface FailedDocMeta {
token: string
code: number
}
export interface ValueRange {
majorDimension: string // 插入维度
range: string // 返回数据的范围,为空时表示查询范围没有数据
revision: number // sheet 的版本号
values: Array<Array<any>> // 查询得到的值
}
export interface SpreadsheetData {
revision: number // sheet 的版本号
spreadsheetToken: string // spreadsheet 的 token
valueRange: ValueRange // 值与范围
}
export interface CopyFileData {
file: {
name: string
parent_token: string
token: string
type: "doc" | "sheet" | "bitable"
url: string
}
}
export interface TableData {
table_id: string
revision: number
name: string
}
export interface ViewData {
view_id: string
view_name: string
view_public_level: "Public" | "Locked" | "Private"
view_type: string
view_private_owner_id?: string
}
export interface MessageData {
message_id: string
root_id: string
parent_id: string
msg_type: MsgType
create_time: string
update_time: string
deleted: boolean
updated: boolean
chat_id: string
sender: {
id: string
id_type: "open_id" | "app_id"
sender_type: "user" | "app"
}
body: {
content: string
}
mentions: any[]
upper_message_id: string
}
export interface ChatGroupData {
avatar: string
chat_id: string
description: string
external: boolean
name: string
owner_id: string
owner_id_type: "open_id" | "user_id"
tenant_key: string
}
export interface BaseRes<T = any> {
code: number
data: T
// 在错误处理中msg会被赋值为message
message: string
}
export interface BaseListRes<T = any> extends BaseRes {
data: {
has_more: boolean
page_token: string
total: number
items: T[]
}
}
export interface SpreadsheetRes extends BaseRes {
data: SpreadsheetData
}
export interface UserSessionRes extends BaseRes {
data: UserSession
}
export interface UserInfoRes extends BaseRes {
data: {
user: any
}
}
export interface BatchUserInfoRes extends BaseRes {
data: {
items: any[]
}
}
export interface BatchDocMetaRes extends BaseRes {
data: {
metas: SuccessDocMeta[]
failed_list: FailedDocMeta[]
}
}
export type ReceiveIDType =
| "open_id"
| "user_id"
| "union_id"
| "email"
| "chat_id"
export type MsgType =
| "text"
| "post"
| "image"
| "file"
| "audio"
| "media"
| "sticker"
| "interactive"
| "share_chat"
| "share_user"
export type FileType =
| "doc"
| "sheet"
| "bitable"
| "file"
| "wiki"
| "docx"
| "folder"
| "mindnote"
| "minutes"
}