@zhin.js/adapter-line 0.1.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 +76 -0
- package/lib/adapter.d.ts +15 -0
- package/lib/adapter.d.ts.map +1 -0
- package/lib/adapter.js +20 -0
- package/lib/adapter.js.map +1 -0
- package/lib/endpoint.d.ts +38 -0
- package/lib/endpoint.d.ts.map +1 -0
- package/lib/endpoint.js +532 -0
- package/lib/endpoint.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +83 -0
- package/lib/index.js.map +1 -0
- package/lib/types.d.ts +112 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +5 -0
- package/lib/types.js.map +1 -0
- package/package.json +74 -0
- package/plugin.yml +3 -0
- package/skills/line/PERMITS.md +17 -0
- package/skills/line/SKILL.md +39 -0
- package/src/adapter.ts +29 -0
- package/src/endpoint.ts +605 -0
- package/src/index.ts +100 -0
- package/src/types.ts +130 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LINE Messaging API 类型定义
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface LineEndpointConfig {
|
|
6
|
+
context: 'line'
|
|
7
|
+
name: string
|
|
8
|
+
channelSecret: string
|
|
9
|
+
channelAccessToken: string
|
|
10
|
+
webhookPath?: string
|
|
11
|
+
apiBaseUrl?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface LineUser {
|
|
15
|
+
userId: string
|
|
16
|
+
displayName?: string
|
|
17
|
+
pictureUrl?: string
|
|
18
|
+
statusMessage?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface LineMessageEvent {
|
|
22
|
+
type: 'message'
|
|
23
|
+
replyToken: string
|
|
24
|
+
source: LineSource
|
|
25
|
+
timestamp: number
|
|
26
|
+
message: LineMessage
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface LineFollowEvent {
|
|
30
|
+
type: 'follow'
|
|
31
|
+
replyToken: string
|
|
32
|
+
source: LineSource
|
|
33
|
+
timestamp: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface LineUnfollowEvent {
|
|
37
|
+
type: 'unfollow'
|
|
38
|
+
source: LineSource
|
|
39
|
+
timestamp: number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface LineJoinEvent {
|
|
43
|
+
type: 'join'
|
|
44
|
+
replyToken: string
|
|
45
|
+
source: LineSource
|
|
46
|
+
timestamp: number
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface LineLeaveEvent {
|
|
50
|
+
type: 'leave'
|
|
51
|
+
source: LineSource
|
|
52
|
+
timestamp: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface LinePostbackEvent {
|
|
56
|
+
type: 'postback'
|
|
57
|
+
replyToken: string
|
|
58
|
+
source: LineSource
|
|
59
|
+
timestamp: number
|
|
60
|
+
postback: {
|
|
61
|
+
data: string
|
|
62
|
+
params?: Record<string, string>
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type LineEvent =
|
|
67
|
+
| LineMessageEvent
|
|
68
|
+
| LineFollowEvent
|
|
69
|
+
| LineUnfollowEvent
|
|
70
|
+
| LineJoinEvent
|
|
71
|
+
| LineLeaveEvent
|
|
72
|
+
| LinePostbackEvent
|
|
73
|
+
|
|
74
|
+
export interface LineSource {
|
|
75
|
+
type: 'user' | 'group' | 'room'
|
|
76
|
+
userId?: string
|
|
77
|
+
groupId?: string
|
|
78
|
+
roomId?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface LineMessage {
|
|
82
|
+
id: string
|
|
83
|
+
type: 'text' | 'image' | 'video' | 'audio' | 'file' | 'location' | 'sticker'
|
|
84
|
+
text?: string
|
|
85
|
+
fileName?: string
|
|
86
|
+
fileSize?: number
|
|
87
|
+
title?: string
|
|
88
|
+
address?: string
|
|
89
|
+
latitude?: number
|
|
90
|
+
longitude?: number
|
|
91
|
+
packageId?: string
|
|
92
|
+
stickerId?: string
|
|
93
|
+
stickerResourceType?: string
|
|
94
|
+
duration?: number
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface LineWebhookBody {
|
|
98
|
+
destination: string
|
|
99
|
+
events: LineEvent[]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface LineReplyMessage {
|
|
103
|
+
type: 'text' | 'image' | 'video' | 'audio' | 'location' | 'sticker' | 'flex'
|
|
104
|
+
text?: string
|
|
105
|
+
originalContentUrl?: string
|
|
106
|
+
previewImageUrl?: string
|
|
107
|
+
packageId?: string
|
|
108
|
+
stickerId?: string
|
|
109
|
+
title?: string
|
|
110
|
+
address?: string
|
|
111
|
+
latitude?: number
|
|
112
|
+
longitude?: number
|
|
113
|
+
duration?: number
|
|
114
|
+
altText?: string
|
|
115
|
+
contents?: Record<string, unknown>
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface LineReplyRequest {
|
|
119
|
+
replyToken: string
|
|
120
|
+
messages: LineReplyMessage[]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface LinePushRequest {
|
|
124
|
+
to: string
|
|
125
|
+
messages: LineReplyMessage[]
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface LineApiResponse {
|
|
129
|
+
sentMessages?: Array<{ id: string; quoteToken?: string }>
|
|
130
|
+
}
|