@teamclaw/feishu-agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/package.json +49 -0
- package/src/cli/commands/auth.ts +309 -0
- package/src/cli/commands/calendar.ts +305 -0
- package/src/cli/commands/config.ts +48 -0
- package/src/cli/commands/contact.ts +90 -0
- package/src/cli/commands/init.ts +128 -0
- package/src/cli/commands/setup.ts +327 -0
- package/src/cli/commands/todo.ts +114 -0
- package/src/cli/commands/whoami.ts +63 -0
- package/src/cli/index.ts +68 -0
- package/src/core/auth-manager.ts +214 -0
- package/src/core/calendar.ts +276 -0
- package/src/core/client.ts +100 -0
- package/src/core/config.ts +174 -0
- package/src/core/contact.ts +83 -0
- package/src/core/introspection.ts +103 -0
- package/src/core/todo.ts +109 -0
- package/src/index.ts +76 -0
- package/src/types/index.ts +199 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
export interface FeishuConfig {
|
|
2
|
+
appId: string;
|
|
3
|
+
appSecret: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
userAccessToken?: string; // Optional: for OAuth 2.0 user authorization
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface TenantAccessTokenResponse {
|
|
9
|
+
code: number;
|
|
10
|
+
msg: string;
|
|
11
|
+
tenant_access_token: string;
|
|
12
|
+
expire: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FeishuErrorResponse {
|
|
16
|
+
code: number;
|
|
17
|
+
msg: string;
|
|
18
|
+
error?: any;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class FeishuError extends Error {
|
|
22
|
+
code: number;
|
|
23
|
+
rawResponse?: any;
|
|
24
|
+
constructor(message: string, code: number, rawResponse?: any) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.code = code;
|
|
27
|
+
this.rawResponse = rawResponse;
|
|
28
|
+
this.name = "FeishuError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface FeishuBase {
|
|
33
|
+
app_token: string;
|
|
34
|
+
name: string;
|
|
35
|
+
revision: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface FeishuTable {
|
|
39
|
+
table_id: string;
|
|
40
|
+
revision: number;
|
|
41
|
+
name: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface FeishuField {
|
|
45
|
+
field_id: string;
|
|
46
|
+
field_name: string;
|
|
47
|
+
type: number;
|
|
48
|
+
property?: any;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ListTablesResponse {
|
|
52
|
+
code: number;
|
|
53
|
+
msg: string;
|
|
54
|
+
data: {
|
|
55
|
+
items: FeishuTable[];
|
|
56
|
+
page_token: string;
|
|
57
|
+
has_more: boolean;
|
|
58
|
+
total: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ListFieldsResponse {
|
|
63
|
+
code: number;
|
|
64
|
+
msg: string;
|
|
65
|
+
data: {
|
|
66
|
+
items: FeishuField[];
|
|
67
|
+
page_token: string;
|
|
68
|
+
has_more: boolean;
|
|
69
|
+
total: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface CalendarTime {
|
|
74
|
+
timestamp?: string; // Seconds as string
|
|
75
|
+
date?: string; // YYYY-MM-DD
|
|
76
|
+
timezone?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface CalendarEvent {
|
|
80
|
+
event_id?: string;
|
|
81
|
+
summary: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
start_time: CalendarTime;
|
|
84
|
+
end_time: CalendarTime;
|
|
85
|
+
calendar_id?: string;
|
|
86
|
+
attendees?: CalendarAttendee[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ListCalendarsResponse {
|
|
90
|
+
code: number;
|
|
91
|
+
msg: string;
|
|
92
|
+
data: {
|
|
93
|
+
calendar_list: Array<{
|
|
94
|
+
calendar_id: string;
|
|
95
|
+
summary: string;
|
|
96
|
+
description: string;
|
|
97
|
+
type: "primary" | "shared" | "google" | "resource" | "exchange";
|
|
98
|
+
role: "owner" | "writer" | "reader" | "free_busy_reader";
|
|
99
|
+
}>;
|
|
100
|
+
page_token: string;
|
|
101
|
+
sync_token: string;
|
|
102
|
+
has_more: boolean;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface ListEventsResponse {
|
|
107
|
+
code: number;
|
|
108
|
+
msg: string;
|
|
109
|
+
data: {
|
|
110
|
+
items: CalendarEvent[];
|
|
111
|
+
page_token: string;
|
|
112
|
+
sync_token: string;
|
|
113
|
+
has_more: boolean;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface CreateEventResponse {
|
|
118
|
+
code: number;
|
|
119
|
+
msg: string;
|
|
120
|
+
data: {
|
|
121
|
+
event: CalendarEvent;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface CalendarAttendee {
|
|
126
|
+
type: "user" | "chat" | "resource" | "third_party";
|
|
127
|
+
is_optional?: boolean;
|
|
128
|
+
user_id?: string;
|
|
129
|
+
chat_id?: string;
|
|
130
|
+
resource_id?: string;
|
|
131
|
+
third_party_email?: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface CreateCalendarPayload {
|
|
135
|
+
summary?: string;
|
|
136
|
+
description?: string;
|
|
137
|
+
permissions?: "private" | "show_only_free_busy" | "public";
|
|
138
|
+
color?: number;
|
|
139
|
+
summary_alias?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface FreeBusyPayload {
|
|
143
|
+
time_min: string; // RFC3339
|
|
144
|
+
time_max: string; // RFC3339
|
|
145
|
+
user_id?: string;
|
|
146
|
+
room_id?: string;
|
|
147
|
+
include_external?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface FreeBusyItem {
|
|
151
|
+
start_time: string;
|
|
152
|
+
end_time: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface FreeBusyResponse {
|
|
156
|
+
code: number;
|
|
157
|
+
msg: string;
|
|
158
|
+
data: {
|
|
159
|
+
freebusy_list: Array<{
|
|
160
|
+
start_time: string;
|
|
161
|
+
end_time: string;
|
|
162
|
+
}>;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface UserInfo {
|
|
167
|
+
user_id: string;
|
|
168
|
+
union_id: string;
|
|
169
|
+
open_id?: string;
|
|
170
|
+
name: string;
|
|
171
|
+
en_name?: string;
|
|
172
|
+
email?: string;
|
|
173
|
+
mobile?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface ListUsersResponse {
|
|
177
|
+
code: number;
|
|
178
|
+
msg: string;
|
|
179
|
+
data: {
|
|
180
|
+
has_more: boolean;
|
|
181
|
+
page_token: string;
|
|
182
|
+
items: UserInfo[];
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface CreateCalendarResponse {
|
|
187
|
+
code: number;
|
|
188
|
+
msg: string;
|
|
189
|
+
data: {
|
|
190
|
+
calendar: {
|
|
191
|
+
calendar_id: string;
|
|
192
|
+
summary: string;
|
|
193
|
+
description: string;
|
|
194
|
+
permissions: string;
|
|
195
|
+
type: string;
|
|
196
|
+
role: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
}
|