@line/bot-sdk
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -0,1 +1,13 @@ | ||
## 6.1.1 (14 Aug 2018) | ||
#### Type | ||
* Update FlexMessage types (#81) | ||
#### Misc | ||
* Add test coverage (#78) | ||
* Add JSDoc comments (#80) | ||
## 6.1.0 (19 June 2018) | ||
@@ -2,0 +14,0 @@ |
@@ -17,5 +17,12 @@ export interface Config { | ||
}; | ||
/** | ||
* JSON objects which contain events generated on the LINE Platform. | ||
* | ||
* @see [Webhook event objects](https://developers.line.me/en/reference/messaging-api/#webhook-event-objects) | ||
*/ | ||
export declare type WebhookEvent = MessageEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | PostbackEvent | BeaconEvent; | ||
export declare type EventBase = { | ||
/** Time of the event in milliseconds */ | ||
timestamp: number; | ||
/** Source user, group, or room object with information about the source of the event. */ | ||
source: EventSource; | ||
@@ -31,2 +38,7 @@ }; | ||
groupId: string; | ||
/** | ||
* ID of the source user. | ||
* Only included in [message events](https://developers.line.me/en/reference/messaging-api/#message-event). | ||
* Not included if the user has not agreed to the [Official Accounts Terms of Use](https://developers.line.me/en/docs/messaging-api/user-consent/). | ||
*/ | ||
userId?: string; | ||
@@ -37,2 +49,7 @@ }; | ||
roomId: string; | ||
/** | ||
* ID of the source user. | ||
* Only included in [message events](https://developers.line.me/en/reference/messaging-api/#message-event). | ||
* Not included if the user has not agreed to the [Official Accounts Terms of Use](https://developers.line.me/en/docs/messaging-api/user-consent/). | ||
*/ | ||
userId?: string; | ||
@@ -43,2 +60,8 @@ }; | ||
}; | ||
/** | ||
* Webhook event object which contains the sent message. | ||
* The `message` property contains a message object which corresponds with the message type. You can reply to message events. | ||
* | ||
* @see [Message event](https://developers.line.me/en/reference/messaging-api/#message-event) | ||
*/ | ||
export declare type MessageEvent = { | ||
@@ -48,14 +71,36 @@ type: "message"; | ||
} & ReplyableEvent; | ||
/** | ||
* Event object for when your account is added as a friend (or unblocked). | ||
* You can reply to follow events. | ||
*/ | ||
export declare type FollowEvent = { | ||
type: "follow"; | ||
} & ReplyableEvent; | ||
/** | ||
* Event object for when your account is blocked. | ||
*/ | ||
export declare type UnfollowEvent = { | ||
type: "unfollow"; | ||
} & EventBase; | ||
/** | ||
* Event object for when your bot joins a group or room. You can reply to join events. | ||
* | ||
* A join event is triggered at different times for groups and rooms. | ||
* | ||
* - For groups: A join event is sent when a user invites your bot. | ||
* - For rooms: A join event is sent when the first event (for example when a user sends a message or is added to the room) occurs after your bot is added. | ||
*/ | ||
export declare type JoinEvent = { | ||
type: "join"; | ||
} & ReplyableEvent; | ||
/** | ||
* Event object for when a user removes your bot from a [group](https://developers.line.me/en/docs/messaging-api/group-chats/#group) or when your bot leaves a [group](https://developers.line.me/en/docs/messaging-api/group-chats/#group) or [room](https://developers.line.me/en/docs/messaging-api/group-chats/#room). | ||
*/ | ||
export declare type LeaveEvent = { | ||
type: "leave"; | ||
} & EventBase; | ||
/** | ||
* Event object for when a user performs an action on a [template message](https://developers.line.me/en/reference/messaging-api/#template-messages) which initiates a postback. | ||
* You can reply to postback events. | ||
*/ | ||
export declare type PostbackEvent = { | ||
@@ -65,2 +110,6 @@ type: "postback"; | ||
} & ReplyableEvent; | ||
/** | ||
* Event object for when a user enters or leaves the range of a [LINE Beacon](https://developers.line.me/en/docs/messaging-api/using-beacons/). | ||
* You can reply to beacon events. | ||
*/ | ||
export declare type BeaconEvent = ReplyableEvent & { | ||
@@ -70,3 +119,12 @@ type: "beacon"; | ||
type: "enter" | "leave" | "banner"; | ||
/** | ||
* Hardware ID of the beacon that was detected | ||
*/ | ||
hwid: string; | ||
/** | ||
* Device message of beacon that was detected. | ||
* This message consists of data generated by the beacon to send notifications to bots. | ||
* Only included in webhooks from devices that support the "device message" property. | ||
* For more information, see the [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame). | ||
*/ | ||
dm?: string; | ||
@@ -79,2 +137,5 @@ }; | ||
}; | ||
/** | ||
* Message object which contains the text sent from the source. | ||
*/ | ||
export declare type TextEventMessage = { | ||
@@ -84,11 +145,27 @@ type: "text"; | ||
} & EventMessageBase; | ||
/** | ||
* Message object which contains the image content sent from the source. | ||
* The binary image data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export declare type ImageEventMessage = { | ||
type: "image"; | ||
} & EventMessageBase; | ||
/** | ||
* Message object which contains the video content sent from the source. | ||
* The binary video data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export declare type VideoEventMessage = { | ||
type: "video"; | ||
} & EventMessageBase; | ||
/** | ||
* Message object which contains the audio content sent from the source. | ||
* The binary audio data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export declare type AudioEventMessage = { | ||
type: "audio"; | ||
} & EventMessageBase; | ||
/** | ||
* Message object which contains the file sent from the source. | ||
* The binary data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export declare type FileEventMessage = { | ||
@@ -99,2 +176,5 @@ type: "file"; | ||
} & EventMessageBase; | ||
/** | ||
* Message object which contains the location data sent from the source. | ||
*/ | ||
export declare type LocationEventMessage = { | ||
@@ -107,2 +187,6 @@ type: "location"; | ||
} & EventMessageBase; | ||
/** | ||
* Message object which contains the sticker data sent from the source. | ||
* For a list of basic LINE stickers and sticker IDs, see [sticker list](https://developers.line.me/media/messaging-api/sticker_list.pdf). | ||
*/ | ||
export declare type StickerEventMessage = { | ||
@@ -115,31 +199,124 @@ type: "sticker"; | ||
data: string; | ||
/** | ||
* Object with the date and time selected by a user through a [datetime picker action](https://developers.line.me/en/reference/messaging-api/#datetime-picker-action). | ||
* Only returned for postback actions via a [datetime picker action](https://developers.line.me/en/reference/messaging-api/#datetime-picker-action). | ||
* The `full-date`, `time-hour`, and `time-minute` formats follow the [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt). | ||
*/ | ||
params?: { | ||
/** | ||
* Date selected by user. Only included in the `date` mode. | ||
*/ | ||
date?: string; | ||
/** | ||
* Time selected by the user. Only included in the `time` mode. | ||
*/ | ||
time?: string; | ||
/** | ||
* Date and time selected by the user. Only included in the `datetime` mode. | ||
*/ | ||
datetime?: string; | ||
}; | ||
}; | ||
/** | ||
* JSON object which contains the contents of the message you send. | ||
* | ||
* @see [Message objects](https://developers.line.me/en/reference/messaging-api/#message-objects) | ||
*/ | ||
export declare type Message = TextMessage | ImageMessage | VideoMessage | AudioMessage | LocationMessage | StickerMessage | ImageMapMessage | TemplateMessage | FlexMessage; | ||
/** | ||
* @see [Text message](https://developers.line.me/en/reference/messaging-api/#text-message) | ||
*/ | ||
export declare type TextMessage = { | ||
type: "text"; | ||
/** | ||
* Message text. You can include the following emoji: | ||
* | ||
* - Unicode emoji | ||
* - LINE original emoji ([Unicode codepoint table for LINE original emoji](https://developers.line.me/media/messaging-api/emoji-list.pdf)) | ||
* | ||
* Max: 2000 characters | ||
*/ | ||
text: string; | ||
}; | ||
/** | ||
* @see [Image message](https://developers.line.me/en/reference/messaging-api/#image-message) | ||
*/ | ||
export declare type ImageMessage = { | ||
type: "image"; | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - JPEG | ||
* - Max: 1024 x 1024 | ||
* - Max: 1 MB | ||
*/ | ||
originalContentUrl: string; | ||
/** | ||
* Preview image URL (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - JPEG | ||
* - Max: 240 x 240 | ||
* - Max: 1 MB | ||
*/ | ||
previewImageUrl: string; | ||
}; | ||
/** | ||
* @see [Video message](https://developers.line.me/en/reference/messaging-api/#video-message) | ||
*/ | ||
export declare type VideoMessage = { | ||
type: "video"; | ||
/** | ||
* URL of video file (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - mp4 | ||
* - Max: 1 minute | ||
* - Max: 10 MB | ||
* | ||
* A very wide or tall video may be cropped when played in some environments. | ||
*/ | ||
originalContentUrl: string; | ||
/** | ||
* URL of preview image (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - JPEG | ||
* - Max: 240 x 240 | ||
* - Max: 1 MB | ||
*/ | ||
previewImageUrl: string; | ||
}; | ||
/** | ||
* @see [Audio message](https://developers.line.me/en/reference/messaging-api/#audio-message) | ||
*/ | ||
export declare type AudioMessage = { | ||
type: "audio"; | ||
/** | ||
* URL of audio file (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - m4a | ||
* - Max: 1 minute | ||
* - Max: 10 MB | ||
*/ | ||
originalContentUrl: string; | ||
/** | ||
* Length of audio file (milliseconds) | ||
*/ | ||
duration: number; | ||
}; | ||
/** | ||
* @see [Location message](https://developers.line.me/en/reference/messaging-api/#location-message) | ||
*/ | ||
export declare type LocationMessage = { | ||
type: "location"; | ||
/** | ||
* Title (Max: 100 characters) | ||
*/ | ||
title: string; | ||
/** | ||
* Address (Max: 100 characters) | ||
*/ | ||
address: string; | ||
@@ -149,19 +326,67 @@ latitude: number; | ||
}; | ||
/** | ||
* @see [Sticker message](https://developers.line.me/en/reference/messaging-api/#sticker-message) | ||
*/ | ||
export declare type StickerMessage = { | ||
type: "sticker"; | ||
/** | ||
* Package ID for a set of stickers. | ||
* For information on package IDs, see the [Sticker list](https://developers.line.me/media/messaging-api/sticker_list.pdf). | ||
*/ | ||
packageId: string; | ||
/** | ||
* Sticker ID. | ||
* For a list of sticker IDs for stickers that can be sent with the Messaging API, see the [Sticker list](https://developers.line.me/media/messaging-api/sticker_list.pdf). | ||
*/ | ||
stickerId: string; | ||
}; | ||
/** | ||
* @see [Imagemap message](https://developers.line.me/en/reference/messaging-api/#imagemap-message) | ||
*/ | ||
export declare type ImageMapMessage = { | ||
type: "imagemap"; | ||
/** | ||
* [Base URL](https://developers.line.me/en/reference/messaging-api/#base-url) of image (Max: 1000 characters, **HTTPS**) | ||
*/ | ||
baseUrl: string; | ||
/** | ||
* Alternative text (Max: 400 characters) | ||
*/ | ||
altText: string; | ||
baseSize: Size; | ||
/** | ||
* Action when tapped (Max: 50) | ||
*/ | ||
actions: ImageMapAction[]; | ||
}; | ||
/** | ||
* Template messages are messages with predefined layouts which you can customize. For more information, see [template messages](https://developers.line.me/en/docs/messaging-api/message-types/#template-messages). | ||
* | ||
* The following template types are available: | ||
* | ||
* - [Buttons](https://developers.line.me/en/reference/messaging-api/#buttons) | ||
* - [Confirm](https://developers.line.me/en/reference/messaging-api/#confirm) | ||
* - [Carousel](https://developers.line.me/en/reference/messaging-api/#carousel) | ||
* - [Image carousel](https://developers.line.me/en/reference/messaging-api/#image-carousel) | ||
* | ||
* @see [Template messages](https://developers.line.me/en/reference/messaging-api/#template-messages) | ||
*/ | ||
export declare type TemplateMessage = { | ||
type: "template"; | ||
/** | ||
* Alternative text (Max: 400 characters) | ||
*/ | ||
altText: string; | ||
/** | ||
* A [Buttons](https://developers.line.me/en/reference/messaging-api/#buttons), [Confirm](https://developers.line.me/en/reference/messaging-api/#confirm), [Carousel](https://developers.line.me/en/reference/messaging-api/#carousel), or [Image Carousel](https://developers.line.me/en/reference/messaging-api/#image-carousel) object. | ||
*/ | ||
template: TemplateContent; | ||
}; | ||
/** | ||
* Flex Messages are messages with a customizable layout. | ||
* You can customize the layout freely by combining multiple elements. | ||
* For more information, see [Using Flex Messages](https://developers.line.me/en/docs/messaging-api/using-flex-messages/). | ||
* | ||
* @see [Flex messages](https://developers.line.me/en/reference/messaging-api/#flex-message) | ||
*/ | ||
export declare type FlexMessage = { | ||
@@ -172,4 +397,12 @@ type: "flex"; | ||
}; | ||
/** | ||
* Object which specifies the actions and tappable regions of an imagemap. | ||
* | ||
* When a region is tapped, the user is redirected to the URI specified in `uri` and the message specified in `message` is sent. | ||
* | ||
* @see [Imagemap action objects](https://developers.line.me/en/reference/messaging-api/#imagemap-action-objects) | ||
*/ | ||
export declare type ImageMapAction = ImageMapURIAction | ImageMapMessageAction; | ||
export declare type ImageMapActionBase = { | ||
/** Defined tappable area */ | ||
area: Area; | ||
@@ -179,2 +412,5 @@ }; | ||
type: "uri"; | ||
/** | ||
* Webpage URL (Max: 1000 characters) | ||
*/ | ||
linkUri: string; | ||
@@ -184,13 +420,48 @@ } & ImageMapActionBase; | ||
type: "message"; | ||
/** | ||
* Message to send (Max: 400 characters) | ||
*/ | ||
text: string; | ||
} & ImageMapActionBase; | ||
export declare type Area = { | ||
/** | ||
* Horizontal position relative to the top-left corner of the area | ||
*/ | ||
x: number; | ||
/** | ||
* Vertical position relative to the top-left corner of the area | ||
*/ | ||
y: number; | ||
/** | ||
* Width of the tappable area | ||
*/ | ||
width: number; | ||
/** | ||
* Height of the tappable area | ||
*/ | ||
height: number; | ||
}; | ||
/** | ||
* A container is the top-level structure of a Flex Message. Here are the types of containers available. | ||
* | ||
* - [Bubble](https://developers.line.me/en/reference/messaging-api/#bubble) | ||
* - [Carousel](https://developers.line.me/en/reference/messaging-api/#f-carousel) | ||
* | ||
* See [Flex Message elements](https://developers.line.me/en/docs/messaging-api/flex-message-elements/) for the containers' JSON data samples and usage. | ||
*/ | ||
export declare type FlexContainer = FlexBubble | FlexCarousel; | ||
/** | ||
* This is a container that contains one message bubble. It can contain four blocks: header, hero, body, and footer. | ||
* For more information about using each block, see [Block](https://developers.line.me/en/docs/messaging-api/flex-message-elements/#block). | ||
*/ | ||
export declare type FlexBubble = { | ||
type: "bubble"; | ||
/** | ||
* Text directionality and the order of components in horizontal boxes in the container. Specify one of the following values: | ||
* | ||
* - `ltr`: Left to right | ||
* - `rtl`: Right to left | ||
* | ||
* The default value is `ltr`. | ||
*/ | ||
direction?: "ltr" | "rtl"; | ||
@@ -210,4 +481,15 @@ header?: FlexBox; | ||
export declare type FlexBlockStyle = { | ||
/** | ||
* Background color of the block. Use a hexadecimal color code. | ||
*/ | ||
backgroundColor?: string; | ||
/** | ||
* `true` to place a separator above the block. | ||
* `true` will be ignored for the first block in a container because you cannot place a separator above the first block. | ||
* The default value is `false`. | ||
*/ | ||
separator?: boolean; | ||
/** | ||
* Color of the separator. Use a hexadecimal color code. | ||
*/ | ||
separatorColor?: string; | ||
@@ -217,53 +499,277 @@ }; | ||
type: "carousel"; | ||
/** | ||
* (Max: 10 bubbles) | ||
*/ | ||
contents: FlexBubble[]; | ||
}; | ||
/** | ||
* Components are objects that compose a Flex Message container. Here are the types of components available: | ||
* | ||
* - [Box](https://developers.line.me/en/reference/messaging-api/#box) | ||
* - [Button](https://developers.line.me/en/reference/messaging-api/#button) | ||
* - [Filler](https://developers.line.me/en/reference/messaging-api/#filler) | ||
* - [Icon](https://developers.line.me/en/reference/messaging-api/#icon) | ||
* - [Image](https://developers.line.me/en/reference/messaging-api/#f-image) | ||
* - [Separator](https://developers.line.me/en/reference/messaging-api/#separator) | ||
* - [Spacer](https://developers.line.me/en/reference/messaging-api/#spacer) | ||
* - [Text](https://developers.line.me/en/reference/messaging-api/#f-text) | ||
* | ||
* See [Flex Message elements](https://developers.line.me/en/docs/messaging-api/flex-message-elements/) and [Flex Message layout](https://developers.line.me/en/docs/messaging-api/flex-message-layout/) for the components' JSON data samples and usage. | ||
*/ | ||
export declare type FlexComponent = FlexBox | FlexButton | FlexFiller | FlexIcon | FlexImage | FlexSeparator | FlexSpacer | FlexText; | ||
/** | ||
* This is a component that defines the layout of child components. | ||
* You can also include a box in a box. | ||
*/ | ||
export declare type FlexBox = { | ||
type: "box"; | ||
/** | ||
* The placement style of components in this box. Specify one of the following values: | ||
* | ||
* - `horizontal`: Components are placed horizontally. The `direction` property of the [bubble](https://developers.line.me/en/reference/messaging-api/#bubble) container specifies the order. | ||
* - `vertical`: Components are placed vertically from top to bottom. | ||
* - `baseline`: Components are placed in the same way as `horizontal` is specified except the baselines of the components are aligned. | ||
* | ||
* For more information, see [Types of box layouts](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#box-layout-types). | ||
*/ | ||
layout: "horizontal" | "vertical" | "baseline"; | ||
/** | ||
* Components in this box. Here are the types of components available: | ||
* | ||
* - When the `layout` property is `horizontal` or `vertical`: | ||
* [Box](https://developers.line.me/en/reference/messaging-api/#box), [button](https://developers.line.me/en/reference/messaging-api/#button), [filler](https://developers.line.me/en/reference/messaging-api/#filler), [image](https://developers.line.me/en/reference/messaging-api/#f-image), [separator](https://developers.line.me/en/reference/messaging-api/#separator), and [text](https://developers.line.me/en/reference/messaging-api/#f-text) components | ||
* - When the `layout` property is `baseline`: | ||
* [filler](https://developers.line.me/en/reference/messaging-api/#filler), [icon](https://developers.line.me/en/reference/messaging-api/#icon), and [text](https://developers.line.me/en/reference/messaging-api/#f-text) components | ||
*/ | ||
contents: FlexComponent[]; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between components in this box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is `none`. | ||
* To override this setting for a specific component, set the `margin` property of that component. | ||
*/ | ||
spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Action performed when this button is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action?: Action; | ||
}; | ||
/** | ||
* This component draws a button. | ||
* When the user taps a button, a specified action is performed. | ||
*/ | ||
export declare type FlexButton = { | ||
type: "button"; | ||
/** | ||
* Action performed when this button is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action: Action; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Height of the button. The default value is `md`. | ||
*/ | ||
height?: "sm" | "md"; | ||
/** | ||
* Style of the button. Specify one of the following values: | ||
* | ||
* - `link`: HTML link style | ||
* - `primary`: Style for dark color buttons | ||
* - `secondary`: Style for light color buttons | ||
* | ||
* The default value is `link`. | ||
*/ | ||
style?: "link" | "primary" | "secondary"; | ||
/** | ||
* Character color when the `style` property is `link`. | ||
* Background color when the `style` property is `primary` or `secondary`. | ||
* Use a hexadecimal color code. | ||
*/ | ||
color?: string; | ||
/** | ||
* Vertical alignment style. Specify one of the following values: | ||
* | ||
* - `top`: Top-aligned | ||
* - `bottom`: Bottom-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `top`. | ||
* | ||
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored. | ||
*/ | ||
gravity?: "top" | "bottom" | "center"; | ||
}; | ||
/** | ||
* This is an invisible component to fill extra space between components. | ||
* | ||
* - The filler's `flex` property is fixed to 1. | ||
* - The `spacing` property of the parent box will be ignored for fillers. | ||
*/ | ||
export declare type FlexFiller = { | ||
type: "filler"; | ||
}; | ||
/** | ||
* This component draws an icon. | ||
*/ | ||
export declare type FlexIcon = { | ||
type: "icon"; | ||
/** | ||
* Image URL | ||
* | ||
* Protocol: HTTPS | ||
* Image format: JPEG or PNG | ||
* Maximum image size: 240×240 pixels | ||
* Maximum data size: 1 MB | ||
*/ | ||
url: string; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Maximum size of the icon width. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl"; | ||
/** | ||
* Aspect ratio of the icon. The default value is `1:1`. | ||
*/ | ||
aspectRatio?: "1:1" | "2:1" | "3:1"; | ||
}; | ||
/** | ||
* This component draws an image. | ||
*/ | ||
export declare type FlexImage = { | ||
type: "image"; | ||
/** | ||
* Image URL | ||
* | ||
* - Protocol: HTTPS | ||
* - Image format: JPEG or PNG | ||
* - Maximum image size: 1024×1024 pixels | ||
* - Maximum data size: 1 MB | ||
*/ | ||
url: string; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Horizontal alignment style. Specify one of the following values: | ||
* | ||
* - `start`: Left-aligned | ||
* - `end`: Right-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `center`. | ||
*/ | ||
align?: "start" | "end" | "center"; | ||
/** | ||
* Vertical alignment style. Specify one of the following values: | ||
* | ||
* - `top`: Top-aligned | ||
* - `bottom`: Bottom-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `top`. | ||
* | ||
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored. | ||
*/ | ||
gravity?: "top" | "bottom" | "center"; | ||
/** | ||
* Maximum size of the image width. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full"; | ||
/** | ||
* Aspect ratio of the image. | ||
* The default value is `1:1`. | ||
*/ | ||
aspectRatio?: "1:1" | "1.51:1" | "1.91:1" | "4:3" | "16:9" | "20:13" | "2:1" | "3:1" | "3:4" | "9:16" | "1:2" | "1:3"; | ||
/** | ||
* Style of the image. Specify one of the following values: | ||
* | ||
* - `cover`: The image fills the entire drawing area. Parts of the image that do not fit in the drawing area are not displayed. | ||
* - `fit`: The entire image is displayed in the drawing area. The background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. | ||
* | ||
* The default value is `fit`. | ||
*/ | ||
aspectMode?: "cover" | "fit"; | ||
/** | ||
* Background color of the image. Use a hexadecimal color code. | ||
*/ | ||
backgroundColor?: string; | ||
/** | ||
* Action performed when this button is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action?: Action; | ||
}; | ||
/** | ||
* This component draws a separator between components in the parent box. | ||
*/ | ||
export declare type FlexSeparator = { | ||
type: "separator"; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Color of the separator. Use a hexadecimal color code. | ||
*/ | ||
color?: string; | ||
}; | ||
/** | ||
* This is an invisible component that places a fixed-size space at the beginning or end of the box. | ||
*/ | ||
export declare type FlexSpacer = { | ||
type: "spacer"; | ||
/** | ||
* Size of the space. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size: "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
@@ -274,47 +780,237 @@ }; | ||
text: string; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Font size. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl"; | ||
/** | ||
* Horizontal alignment style. Specify one of the following values: | ||
* | ||
* - `start`: Left-aligned | ||
* - `end`: Right-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `start`. | ||
*/ | ||
align?: "start" | "end" | "center"; | ||
/** | ||
* Vertical alignment style. Specify one of the following values: | ||
* | ||
* - `top`: Top-aligned | ||
* - `bottom`: Bottom-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `top`. | ||
* | ||
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored. | ||
*/ | ||
gravity?: "top" | "bottom" | "center"; | ||
/** | ||
* `true` to wrap text. | ||
* The default value is `false`. | ||
* If set to `true`, you can use a new line character (\n) to begin on a new line. | ||
*/ | ||
wrap?: boolean; | ||
/** | ||
* Max number of lines. If the text does not fit in the specified number of lines, | ||
* an ellipsis (…) is displayed at the end of the last line. | ||
* If set to 0, all the text is displayed. The default value is 0. | ||
*/ | ||
maxLines?: number; | ||
/** | ||
* Font weight. | ||
* Specifying `bold`makes the font bold. | ||
* The default value is `regular`. | ||
*/ | ||
weight?: "regular" | "bold"; | ||
/** | ||
* Font color. Use a hexadecimal color code. | ||
*/ | ||
color?: string; | ||
/** | ||
* Action performed when this text is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action?: Action; | ||
}; | ||
export declare type TemplateContent = TemplateButtons | TemplateConfirm | TemplateCarousel | TemplateImageCarousel; | ||
/** | ||
* Template with an image, title, text, and multiple action buttons. | ||
* | ||
* Because of the height limitation for buttons template messages, the lower part of the text display area will get cut off if the height limitation is exceeded. | ||
* For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits. | ||
*/ | ||
export declare type TemplateButtons = { | ||
type: "buttons"; | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - HTTPS | ||
* - JPEG or PNG | ||
* - Max width: 1024px | ||
* - Max: 1 MB | ||
*/ | ||
thumbnailImageUrl?: string; | ||
/** | ||
* Aspect ratio of the image. Specify one of the following values: | ||
* | ||
* - `rectangle`: 1.51:1 | ||
* - `square`: 1:1 | ||
* | ||
* The default value is `rectangle` | ||
*/ | ||
imageAspectRatio?: "rectangle" | "square"; | ||
/** | ||
* Size of the image. Specify one of the following values: | ||
* | ||
* - `cover`: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. | ||
* - `contain`: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. | ||
* | ||
* The default value is `cover`. | ||
*/ | ||
imageSize?: "cover" | "contain"; | ||
/** | ||
* Background color of image. Specify a RGB color value. | ||
* The default value is `#FFFFFF` (white). | ||
*/ | ||
imageBackgroundColor?: string; | ||
/** | ||
* Title (Max: 40 characters) | ||
*/ | ||
title?: string; | ||
/** | ||
* Message text | ||
* | ||
* - Max: 160 characters (no image or title) | ||
* - Max: 60 characters (message with an image or title) | ||
*/ | ||
text: string; | ||
/** | ||
* Action when tapped (Max: 4) | ||
*/ | ||
actions: Action[]; | ||
}; | ||
/** | ||
* Template with two action buttons. | ||
* | ||
* Because of the height limitation for confirm template messages, the lower part of the `text` display area will get cut off if the height limitation is exceeded. | ||
* For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits. | ||
*/ | ||
export declare type TemplateConfirm = { | ||
type: "confirm"; | ||
/** | ||
* Message text (Max: 240 characters) | ||
*/ | ||
text: string; | ||
/** | ||
* Action when tapped. Set 2 actions for the 2 buttons | ||
*/ | ||
actions: Action[]; | ||
}; | ||
/** | ||
* Template with multiple columns which can be cycled like a carousel. | ||
* The columns will be shown in order by scrolling horizontally. | ||
* | ||
* Because of the height limitation for carousel template messages, the lower part of the `text` display area will get cut off if the height limitation is exceeded. | ||
* For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits. | ||
* | ||
* Keep the number of actions consistent for all columns. | ||
* If you use an image or title for a column, make sure to do the same for all other columns. | ||
*/ | ||
export declare type TemplateCarousel = { | ||
type: "carousel"; | ||
/** | ||
* Array of columns (Max: 10) | ||
*/ | ||
columns: TemplateColumn[]; | ||
/** | ||
* Aspect ratio of the image. Specify one of the following values: | ||
* | ||
* - `rectangle`: 1.51:1 | ||
* - `square`: 1:1 | ||
* | ||
* Applies to all columns. The default value is `rectangle`. | ||
*/ | ||
imageAspectRatio?: "rectangle" | "square"; | ||
/** | ||
* Size of the image. Specify one of the following values: | ||
* | ||
* - `cover`: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. | ||
* - `contain`: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. | ||
* | ||
* Applies to all columns. The default value is `cover`. | ||
*/ | ||
imageSize?: "cover" | "contain"; | ||
}; | ||
export declare type TemplateColumn = { | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - HTTPS | ||
* - JPEG or PNG | ||
* - Aspect ratio: 1:1.51 | ||
* - Max width: 1024px | ||
* - Max: 1 MB | ||
*/ | ||
thumbnailImageUrl?: string; | ||
/** | ||
* Background color of image. Specify a RGB color value. | ||
* The default value is `#FFFFFF` (white). | ||
*/ | ||
imageBackgroundColor?: string; | ||
/** | ||
* Title (Max: 40 characters) | ||
*/ | ||
title?: string; | ||
/** | ||
* Message text | ||
* | ||
* - Max: 120 characters (no image or title) | ||
* - Max: 60 characters (message with an image or title) | ||
*/ | ||
text: string; | ||
/** | ||
* Action when tapped (Max: 3) | ||
*/ | ||
actions: Action[]; | ||
}; | ||
/** | ||
* Template with multiple images which can be cycled like a carousel. | ||
* The images will be shown in order by scrolling horizontally. | ||
*/ | ||
export declare type TemplateImageCarousel = { | ||
type: "image_carousel"; | ||
/** | ||
* Array of columns (Max: 10) | ||
*/ | ||
columns: TemplateImageColumn; | ||
}; | ||
export declare type TemplateImageColumn = { | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - HTTPS | ||
* - JPEG or PNG | ||
* - Aspect ratio: 1:1 | ||
* - Max width: 1024px | ||
* - Max: 1 MB | ||
*/ | ||
imageUrl: string; | ||
/** | ||
* Action when image is tapped | ||
*/ | ||
action: Action<{ | ||
@@ -324,25 +1020,95 @@ label?: string; | ||
}; | ||
/** | ||
* These are types of actions for your bot to take when a user taps a button or an image in a message. | ||
* | ||
* - [Postback action](https://developers.line.me/en/reference/messaging-api/#postback-action) | ||
* - [Message action](https://developers.line.me/en/reference/messaging-api/#message-action) | ||
* - [URI action](https://developers.line.me/en/reference/messaging-api/#uri-action) | ||
* - [Datetime picker action](https://developers.line.me/en/reference/messaging-api/#datetime-picker-action) | ||
* - [Camera action](https://developers.line.me/en/reference/messaging-api/#camera-action) | ||
* - [Camera roll action](https://developers.line.me/en/reference/messaging-api/#camera-roll-action) | ||
* - [Location action](https://developers.line.me/en/reference/messaging-api/#location-action) | ||
*/ | ||
export declare type Action<ExtraFields = { | ||
label: string; | ||
}> = (PostbackAction | MessageAction | URIAction | DatetimePickerAction) & ExtraFields; | ||
/** | ||
* When a control associated with this action is tapped, a postback event is returned via webhook with the specified string in the data property. | ||
*/ | ||
export declare type PostbackAction = { | ||
type: "postback"; | ||
/** | ||
* String returned via webhook in the `postback.data` property of the postback event (Max: 300 characters) | ||
*/ | ||
data: string; | ||
/** | ||
* Text displayed in the chat as a message sent by the user when the action is performed. | ||
* Returned from the server through a webhook. | ||
* This property cannot be used with quick reply buttons. (Max: 300 characters) | ||
* The `displayText` and `text` properties cannot both be used at the same time. | ||
* @deprecated | ||
*/ | ||
text?: string; | ||
/** | ||
* Text displayed in the chat as a message sent by the user when the action is performed. | ||
* Required for quick reply buttons. | ||
* Optional for the other message types. | ||
* Max: 300 characters | ||
* The `displayText` and `text` properties cannot both be used at the same time. | ||
*/ | ||
displayText?: string; | ||
}; | ||
/** | ||
* When a control associated with this action is tapped, the string in the text property is sent as a message from the user. | ||
*/ | ||
export declare type MessageAction = { | ||
type: "message"; | ||
/** | ||
* Text sent when the action is performed (Max: 300 characters) | ||
*/ | ||
text: string; | ||
}; | ||
/** | ||
* When a control associated with this action is tapped, the URI specified in the `uri` property is opened. | ||
*/ | ||
export declare type URIAction = { | ||
type: "uri"; | ||
/** | ||
* URI opened when the action is performed (Max: 1000 characters). | ||
* Must start with `http`, `https`, or `tel`. | ||
*/ | ||
uri: string; | ||
}; | ||
/** | ||
* When a control associated with this action is tapped, a [postback event](https://developers.line.me/en/reference/messaging-api/#postback-event) is returned via webhook with the date and time selected by the user from the date and time selection dialog. | ||
* The datetime picker action does not support time zones. | ||
* | ||
* #### Date and time format | ||
* | ||
* The date and time formats for the `initial`, `max`, and `min` values are shown below. The `full-date`, `time-hour`, and `time-minute` formats follow the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol. | ||
* | ||
* | Mode | Format | Example | | ||
* | -------- | ------------------------------------------------------------ | -------------------------------- | | ||
* | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 | | ||
* | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 | | ||
* | datetime | `full-date`T`time-hour`:`time-minute` or `full-date`t`time-hour`:`time-minute` (Max: 2100-12-31T23:59; Min: 1900-01-01T00:00) | 2017-06-18T06:152017-06-18t06:15 | | ||
*/ | ||
export declare type DatetimePickerAction = { | ||
type: "datetimepicker"; | ||
/** | ||
* String returned via webhook in the `postback.data` property of the postback event (Max: 300 characters) | ||
*/ | ||
data: string; | ||
mode: "date" | "time" | "datetime"; | ||
/** | ||
* Initial value of date or time | ||
*/ | ||
initial?: string; | ||
/** | ||
* Largest date or time value that can be selected. Must be greater than the `min` value. | ||
*/ | ||
max?: string; | ||
/** | ||
* Smallest date or time value that can be selected. Must be less than the `max` value. | ||
*/ | ||
min?: string; | ||
@@ -354,7 +1120,34 @@ }; | ||
}; | ||
/** | ||
* Rich menus consist of either of these objects. | ||
* | ||
* - [Rich menu object](https://developers.line.me/en/reference/messaging-api/#rich-menu-object) without the rich menu ID. Use this object when you [create a rich menu](https://developers.line.me/en/reference/messaging-api/#create-rich-menu). | ||
* - [Rich menu response object](https://developers.line.me/en/reference/messaging-api/#rich-menu-response-object) with the rich menu ID. This object is returned when you [get a rich menu](https://developers.line.me/en/reference/messaging-api/#get-rich-menu) or [get a list of rich menus](https://developers.line.me/en/reference/messaging-api/#get-rich-menu-list). | ||
* | ||
* [Area objects](https://developers.line.me/en/reference/messaging-api/#area-object) and [action objects](https://developers.line.me/en/reference/messaging-api/#action-objects) are included in these objects. | ||
*/ | ||
export declare type RichMenu = { | ||
/** | ||
* [`size` object](https://developers.line.me/en/reference/messaging-api/#size-object) which contains the width and height of the rich menu displayed in the chat. | ||
* Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px. | ||
*/ | ||
size: Size; | ||
/** | ||
* `true` to display the rich menu by default. Otherwise, `false`. | ||
*/ | ||
selected: boolean; | ||
/** | ||
* Name of the rich menu. | ||
* This value can be used to help manage your rich menus and is not displayed to users. | ||
* (Max: 300 characters) | ||
*/ | ||
name: string; | ||
/** | ||
* Text displayed in the chat bar (Max: 14 characters) | ||
*/ | ||
chatBarText: string; | ||
/** | ||
* Array of [area objects](https://developers.line.me/en/reference/messaging-api/#area-object) which define the coordinates and size of tappable areas | ||
* (Max: 20 area objects) | ||
*/ | ||
areas: Array<{ | ||
@@ -361,0 +1154,0 @@ bounds: Area; |
811
lib/types.ts
@@ -21,2 +21,7 @@ export interface Config { | ||
/** | ||
* JSON objects which contain events generated on the LINE Platform. | ||
* | ||
* @see [Webhook event objects](https://developers.line.me/en/reference/messaging-api/#webhook-event-objects) | ||
*/ | ||
export type WebhookEvent = | ||
@@ -32,3 +37,5 @@ | MessageEvent | ||
export type EventBase = { | ||
/** Time of the event in milliseconds */ | ||
timestamp: number; | ||
/** Source user, group, or room object with information about the source of the event. */ | ||
source: EventSource; | ||
@@ -41,8 +48,32 @@ }; | ||
export type Group = { type: "group"; groupId: string; userId?: string }; | ||
export type Group = { | ||
type: "group"; | ||
groupId: string; | ||
/** | ||
* ID of the source user. | ||
* Only included in [message events](https://developers.line.me/en/reference/messaging-api/#message-event). | ||
* Not included if the user has not agreed to the [Official Accounts Terms of Use](https://developers.line.me/en/docs/messaging-api/user-consent/). | ||
*/ | ||
userId?: string; | ||
}; | ||
export type Room = { type: "room"; roomId: string; userId?: string }; | ||
export type Room = { | ||
type: "room"; | ||
roomId: string; | ||
/** | ||
* ID of the source user. | ||
* Only included in [message events](https://developers.line.me/en/reference/messaging-api/#message-event). | ||
* Not included if the user has not agreed to the [Official Accounts Terms of Use](https://developers.line.me/en/docs/messaging-api/user-consent/). | ||
*/ | ||
userId?: string; | ||
}; | ||
export type ReplyableEvent = EventBase & { replyToken: string }; | ||
/** | ||
* Webhook event object which contains the sent message. | ||
* The `message` property contains a message object which corresponds with the message type. You can reply to message events. | ||
* | ||
* @see [Message event](https://developers.line.me/en/reference/messaging-api/#message-event) | ||
*/ | ||
export type MessageEvent = { | ||
@@ -53,10 +84,32 @@ type: "message"; | ||
/** | ||
* Event object for when your account is added as a friend (or unblocked). | ||
* You can reply to follow events. | ||
*/ | ||
export type FollowEvent = { type: "follow" } & ReplyableEvent; | ||
/** | ||
* Event object for when your account is blocked. | ||
*/ | ||
export type UnfollowEvent = { type: "unfollow" } & EventBase; | ||
/** | ||
* Event object for when your bot joins a group or room. You can reply to join events. | ||
* | ||
* A join event is triggered at different times for groups and rooms. | ||
* | ||
* - For groups: A join event is sent when a user invites your bot. | ||
* - For rooms: A join event is sent when the first event (for example when a user sends a message or is added to the room) occurs after your bot is added. | ||
*/ | ||
export type JoinEvent = { type: "join" } & ReplyableEvent; | ||
/** | ||
* Event object for when a user removes your bot from a [group](https://developers.line.me/en/docs/messaging-api/group-chats/#group) or when your bot leaves a [group](https://developers.line.me/en/docs/messaging-api/group-chats/#group) or [room](https://developers.line.me/en/docs/messaging-api/group-chats/#room). | ||
*/ | ||
export type LeaveEvent = { type: "leave" } & EventBase; | ||
/** | ||
* Event object for when a user performs an action on a [template message](https://developers.line.me/en/reference/messaging-api/#template-messages) which initiates a postback. | ||
* You can reply to postback events. | ||
*/ | ||
export type PostbackEvent = { | ||
@@ -67,2 +120,6 @@ type: "postback"; | ||
/** | ||
* Event object for when a user enters or leaves the range of a [LINE Beacon](https://developers.line.me/en/docs/messaging-api/using-beacons/). | ||
* You can reply to beacon events. | ||
*/ | ||
export type BeaconEvent = ReplyableEvent & { | ||
@@ -72,3 +129,14 @@ type: "beacon"; | ||
type: "enter" | "leave" | "banner"; | ||
/** | ||
* Hardware ID of the beacon that was detected | ||
*/ | ||
hwid: string; | ||
/** | ||
* Device message of beacon that was detected. | ||
* This message consists of data generated by the beacon to send notifications to bots. | ||
* Only included in webhooks from devices that support the "device message" property. | ||
* For more information, see the [LINE Simple Beacon specification](https://github.com/line/line-simple-beacon/blob/master/README.en.md/#line-simple-beacon-frame). | ||
*/ | ||
dm?: string; | ||
@@ -89,2 +157,5 @@ }; | ||
/** | ||
* Message object which contains the text sent from the source. | ||
*/ | ||
export type TextEventMessage = { | ||
@@ -95,8 +166,24 @@ type: "text"; | ||
/** | ||
* Message object which contains the image content sent from the source. | ||
* The binary image data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export type ImageEventMessage = { type: "image" } & EventMessageBase; | ||
/** | ||
* Message object which contains the video content sent from the source. | ||
* The binary video data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export type VideoEventMessage = { type: "video" } & EventMessageBase; | ||
/** | ||
* Message object which contains the audio content sent from the source. | ||
* The binary audio data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export type AudioEventMessage = { type: "audio" } & EventMessageBase; | ||
/** | ||
* Message object which contains the file sent from the source. | ||
* The binary data can be retrieved using Client#getMessageContent. | ||
*/ | ||
export type FileEventMessage = { | ||
@@ -108,2 +195,5 @@ type: "file"; | ||
/** | ||
* Message object which contains the location data sent from the source. | ||
*/ | ||
export type LocationEventMessage = { | ||
@@ -117,2 +207,6 @@ type: "location"; | ||
/** | ||
* Message object which contains the sticker data sent from the source. | ||
* For a list of basic LINE stickers and sticker IDs, see [sticker list](https://developers.line.me/media/messaging-api/sticker_list.pdf). | ||
*/ | ||
export type StickerEventMessage = { | ||
@@ -126,5 +220,19 @@ type: "sticker"; | ||
data: string; | ||
/** | ||
* Object with the date and time selected by a user through a [datetime picker action](https://developers.line.me/en/reference/messaging-api/#datetime-picker-action). | ||
* Only returned for postback actions via a [datetime picker action](https://developers.line.me/en/reference/messaging-api/#datetime-picker-action). | ||
* The `full-date`, `time-hour`, and `time-minute` formats follow the [RFC3339 protocol](https://www.ietf.org/rfc/rfc3339.txt). | ||
*/ | ||
params?: { | ||
/** | ||
* Date selected by user. Only included in the `date` mode. | ||
*/ | ||
date?: string; | ||
/** | ||
* Time selected by the user. Only included in the `time` mode. | ||
*/ | ||
time?: string; | ||
/** | ||
* Date and time selected by the user. Only included in the `datetime` mode. | ||
*/ | ||
datetime?: string; | ||
@@ -134,2 +242,7 @@ }; | ||
/** | ||
* JSON object which contains the contents of the message you send. | ||
* | ||
* @see [Message objects](https://developers.line.me/en/reference/messaging-api/#message-objects) | ||
*/ | ||
export type Message = | ||
@@ -146,28 +259,102 @@ | TextMessage | ||
/** | ||
* @see [Text message](https://developers.line.me/en/reference/messaging-api/#text-message) | ||
*/ | ||
export type TextMessage = { | ||
type: "text"; | ||
/** | ||
* Message text. You can include the following emoji: | ||
* | ||
* - Unicode emoji | ||
* - LINE original emoji ([Unicode codepoint table for LINE original emoji](https://developers.line.me/media/messaging-api/emoji-list.pdf)) | ||
* | ||
* Max: 2000 characters | ||
*/ | ||
text: string; | ||
}; | ||
/** | ||
* @see [Image message](https://developers.line.me/en/reference/messaging-api/#image-message) | ||
*/ | ||
export type ImageMessage = { | ||
type: "image"; | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - JPEG | ||
* - Max: 1024 x 1024 | ||
* - Max: 1 MB | ||
*/ | ||
originalContentUrl: string; | ||
/** | ||
* Preview image URL (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - JPEG | ||
* - Max: 240 x 240 | ||
* - Max: 1 MB | ||
*/ | ||
previewImageUrl: string; | ||
}; | ||
/** | ||
* @see [Video message](https://developers.line.me/en/reference/messaging-api/#video-message) | ||
*/ | ||
export type VideoMessage = { | ||
type: "video"; | ||
/** | ||
* URL of video file (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - mp4 | ||
* - Max: 1 minute | ||
* - Max: 10 MB | ||
* | ||
* A very wide or tall video may be cropped when played in some environments. | ||
*/ | ||
originalContentUrl: string; | ||
/** | ||
* URL of preview image (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - JPEG | ||
* - Max: 240 x 240 | ||
* - Max: 1 MB | ||
*/ | ||
previewImageUrl: string; | ||
}; | ||
/** | ||
* @see [Audio message](https://developers.line.me/en/reference/messaging-api/#audio-message) | ||
*/ | ||
export type AudioMessage = { | ||
type: "audio"; | ||
/** | ||
* URL of audio file (Max: 1000 characters) | ||
* | ||
* - **HTTPS** | ||
* - m4a | ||
* - Max: 1 minute | ||
* - Max: 10 MB | ||
*/ | ||
originalContentUrl: string; | ||
/** | ||
* Length of audio file (milliseconds) | ||
*/ | ||
duration: number; | ||
}; | ||
/** | ||
* @see [Location message](https://developers.line.me/en/reference/messaging-api/#location-message) | ||
*/ | ||
export type LocationMessage = { | ||
type: "location"; | ||
/** | ||
* Title (Max: 100 characters) | ||
*/ | ||
title: string; | ||
/** | ||
* Address (Max: 100 characters) | ||
*/ | ||
address: string; | ||
@@ -178,22 +365,70 @@ latitude: number; | ||
/** | ||
* @see [Sticker message](https://developers.line.me/en/reference/messaging-api/#sticker-message) | ||
*/ | ||
export type StickerMessage = { | ||
type: "sticker"; | ||
/** | ||
* Package ID for a set of stickers. | ||
* For information on package IDs, see the [Sticker list](https://developers.line.me/media/messaging-api/sticker_list.pdf). | ||
*/ | ||
packageId: string; | ||
/** | ||
* Sticker ID. | ||
* For a list of sticker IDs for stickers that can be sent with the Messaging API, see the [Sticker list](https://developers.line.me/media/messaging-api/sticker_list.pdf). | ||
*/ | ||
stickerId: string; | ||
}; | ||
/** | ||
* @see [Imagemap message](https://developers.line.me/en/reference/messaging-api/#imagemap-message) | ||
*/ | ||
export type ImageMapMessage = { | ||
type: "imagemap"; | ||
/** | ||
* [Base URL](https://developers.line.me/en/reference/messaging-api/#base-url) of image (Max: 1000 characters, **HTTPS**) | ||
*/ | ||
baseUrl: string; | ||
/** | ||
* Alternative text (Max: 400 characters) | ||
*/ | ||
altText: string; | ||
baseSize: Size; | ||
/** | ||
* Action when tapped (Max: 50) | ||
*/ | ||
actions: ImageMapAction[]; | ||
}; | ||
/** | ||
* Template messages are messages with predefined layouts which you can customize. For more information, see [template messages](https://developers.line.me/en/docs/messaging-api/message-types/#template-messages). | ||
* | ||
* The following template types are available: | ||
* | ||
* - [Buttons](https://developers.line.me/en/reference/messaging-api/#buttons) | ||
* - [Confirm](https://developers.line.me/en/reference/messaging-api/#confirm) | ||
* - [Carousel](https://developers.line.me/en/reference/messaging-api/#carousel) | ||
* - [Image carousel](https://developers.line.me/en/reference/messaging-api/#image-carousel) | ||
* | ||
* @see [Template messages](https://developers.line.me/en/reference/messaging-api/#template-messages) | ||
*/ | ||
export type TemplateMessage = { | ||
type: "template"; | ||
/** | ||
* Alternative text (Max: 400 characters) | ||
*/ | ||
altText: string; | ||
/** | ||
* A [Buttons](https://developers.line.me/en/reference/messaging-api/#buttons), [Confirm](https://developers.line.me/en/reference/messaging-api/#confirm), [Carousel](https://developers.line.me/en/reference/messaging-api/#carousel), or [Image Carousel](https://developers.line.me/en/reference/messaging-api/#image-carousel) object. | ||
*/ | ||
template: TemplateContent; | ||
}; | ||
/** | ||
* Flex Messages are messages with a customizable layout. | ||
* You can customize the layout freely by combining multiple elements. | ||
* For more information, see [Using Flex Messages](https://developers.line.me/en/docs/messaging-api/using-flex-messages/). | ||
* | ||
* @see [Flex messages](https://developers.line.me/en/reference/messaging-api/#flex-message) | ||
*/ | ||
export type FlexMessage = { | ||
@@ -205,8 +440,21 @@ type: "flex"; | ||
/** | ||
* Object which specifies the actions and tappable regions of an imagemap. | ||
* | ||
* When a region is tapped, the user is redirected to the URI specified in `uri` and the message specified in `message` is sent. | ||
* | ||
* @see [Imagemap action objects](https://developers.line.me/en/reference/messaging-api/#imagemap-action-objects) | ||
*/ | ||
export type ImageMapAction = ImageMapURIAction | ImageMapMessageAction; | ||
export type ImageMapActionBase = { area: Area }; | ||
export type ImageMapActionBase = { | ||
/** Defined tappable area */ | ||
area: Area; | ||
}; | ||
export type ImageMapURIAction = { | ||
type: "uri"; | ||
/** | ||
* Webpage URL (Max: 1000 characters) | ||
*/ | ||
linkUri: string; | ||
@@ -217,2 +465,5 @@ } & ImageMapActionBase; | ||
type: "message"; | ||
/** | ||
* Message to send (Max: 400 characters) | ||
*/ | ||
text: string; | ||
@@ -222,12 +473,44 @@ } & ImageMapActionBase; | ||
export type Area = { | ||
/** | ||
* Horizontal position relative to the top-left corner of the area | ||
*/ | ||
x: number; | ||
/** | ||
* Vertical position relative to the top-left corner of the area | ||
*/ | ||
y: number; | ||
/** | ||
* Width of the tappable area | ||
*/ | ||
width: number; | ||
/** | ||
* Height of the tappable area | ||
*/ | ||
height: number; | ||
}; | ||
/** | ||
* A container is the top-level structure of a Flex Message. Here are the types of containers available. | ||
* | ||
* - [Bubble](https://developers.line.me/en/reference/messaging-api/#bubble) | ||
* - [Carousel](https://developers.line.me/en/reference/messaging-api/#f-carousel) | ||
* | ||
* See [Flex Message elements](https://developers.line.me/en/docs/messaging-api/flex-message-elements/) for the containers' JSON data samples and usage. | ||
*/ | ||
export type FlexContainer = FlexBubble | FlexCarousel; | ||
/** | ||
* This is a container that contains one message bubble. It can contain four blocks: header, hero, body, and footer. | ||
* For more information about using each block, see [Block](https://developers.line.me/en/docs/messaging-api/flex-message-elements/#block). | ||
*/ | ||
export type FlexBubble = { | ||
type: "bubble"; | ||
/** | ||
* Text directionality and the order of components in horizontal boxes in the container. Specify one of the following values: | ||
* | ||
* - `ltr`: Left to right | ||
* - `rtl`: Right to left | ||
* | ||
* The default value is `ltr`. | ||
*/ | ||
direction?: "ltr" | "rtl"; | ||
@@ -249,4 +532,15 @@ header?: FlexBox; | ||
export type FlexBlockStyle = { | ||
/** | ||
* Background color of the block. Use a hexadecimal color code. | ||
*/ | ||
backgroundColor?: string; | ||
/** | ||
* `true` to place a separator above the block. | ||
* `true` will be ignored for the first block in a container because you cannot place a separator above the first block. | ||
* The default value is `false`. | ||
*/ | ||
separator?: boolean; | ||
/** | ||
* Color of the separator. Use a hexadecimal color code. | ||
*/ | ||
separatorColor?: string; | ||
@@ -257,5 +551,22 @@ }; | ||
type: "carousel"; | ||
/** | ||
* (Max: 10 bubbles) | ||
*/ | ||
contents: FlexBubble[]; | ||
}; | ||
/** | ||
* Components are objects that compose a Flex Message container. Here are the types of components available: | ||
* | ||
* - [Box](https://developers.line.me/en/reference/messaging-api/#box) | ||
* - [Button](https://developers.line.me/en/reference/messaging-api/#button) | ||
* - [Filler](https://developers.line.me/en/reference/messaging-api/#filler) | ||
* - [Icon](https://developers.line.me/en/reference/messaging-api/#icon) | ||
* - [Image](https://developers.line.me/en/reference/messaging-api/#f-image) | ||
* - [Separator](https://developers.line.me/en/reference/messaging-api/#separator) | ||
* - [Spacer](https://developers.line.me/en/reference/messaging-api/#spacer) | ||
* - [Text](https://developers.line.me/en/reference/messaging-api/#f-text) | ||
* | ||
* See [Flex Message elements](https://developers.line.me/en/docs/messaging-api/flex-message-elements/) and [Flex Message layout](https://developers.line.me/en/docs/messaging-api/flex-message-layout/) for the components' JSON data samples and usage. | ||
*/ | ||
export type FlexComponent = | ||
@@ -271,22 +582,118 @@ | FlexBox | ||
/** | ||
* This is a component that defines the layout of child components. | ||
* You can also include a box in a box. | ||
*/ | ||
export type FlexBox = { | ||
type: "box"; | ||
/** | ||
* The placement style of components in this box. Specify one of the following values: | ||
* | ||
* - `horizontal`: Components are placed horizontally. The `direction` property of the [bubble](https://developers.line.me/en/reference/messaging-api/#bubble) container specifies the order. | ||
* - `vertical`: Components are placed vertically from top to bottom. | ||
* - `baseline`: Components are placed in the same way as `horizontal` is specified except the baselines of the components are aligned. | ||
* | ||
* For more information, see [Types of box layouts](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#box-layout-types). | ||
*/ | ||
layout: "horizontal" | "vertical" | "baseline"; | ||
/** | ||
* Components in this box. Here are the types of components available: | ||
* | ||
* - When the `layout` property is `horizontal` or `vertical`: | ||
* [Box](https://developers.line.me/en/reference/messaging-api/#box), [button](https://developers.line.me/en/reference/messaging-api/#button), [filler](https://developers.line.me/en/reference/messaging-api/#filler), [image](https://developers.line.me/en/reference/messaging-api/#f-image), [separator](https://developers.line.me/en/reference/messaging-api/#separator), and [text](https://developers.line.me/en/reference/messaging-api/#f-text) components | ||
* - When the `layout` property is `baseline`: | ||
* [filler](https://developers.line.me/en/reference/messaging-api/#filler), [icon](https://developers.line.me/en/reference/messaging-api/#icon), and [text](https://developers.line.me/en/reference/messaging-api/#f-text) components | ||
*/ | ||
contents: FlexComponent[]; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between components in this box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is `none`. | ||
* To override this setting for a specific component, set the `margin` property of that component. | ||
*/ | ||
spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Action performed when this button is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action?: Action; | ||
}; | ||
/** | ||
* This component draws a button. | ||
* When the user taps a button, a specified action is performed. | ||
*/ | ||
export type FlexButton = { | ||
type: "button"; | ||
/** | ||
* Action performed when this button is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action: Action; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Height of the button. The default value is `md`. | ||
*/ | ||
height?: "sm" | "md"; | ||
/** | ||
* Style of the button. Specify one of the following values: | ||
* | ||
* - `link`: HTML link style | ||
* - `primary`: Style for dark color buttons | ||
* - `secondary`: Style for light color buttons | ||
* | ||
* The default value is `link`. | ||
*/ | ||
style?: "link" | "primary" | "secondary"; | ||
/** | ||
* Character color when the `style` property is `link`. | ||
* Background color when the `style` property is `primary` or `secondary`. | ||
* Use a hexadecimal color code. | ||
*/ | ||
color?: string; | ||
/** | ||
* Vertical alignment style. Specify one of the following values: | ||
* | ||
* - `top`: Top-aligned | ||
* - `bottom`: Bottom-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `top`. | ||
* | ||
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored. | ||
*/ | ||
gravity?: "top" | "bottom" | "center"; | ||
}; | ||
/** | ||
* This is an invisible component to fill extra space between components. | ||
* | ||
* - The filler's `flex` property is fixed to 1. | ||
* - The `spacing` property of the parent box will be ignored for fillers. | ||
*/ | ||
export type FlexFiller = { | ||
@@ -296,6 +703,28 @@ type: "filler"; | ||
/** | ||
* This component draws an icon. | ||
*/ | ||
export type FlexIcon = { | ||
type: "icon"; | ||
/** | ||
* Image URL | ||
* | ||
* Protocol: HTTPS | ||
* Image format: JPEG or PNG | ||
* Maximum image size: 240×240 pixels | ||
* Maximum data size: 1 MB | ||
*/ | ||
url: string; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Maximum size of the icon width. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size?: | ||
@@ -312,12 +741,62 @@ | "xxs" | ||
| "5xl"; | ||
/** | ||
* Aspect ratio of the icon. The default value is `1:1`. | ||
*/ | ||
aspectRatio?: "1:1" | "2:1" | "3:1"; | ||
}; | ||
/** | ||
* This component draws an image. | ||
*/ | ||
export type FlexImage = { | ||
type: "image"; | ||
/** | ||
* Image URL | ||
* | ||
* - Protocol: HTTPS | ||
* - Image format: JPEG or PNG | ||
* - Maximum image size: 1024×1024 pixels | ||
* - Maximum data size: 1 MB | ||
*/ | ||
url: string; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Horizontal alignment style. Specify one of the following values: | ||
* | ||
* - `start`: Left-aligned | ||
* - `end`: Right-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `center`. | ||
*/ | ||
align?: "start" | "end" | "center"; | ||
/** | ||
* Vertical alignment style. Specify one of the following values: | ||
* | ||
* - `top`: Top-aligned | ||
* - `bottom`: Bottom-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `top`. | ||
* | ||
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored. | ||
*/ | ||
gravity?: "top" | "bottom" | "center"; | ||
/** | ||
* Maximum size of the image width. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size?: | ||
@@ -335,2 +814,6 @@ | "xxs" | ||
| "full"; | ||
/** | ||
* Aspect ratio of the image. | ||
* The default value is `1:1`. | ||
*/ | ||
aspectRatio?: | ||
@@ -349,15 +832,50 @@ | "1:1" | ||
| "1:3"; | ||
/** | ||
* Style of the image. Specify one of the following values: | ||
* | ||
* - `cover`: The image fills the entire drawing area. Parts of the image that do not fit in the drawing area are not displayed. | ||
* - `fit`: The entire image is displayed in the drawing area. The background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. | ||
* | ||
* The default value is `fit`. | ||
*/ | ||
aspectMode?: "cover" | "fit"; | ||
/** | ||
* Background color of the image. Use a hexadecimal color code. | ||
*/ | ||
backgroundColor?: string; | ||
/** | ||
* Action performed when this button is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action?: Action; | ||
}; | ||
/** | ||
* This component draws a separator between components in the parent box. | ||
*/ | ||
export type FlexSeparator = { | ||
type: "separator"; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Color of the separator. Use a hexadecimal color code. | ||
*/ | ||
color?: string; | ||
}; | ||
/** | ||
* This is an invisible component that places a fixed-size space at the beginning or end of the box. | ||
*/ | ||
export type FlexSpacer = { | ||
type: "spacer"; | ||
/** | ||
* Size of the space. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size: "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
@@ -369,4 +887,20 @@ }; | ||
text: string; | ||
/** | ||
* The ratio of the width or height of this box within the parent box. | ||
* The default value for the horizontal parent box is `1`, and the default value for the vertical parent box is `0`. | ||
* For more information, see [Width and height of components](https://developers.line.me/en/docs/messaging-api/flex-message-layout/#component-width-and-height). | ||
*/ | ||
flex?: number; | ||
/** | ||
* Minimum space between this box and the previous component in the parent box. | ||
* `none` does not set a space while the other values set a space whose size increases in the order of listing. | ||
* The default value is the value of the `spacing` property of the parent box. | ||
* If this box is the first component in the parent box, the `margin` property will be ignored. | ||
*/ | ||
margin?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; | ||
/** | ||
* Font size. | ||
* The size increases in the order of listing. | ||
* The default value is `md`. | ||
*/ | ||
size?: | ||
@@ -383,7 +917,50 @@ | "xxs" | ||
| "5xl"; | ||
/** | ||
* Horizontal alignment style. Specify one of the following values: | ||
* | ||
* - `start`: Left-aligned | ||
* - `end`: Right-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `start`. | ||
*/ | ||
align?: "start" | "end" | "center"; | ||
/** | ||
* Vertical alignment style. Specify one of the following values: | ||
* | ||
* - `top`: Top-aligned | ||
* - `bottom`: Bottom-aligned | ||
* - `center`: Center-aligned | ||
* | ||
* The default value is `top`. | ||
* | ||
* If the `layout` property of the parent box is `baseline`, the `gravity` property will be ignored. | ||
*/ | ||
gravity?: "top" | "bottom" | "center"; | ||
/** | ||
* `true` to wrap text. | ||
* The default value is `false`. | ||
* If set to `true`, you can use a new line character (\n) to begin on a new line. | ||
*/ | ||
wrap?: boolean; | ||
/** | ||
* Max number of lines. If the text does not fit in the specified number of lines, | ||
* an ellipsis (…) is displayed at the end of the last line. | ||
* If set to 0, all the text is displayed. The default value is 0. | ||
*/ | ||
maxLines?: number; | ||
/** | ||
* Font weight. | ||
* Specifying `bold`makes the font bold. | ||
* The default value is `regular`. | ||
*/ | ||
weight?: "regular" | "bold"; | ||
/** | ||
* Font color. Use a hexadecimal color code. | ||
*/ | ||
color?: string; | ||
/** | ||
* Action performed when this text is tapped. | ||
* Specify an [action object](https://developers.line.me/en/reference/messaging-api/#action-objects). | ||
*/ | ||
action?: Action; | ||
@@ -398,23 +975,110 @@ }; | ||
/** | ||
* Template with an image, title, text, and multiple action buttons. | ||
* | ||
* Because of the height limitation for buttons template messages, the lower part of the text display area will get cut off if the height limitation is exceeded. | ||
* For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits. | ||
*/ | ||
export type TemplateButtons = { | ||
type: "buttons"; | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - HTTPS | ||
* - JPEG or PNG | ||
* - Max width: 1024px | ||
* - Max: 1 MB | ||
*/ | ||
thumbnailImageUrl?: string; | ||
/** | ||
* Aspect ratio of the image. Specify one of the following values: | ||
* | ||
* - `rectangle`: 1.51:1 | ||
* - `square`: 1:1 | ||
* | ||
* The default value is `rectangle` | ||
*/ | ||
imageAspectRatio?: "rectangle" | "square"; | ||
/** | ||
* Size of the image. Specify one of the following values: | ||
* | ||
* - `cover`: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. | ||
* - `contain`: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. | ||
* | ||
* The default value is `cover`. | ||
*/ | ||
imageSize?: "cover" | "contain"; | ||
/** | ||
* Background color of image. Specify a RGB color value. | ||
* The default value is `#FFFFFF` (white). | ||
*/ | ||
imageBackgroundColor?: string; | ||
/** | ||
* Title (Max: 40 characters) | ||
*/ | ||
title?: string; | ||
/** | ||
* Message text | ||
* | ||
* - Max: 160 characters (no image or title) | ||
* - Max: 60 characters (message with an image or title) | ||
*/ | ||
text: string; | ||
/** | ||
* Action when tapped (Max: 4) | ||
*/ | ||
actions: Action[]; | ||
}; | ||
/** | ||
* Template with two action buttons. | ||
* | ||
* Because of the height limitation for confirm template messages, the lower part of the `text` display area will get cut off if the height limitation is exceeded. | ||
* For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits. | ||
*/ | ||
export type TemplateConfirm = { | ||
type: "confirm"; | ||
/** | ||
* Message text (Max: 240 characters) | ||
*/ | ||
text: string; | ||
/** | ||
* Action when tapped. Set 2 actions for the 2 buttons | ||
*/ | ||
actions: Action[]; | ||
}; | ||
/** | ||
* Template with multiple columns which can be cycled like a carousel. | ||
* The columns will be shown in order by scrolling horizontally. | ||
* | ||
* Because of the height limitation for carousel template messages, the lower part of the `text` display area will get cut off if the height limitation is exceeded. | ||
* For this reason, depending on the character width, the message text may not be fully displayed even when it is within the character limits. | ||
* | ||
* Keep the number of actions consistent for all columns. | ||
* If you use an image or title for a column, make sure to do the same for all other columns. | ||
*/ | ||
export type TemplateCarousel = { | ||
type: "carousel"; | ||
/** | ||
* Array of columns (Max: 10) | ||
*/ | ||
columns: TemplateColumn[]; | ||
/** | ||
* Aspect ratio of the image. Specify one of the following values: | ||
* | ||
* - `rectangle`: 1.51:1 | ||
* - `square`: 1:1 | ||
* | ||
* Applies to all columns. The default value is `rectangle`. | ||
*/ | ||
imageAspectRatio?: "rectangle" | "square"; | ||
/** | ||
* Size of the image. Specify one of the following values: | ||
* | ||
* - `cover`: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. | ||
* - `contain`: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. | ||
* | ||
* Applies to all columns. The default value is `cover`. | ||
*/ | ||
imageSize?: "cover" | "contain"; | ||
@@ -424,11 +1088,43 @@ }; | ||
export type TemplateColumn = { | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - HTTPS | ||
* - JPEG or PNG | ||
* - Aspect ratio: 1:1.51 | ||
* - Max width: 1024px | ||
* - Max: 1 MB | ||
*/ | ||
thumbnailImageUrl?: string; | ||
/** | ||
* Background color of image. Specify a RGB color value. | ||
* The default value is `#FFFFFF` (white). | ||
*/ | ||
imageBackgroundColor?: string; | ||
/** | ||
* Title (Max: 40 characters) | ||
*/ | ||
title?: string; | ||
/** | ||
* Message text | ||
* | ||
* - Max: 120 characters (no image or title) | ||
* - Max: 60 characters (message with an image or title) | ||
*/ | ||
text: string; | ||
/** | ||
* Action when tapped (Max: 3) | ||
*/ | ||
actions: Action[]; | ||
}; | ||
/** | ||
* Template with multiple images which can be cycled like a carousel. | ||
* The images will be shown in order by scrolling horizontally. | ||
*/ | ||
export type TemplateImageCarousel = { | ||
type: "image_carousel"; | ||
/** | ||
* Array of columns (Max: 10) | ||
*/ | ||
columns: TemplateImageColumn; | ||
@@ -438,6 +1134,29 @@ }; | ||
export type TemplateImageColumn = { | ||
/** | ||
* Image URL (Max: 1000 characters) | ||
* | ||
* - HTTPS | ||
* - JPEG or PNG | ||
* - Aspect ratio: 1:1 | ||
* - Max width: 1024px | ||
* - Max: 1 MB | ||
*/ | ||
imageUrl: string; | ||
/** | ||
* Action when image is tapped | ||
*/ | ||
action: Action<{ label?: string }>; | ||
}; | ||
/** | ||
* These are types of actions for your bot to take when a user taps a button or an image in a message. | ||
* | ||
* - [Postback action](https://developers.line.me/en/reference/messaging-api/#postback-action) | ||
* - [Message action](https://developers.line.me/en/reference/messaging-api/#message-action) | ||
* - [URI action](https://developers.line.me/en/reference/messaging-api/#uri-action) | ||
* - [Datetime picker action](https://developers.line.me/en/reference/messaging-api/#datetime-picker-action) | ||
* - [Camera action](https://developers.line.me/en/reference/messaging-api/#camera-action) | ||
* - [Camera roll action](https://developers.line.me/en/reference/messaging-api/#camera-roll-action) | ||
* - [Location action](https://developers.line.me/en/reference/messaging-api/#location-action) | ||
*/ | ||
export type Action<ExtraFields = { label: string }> = ( | ||
@@ -450,25 +1169,84 @@ | PostbackAction | ||
/** | ||
* When a control associated with this action is tapped, a postback event is returned via webhook with the specified string in the data property. | ||
*/ | ||
export type PostbackAction = { | ||
type: "postback"; | ||
/** | ||
* String returned via webhook in the `postback.data` property of the postback event (Max: 300 characters) | ||
*/ | ||
data: string; | ||
/** | ||
* Text displayed in the chat as a message sent by the user when the action is performed. | ||
* Returned from the server through a webhook. | ||
* This property cannot be used with quick reply buttons. (Max: 300 characters) | ||
* The `displayText` and `text` properties cannot both be used at the same time. | ||
* @deprecated | ||
*/ | ||
text?: string; | ||
/** | ||
* Text displayed in the chat as a message sent by the user when the action is performed. | ||
* Required for quick reply buttons. | ||
* Optional for the other message types. | ||
* Max: 300 characters | ||
* The `displayText` and `text` properties cannot both be used at the same time. | ||
*/ | ||
displayText?: string; | ||
}; | ||
/** | ||
* When a control associated with this action is tapped, the string in the text property is sent as a message from the user. | ||
*/ | ||
export type MessageAction = { | ||
type: "message"; | ||
/** | ||
* Text sent when the action is performed (Max: 300 characters) | ||
*/ | ||
text: string; | ||
}; | ||
/** | ||
* When a control associated with this action is tapped, the URI specified in the `uri` property is opened. | ||
*/ | ||
export type URIAction = { | ||
type: "uri"; | ||
/** | ||
* URI opened when the action is performed (Max: 1000 characters). | ||
* Must start with `http`, `https`, or `tel`. | ||
*/ | ||
uri: string; | ||
}; | ||
/** | ||
* When a control associated with this action is tapped, a [postback event](https://developers.line.me/en/reference/messaging-api/#postback-event) is returned via webhook with the date and time selected by the user from the date and time selection dialog. | ||
* The datetime picker action does not support time zones. | ||
* | ||
* #### Date and time format | ||
* | ||
* The date and time formats for the `initial`, `max`, and `min` values are shown below. The `full-date`, `time-hour`, and `time-minute` formats follow the [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) protocol. | ||
* | ||
* | Mode | Format | Example | | ||
* | -------- | ------------------------------------------------------------ | -------------------------------- | | ||
* | date | `full-date` (Max: 2100-12-31; Min: 1900-01-01) | 2017-06-18 | | ||
* | time | `time-hour`:`time-minute` (Max: 23:59; Min: 00:00) | 00:0006:1523:59 | | ||
* | datetime | `full-date`T`time-hour`:`time-minute` or `full-date`t`time-hour`:`time-minute` (Max: 2100-12-31T23:59; Min: 1900-01-01T00:00) | 2017-06-18T06:152017-06-18t06:15 | | ||
*/ | ||
export type DatetimePickerAction = { | ||
type: "datetimepicker"; | ||
/** | ||
* String returned via webhook in the `postback.data` property of the postback event (Max: 300 characters) | ||
*/ | ||
data: string; | ||
mode: "date" | "time" | "datetime"; | ||
/** | ||
* Initial value of date or time | ||
*/ | ||
initial?: string; | ||
/** | ||
* Largest date or time value that can be selected. Must be greater than the `min` value. | ||
*/ | ||
max?: string; | ||
/** | ||
* Smallest date or time value that can be selected. Must be less than the `max` value. | ||
*/ | ||
min?: string; | ||
@@ -482,7 +1260,34 @@ }; | ||
/** | ||
* Rich menus consist of either of these objects. | ||
* | ||
* - [Rich menu object](https://developers.line.me/en/reference/messaging-api/#rich-menu-object) without the rich menu ID. Use this object when you [create a rich menu](https://developers.line.me/en/reference/messaging-api/#create-rich-menu). | ||
* - [Rich menu response object](https://developers.line.me/en/reference/messaging-api/#rich-menu-response-object) with the rich menu ID. This object is returned when you [get a rich menu](https://developers.line.me/en/reference/messaging-api/#get-rich-menu) or [get a list of rich menus](https://developers.line.me/en/reference/messaging-api/#get-rich-menu-list). | ||
* | ||
* [Area objects](https://developers.line.me/en/reference/messaging-api/#area-object) and [action objects](https://developers.line.me/en/reference/messaging-api/#action-objects) are included in these objects. | ||
*/ | ||
export type RichMenu = { | ||
/** | ||
* [`size` object](https://developers.line.me/en/reference/messaging-api/#size-object) which contains the width and height of the rich menu displayed in the chat. | ||
* Rich menu images must be one of the following sizes: 2500x1686px or 2500x843px. | ||
*/ | ||
size: Size; | ||
/** | ||
* `true` to display the rich menu by default. Otherwise, `false`. | ||
*/ | ||
selected: boolean; | ||
/** | ||
* Name of the rich menu. | ||
* This value can be used to help manage your rich menus and is not displayed to users. | ||
* (Max: 300 characters) | ||
*/ | ||
name: string; | ||
/** | ||
* Text displayed in the chat bar (Max: 14 characters) | ||
*/ | ||
chatBarText: string; | ||
/** | ||
* Array of [area objects](https://developers.line.me/en/reference/messaging-api/#area-object) which define the coordinates and size of tappable areas | ||
* (Max: 20 area objects) | ||
*/ | ||
areas: Array<{ bounds: Area; action: Action<{}> }>; | ||
@@ -489,0 +1294,0 @@ }; |
{ | ||
"name": "@line/bot-sdk", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"description": "Node.js SDK for LINE Messaging API", | ||
@@ -17,3 +17,3 @@ "engines": { | ||
"pretest": "npm run build", | ||
"test": "API_BASE_URL=http://localhost:1234/ TEST_PORT=1234 TS_NODE_CACHE=0 mocha -r ts-node/register test/*.spec.ts", | ||
"test": "API_BASE_URL=http://localhost:1234/ TEST_PORT=1234 TS_NODE_CACHE=0 nyc mocha", | ||
"prettier": "prettier --parser typescript --trailing-comma all \"{lib,test}/**/*.ts\"", | ||
@@ -56,2 +56,3 @@ "format": "npm run prettier -- --write", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.2", | ||
"prettier": "^1.8.2", | ||
@@ -61,3 +62,17 @@ "ts-node": "^3.3.0", | ||
}, | ||
"nyc": { | ||
"require": [ | ||
"ts-node/register" | ||
], | ||
"extension": [ | ||
".ts" | ||
], | ||
"reporter": [ | ||
"lcov", | ||
"text-summary" | ||
], | ||
"sourceMap": true, | ||
"instrument": true | ||
}, | ||
"license": "Apache-2.0" | ||
} |
# line-bot-sdk-nodejs | ||
[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs) [![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk) | ||
[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs) | ||
[![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk) | ||
@@ -5,0 +6,0 @@ Node.js SDK for LINE Messaging API |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 55 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2776346
162
5656
45
11
61