@@ -9,19 +9,37 @@ corresponding to [messaging APIs](https://developers.line.me/en/docs/messaging-a
99class Client {
1010 public config: ClientConfig
1111
12- constructor (config : ClientConfig )
12+ constructor (config : ClientConfig ) {}
1313
14- pushMessage(to : string , messages : Message | Message []): Promise <{}>
15- replyMessage(replyToken : string , messages : Message | Message []): Promise <{}>
16- multicast(to : string [], messages : Message | Message []): Promise <{}>
14+ // Message
15+ pushMessage(to : string , messages : Message | Message []): Promise <any >
16+ replyMessage(replyToken : string , messages : Message | Message []): Promise <any >
17+ multicast(to : string [], messages : Message | Message []): Promise <any >
18+ getMessageContent(messageId : string ): Promise <Readable >
19+
20+ // Profile
1721 getProfile(userId : string ): Promise <Profile >
22+
23+ // Group
1824 getGroupMemberProfile(groupId : string , userId : string ): Promise <Profile >
19- getRoomMemberProfile(roomId : string , userId : string ): Promise <Profile >
2025 getGroupMemberIds(groupId : string ): Promise <string []>
26+ leaveGroup(groupId : string ): Promise <any >
27+
28+ // Room
29+ getRoomMemberProfile(roomId : string , userId : string ): Promise <Profile >
2130 getRoomMemberIds(roomId : string ): Promise <string []>
22- getMessageContent(messageId : string ): Promise <ReadableStream >
23- leaveGroup(groupId : string ): Promise <{}>
24- leaveRoom(roomId : string ): Promise <{}>
31+ leaveRoom(roomId : string ): Promise <any >
32+
33+ // Rich menu
34+ getRichMenu(richMenuId : string ): Promise <RichMenuResponse >
35+ createRichMenu(richMenu : RichMenu ): Promise <string >
36+ deleteRichMenu(richMenuId : string ): Promise <any >
37+ getRichMenuIdOfUser(userId : string ): Promise <string >
38+ linkRichMenuToUser(userId : string , richMenuId : string ): Promise <any >
39+ unlinkRichMenuFromUser(userId : string , richMenuId : string ): Promise <any >
40+ getRichMenuImage(richMenuId : string ): Promise <Readable >
41+ setRichMenuImage(richMenuId : string , data : Buffer | Readable , contentType ? : string ): Promise <any >
42+ getRichMenuList(): Promise <Array <RichMenuResponse >>
2543}
2644```
2745
@@ -51,7 +69,9 @@ goes wrong, such as HTTP errors or parsing errors. You can catch them with the
5169` .catch() ` method of the promises. The detailed error handling is explained
5270in [ the Client guide] ( ../guide/client.md ) .
5371
54- ### ` pushMessage(to: string, messages: Message | Message[]): Promise<{}> `
72+ ### Message
73+
74+ #### ` pushMessage(to: string, messages: Message | Message[]): Promise<any> `
5575
5676It corresponds to the [ Push message] ( https://developers.line.me/en/docs/messaging-api/reference/#send-push-message ) API.
5777
@@ -64,7 +84,7 @@ client.pushMessage('user_or_group_or_room_id', {
6484})
6585```
6686
67- ### ` replyMessage(replyToken: string, messages: Message | Message[]): Promise<{} > `
87+ #### ` replyMessage(replyToken: string, messages: Message | Message[]): Promise<any > `
6888
6989It corresponds to the [ Reply message] ( https://developers.line.me/en/docs/messaging-api/reference/#send-reply-message ) API.
7090
@@ -79,7 +99,7 @@ client.replyMessage(event.replyToken, {
7999})
80100```
81101
82- ### ` multicast(to: string[], messages: Message | Message[]): Promise<{} > `
102+ #### ` multicast(to: string[], messages: Message | Message[]): Promise<any > `
83103
84104It corresponds to the [ Multicast] ( https://developers.line.me/en/docs/messaging-api/reference/#send-multicast-messages ) API.
85105
@@ -93,7 +113,32 @@ client.multicast(['user_id_1', 'user_id_2', 'room_id_1'], {
93113})
94114```
95115
96- ### ` getProfile(userId: string): Promise<Profile> `
116+ #### ` getMessageContent(messageId: string): Promise<Readable> `
117+
118+ It corresponds to the [ Content] ( https://developers.line.me/en/docs/messaging-api/reference/#get-content ) API.
119+
120+ The argument is an ID of media messages, such as image, video, and audio. The ID
121+ can be retrieved from a message object of a message event.
122+
123+ Please beware that what it returns is promise of [ readable stream] ( https://nodejs.org/dist/latest/docs/api/stream.html#stream_readable_streams ) .
124+ You can pipe the stream into a file, an HTTP response, etc.
125+
126+ ``` js
127+ client .getMessageContent (' message_id' )
128+ .then ((stream ) => {
129+ stream .on (' data' , (chunk ) => {
130+ ...
131+ })
132+ stream .on (' error' , (err ) => {
133+ ...
134+ })
135+ stream .pipe (... )
136+ })
137+ ```
138+
139+ ### Profile
140+
141+ #### ` getProfile(userId: string): Promise<Profile> `
97142
98143It corresponds to the [ Profile] ( https://developers.line.me/en/docs/messaging-api/reference/#get-profile ) API.
99144
@@ -105,7 +150,9 @@ client.getProfile('user_id').then((profile) => {
105150});
106151```
107152
108- ### ` getGroupMemberProfile(groupId: string, userId: string): Promise<Profile> `
153+ ### Group
154+
155+ #### ` getGroupMemberProfile(groupId: string, userId: string): Promise<Profile> `
109156
110157It corresponds to the [ Group Member Profile] ( https://developers.line.me/en/docs/messaging-api/reference/#get-group-member-profile ) API.
111158
@@ -118,7 +165,33 @@ client.getGroupMemberProfile('group_id', 'user_id').then((profile) => {
118165})
119166```
120167
121- ### ` getRoomMemberProfile(roomId: string, userId: string): Promise<Profile> `
168+ #### ` getGroupMemberIds(groupId: string): Promise<string[]> `
169+
170+ It corresponds to the [ Group Member IDs] ( https://developers.line.me/en/docs/messaging-api/reference/#get-group-member-user-ids ) API.
171+
172+ * FYI: This feature is only available for LINE@ Approved accounts or official accounts.*
173+
174+ The argument is a group ID and the method returns a promise of an array of user IDs.
175+
176+ ``` js
177+ client .getGroupMemberIds (' group_id' ).then ((ids ) => {
178+ ids .forEach ((id ) => console .log (id));
179+ })
180+ ```
181+
182+ #### ` leaveGroup(groupId: string): Promise<any> `
183+
184+ It corresponds to the [ Leave group] ( https://developers.line.me/en/docs/messaging-api/reference/#leave-group ) API.
185+
186+ The argument is a group ID.
187+
188+ ``` js
189+ client .leaveGroup (' group_id' )
190+ ```
191+
192+ ### Room
193+
194+ #### ` getRoomMemberProfile(roomId: string, userId: string): Promise<Profile> `
122195
123196It corresponds to the [ Room Member Profile] ( https://developers.line.me/en/docs/messaging-api/reference/#get-room-member-profile ) API.
124197
@@ -131,46 +204,111 @@ client.getRoomMemberProfile('room_id', 'user_id').then((profile) => {
131204})
132205```
133206
134- ### ` getGroupMemberIds(groupId : string): Promise<string[]>`
207+ #### ` getRoomMemberIds(roomId : string): Promise<string[]>`
135208
136- It corresponds to the [ Group Member IDs] ( https://developers.line.me/en/docs/messaging-api/reference/#get-group -member-user-ids ) API.
209+ It corresponds to the [ Room Member IDs] ( https://developers.line.me/en/docs/messaging-api/reference/#get-room -member-user-ids ) API.
137210
138211* FYI: This feature is only available for LINE@ Approved accounts or official accounts.*
139212
140- The argument is a group ID and the method returns a promise of an array of user IDs.
213+ The argument is a room ID and the method returns a promise of an array of user IDs.
141214
142215``` js
143- client .getGroupMemberIds ( ' group_id ' ).then ((ids ) => {
216+ client .getRoomMemberIds ( ' room_id ' ).then ((ids ) => {
144217 ids .forEach ((id ) => console .log (id));
145218})
146219```
147220
148- ### ` getRoomMemberIds (roomId: string): Promise<string[] >`
221+ #### ` leaveRoom (roomId: string): Promise<any >`
149222
150- It corresponds to the [ Room Member IDs ] ( https://developers.line.me/en/docs/messaging-api/reference/#get -room-member-user-ids ) API.
223+ It corresponds to the [ Leave room ] ( https://developers.line.me/en/docs/messaging-api/reference/#leave -room ) API.
151224
152- * FYI: This feature is only available for LINE@ Approved accounts or official accounts. *
225+ The argument is a room ID.
153226
154- The argument is a room ID and the method returns a promise of an array of user IDs.
227+ ``` js
228+ client .leaveGroup (' room_id' )
229+ ```
230+
231+ ### Rich menu
232+
233+ #### ` getRichMenu(richMenuId: string): Promise<RichMenuResponse> `
234+
235+ It corresponds to the [ Get rich menu] ( https://developers.line.me/en/docs/messaging-api/reference/#get-rich-menu ) API.
236+
237+ The argument is a rich menu ID. The return type is [ a rich menu response object] ( https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object ) .
155238
156239``` js
157- client .getRoomMemberIds (' room_id' ).then ((ids ) => {
158- ids .forEach ((id ) => console .log (id));
240+ client .getRichMenu (' rich_menu_id' ).then ((richMenu ) => {
241+ console .log (richMenu .size );
242+ console .log (richMenu .areas [0 ].bounds );
159243})
160244```
161245
162- ### ` getMessageContent(messageId: string ): Promise<ReadableStream >`
246+ #### ` createRichMenu(richMenu: RichMenu ): Promise<string >`
163247
164- It corresponds to the [ Content ] ( https://developers.line.me/en/docs/messaging-api/reference/#get-content ) API.
248+ It corresponds to the [ Create rich menu ] ( https://developers.line.me/en/docs/messaging-api/reference/#create-rich-menu ) API.
165249
166- The argument is an ID of media messages, such as image, video, and audio. The ID
167- can be retrieved from a message object of a message event.
250+ The argument is [ a rich menu object] ( https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-object ) .
251+ For the detail of the object format, please refer to the official documentation.
252+ It returns the result rich menu ID.
253+
254+ ``` js
255+ client .createRichMenu ({ size: { width: 2500 , height: 1686 }, ... })
256+ .then ((richMenuId ) => console .log (richMenuId))
257+ ```
258+
259+ #### ` deleteRichMenu(richMenuId: string): Promise<any> `
260+
261+ It corresponds to the [ Delete rich menu] ( https://developers.line.me/en/docs/messaging-api/reference/#delete-rich-menu ) API.
262+
263+ The argument is a rich menu ID.
264+
265+ ``` js
266+ client .deleteRichMenu (' rich_menu_id' )
267+ ```
268+
269+ #### ` getRichMenuIdOfUser(userId: string): Promise<string> `
270+
271+ It corresponds to the [ Get rich menu ID of user] ( https://developers.line.me/en/docs/messaging-api/reference/#get-rich-menu-id-of-user ) API.
272+
273+ The argument is a user ID. It returns a rich menu ID to be used with other APIs.
274+
275+ ``` js
276+ client .getRichMenuIdOfUser (' user_id' ).then ((richMenuId ) => {
277+ console .log (richMenuId);
278+ })
279+ ```
280+
281+ #### ` linkRichMenuToUser(userId: string, richMenuId: string): Promise<any> `
282+
283+ It corresponds to the [ Link rich menu to user] ( https://developers.line.me/en/docs/messaging-api/reference/#link-rich-menu-to-user ) API.
284+
285+ The arguments are a user ID and a rich menu ID.
286+
287+ ``` js
288+ client .linkRichMenuToUser (' user_id' , ' rich_menu_id' )
289+ ```
290+
291+ #### ` unlinkRichMenuFromUser(userId: string, richMenuId: string): Promise<any> `
292+
293+ It corresponds to the [ Unlink rich menu from user] ( https://developers.line.me/en/docs/messaging-api/reference/#unlink-rich-menu-from-user ) API.
294+
295+ The arguments are a user ID and a rich menu ID.
296+
297+ ``` js
298+ client .unlinkRichMenuFromUser (' user_id' , ' rich_menu_id' )
299+ ```
300+
301+ #### ` getRichMenuImage(richMenuId: string): Promise<Readable> `
302+
303+ It corresponds to the [ Download rich menu image] ( https://developers.line.me/en/docs/messaging-api/reference/#download-rich-menu-image ) API.
304+
305+ The argument is a rich menu ID.
168306
169307Please beware that what it returns is promise of [ readable stream] ( https://nodejs.org/dist/latest/docs/api/stream.html#stream_readable_streams ) .
170308You can pipe the stream into a file, an HTTP response, etc.
171309
172310``` js
173- client .getMessageContent ( ' message_id ' )
311+ client .getRichMenuImage ( ' rich_menu_id ' )
174312 .then ((stream ) => {
175313 stream .on (' data' , (chunk ) => {
176314 ...
@@ -182,22 +320,22 @@ client.getMessageContent('message_id')
182320 })
183321```
184322
185- ### ` leaveGroup(groupId : string): Promise<{} >`
323+ #### ` setRichMenuImage(richMenuId : string, data: Buffer | Readable, contentType?: string ): Promise<any >`
186324
187- It corresponds to the [ Leave group ] ( https://developers.line.me/en/docs/messaging-api/reference/#leave-group ) API.
325+ It corresponds to the [ Upload rich menu image ] ( https://developers.line.me/en/docs/messaging-api/reference/#upload-rich-menu-image ) API.
188326
189- The argument is a group ID.
327+ The 1st argument is a rich menu ID. For 2nd argument, a buffer or a readable
328+ stream of an image should be provided. For the restriction of the image, please
329+ refer to the official documentation. The last argument is optional. If it's not
330+ provided, the mime type will be guessted from ` data ` . Only ` image/jpeg ` or
331+ ` image/png ` is allowed for the content type.
190332
191333``` js
192- client .leaveGroup ( ' group_id ' )
334+ client .setRichMenuImage ( ' rich_menu_id ' , fs . createReadStream ( ' ./some_image.png ' ) )
193335```
194336
195- ### ` leaveRoom(roomId: string): Promise<{}> `
196-
197- It corresponds to the [ Leave room] ( https://developers.line.me/en/docs/messaging-api/reference/#leave-room ) API.
337+ #### ` getRichMenuList(): Promise<Array<RichMenuResponse>> `
198338
199- The argument is a room ID .
339+ It corresponds to the [ Get rich menu list ] ( https://developers.line.me/en/docs/messaging-api/reference/#get-rich-menu-list ) API .
200340
201- ``` js
202- client .leaveGroup (' room_id' )
203- ```
341+ The return type is a list of [ rich menu response objects] ( https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object ) .
0 commit comments