Skip to content

Commit e546445

Browse files
author
Hyunje Jun
committed
Update docs
1 parent 4a31eab commit e546445

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

docs/pages/api-reference/client.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Client {
1515
replyMessage(replyToken: string, messages: Message | Message[]): Promise<{}>
1616
multicast(to: string[], messages: Message | Message[]): Promise<{}>
1717
getProfile(userId: string): Promise<Profile>
18-
getMessageContent(messageId: string): ReadableStream
18+
getMessageContent(messageId: string): Promise<ReadableStream>
1919
leaveGroup(groupId: string): Promise<{}>
2020
leaveRoom(roomId: string): Promise<{}>
2121
}
@@ -100,25 +100,27 @@ client.getProfile('user_id').then((profile) => {
100100
});
101101
```
102102

103-
### `getMessageContent(messageId: string): ReadableStream`
103+
### `getMessageContent(messageId: string): Promise<ReadableStream>`
104104

105105
It corresponds to the [Content](https://devdocs.line.me/en/#content) API.
106106

107107
The argument is an ID of media messages, such as image, video, and audio. The ID
108108
can be retrieved from a message object of a message event.
109109

110-
Please beware that what it returns is not a promise, but a [readable stream](https://nodejs.org/dist/latest/docs/api/stream.html#stream_readable_streams).
110+
Please beware that what it returns is promise of [readable stream](https://nodejs.org/dist/latest/docs/api/stream.html#stream_readable_streams).
111111
You can pipe the stream into a file, an HTTP response, etc.
112112

113113
``` js
114-
const stream = client.getMessageContent('message_id')
115-
116-
stream.on('data', (chunk) => {
117-
...
118-
})
119-
stream.on('error', (err) => {
120-
...
121-
})
114+
client.getMessageContent('message_id')
115+
.then((stream) => {
116+
stream.on('data', (chunk) => {
117+
...
118+
})
119+
stream.on('error', (err) => {
120+
...
121+
})
122+
stream.pipe(...)
123+
})
122124
```
123125

124126
### `leaveGroup(groupId: string): Promise<{}>`

docs/pages/api-reference/exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SignatureValidationFailed extends Error {
2828
}
2929

3030
class JSONParseError extends Error {
31-
public raw: string;
31+
public raw: any;
3232
}
3333

3434
class RequestError extends Error {

0 commit comments

Comments
 (0)