Skip to content

Commit a4bcf63

Browse files
authored
Merge pull request #269 from line/next
Release 7.2.0
2 parents d9472ee + 8a3bcf6 commit a4bcf63

File tree

6 files changed

+263
-7
lines changed

6 files changed

+263
-7
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 7.2.0 (18 Sep 2020)
2+
3+
### Feature
4+
* Messaging API - December 2020 update (#268)
5+
* Messaging API - October 2020 update (#261)(#264)
6+
* update some Flex Message Update 2 (#265)
7+
8+
### Misc
9+
* Update dependencies (#267)
10+
111
## 7.1.0 (18 Sep 2020)
212

313
### Feature

docs/api-reference/client.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Client {
5454
linkRichMenuToUser(userId: string, richMenuId: string): Promise<any>
5555
unlinkRichMenuFromUser(userId: string, richMenuId: string): Promise<any>
5656
linkRichMenuToMultipleUsers(richMenuId: string, userIds: string[]): Promise<any>
57-
unlinkRichMenusFromMultipleUsers(userIds: string[]): Promise<any>
57+
unlinkRichMenusFromMultipleUsers(userIds: string[]): Promise<any>
5858
getRichMenuImage(richMenuId: string): Promise<Readable>
5959
setRichMenuImage(richMenuId: string, data: Buffer | Readable, contentType?: string): Promise<any>
6060
getRichMenuList(): Promise<Array<RichMenuResponse>>
@@ -172,6 +172,23 @@ class Client {
172172
changeAudienceGroupAuthorityLevel(
173173
authorityLevel: Types.AudienceGroupAuthorityLevel
174174
): Promise<{}>
175+
176+
// Bot
177+
getBotInfo(): Promise<BotInfoResponse>
178+
179+
// Webhook
180+
setWebhookEndpointUrl(endpoint: string): Promise<{}>
181+
getWebhookEndpointInfo(): Promise<{
182+
endpoint: string;
183+
active: boolean;
184+
}>
185+
testWebhookEndpoint(endpoint?: string): Promise<{
186+
success: boolean;
187+
timestamp: string;
188+
statusCode: number;
189+
reason: string;
190+
detail: string;
191+
}>
175192
}
176193
```
177194

@@ -667,3 +684,24 @@ It corresponds to the [Get number of followers](https://developers.line.biz/en/r
667684
#### `getFriendDemographics(): Promise<Types.FriendDemographics>`
668685

669686
It corresponds to the [Get friend demographics](https://developers.line.biz/en/reference/messaging-api/#get-demographic) API.
687+
688+
### Bot
689+
690+
#### `getBotInfo(): Promise<BotInfoResponse>`
691+
692+
It corresponds to the [Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info) API.
693+
694+
### Webhook
695+
696+
#### `setWebhookEndpointUrl(endpoint: string): Promise<{}}>`
697+
698+
It corresponds to the [Set webhook endpoint URL](https://developers.line.biz/en/reference/messaging-api/#set-webhook-endpoint-url) API.
699+
700+
701+
#### `getWebhookEndpointInfo(): Promise<Types.WebhookEndpointInfoResponse>`
702+
703+
It corresponds to the [Get webhook endpoint information](https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information) API.
704+
705+
#### `testWebhookEndpoint(endpoint?: string): Promise<Types.TestWebhookEndpointResponse>`
706+
707+
It corresponds to the [Test webhook endpoint](https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint) API.

lib/client.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,35 @@ export default class Client {
630630
);
631631
return ensureJSON(res);
632632
}
633+
634+
public async getBotInfo(): Promise<Types.BotInfoResponse> {
635+
const res = await this.http.get<Types.BotInfoResponse>(
636+
`${MESSAGING_API_PREFIX}/info`,
637+
);
638+
return ensureJSON(res);
639+
}
640+
641+
public async setWebhookEndpointUrl(endpoint: string) {
642+
return this.http.put<{}>(
643+
`${MESSAGING_API_PREFIX}/channel/webhook/endpoint`,
644+
{ endpoint },
645+
);
646+
}
647+
648+
public async getWebhookEndpointInfo() {
649+
const res = await this.http.get<Types.WebhookEndpointInfoResponse>(
650+
`${MESSAGING_API_PREFIX}/channel/webhook/endpoint`,
651+
);
652+
return ensureJSON(res);
653+
}
654+
655+
public async testWebhookEndpoint(endpoint?: string) {
656+
const res = await this.http.post<Types.TestWebhookEndpointResponse>(
657+
`${MESSAGING_API_PREFIX}/channel/webhook/test`,
658+
{ endpoint },
659+
);
660+
return ensureJSON(res);
661+
}
633662
}
634663

635664
export class OAuth {

lib/types.ts

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,9 @@ export type StickerEventMessage = {
479479
| "ANIMATION_SOUND"
480480
| "POPUP"
481481
| "POPUP_SOUND"
482-
| "NAME_TEXT";
482+
| "NAME_TEXT"
483+
| "PER_STICKER_TEXT";
484+
keywords: string[];
483485
} & EventMessageBase;
484486

485487
export type Postback = {
@@ -888,7 +890,7 @@ export type FlexBlockStyle = {
888890
export type FlexCarousel = {
889891
type: "carousel";
890892
/**
891-
* (Max: 10 bubbles)
893+
* (Max: 12 bubbles)
892894
*/
893895
contents: FlexBubble[];
894896
};
@@ -1059,6 +1061,25 @@ export type FlexBox = {
10591061
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
10601062
*/
10611063
action?: Action;
1064+
/**
1065+
* How child elements are aligned along the main axis of the parent element. If the
1066+
* parent element is a horizontal box, this only takes effect when its child elements have
1067+
* their `flex` property set equal to 0. For more information, see [Arranging a box's child elements and free space](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#justify-property)
1068+
* in the Messaging API documentation.
1069+
*/
1070+
justifyContent?:
1071+
| "flex-start"
1072+
| "center"
1073+
| "flex-end"
1074+
| "space-between"
1075+
| "space-around"
1076+
| "space-evenly";
1077+
/**
1078+
* How child elements are aligned along the cross axis of the parent element. For more
1079+
* information, see [Arranging a box's child elements and free space](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#justify-property) in the Messaging API documentation.
1080+
*/
1081+
alignItems?: "flex-start" | "center" | "flex-end";
1082+
background?: Background;
10621083
} & Offset;
10631084

10641085
export type Offset = {
@@ -1093,6 +1114,49 @@ export type Offset = {
10931114
offsetEnd?: string;
10941115
};
10951116

1117+
export type Background = {
1118+
/**
1119+
* The type of background used. Specify these values:
1120+
* - `linearGradient`: Linear gradient. For more information, see [Linear gradient backgrounds](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg) in the Messaging API documentation.
1121+
*/
1122+
type: "linearGradient";
1123+
/**
1124+
* The angle at which a linear gradient moves. Specify the angle using an integer value
1125+
* like `90deg` (90 degrees) or a decimal number like `23.5deg` (23.5 degrees) in the
1126+
* half-open interval [0, 360). The direction of the linear gradient rotates clockwise as the
1127+
* angle increases. Given a value of `0deg`, the gradient starts at the bottom and ends at
1128+
* the top; given a value of `45deg`, the gradient starts at the bottom-left corner and ends
1129+
* at the top-right corner; given a value of 90deg, the gradient starts at the left and ends
1130+
* at the right; and given a value of `180deg`, the gradient starts at the top and ends at
1131+
* the bottom. For more information, see [Direction (angle) of linear gradient backgrounds](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-angle) in the Messaging API documentation.
1132+
*/
1133+
angle: string;
1134+
/**
1135+
* The color at the gradient's starting point. Use a hexadecimal color code in the
1136+
* `#RRGGBB` or `#RRGGBBAA` format.
1137+
*/
1138+
startColor: string;
1139+
/**
1140+
* The color at the gradient's ending point. Use a hexadecimal color code in the
1141+
* `#RRGGBB` or `#RRGGBBAA` format.
1142+
*/
1143+
endColor: string;
1144+
/**
1145+
* The color in the middle of the gradient. Use a hexadecimal color code in the `#RRGGBB`
1146+
* or `#RRGGBBAA` format. Specify a value for the `background.centerColor` property to
1147+
* create a gradient that has three colors. For more information, see [Intermediate color stops for linear gradients](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-center-color) in the
1148+
* Messaging API documentation.
1149+
*/
1150+
centerColor?: string;
1151+
/**
1152+
* The position of the intermediate color stop. Specify an integer or decimal value
1153+
* between `0%` (the starting point) and `100%` (the ending point). This is `50%` by
1154+
* default. For more information, see [Intermediate color stops for linear gradients](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#linear-gradient-bg-center-color) in the
1155+
* Messaging API documentation.
1156+
*/
1157+
centerPosition?: string;
1158+
};
1159+
10961160
/**
10971161
* This component draws a button.
10981162
*
@@ -1161,6 +1225,18 @@ export type FlexButton = {
11611225
* property will be ignored.
11621226
*/
11631227
gravity?: "top" | "bottom" | "center";
1228+
/**
1229+
* The method by which to adjust the text font size. Specify this value:
1230+
*
1231+
* - `shrink-to-fit`: Automatically shrink the font
1232+
* size to fit the width of the component. This
1233+
* property takes a "best-effort" approach that may
1234+
* work differently—or not at all!—on some platforms.
1235+
* For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
1236+
* in the Messaging API documentation.
1237+
* - LINE 10.13.0 or later for iOS and Android
1238+
*/
1239+
adjustMode?: "shrink-to-fit";
11641240
} & Offset;
11651241

11661242
/**
@@ -1207,8 +1283,10 @@ export type FlexIcon = {
12071283
* Maximum size of the icon width.
12081284
* The size increases in the order of listing.
12091285
* The default value is `md`.
1286+
* For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
12101287
*/
12111288
size?:
1289+
| string
12121290
| "xxs"
12131291
| "xs"
12141292
| "sm"
@@ -1290,8 +1368,10 @@ export type FlexImage = {
12901368
* Maximum size of the image width.
12911369
* The size increases in the order of listing.
12921370
* The default value is `md`.
1371+
* For more information, see [Image size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#image-size) in the Messaging API documentation.
12931372
*/
12941373
size?:
1374+
| string
12951375
| "xxs"
12961376
| "xs"
12971377
| "sm"
@@ -1359,6 +1439,7 @@ export type FlexSeparator = {
13591439
/**
13601440
* This is an invisible component that places a fixed-size space at the
13611441
* beginning or end of the box.
1442+
* @deprecated
13621443
*/
13631444
export type FlexSpacer = {
13641445
type: "spacer";
@@ -1377,6 +1458,18 @@ export type FlexText = {
13771458
* Array of spans. Be sure to set either one of the `text` property or `contents` property. If you set the `contents` property, `text` is ignored.
13781459
*/
13791460
contents?: FlexSpan[];
1461+
/**
1462+
* The method by which to adjust the text font size. Specify this value:
1463+
*
1464+
* - `shrink-to-fit`: Automatically shrink the font
1465+
* size to fit the width of the component. This
1466+
* property takes a "best-effort" approach that may
1467+
* work differently—or not at all!—on some platforms.
1468+
* For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
1469+
* in the Messaging API documentation.
1470+
* - LINE 10.13.0 or later for iOS and Android
1471+
*/
1472+
adjustMode?: "shrink-to-fit";
13801473
/**
13811474
* The ratio of the width or height of this box within the parent box.
13821475
*
@@ -1403,8 +1496,10 @@ export type FlexText = {
14031496
* Font size.
14041497
* The size increases in the order of listing.
14051498
* The default value is `md`.
1499+
* For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
14061500
*/
14071501
size?:
1502+
| string
14081503
| "xxs"
14091504
| "xs"
14101505
| "sm"
@@ -1502,8 +1597,20 @@ export type FlexSpan = {
15021597
color?: string;
15031598
/**
15041599
* Font size. You can specify one of the following values: `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `xxl`, `3xl`, `4xl`, or `5xl`. The size increases in the order of listing. The default value is `md`.
1600+
* For more information, see [Icon, text, and span size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#other-component-size) in the Messaging API documentation.
15051601
*/
1506-
size?: string;
1602+
size?:
1603+
| string
1604+
| "xxs"
1605+
| "xs"
1606+
| "sm"
1607+
| "md"
1608+
| "lg"
1609+
| "xl"
1610+
| "xxl"
1611+
| "3xl"
1612+
| "4xl"
1613+
| "5xl";
15071614
/**
15081615
* Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
15091616
*/
@@ -2480,3 +2587,41 @@ export type GroupSummaryResponse = {
24802587
export type MembersCountResponse = {
24812588
count: number;
24822589
};
2590+
2591+
/**
2592+
* Response body of get bot info.
2593+
*
2594+
* @see [Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info)
2595+
*/
2596+
export type BotInfoResponse = {
2597+
userId: string;
2598+
basicId: string;
2599+
premiumId?: string;
2600+
displayName: string;
2601+
pictureUrl?: string;
2602+
chatMode: "chat" | "bot";
2603+
markAsReadMode: "auto" | "manual";
2604+
};
2605+
2606+
/**
2607+
* Response body of get webhook endpoint info.
2608+
*
2609+
* @see [Get get webhook endpoint info](https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information)
2610+
*/
2611+
export type WebhookEndpointInfoResponse = {
2612+
endpoint: string;
2613+
active: boolean;
2614+
};
2615+
2616+
/**
2617+
* Response body of test webhook endpoint.
2618+
*
2619+
* @see [Test webhook endpoint](https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint)
2620+
*/
2621+
export type TestWebhookEndpointResponse = {
2622+
success: boolean;
2623+
timestamp: string;
2624+
statusCode: number;
2625+
reason: string;
2626+
detail: string;
2627+
};

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)