This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+34 -5
View File
@@ -19,7 +19,8 @@ export default class Client {
narrowcast(messages: Types.Message | Types.Message[], recipient?: Types.ReceieptObject, filter?: {
demographic: Types.DemographicFilterObject;
}, limit?: {
max: number;
max?: number;
upToRemainingQuota?: boolean;
}, notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
broadcast(messages: Types.Message | Types.Message[], notificationDisabled?: boolean): Promise<Types.MessageAPIResponseBase>;
getProfile(userId: string): Promise<Types.Profile>;
@@ -29,6 +30,7 @@ export default class Client {
private getChatMemberIds;
getGroupMemberIds(groupId: string): Promise<string[]>;
getRoomMemberIds(roomId: string): Promise<string[]>;
getBotFollowersIds(): Promise<string[]>;
getGroupMembersCount(groupId: string): Promise<Types.MembersCountResponse>;
getRoomMembersCount(roomId: string): Promise<Types.MembersCountResponse>;
getGroupSummary(groupId: string): Promise<Types.GroupSummaryResponse>;
@@ -39,6 +41,11 @@ export default class Client {
getRichMenu(richMenuId: string): Promise<Types.RichMenuResponse>;
createRichMenu(richMenu: Types.RichMenu): Promise<string>;
deleteRichMenu(richMenuId: string): Promise<any>;
getRichMenuAliasList(): Promise<Types.GetRichMenuAliasListResponse>;
getRichMenuAlias(richMenuAliasId: string): Promise<Types.GetRichMenuAliasResponse>;
createRichMenuAlias(richMenuId: string, richMenuAliasId: string): Promise<{}>;
deleteRichMenuAlias(richMenuAliasId: string): Promise<{}>;
updateRichMenuAlias(richMenuAliasId: string, richMenuId: string): Promise<{}>;
getRichMenuIdOfUser(userId: string): Promise<string>;
linkRichMenuToUser(userId: string, richMenuId: string): Promise<any>;
unlinkRichMenuFromUser(userId: string): Promise<any>;
@@ -64,8 +71,8 @@ export default class Client {
getUserInteractionStatistics(requestId: string): Promise<Types.UserInteractionStatistics>;
createUploadAudienceGroup(uploadAudienceGroup: {
description: string;
isIfaAudience: boolean;
audiences: {
isIfaAudience?: boolean;
audiences?: {
id: string;
}[];
uploadDescription?: string;
@@ -75,6 +82,17 @@ export default class Client {
description: string;
created: number;
}>;
createUploadAudienceGroupByFile(uploadAudienceGroup: {
description: string;
isIfaAudience?: boolean;
uploadDescription?: string;
file: Buffer | Readable;
}): Promise<{
audienceGroupId: number;
type: "UPLOAD";
description: string;
created: number;
}>;
updateUploadAudienceGroup(uploadAudienceGroup: {
audienceGroupId: number;
description?: string;
@@ -83,6 +101,11 @@ export default class Client {
id: string;
}[];
}, httpConfig?: Partial<AxiosRequestConfig>): Promise<{}>;
updateUploadAudienceGroupByFile(uploadAudienceGroup: {
audienceGroupId: number;
uploadDescription?: string;
file: Buffer | Readable;
}, httpConfig?: Partial<AxiosRequestConfig>): Promise<{}>;
createClickAudienceGroup(clickAudienceGroup: {
description: string;
requestId: string;
@@ -122,15 +145,21 @@ export default class Client {
authorityLevel: Types.AudienceGroupAuthorityLevel;
}>;
changeAudienceGroupAuthorityLevel(authorityLevel: Types.AudienceGroupAuthorityLevel): Promise<{}>;
getBotInfo(): Promise<Types.BotInfoResponse>;
setWebhookEndpointUrl(endpoint: string): Promise<{}>;
getWebhookEndpointInfo(): Promise<Types.WebhookEndpointInfoResponse>;
testWebhookEndpoint(endpoint?: string): Promise<Types.TestWebhookEndpointResponse>;
}
export declare class OAuth {
private http;
constructor();
issueAccessToken(client_id: string, client_secret: string): Promise<Types.ChannelAccessToken>;
revokeAccessToken(access_token: string): Promise<{}>;
verifyAccessToken(access_token: string): Promise<Types.VerifyAccessToken>;
verifyIdToken(id_token: string, client_id: string, nonce?: string, user_id?: string): Promise<Types.VerifyIDToken>;
issueChannelAccessTokenV2_1(client_assertion: string): Promise<Types.ChannelAccessToken>;
getIssuedChannelAccessTokenV2_1(client_assertion: string): Promise<{
access_tokens: string[];
getChannelAccessTokenKeyIdsV2_1(client_assertion: string): Promise<{
key_ids: string[];
}>;
revokeChannelAccessTokenV2_1(client_id: string, client_secret: string, access_token: string): Promise<{}>;
}
+83 -5
View File
@@ -58,7 +58,7 @@ class Client {
notificationDisabled,
}, this.generateRequestConfig());
}
async narrowcast(messages, recipient, filter, limit, notificationDisabled = false) {
async narrowcast(messages, recipient, filter, limit, notificationDisabled) {
return this.http.post(`${endpoints_1.MESSAGING_API_PREFIX}/message/narrowcast`, {
messages: utils_1.toArray(messages),
recipient,
@@ -104,6 +104,17 @@ class Client {
async getRoomMemberIds(roomId) {
return this.getChatMemberIds("room", roomId);
}
async getBotFollowersIds() {
let userIds = [];
let start;
do {
const res = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/followers/ids`, start ? { start, limit: 1000 } : { limit: 1000 });
utils_1.ensureJSON(res);
userIds = userIds.concat(res.userIds);
start = res.next;
} while (start);
return userIds;
}
async getGroupMembersCount(groupId) {
const groupMemberCount = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/group/${groupId}/members/count`);
return utils_1.ensureJSON(groupMemberCount);
@@ -139,6 +150,31 @@ class Client {
async deleteRichMenu(richMenuId) {
return this.http.delete(`${endpoints_1.MESSAGING_API_PREFIX}/richmenu/${richMenuId}`);
}
async getRichMenuAliasList() {
const res = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/richmenu/alias/list`);
return utils_1.ensureJSON(res);
}
async getRichMenuAlias(richMenuAliasId) {
const res = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/richmenu/alias/${richMenuAliasId}`);
return utils_1.ensureJSON(res);
}
async createRichMenuAlias(richMenuId, richMenuAliasId) {
const res = await this.http.post(`${endpoints_1.MESSAGING_API_PREFIX}/richmenu/alias`, {
richMenuId,
richMenuAliasId,
});
return utils_1.ensureJSON(res);
}
async deleteRichMenuAlias(richMenuAliasId) {
const res = this.http.delete(`${endpoints_1.MESSAGING_API_PREFIX}/richmenu/alias/${richMenuAliasId}`);
return utils_1.ensureJSON(res);
}
async updateRichMenuAlias(richMenuAliasId, richMenuId) {
const res = await this.http.post(`${endpoints_1.MESSAGING_API_PREFIX}/richmenu/alias/${richMenuAliasId}`, {
richMenuId,
});
return utils_1.ensureJSON(res);
}
async getRichMenuIdOfUser(userId) {
const res = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/user/${userId}/richmenu`);
return utils_1.ensureJSON(res).richMenuId;
@@ -232,12 +268,28 @@ class Client {
const res = await this.http.post(`${endpoints_1.MESSAGING_API_PREFIX}/audienceGroup/upload`, Object.assign({}, uploadAudienceGroup));
return utils_1.ensureJSON(res);
}
async createUploadAudienceGroupByFile(uploadAudienceGroup) {
const file = await this.http.toBuffer(uploadAudienceGroup.file);
const body = utils_1.createMultipartFormData(Object.assign(Object.assign({}, uploadAudienceGroup), { file }));
const res = await this.http.post(`${endpoints_1.DATA_API_PREFIX}/audienceGroup/upload/byFile`, body, {
headers: body.getHeaders(),
});
return utils_1.ensureJSON(res);
}
async updateUploadAudienceGroup(uploadAudienceGroup,
// for set request timeout
httpConfig) {
const res = await this.http.put(`${endpoints_1.MESSAGING_API_PREFIX}/audienceGroup/upload`, Object.assign({}, uploadAudienceGroup), httpConfig);
return utils_1.ensureJSON(res);
}
async updateUploadAudienceGroupByFile(uploadAudienceGroup,
// for set request timeout
httpConfig) {
const file = await this.http.toBuffer(uploadAudienceGroup.file);
const body = utils_1.createMultipartFormData(Object.assign(Object.assign({}, uploadAudienceGroup), { file }));
const res = await this.http.put(`${endpoints_1.DATA_API_PREFIX}/audienceGroup/upload/byFile`, body, Object.assign({ headers: body.getHeaders() }, httpConfig));
return utils_1.ensureJSON(res);
}
async createClickAudienceGroup(clickAudienceGroup) {
const res = await this.http.post(`${endpoints_1.MESSAGING_API_PREFIX}/audienceGroup/click`, Object.assign({}, clickAudienceGroup));
return utils_1.ensureJSON(res);
@@ -279,6 +331,21 @@ class Client {
const res = await this.http.put(`${endpoints_1.MESSAGING_API_PREFIX}/audienceGroup/authorityLevel`, { authorityLevel });
return utils_1.ensureJSON(res);
}
async getBotInfo() {
const res = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/info`);
return utils_1.ensureJSON(res);
}
async setWebhookEndpointUrl(endpoint) {
return this.http.put(`${endpoints_1.MESSAGING_API_PREFIX}/channel/webhook/endpoint`, { endpoint });
}
async getWebhookEndpointInfo() {
const res = await this.http.get(`${endpoints_1.MESSAGING_API_PREFIX}/channel/webhook/endpoint`);
return utils_1.ensureJSON(res);
}
async testWebhookEndpoint(endpoint) {
const res = await this.http.post(`${endpoints_1.MESSAGING_API_PREFIX}/channel/webhook/test`, { endpoint });
return utils_1.ensureJSON(res);
}
}
exports.default = Client;
class OAuth {
@@ -295,21 +362,32 @@ class OAuth {
revokeAccessToken(access_token) {
return this.http.postForm(`${endpoints_1.OAUTH_BASE_PREFIX}/revoke`, { access_token });
}
verifyAccessToken(access_token) {
return this.http.get(`${endpoints_1.OAUTH_BASE_PREFIX_V2_1}/verify`, { access_token });
}
verifyIdToken(id_token, client_id, nonce, user_id) {
return this.http.postForm(`${endpoints_1.OAUTH_BASE_PREFIX}/verify`, {
id_token,
client_id,
nonce,
user_id,
});
}
issueChannelAccessTokenV2_1(client_assertion) {
return this.http.postForm(`${endpoints_1.OAUTH_BASE_PREFIX}/v2.1/token`, {
return this.http.postForm(`${endpoints_1.OAUTH_BASE_PREFIX_V2_1}/token`, {
grant_type: "client_credentials",
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
client_assertion,
});
}
getIssuedChannelAccessTokenV2_1(client_assertion) {
return this.http.get(`${endpoints_1.OAUTH_BASE_PREFIX}/v2.1/tokens`, {
getChannelAccessTokenKeyIdsV2_1(client_assertion) {
return this.http.get(`${endpoints_1.OAUTH_BASE_PREFIX_V2_1}/tokens/kid`, {
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
client_assertion,
});
}
revokeChannelAccessTokenV2_1(client_id, client_secret, access_token) {
return this.http.postForm(`${endpoints_1.OAUTH_BASE_PREFIX}/v2.1/revoke`, {
return this.http.postForm(`${endpoints_1.OAUTH_BASE_PREFIX_V2_1}/revoke`, {
client_id,
client_secret,
access_token,
+1
View File
@@ -1,3 +1,4 @@
export declare const MESSAGING_API_PREFIX = "https://api.line.me/v2/bot";
export declare const DATA_API_PREFIX = "https://api-data.line.me/v2/bot";
export declare const OAUTH_BASE_PREFIX = "https://api.line.me/v2/oauth";
export declare const OAUTH_BASE_PREFIX_V2_1 = "https://api.line.me/oauth2/v2.1";
+2 -1
View File
@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OAUTH_BASE_PREFIX = exports.DATA_API_PREFIX = exports.MESSAGING_API_PREFIX = void 0;
exports.OAUTH_BASE_PREFIX_V2_1 = exports.OAUTH_BASE_PREFIX = exports.DATA_API_PREFIX = exports.MESSAGING_API_PREFIX = void 0;
exports.MESSAGING_API_PREFIX = `https://api.line.me/v2/bot`;
exports.DATA_API_PREFIX = `https://api-data.line.me/v2/bot`;
exports.OAUTH_BASE_PREFIX = `https://api.line.me/v2/oauth`;
exports.OAUTH_BASE_PREFIX_V2_1 = `https://api.line.me/oauth2/v2.1`;
+1
View File
@@ -16,6 +16,7 @@ export default class HTTPClient {
private responseParse;
put<T>(url: string, body?: any, config?: Partial<AxiosRequestConfig>): Promise<T>;
postForm<T>(url: string, body?: any): Promise<T>;
toBuffer(data: Buffer | Readable): Promise<Buffer>;
postBinary<T>(url: string, data: Buffer | Readable, contentType?: string): Promise<T>;
delete<T>(url: string, params?: any): Promise<T>;
private wrapError;
+22 -21
View File
@@ -50,30 +50,31 @@ class HTTPClient {
});
return res.data;
}
async postBinary(url, data, contentType) {
const buffer = await (async () => {
if (Buffer.isBuffer(data)) {
return data;
}
else if (data instanceof stream_1.Readable) {
return new Promise((resolve, reject) => {
const buffers = [];
let size = 0;
data.on("data", (chunk) => {
buffers.push(chunk);
size += chunk.length;
});
data.on("end", () => resolve(Buffer.concat(buffers, size)));
data.on("error", reject);
async toBuffer(data) {
if (Buffer.isBuffer(data)) {
return data;
}
else if (data instanceof stream_1.Readable) {
return await new Promise((resolve, reject) => {
const buffers = [];
let size = 0;
data.on("data", (chunk) => {
buffers.push(chunk);
size += chunk.length;
});
}
else {
throw new Error("invalid data type for postBinary");
}
})();
data.on("end", () => resolve(Buffer.concat(buffers, size)));
data.on("error", reject);
});
}
else {
throw new Error("invalid data type for binary data");
}
}
async postBinary(url, data, contentType) {
const buffer = await this.toBuffer(data);
const res = await this.instance.post(url, buffer, {
headers: {
"Content-Type": contentType || fileType(buffer).mime,
"Content-Type": contentType || (await fileType.fromBuffer(buffer)).mime,
"Content-Length": buffer.length,
},
});
+412 -59
View File
@@ -37,7 +37,7 @@ export declare type WebhookRequestBody = {
*
* @see [Webhook event objects](https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects)
*/
export declare type WebhookEvent = MessageEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | MemberJoinEvent | MemberLeaveEvent | PostbackEvent | BeaconEvent | AccountLinkEvent | DeviceLinkEvent | DeviceUnlinkEvent | LINEThingsScenarioExecutionEvent;
export declare type WebhookEvent = MessageEvent | UnsendEvent | FollowEvent | UnfollowEvent | JoinEvent | LeaveEvent | MemberJoinEvent | MemberLeaveEvent | PostbackEvent | VideoPlayCompleteEvent | BeaconEvent | AccountLinkEvent | DeviceLinkEvent | DeviceUnlinkEvent | LINEThingsScenarioExecutionEvent;
export declare type EventBase = {
/**
* Channel state.
@@ -100,6 +100,20 @@ export declare type MessageEvent = {
type: "message";
message: EventMessage;
} & ReplyableEvent;
/**
* Event object for when the user unsends a message in a [group](https://developers.line.biz/en/docs/messaging-api/group-chats/#group)
* or [room](https://developers.line.biz/en/docs/messaging-api/group-chats/#room).
* [Unsend event](https://developers.line.biz/en/reference/messaging-api/#unsend-event)
*/
export declare type UnsendEvent = {
type: "unsend";
/**
* The message ID of the unsent message
*/
unsend: {
messageId: string;
};
} & EventBase;
/**
* Event object for when your account is added as a friend (or unblocked).
*/
@@ -167,6 +181,19 @@ export declare type PostbackEvent = {
type: "postback";
postback: Postback;
} & ReplyableEvent;
/**
* Event for when a user finishes viewing a video at least once with the specified trackingId sent by the LINE Official Account.
*/
export declare type VideoPlayCompleteEvent = {
type: "videoPlayComplete";
/**
* ID used to identify a video. Returns the same value as the trackingId assigned to the [video message](https://developers.line.biz/en/reference/messaging-api/#video-message).
* String
*/
videoPlayComplete: {
trackingId: string;
};
} & ReplyableEvent;
/**
* Event object for when a user enters or leaves the range of a
* [LINE Beacon](https://developers.line.biz/en/docs/messaging-api/using-beacons/).
@@ -325,6 +352,28 @@ export declare type TextEventMessage = {
productId: string;
emojiId: string;
}[];
/**
* Object containing the contents of the mentioned user.
*/
mention?: {
/**
* Mentioned user information.
* Max: 20 mentions
*/
mentionees: {
/**
* Index position of the user mention for a character in `text`,
* with the first character being at position 0.
*/
index: number;
/**
* The length of the text of the mentioned user. For a mention `@example`,
* 8 is the length.
*/
length: number;
userId: string;
}[];
};
} & EventMessageBase;
export declare type ContentProvider<WithPreview extends boolean = true> = {
/**
@@ -356,6 +405,28 @@ export declare type ContentProvider<WithPreview extends boolean = true> = {
export declare type ImageEventMessage = {
type: "image";
contentProvider: ContentProvider;
/**
* Object containing the number of images sent simultaneously.
*/
imageSet?: {
/**
* Image set ID. Only included when multiple images are sent simultaneously.
*/
id: string;
/**
* An index starting from 1, indicating the image number in a set of images sent simultaneously.
* Only included when multiple images are sent simultaneously.
* However, it won't be included if the sender is using LINE 11.15 or earlier for Android.
*/
index: number;
/**
* The total number of images sent simultaneously.
* If two images are sent simultaneously, the number is 2.
* Only included when multiple images are sent simultaneously.
* However, it won't be included if the sender is using LINE 11.15 or earlier for Android.
*/
total: number;
};
} & EventMessageBase;
/**
* Message object which contains the video content sent from the source.
@@ -402,32 +473,47 @@ export declare type StickerEventMessage = {
type: "sticker";
packageId: string;
stickerId: string;
stickerResourceType: "STATIC" | "ANIMATION" | "SOUND" | "ANIMATION_SOUND" | "POPUP" | "POPUP_SOUND" | "NAME_TEXT";
stickerResourceType: "STATIC" | "ANIMATION" | "SOUND" | "ANIMATION_SOUND" | "POPUP" | "POPUP_SOUND" | "CUSTOM" | "MESSAGE";
keywords: string[];
/**
* Any text entered by the user. This property is only included for message stickers.
* Max character limit: 100
*/
text?: string;
} & EventMessageBase;
export declare type Postback = {
data: string;
params?: DateTimePostback | RichMenuSwitchPostback;
};
/**
* Object with the date and time selected by a user through a
* [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
* Only returned for postback actions via a
* [datetime picker action](https://developers.line.biz/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).
*/
declare type DateTimePostback = {
/**
* Object with the date and time selected by a user through a
* [datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action).
* Only returned for postback actions via a
* [datetime picker action](https://developers.line.biz/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).
* Date selected by user. Only included in the `date` mode.
*/
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;
};
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;
};
/**
* Object with rich menu alias ID selected by user via rich menu switch action.
* https://developers.line.biz/en/reference/messaging-api/#postback-params-object-for-richmenu-switch-action
*/
declare type RichMenuSwitchPostback = {
newRichMenuAliasId: string;
status: "SUCCESS" | "RICHMENU_ALIAS_ID_NOTFOUND" | "RICHMENU_NOTFOUND" | "FAILED";
};
/**
* JSON object which contains the contents of the message you send.
@@ -463,13 +549,24 @@ export declare type TextMessage = MessageCommon & {
/**
* Message text. You can include the following emoji:
*
* - LINE emojis. Use a $ character as a placeholder and specify the product ID and emoji ID of the LINE emoji you want to use in the emojis property.
* - Unicode emoji
* - LINE original emoji
* - (Deprecated) LINE original unicode emojis
* ([Unicode codepoint table for LINE original emoji](https://developers.line.biz/media/messaging-api/emoji-list.pdf))
*
* Max: 2000 characters
* Max: 5000 characters
*/
text: string;
/**
* One or more LINE emoji.
*
* Max: 20 LINE emoji
*/
emojis?: {
index: number;
productId: string;
emojiId: string;
}[];
};
/**
* @see [Image message](https://developers.line.biz/en/reference/messaging-api/#image-message)
@@ -477,7 +574,7 @@ export declare type TextMessage = MessageCommon & {
export declare type ImageMessage = MessageCommon & {
type: "image";
/**
* Image URL (Max: 1000 characters)
* Image URL (Max: 2000 characters)
*
* - **HTTPS**
* - JPEG
@@ -486,7 +583,7 @@ export declare type ImageMessage = MessageCommon & {
*/
originalContentUrl: string;
/**
* Preview image URL (Max: 1000 characters)
* Preview image URL (Max: 2000 characters)
*
* - **HTTPS**
* - JPEG
@@ -501,7 +598,7 @@ export declare type ImageMessage = MessageCommon & {
export declare type VideoMessage = MessageCommon & {
type: "video";
/**
* URL of video file (Max: 1000 characters)
* URL of video file (Max: 2000 characters)
*
* - **HTTPS**
* - mp4
@@ -512,7 +609,7 @@ export declare type VideoMessage = MessageCommon & {
*/
originalContentUrl: string;
/**
* URL of preview image (Max: 1000 characters)
* URL of preview image (Max: 2000 characters)
*
* - **HTTPS**
* - JPEG
@@ -527,7 +624,7 @@ export declare type VideoMessage = MessageCommon & {
export declare type AudioMessage = MessageCommon & {
type: "audio";
/**
* URL of audio file (Max: 1000 characters)
* URL of audio file (Max: 2000 characters)
*
* - **HTTPS**
* - m4a
@@ -582,7 +679,7 @@ export declare type ImageMapMessage = MessageCommon & {
type: "imagemap";
/**
* [Base URL](https://developers.line.biz/en/reference/messaging-api/#base-url) of image
* (Max: 1000 characters, **HTTPS**)
* (Max: 2000 characters, **HTTPS**)
*/
baseUrl: string;
/**
@@ -595,7 +692,7 @@ export declare type ImageMapMessage = MessageCommon & {
*/
video?: {
/**
* URL of video file (Max: 1000 characters)
* URL of video file (Max: 2000 characters)
*
* - **HTTPS**
* - mp4
@@ -606,7 +703,7 @@ export declare type ImageMapMessage = MessageCommon & {
*/
originalContentUrl: string;
/**
* URL of preview image (Max: 1000 characters)
* URL of preview image (Max: 2000 characters)
*
* - **HTTPS**
* - JPEG
@@ -748,7 +845,7 @@ export declare type FlexBubble = {
*/
direction?: "ltr" | "rtl";
header?: FlexBox;
hero?: FlexBox | FlexImage;
hero?: FlexBox | FlexImage | FlexVideo;
body?: FlexBox;
footer?: FlexBox;
styles?: FlexBubbleStyle;
@@ -780,7 +877,7 @@ export declare type FlexBlockStyle = {
export declare type FlexCarousel = {
type: "carousel";
/**
* (Max: 10 bubbles)
* (Max: 12 bubbles)
*/
contents: FlexBubble[];
};
@@ -791,6 +888,7 @@ export declare type FlexCarousel = {
* - [Box](https://developers.line.biz/en/reference/messaging-api/#box)
* - [Button](https://developers.line.biz/en/reference/messaging-api/#button)
* - [Image](https://developers.line.biz/en/reference/messaging-api/#f-image)
* - [Video](https://developers.line.biz/en/reference/messaging-api/#f-video)
* - [Icon](https://developers.line.biz/en/reference/messaging-api/#icon)
* - [Text](https://developers.line.biz/en/reference/messaging-api/#f-text)
* - [Span](https://developers.line.biz/en/reference/messaging-api/#span)
@@ -803,7 +901,7 @@ export declare type FlexCarousel = {
* - [Flex Message elements](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/)
* - [Flex Message layout](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/)
*/
export declare type FlexComponent = FlexBox | FlexButton | FlexImage | FlexIcon | FlexText | FlexSpan | FlexSeparator | FlexFiller | FlexSpacer;
export declare type FlexComponent = FlexBox | FlexButton | FlexImage | FlexVideo | FlexIcon | FlexText | FlexSpan | FlexSeparator | FlexFiller | FlexSpacer;
/**
* This is a component that defines the layout of child components.
* You can also include a box in a box.
@@ -868,10 +966,18 @@ export declare type FlexBox = {
* Width of the box. For more information, see [Width of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-width) in the API documentation.
*/
width?: string;
/**
* Max width of the box. For more information, see [Max width of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-max-width) in the API documentation.
*/
maxWidth?: string;
/**
* Height of the box. For more information, see [Height of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-height) in the API documentation.
*/
height?: string;
/**
* Max height of the box. For more information, see [Max height of a box](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#box-max-height) in the API documentation.
*/
maxHeight?: 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
@@ -890,7 +996,7 @@ export declare type FlexBox = {
* - To override this setting for a specific component, set the `margin`
* property of that component.
*/
spacing?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
spacing?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Minimum space between this box and the previous component in the parent box.
*
@@ -901,7 +1007,7 @@ export declare type FlexBox = {
* - 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";
margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Free space between the borders of this box and the child element.
* For more information, see [Box padding](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#padding-property) in the API documentation.
@@ -933,6 +1039,19 @@ export declare type FlexBox = {
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
/**
* How child elements are aligned along the main axis of the parent element. If the
* parent element is a horizontal box, this only takes effect when its child elements have
* 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)
* in the Messaging API documentation.
*/
justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
/**
* How child elements are aligned along the cross axis of the parent element. 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) in the Messaging API documentation.
*/
alignItems?: "flex-start" | "center" | "flex-end";
background?: Background;
} & Offset;
export declare type Offset = {
/**
@@ -965,6 +1084,48 @@ export declare type Offset = {
*/
offsetEnd?: string;
};
export declare type Background = {
/**
* The type of background used. Specify these values:
* - `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.
*/
type: "linearGradient";
/**
* The angle at which a linear gradient moves. Specify the angle using an integer value
* like `90deg` (90 degrees) or a decimal number like `23.5deg` (23.5 degrees) in the
* half-open interval [0, 360). The direction of the linear gradient rotates clockwise as the
* angle increases. Given a value of `0deg`, the gradient starts at the bottom and ends at
* the top; given a value of `45deg`, the gradient starts at the bottom-left corner and ends
* at the top-right corner; given a value of 90deg, the gradient starts at the left and ends
* at the right; and given a value of `180deg`, the gradient starts at the top and ends at
* 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.
*/
angle: string;
/**
* The color at the gradient's starting point. Use a hexadecimal color code in the
* `#RRGGBB` or `#RRGGBBAA` format.
*/
startColor: string;
/**
* The color at the gradient's ending point. Use a hexadecimal color code in the
* `#RRGGBB` or `#RRGGBBAA` format.
*/
endColor: string;
/**
* The color in the middle of the gradient. Use a hexadecimal color code in the `#RRGGBB`
* or `#RRGGBBAA` format. Specify a value for the `background.centerColor` property to
* 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
* Messaging API documentation.
*/
centerColor?: string;
/**
* The position of the intermediate color stop. Specify an integer or decimal value
* between `0%` (the starting point) and `100%` (the ending point). This is `50%` by
* 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
* Messaging API documentation.
*/
centerPosition?: string;
};
/**
* This component draws a button.
*
@@ -998,7 +1159,7 @@ export declare type FlexButton = {
* - 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";
margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Height of the button. The default value is `md`.
*/
@@ -1033,6 +1194,18 @@ export declare type FlexButton = {
* property will be ignored.
*/
gravity?: "top" | "bottom" | "center";
/**
* The method by which to adjust the text font size. Specify this value:
*
* - `shrink-to-fit`: Automatically shrink the font
* size to fit the width of the component. This
* property takes a "best-effort" approach that may
* work differently—or not at all!—on some platforms.
* For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
* in the Messaging API documentation.
* - LINE 10.13.0 or later for iOS and Android
*/
adjustMode?: "shrink-to-fit";
} & Offset;
/**
* This is an invisible component to fill extra space between components.
@@ -1053,7 +1226,7 @@ export declare type FlexFiller = {
export declare type FlexIcon = {
type: "icon";
/**
* Image URL
* Image URL (Max character limit: 2000)
*
* Protocol: HTTPS
* Image format: JPEG or PNG
@@ -1072,13 +1245,14 @@ export declare type FlexIcon = {
* - 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";
margin?: string | "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`.
* 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.
*/
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
/**
* Aspect ratio of the icon. `{width}:{height}` format.
* The values of `{width}` and `{height}` must be in the range 1100000.
@@ -1093,7 +1267,7 @@ export declare type FlexIcon = {
export declare type FlexImage = {
type: "image";
/**
* Image URL
* Image URL (Max character limit: 2000)
*
* - Protocol: HTTPS
* - Image format: JPEG or PNG
@@ -1122,7 +1296,7 @@ export declare type FlexImage = {
* - 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";
margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Horizontal alignment style. Specify one of the following values:
*
@@ -1149,8 +1323,9 @@ export declare type FlexImage = {
* Maximum size of the image width.
* The size increases in the order of listing.
* The default value is `md`.
* For more information, see [Image size](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#image-size) in the Messaging API documentation.
*/
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full";
size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl" | "full";
/**
* Aspect ratio of the image. `{width}:{height}` format.
* Specify the value of `{width}` and `{height}` in the range from 1 to 100000. However,
@@ -1179,7 +1354,61 @@ export declare type FlexImage = {
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
/**
* When this is `true`, an animated image (APNG) plays.
* You can specify a value of `true` up to three times in a single message.
* You can't send messages that exceed this limit.
* This is `false` by default.
* Animated images larger than 300 KB aren't played back.
*/
animated?: Boolean;
} & Offset;
/**
* This component draws a video.
*/
export declare type FlexVideo = {
type: "video";
/**
* Video file URL (Max character limit: 2000)
*
* - Protocol: HTTPS (TLS 1.2 or later)
* - Video format: mp4
* - Maximum data size: 200 MB
*/
url: string;
/**
* Preview image URL (Max character limit: 2000)
*
* - Protocol: HTTPS (TLS 1.2 or later)
* - Image format: JPEG or PNG
* - Maximum data size: 1 MB
*/
previewUrl: string;
/**
* Alternative content.
*
* The alternative content will be displayed on the screen of a user device
* that is using a version of LINE that doesn't support the video component.
* Specify a box or an image.
*
* - Protocol: HTTPS (TLS 1.2 or later)
* - Image format: JPEG or PNG
* - Maximum data size: 1 MB
*/
altContent: FlexBox | FlexImage;
/**
* Aspect ratio of the video. `{width}:{height}` format.
* Specify the value of `{width}` and `{height}` in the range from 1 to 100000. However,
* you cannot set `{height}` to a value that is more than three times the value of `{width}`.
* The default value is `1:1`.
*/
aspectRatio?: string;
/**
* Action performed when this button is tapped.
* Specify an [action object](https://developers.line.biz/en/reference/messaging-api/#action-objects).
*/
action?: Action;
};
/**
* This component draws a separator between components in the parent box.
*/
@@ -1196,7 +1425,7 @@ export declare type FlexSeparator = {
* - 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";
margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Color of the separator. Use a hexadecimal color code.
*/
@@ -1205,6 +1434,7 @@ export declare type FlexSeparator = {
/**
* This is an invisible component that places a fixed-size space at the
* beginning or end of the box.
* @deprecated
*/
export declare type FlexSpacer = {
type: "spacer";
@@ -1215,13 +1445,20 @@ export declare type FlexSpacer = {
*/
size?: "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
};
export declare type FlexText = {
declare type FlexTextBase = {
type: "text";
text: string;
/**
* 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.
* The method by which to adjust the text font size. Specify this value:
*
* - `shrink-to-fit`: Automatically shrink the font
* size to fit the width of the component. This
* property takes a "best-effort" approach that may
* work differently—or not at all!—on some platforms.
* For more information, see [Automatically shrink fonts to fit](https://developers.line.biz/en/docs/messaging-api/flex-message-layout/#adjusts-fontsize-to-fit)
* in the Messaging API documentation.
* - LINE 10.13.0 or later for iOS and Android
*/
contents?: FlexSpan[];
adjustMode?: "shrink-to-fit";
/**
* The ratio of the width or height of this box within the parent box.
*
@@ -1243,13 +1480,14 @@ export declare type FlexText = {
* - 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";
margin?: string | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
/**
* Font size.
* The size increases in the order of listing.
* The default value is `md`.
* 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.
*/
size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
/**
* Horizontal alignment style. Specify one of the following values:
*
@@ -1282,6 +1520,14 @@ export declare type FlexText = {
* line.
*/
wrap?: boolean;
/**
* Line spacing in a wrapping text.
*
* Specify a positive integer or decimal number that ends in px.
* The `lineSpacing` property doesn't apply to the top of the start line and the bottom of the last line.
* For more information, see [Increase the line spacing in a text](https://developers.line.biz/en/docs/messaging-api/flex-message-elements/#text-line-spacing) in the Messaging API documentation.
*/
lineSpacing?: string;
/**
* 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
@@ -1320,7 +1566,19 @@ export declare type FlexText = {
* The default value is `none`.
*/
decoration?: string;
} & Offset;
};
declare type FlexTextWithText = FlexTextBase & {
text: string;
contents?: never;
};
declare type FlexTextWithContents = FlexTextBase & {
/**
* 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.
*/
contents: FlexSpan[];
text?: never;
};
export declare type FlexText = (FlexTextWithText | FlexTextWithContents) & Offset;
/**
* This component renders multiple text strings with different designs in one row. You can specify the color, size, weight, and decoration for the font. Span is set to `contents` property in [Text](https://developers.line.biz/en/reference/messaging-api/#f-text).
*/
@@ -1336,8 +1594,9 @@ export declare type FlexSpan = {
color?: string;
/**
* 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`.
* 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.
*/
size?: string;
size?: string | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "3xl" | "4xl" | "5xl";
/**
* Font weight. You can specify one of the following values: `regular` or `bold`. Specifying `bold` makes the font bold. The default value is `regular`.
*/
@@ -1374,7 +1633,7 @@ export declare type TemplateContent = TemplateButtons | TemplateConfirm | Templa
export declare type TemplateButtons = {
type: "buttons";
/**
* Image URL (Max: 1000 characters)
* Image URL (Max: 2000 characters)
*
* - HTTPS
* - JPEG or PNG
@@ -1485,7 +1744,7 @@ export declare type TemplateCarousel = {
};
export declare type TemplateColumn = {
/**
* Image URL (Max: 1000 characters)
* Image URL (Max: 2000 characters)
*
* - HTTPS
* - JPEG or PNG
@@ -1532,7 +1791,7 @@ export declare type TemplateImageCarousel = {
};
export declare type TemplateImageColumn = {
/**
* Image URL (Max: 1000 characters)
* Image URL (Max: 2000 characters)
*
* - HTTPS
* - JPEG or PNG
@@ -1602,6 +1861,7 @@ export declare type QuickReplyItem = {
* - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
* - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
*/
action: Action;
};
@@ -1628,13 +1888,14 @@ export declare type Sender = {
* - [Message action](https://developers.line.biz/en/reference/messaging-api/#message-action)
* - [URI action](https://developers.line.biz/en/reference/messaging-api/#uri-action)
* - [Datetime picker action](https://developers.line.biz/en/reference/messaging-api/#datetime-picker-action)
* - [Rich menu switch action](https://developers.line.biz/en/reference/messaging-api/#richmenu-switch-action)
* - [Camera action](https://developers.line.biz/en/reference/messaging-api/#camera-action)
* - [Camera roll action](https://developers.line.biz/en/reference/messaging-api/#camera-roll-action)
* - [Location action](https://developers.line.biz/en/reference/messaging-api/#location-action)
*/
export declare type Action<ExtraFields = {
label: string;
}> = (PostbackAction | MessageAction | URIAction | DatetimePickerAction | {
}> = (PostbackAction | MessageAction | URIAction | DatetimePickerAction | RichMenuSwitchAction | {
type: "camera";
} | {
type: "cameraRoll";
@@ -1757,6 +2018,27 @@ export declare type Size = {
width: number;
height: number;
};
/**
* When a control associated with this action is tapped, the URI specified in
* the `uri` property is opened.
*/
export declare type RichMenuSwitchAction = {
type: "richmenuswitch";
/**
* Action label. Optional for rich menus. Read when the user's device accessibility feature is enabled.
* Max character limit: 20. Supported on LINE for iOS 8.2.0 or later.
*/
label?: string;
/**
* Rich menu alias ID to switch to.
*/
richMenuAliasId: string;
/**
* String returned by the postback.data property of the postback event via a webhook
* Max character limit: 300
*/
data: string;
};
/**
* Rich menus consist of either of these objects.
*
@@ -1803,7 +2085,9 @@ export declare type RichMenu = {
*/
areas: Array<{
bounds: Area;
action: Action<{}>;
action: Action<{
label?: string;
}>;
}>;
};
export declare type RichMenuResponse = {
@@ -2001,7 +2285,11 @@ declare type AudienceObject = {
type: "audience";
audienceGroupId: number;
};
export declare type ReceieptObject = AudienceObject | FilterOperatorObject<AudienceObject>;
declare type RedeliveryObject = {
type: "redelivery";
requestId: string;
};
export declare type ReceieptObject = AudienceObject | RedeliveryObject | FilterOperatorObject<AudienceObject> | FilterOperatorObject<RedeliveryObject>;
declare type DemographicAge = "age_15" | "age_20" | "age_25" | "age_30" | "age_35" | "age_40" | "age_45" | "age_50";
declare type DemographicSubscriptionPeriod = "day_7" | "day_30" | "day_90" | "day_180" | "day_365";
declare type DemographicArea = "jp_01" | "jp_02" | "jp_03" | "jp_04" | "jp_05" | "jp_06" | "jp_07" | "jp_08" | "jp_09" | "jp_10" | "jp_11" | "jp_12" | "jp_13" | "jp_14" | "jp_15" | "jp_16" | "jp_17" | "jp_18" | "jp_19" | "jp_20" | "jp_21" | "jp_22" | "jp_23" | "jp_24" | "jp_25" | "jp_26" | "jp_27" | "jp_28" | "jp_29" | "jp_30" | "jp_31" | "jp_32" | "jp_33" | "jp_34" | "jp_35" | "jp_36" | "jp_37" | "jp_38" | "jp_39" | "jp_40" | "jp_41" | "jp_42" | "jp_43" | "jp_44" | "jp_45" | "jp_46" | "jp_47" | "tw_01" | "tw_02" | "tw_03" | "tw_04" | "tw_05" | "tw_06" | "tw_07" | "tw_08" | "tw_09" | "tw_10" | "tw_11" | "tw_12" | "tw_13" | "tw_14" | "tw_15" | "tw_16" | "tw_17" | "tw_18" | "tw_19" | "tw_20" | "tw_21" | "tw_22" | "th_01" | "th_02" | "th_03" | "th_04" | "th_05" | "th_06" | "th_07" | "th_08" | "id_01" | "id_02" | "id_03" | "id_04" | "id_06" | "id_07" | "id_08" | "id_09" | "id_10" | "id_11" | "id_12" | "id_05";
@@ -2035,6 +2323,8 @@ export declare type NarrowcastProgressResponse = ({
successCount: number;
failureCount: number;
targetCount: string;
acceptedTime: string;
completedTime: string;
})) & {
errorCode?: 1 | 2;
};
@@ -2084,6 +2374,27 @@ export declare type ChannelAccessToken = {
access_token: string;
expires_in: number;
token_type: "Bearer";
key_id?: string;
};
export declare type VerifyAccessToken = {
scope: string;
client_id: string;
expires_in: number;
};
export declare type VerifyIDToken = {
scope: string;
client_id: string;
expires_in: number;
iss: string;
sub: string;
aud: number;
exp: number;
iat: number;
nonce: string;
amr: string[];
name: string;
picture: string;
email: string;
};
/**
* Response body of get group summary.
@@ -2104,4 +2415,46 @@ export declare type GroupSummaryResponse = {
export declare type MembersCountResponse = {
count: number;
};
export declare type GetRichMenuAliasResponse = {
richMenuAliasId: string;
richMenuId: string;
};
export declare type GetRichMenuAliasListResponse = {
aliases: GetRichMenuAliasResponse[];
};
/**
* Response body of get bot info.
*
* @see [Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info)
*/
export declare type BotInfoResponse = {
userId: string;
basicId: string;
premiumId?: string;
displayName: string;
pictureUrl?: string;
chatMode: "chat" | "bot";
markAsReadMode: "auto" | "manual";
};
/**
* Response body of get webhook endpoint info.
*
* @see [Get get webhook endpoint info](https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information)
*/
export declare type WebhookEndpointInfoResponse = {
endpoint: string;
active: boolean;
};
/**
* Response body of test webhook endpoint.
*
* @see [Test webhook endpoint](https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint)
*/
export declare type TestWebhookEndpointResponse = {
success: boolean;
timestamp: string;
statusCode: number;
reason: string;
detail: string;
};
export {};
+2
View File
@@ -1,2 +1,4 @@
import * as FormData from "form-data";
export declare function toArray<T>(maybeArr: T | T[]): T[];
export declare function ensureJSON<T>(raw: T): T;
export declare function createMultipartFormData(this: FormData | void, formBody: Record<string, any>): FormData;
+15 -1
View File
@@ -1,7 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureJSON = exports.toArray = void 0;
exports.createMultipartFormData = exports.ensureJSON = exports.toArray = void 0;
const exceptions_1 = require("./exceptions");
const FormData = require("form-data");
function toArray(maybeArr) {
return Array.isArray(maybeArr) ? maybeArr : [maybeArr];
}
@@ -15,3 +16,16 @@ function ensureJSON(raw) {
}
}
exports.ensureJSON = ensureJSON;
function createMultipartFormData(formBody) {
const formData = this instanceof FormData ? this : new FormData();
Object.entries(formBody).forEach(([key, value]) => {
if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
formData.append(key, value);
}
else {
formData.append(key, String(value));
}
});
return formData;
}
exports.createMultipartFormData = createMultipartFormData;