@line/bot-sdk
Version:
Node.js SDK for LINE Messaging API
1,269 lines (1,204 loc) • 84.5 kB
text/typescript
/**
* LINE Messaging API
* This document describes LINE Messaging API.
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-locals */
import { BotInfoResponse } from "../model/botInfoResponse.js";
import { BroadcastRequest } from "../model/broadcastRequest.js";
import { CreateRichMenuAliasRequest } from "../model/createRichMenuAliasRequest.js";
import { ErrorResponse } from "../model/errorResponse.js";
import { GetAggregationUnitNameListResponse } from "../model/getAggregationUnitNameListResponse.js";
import { GetAggregationUnitUsageResponse } from "../model/getAggregationUnitUsageResponse.js";
import { GetFollowersResponse } from "../model/getFollowersResponse.js";
import { GetMembershipSubscriptionResponse } from "../model/getMembershipSubscriptionResponse.js";
import { GetWebhookEndpointResponse } from "../model/getWebhookEndpointResponse.js";
import { GroupMemberCountResponse } from "../model/groupMemberCountResponse.js";
import { GroupSummaryResponse } from "../model/groupSummaryResponse.js";
import { GroupUserProfileResponse } from "../model/groupUserProfileResponse.js";
import { IssueLinkTokenResponse } from "../model/issueLinkTokenResponse.js";
import { MarkMessagesAsReadRequest } from "../model/markMessagesAsReadRequest.js";
import { MembersIdsResponse } from "../model/membersIdsResponse.js";
import { MembershipListResponse } from "../model/membershipListResponse.js";
import { MessageQuotaResponse } from "../model/messageQuotaResponse.js";
import { MulticastRequest } from "../model/multicastRequest.js";
import { NarrowcastProgressResponse } from "../model/narrowcastProgressResponse.js";
import { NarrowcastRequest } from "../model/narrowcastRequest.js";
import { NumberOfMessagesResponse } from "../model/numberOfMessagesResponse.js";
import { PnpMessagesRequest } from "../model/pnpMessagesRequest.js";
import { PushMessageRequest } from "../model/pushMessageRequest.js";
import { PushMessageResponse } from "../model/pushMessageResponse.js";
import { QuotaConsumptionResponse } from "../model/quotaConsumptionResponse.js";
import { ReplyMessageRequest } from "../model/replyMessageRequest.js";
import { ReplyMessageResponse } from "../model/replyMessageResponse.js";
import { RichMenuAliasListResponse } from "../model/richMenuAliasListResponse.js";
import { RichMenuAliasResponse } from "../model/richMenuAliasResponse.js";
import { RichMenuBatchProgressResponse } from "../model/richMenuBatchProgressResponse.js";
import { RichMenuBatchRequest } from "../model/richMenuBatchRequest.js";
import { RichMenuBulkLinkRequest } from "../model/richMenuBulkLinkRequest.js";
import { RichMenuBulkUnlinkRequest } from "../model/richMenuBulkUnlinkRequest.js";
import { RichMenuIdResponse } from "../model/richMenuIdResponse.js";
import { RichMenuListResponse } from "../model/richMenuListResponse.js";
import { RichMenuRequest } from "../model/richMenuRequest.js";
import { RichMenuResponse } from "../model/richMenuResponse.js";
import { RoomMemberCountResponse } from "../model/roomMemberCountResponse.js";
import { RoomUserProfileResponse } from "../model/roomUserProfileResponse.js";
import { SetWebhookEndpointRequest } from "../model/setWebhookEndpointRequest.js";
import { ShowLoadingAnimationRequest } from "../model/showLoadingAnimationRequest.js";
import { TestWebhookEndpointRequest } from "../model/testWebhookEndpointRequest.js";
import { TestWebhookEndpointResponse } from "../model/testWebhookEndpointResponse.js";
import { UpdateRichMenuAliasRequest } from "../model/updateRichMenuAliasRequest.js";
import { UserProfileResponse } from "../model/userProfileResponse.js";
import { ValidateMessageRequest } from "../model/validateMessageRequest.js";
import * as Types from "../../types.js";
import { ensureJSON } from "../../utils.js";
import { Readable } from "node:stream";
import HTTPFetchClient, {
convertResponseToReadable,
} from "../../http-fetch.js";
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
interface httpClientConfig {
baseURL?: string;
channelAccessToken: string;
// TODO support defaultHeaders?
}
export class MessagingApiClient {
private httpClient: HTTPFetchClient;
constructor(config: httpClientConfig) {
const baseURL = config.baseURL || "https://api.line.me";
this.httpClient = new HTTPFetchClient({
defaultHeaders: {
Authorization: "Bearer " + config.channelAccessToken,
},
baseURL: baseURL,
});
}
private async parseHTTPResponse(response: Response) {
const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
let resBody: Record<string, any> = {
...(await response.json()),
};
if (response.headers.get(LINE_REQUEST_ID_HTTP_HEADER_NAME)) {
resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] = response.headers.get(
LINE_REQUEST_ID_HTTP_HEADER_NAME,
);
}
return resBody;
}
/**
* Sends a message to multiple users at any time.
* @param broadcastRequest
* @param xLineRetryKey Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn\'t generated by LINE. Each developer must generate their own retry key.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message"> Documentation</a>
*/
public async broadcast(
broadcastRequest: BroadcastRequest,
xLineRetryKey?: string,
): Promise<object> {
return (await this.broadcastWithHttpInfo(broadcastRequest, xLineRetryKey))
.body;
}
/**
* Sends a message to multiple users at any time..
* This method includes HttpInfo object to return additional information.
* @param broadcastRequest
* @param xLineRetryKey Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn\'t generated by LINE. Each developer must generate their own retry key.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#send-broadcast-message"> Documentation</a>
*/
public async broadcastWithHttpInfo(
broadcastRequest: BroadcastRequest,
xLineRetryKey?: string,
): Promise<Types.ApiResponseType<object>> {
const params = broadcastRequest;
const headerParams = {
...(xLineRetryKey != null ? { "X-Line-Retry-Key": xLineRetryKey } : {}),
};
const res = await this.httpClient.post(
"/v2/bot/message/broadcast",
params,
{ headers: headerParams },
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Cancel default rich menu
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#cancel-default-rich-menu"> Documentation</a>
*/
public async cancelDefaultRichMenu(): Promise<Types.MessageAPIResponseBase> {
return (await this.cancelDefaultRichMenuWithHttpInfo()).body;
}
/**
* Cancel default rich menu.
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#cancel-default-rich-menu"> Documentation</a>
*/
public async cancelDefaultRichMenuWithHttpInfo(): Promise<
Types.ApiResponseType<Types.MessageAPIResponseBase>
> {
const res = await this.httpClient.delete("/v2/bot/user/all/richmenu");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Create rich menu
* @param richMenuRequest
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#create-rich-menu"> Documentation</a>
*/
public async createRichMenu(
richMenuRequest: RichMenuRequest,
): Promise<RichMenuIdResponse> {
return (await this.createRichMenuWithHttpInfo(richMenuRequest)).body;
}
/**
* Create rich menu.
* This method includes HttpInfo object to return additional information.
* @param richMenuRequest
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#create-rich-menu"> Documentation</a>
*/
public async createRichMenuWithHttpInfo(
richMenuRequest: RichMenuRequest,
): Promise<Types.ApiResponseType<RichMenuIdResponse>> {
const params = richMenuRequest;
const res = await this.httpClient.post("/v2/bot/richmenu", params);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Create rich menu alias
* @param createRichMenuAliasRequest
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#create-rich-menu-alias"> Documentation</a>
*/
public async createRichMenuAlias(
createRichMenuAliasRequest: CreateRichMenuAliasRequest,
): Promise<Types.MessageAPIResponseBase> {
return (
await this.createRichMenuAliasWithHttpInfo(createRichMenuAliasRequest)
).body;
}
/**
* Create rich menu alias.
* This method includes HttpInfo object to return additional information.
* @param createRichMenuAliasRequest
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#create-rich-menu-alias"> Documentation</a>
*/
public async createRichMenuAliasWithHttpInfo(
createRichMenuAliasRequest: CreateRichMenuAliasRequest,
): Promise<Types.ApiResponseType<Types.MessageAPIResponseBase>> {
const params = createRichMenuAliasRequest;
const res = await this.httpClient.post("/v2/bot/richmenu/alias", params);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Deletes a rich menu.
* @param richMenuId ID of a rich menu
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#delete-rich-menu"> Documentation</a>
*/
public async deleteRichMenu(
richMenuId: string,
): Promise<Types.MessageAPIResponseBase> {
return (await this.deleteRichMenuWithHttpInfo(richMenuId)).body;
}
/**
* Deletes a rich menu..
* This method includes HttpInfo object to return additional information.
* @param richMenuId ID of a rich menu
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#delete-rich-menu"> Documentation</a>
*/
public async deleteRichMenuWithHttpInfo(
richMenuId: string,
): Promise<Types.ApiResponseType<Types.MessageAPIResponseBase>> {
const res = await this.httpClient.delete(
"/v2/bot/richmenu/{richMenuId}".replace(
"{richMenuId}",
String(richMenuId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Delete rich menu alias
* @param richMenuAliasId Rich menu alias ID that you want to delete.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#delete-rich-menu-alias"> Documentation</a>
*/
public async deleteRichMenuAlias(
richMenuAliasId: string,
): Promise<Types.MessageAPIResponseBase> {
return (await this.deleteRichMenuAliasWithHttpInfo(richMenuAliasId)).body;
}
/**
* Delete rich menu alias.
* This method includes HttpInfo object to return additional information.
* @param richMenuAliasId Rich menu alias ID that you want to delete.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#delete-rich-menu-alias"> Documentation</a>
*/
public async deleteRichMenuAliasWithHttpInfo(
richMenuAliasId: string,
): Promise<Types.ApiResponseType<Types.MessageAPIResponseBase>> {
const res = await this.httpClient.delete(
"/v2/bot/richmenu/alias/{richMenuAliasId}".replace(
"{richMenuAliasId}",
String(richMenuAliasId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get name list of units used this month
* @param limit The maximum number of aggregation units you can get per request.
* @param start Value of the continuation token found in the next property of the JSON object returned in the response. If you can\'t get all the aggregation units in one request, include this parameter to get the remaining array.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-name-list-of-units-used-this-month"> Documentation</a>
*/
public async getAggregationUnitNameList(
limit?: string,
start?: string,
): Promise<GetAggregationUnitNameListResponse> {
return (await this.getAggregationUnitNameListWithHttpInfo(limit, start))
.body;
}
/**
* Get name list of units used this month.
* This method includes HttpInfo object to return additional information.
* @param limit The maximum number of aggregation units you can get per request.
* @param start Value of the continuation token found in the next property of the JSON object returned in the response. If you can\'t get all the aggregation units in one request, include this parameter to get the remaining array.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-name-list-of-units-used-this-month"> Documentation</a>
*/
public async getAggregationUnitNameListWithHttpInfo(
limit?: string,
start?: string,
): Promise<Types.ApiResponseType<GetAggregationUnitNameListResponse>> {
const queryParams = {
limit: limit,
start: start,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/aggregation/list",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of units used this month
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-units-used-this-month"> Documentation</a>
*/
public async getAggregationUnitUsage(): Promise<GetAggregationUnitUsageResponse> {
return (await this.getAggregationUnitUsageWithHttpInfo()).body;
}
/**
* Get number of units used this month.
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-units-used-this-month"> Documentation</a>
*/
public async getAggregationUnitUsageWithHttpInfo(): Promise<
Types.ApiResponseType<GetAggregationUnitUsageResponse>
> {
const res = await this.httpClient.get("/v2/bot/message/aggregation/info");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get bot info
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-bot-info"> Documentation</a>
*/
public async getBotInfo(): Promise<BotInfoResponse> {
return (await this.getBotInfoWithHttpInfo()).body;
}
/**
* Get bot info.
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-bot-info"> Documentation</a>
*/
public async getBotInfoWithHttpInfo(): Promise<
Types.ApiResponseType<BotInfoResponse>
> {
const res = await this.httpClient.get("/v2/bot/info");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets the ID of the default rich menu set with the Messaging API.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-default-rich-menu-id"> Documentation</a>
*/
public async getDefaultRichMenuId(): Promise<RichMenuIdResponse> {
return (await this.getDefaultRichMenuIdWithHttpInfo()).body;
}
/**
* Gets the ID of the default rich menu set with the Messaging API..
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-default-rich-menu-id"> Documentation</a>
*/
public async getDefaultRichMenuIdWithHttpInfo(): Promise<
Types.ApiResponseType<RichMenuIdResponse>
> {
const res = await this.httpClient.get("/v2/bot/user/all/richmenu");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get a list of users who added your LINE Official Account as a friend
* @param start Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs.
* @param limit The maximum number of user IDs to retrieve in a single request.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-follower-ids"> Documentation</a>
*/
public async getFollowers(
start?: string,
limit?: number,
): Promise<GetFollowersResponse> {
return (await this.getFollowersWithHttpInfo(start, limit)).body;
}
/**
* Get a list of users who added your LINE Official Account as a friend.
* This method includes HttpInfo object to return additional information.
* @param start Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs.
* @param limit The maximum number of user IDs to retrieve in a single request.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-follower-ids"> Documentation</a>
*/
public async getFollowersWithHttpInfo(
start?: string,
limit?: number,
): Promise<Types.ApiResponseType<GetFollowersResponse>> {
const queryParams = {
start: start,
limit: limit,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get("/v2/bot/followers/ids", queryParams);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of users in a group chat
* @param groupId Group ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-members-group-count"> Documentation</a>
*/
public async getGroupMemberCount(
groupId: string,
): Promise<GroupMemberCountResponse> {
return (await this.getGroupMemberCountWithHttpInfo(groupId)).body;
}
/**
* Get number of users in a group chat.
* This method includes HttpInfo object to return additional information.
* @param groupId Group ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-members-group-count"> Documentation</a>
*/
public async getGroupMemberCountWithHttpInfo(
groupId: string,
): Promise<Types.ApiResponseType<GroupMemberCountResponse>> {
const res = await this.httpClient.get(
"/v2/bot/group/{groupId}/members/count".replace(
"{groupId}",
String(groupId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get group chat member profile
* @param groupId Group ID
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-group-member-profile"> Documentation</a>
*/
public async getGroupMemberProfile(
groupId: string,
userId: string,
): Promise<GroupUserProfileResponse> {
return (await this.getGroupMemberProfileWithHttpInfo(groupId, userId)).body;
}
/**
* Get group chat member profile.
* This method includes HttpInfo object to return additional information.
* @param groupId Group ID
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-group-member-profile"> Documentation</a>
*/
public async getGroupMemberProfileWithHttpInfo(
groupId: string,
userId: string,
): Promise<Types.ApiResponseType<GroupUserProfileResponse>> {
const res = await this.httpClient.get(
"/v2/bot/group/{groupId}/member/{userId}"
.replace("{groupId}", String(groupId))
.replace("{userId}", String(userId)),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get group chat member user IDs
* @param groupId Group ID
* @param start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-group-member-user-ids"> Documentation</a>
*/
public async getGroupMembersIds(
groupId: string,
start?: string,
): Promise<MembersIdsResponse> {
return (await this.getGroupMembersIdsWithHttpInfo(groupId, start)).body;
}
/**
* Get group chat member user IDs.
* This method includes HttpInfo object to return additional information.
* @param groupId Group ID
* @param start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-group-member-user-ids"> Documentation</a>
*/
public async getGroupMembersIdsWithHttpInfo(
groupId: string,
start?: string,
): Promise<Types.ApiResponseType<MembersIdsResponse>> {
const queryParams = {
start: start,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/group/{groupId}/members/ids".replace(
"{groupId}",
String(groupId),
),
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get group chat summary
* @param groupId Group ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-group-summary"> Documentation</a>
*/
public async getGroupSummary(groupId: string): Promise<GroupSummaryResponse> {
return (await this.getGroupSummaryWithHttpInfo(groupId)).body;
}
/**
* Get group chat summary.
* This method includes HttpInfo object to return additional information.
* @param groupId Group ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-group-summary"> Documentation</a>
*/
public async getGroupSummaryWithHttpInfo(
groupId: string,
): Promise<Types.ApiResponseType<GroupSummaryResponse>> {
const res = await this.httpClient.get(
"/v2/bot/group/{groupId}/summary".replace("{groupId}", String(groupId)),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get a list of memberships.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-membership-plans"> Documentation</a>
*/
public async getMembershipList(): Promise<MembershipListResponse> {
return (await this.getMembershipListWithHttpInfo()).body;
}
/**
* Get a list of memberships..
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-membership-plans"> Documentation</a>
*/
public async getMembershipListWithHttpInfo(): Promise<
Types.ApiResponseType<MembershipListResponse>
> {
const res = await this.httpClient.get("/v2/bot/membership/list");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get a user\'s membership subscription.
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-a-users-membership-subscription-status"> Documentation</a>
*/
public async getMembershipSubscription(
userId: string,
): Promise<GetMembershipSubscriptionResponse> {
return (await this.getMembershipSubscriptionWithHttpInfo(userId)).body;
}
/**
* Get a user\'s membership subscription..
* This method includes HttpInfo object to return additional information.
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-a-users-membership-subscription-status"> Documentation</a>
*/
public async getMembershipSubscriptionWithHttpInfo(
userId: string,
): Promise<Types.ApiResponseType<GetMembershipSubscriptionResponse>> {
const res = await this.httpClient.get(
"/v2/bot/membership/subscription/{userId}".replace(
"{userId}",
String(userId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-quota"> Documentation</a>
*/
public async getMessageQuota(): Promise<MessageQuotaResponse> {
return (await this.getMessageQuotaWithHttpInfo()).body;
}
/**
* Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned..
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-quota"> Documentation</a>
*/
public async getMessageQuotaWithHttpInfo(): Promise<
Types.ApiResponseType<MessageQuotaResponse>
> {
const res = await this.httpClient.get("/v2/bot/message/quota");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets the number of messages sent in the current month.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-consumption"> Documentation</a>
*/
public async getMessageQuotaConsumption(): Promise<QuotaConsumptionResponse> {
return (await this.getMessageQuotaConsumptionWithHttpInfo()).body;
}
/**
* Gets the number of messages sent in the current month..
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-consumption"> Documentation</a>
*/
public async getMessageQuotaConsumptionWithHttpInfo(): Promise<
Types.ApiResponseType<QuotaConsumptionResponse>
> {
const res = await this.httpClient.get("/v2/bot/message/quota/consumption");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets the status of a narrowcast message.
* @param requestId The narrowcast message\'s request ID. Each Messaging API request has a request ID.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-narrowcast-progress-status"> Documentation</a>
*/
public async getNarrowcastProgress(
requestId: string,
): Promise<NarrowcastProgressResponse> {
return (await this.getNarrowcastProgressWithHttpInfo(requestId)).body;
}
/**
* Gets the status of a narrowcast message..
* This method includes HttpInfo object to return additional information.
* @param requestId The narrowcast message\'s request ID. Each Messaging API request has a request ID.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-narrowcast-progress-status"> Documentation</a>
*/
public async getNarrowcastProgressWithHttpInfo(
requestId: string,
): Promise<Types.ApiResponseType<NarrowcastProgressResponse>> {
const queryParams = {
requestId: requestId,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/progress/narrowcast",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of sent broadcast messages
* @param date Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-broadcast-messages"> Documentation</a>
*/
public async getNumberOfSentBroadcastMessages(
date: string,
): Promise<NumberOfMessagesResponse> {
return (await this.getNumberOfSentBroadcastMessagesWithHttpInfo(date)).body;
}
/**
* Get number of sent broadcast messages.
* This method includes HttpInfo object to return additional information.
* @param date Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-broadcast-messages"> Documentation</a>
*/
public async getNumberOfSentBroadcastMessagesWithHttpInfo(
date: string,
): Promise<Types.ApiResponseType<NumberOfMessagesResponse>> {
const queryParams = {
date: date,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/delivery/broadcast",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of sent multicast messages
* @param date Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-multicast-messages"> Documentation</a>
*/
public async getNumberOfSentMulticastMessages(
date: string,
): Promise<NumberOfMessagesResponse> {
return (await this.getNumberOfSentMulticastMessagesWithHttpInfo(date)).body;
}
/**
* Get number of sent multicast messages.
* This method includes HttpInfo object to return additional information.
* @param date Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-multicast-messages"> Documentation</a>
*/
public async getNumberOfSentMulticastMessagesWithHttpInfo(
date: string,
): Promise<Types.ApiResponseType<NumberOfMessagesResponse>> {
const queryParams = {
date: date,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/delivery/multicast",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of sent push messages
* @param date Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-push-messages"> Documentation</a>
*/
public async getNumberOfSentPushMessages(
date: string,
): Promise<NumberOfMessagesResponse> {
return (await this.getNumberOfSentPushMessagesWithHttpInfo(date)).body;
}
/**
* Get number of sent push messages.
* This method includes HttpInfo object to return additional information.
* @param date Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-push-messages"> Documentation</a>
*/
public async getNumberOfSentPushMessagesWithHttpInfo(
date: string,
): Promise<Types.ApiResponseType<NumberOfMessagesResponse>> {
const queryParams = {
date: date,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/delivery/push",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of sent reply messages
* @param date Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-reply-messages"> Documentation</a>
*/
public async getNumberOfSentReplyMessages(
date: string,
): Promise<NumberOfMessagesResponse> {
return (await this.getNumberOfSentReplyMessagesWithHttpInfo(date)).body;
}
/**
* Get number of sent reply messages.
* This method includes HttpInfo object to return additional information.
* @param date Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-number-of-reply-messages"> Documentation</a>
*/
public async getNumberOfSentReplyMessagesWithHttpInfo(
date: string,
): Promise<Types.ApiResponseType<NumberOfMessagesResponse>> {
const queryParams = {
date: date,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/delivery/reply",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of sent LINE notification messages
* @param date Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/partner-docs/#get-number-of-sent-line-notification-messages"> Documentation</a>
*/
public async getPNPMessageStatistics(
date: string,
): Promise<NumberOfMessagesResponse> {
return (await this.getPNPMessageStatisticsWithHttpInfo(date)).body;
}
/**
* Get number of sent LINE notification messages .
* This method includes HttpInfo object to return additional information.
* @param date Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9
*
* @see <a href="https://developers.line.biz/en/reference/partner-docs/#get-number-of-sent-line-notification-messages"> Documentation</a>
*/
public async getPNPMessageStatisticsWithHttpInfo(
date: string,
): Promise<Types.ApiResponseType<NumberOfMessagesResponse>> {
const queryParams = {
date: date,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/message/delivery/pnp",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get profile
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-profile"> Documentation</a>
*/
public async getProfile(userId: string): Promise<UserProfileResponse> {
return (await this.getProfileWithHttpInfo(userId)).body;
}
/**
* Get profile.
* This method includes HttpInfo object to return additional information.
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-profile"> Documentation</a>
*/
public async getProfileWithHttpInfo(
userId: string,
): Promise<Types.ApiResponseType<UserProfileResponse>> {
const res = await this.httpClient.get(
"/v2/bot/profile/{userId}".replace("{userId}", String(userId)),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Gets a rich menu via a rich menu ID.
* @param richMenuId ID of a rich menu
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu"> Documentation</a>
*/
public async getRichMenu(richMenuId: string): Promise<RichMenuResponse> {
return (await this.getRichMenuWithHttpInfo(richMenuId)).body;
}
/**
* Gets a rich menu via a rich menu ID..
* This method includes HttpInfo object to return additional information.
* @param richMenuId ID of a rich menu
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu"> Documentation</a>
*/
public async getRichMenuWithHttpInfo(
richMenuId: string,
): Promise<Types.ApiResponseType<RichMenuResponse>> {
const res = await this.httpClient.get(
"/v2/bot/richmenu/{richMenuId}".replace(
"{richMenuId}",
String(richMenuId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get rich menu alias information
* @param richMenuAliasId The rich menu alias ID whose information you want to obtain.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-by-id"> Documentation</a>
*/
public async getRichMenuAlias(
richMenuAliasId: string,
): Promise<RichMenuAliasResponse> {
return (await this.getRichMenuAliasWithHttpInfo(richMenuAliasId)).body;
}
/**
* Get rich menu alias information.
* This method includes HttpInfo object to return additional information.
* @param richMenuAliasId The rich menu alias ID whose information you want to obtain.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-by-id"> Documentation</a>
*/
public async getRichMenuAliasWithHttpInfo(
richMenuAliasId: string,
): Promise<Types.ApiResponseType<RichMenuAliasResponse>> {
const res = await this.httpClient.get(
"/v2/bot/richmenu/alias/{richMenuAliasId}".replace(
"{richMenuAliasId}",
String(richMenuAliasId),
),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get list of rich menu alias
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-list"> Documentation</a>
*/
public async getRichMenuAliasList(): Promise<RichMenuAliasListResponse> {
return (await this.getRichMenuAliasListWithHttpInfo()).body;
}
/**
* Get list of rich menu alias.
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-alias-list"> Documentation</a>
*/
public async getRichMenuAliasListWithHttpInfo(): Promise<
Types.ApiResponseType<RichMenuAliasListResponse>
> {
const res = await this.httpClient.get("/v2/bot/richmenu/alias/list");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get the status of Replace or unlink a linked rich menus in batches.
* @param requestId A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-batch-control-rich-menus-progress-status"> Documentation</a>
*/
public async getRichMenuBatchProgress(
requestId: string,
): Promise<RichMenuBatchProgressResponse> {
return (await this.getRichMenuBatchProgressWithHttpInfo(requestId)).body;
}
/**
* Get the status of Replace or unlink a linked rich menus in batches..
* This method includes HttpInfo object to return additional information.
* @param requestId A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-batch-control-rich-menus-progress-status"> Documentation</a>
*/
public async getRichMenuBatchProgressWithHttpInfo(
requestId: string,
): Promise<Types.ApiResponseType<RichMenuBatchProgressResponse>> {
const queryParams = {
requestId: requestId,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/richmenu/progress/batch",
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get rich menu ID of user
* @param userId User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-id-of-user"> Documentation</a>
*/
public async getRichMenuIdOfUser(
userId: string,
): Promise<RichMenuIdResponse> {
return (await this.getRichMenuIdOfUserWithHttpInfo(userId)).body;
}
/**
* Get rich menu ID of user.
* This method includes HttpInfo object to return additional information.
* @param userId User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-id-of-user"> Documentation</a>
*/
public async getRichMenuIdOfUserWithHttpInfo(
userId: string,
): Promise<Types.ApiResponseType<RichMenuIdResponse>> {
const res = await this.httpClient.get(
"/v2/bot/user/{userId}/richmenu".replace("{userId}", String(userId)),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get rich menu list
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list"> Documentation</a>
*/
public async getRichMenuList(): Promise<RichMenuListResponse> {
return (await this.getRichMenuListWithHttpInfo()).body;
}
/**
* Get rich menu list.
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list"> Documentation</a>
*/
public async getRichMenuListWithHttpInfo(): Promise<
Types.ApiResponseType<RichMenuListResponse>
> {
const res = await this.httpClient.get("/v2/bot/richmenu/list");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get number of users in a multi-person chat
* @param roomId Room ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-members-room-count"> Documentation</a>
*/
public async getRoomMemberCount(
roomId: string,
): Promise<RoomMemberCountResponse> {
return (await this.getRoomMemberCountWithHttpInfo(roomId)).body;
}
/**
* Get number of users in a multi-person chat.
* This method includes HttpInfo object to return additional information.
* @param roomId Room ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-members-room-count"> Documentation</a>
*/
public async getRoomMemberCountWithHttpInfo(
roomId: string,
): Promise<Types.ApiResponseType<RoomMemberCountResponse>> {
const res = await this.httpClient.get(
"/v2/bot/room/{roomId}/members/count".replace("{roomId}", String(roomId)),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get multi-person chat member profile
* @param roomId Room ID
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-room-member-profile"> Documentation</a>
*/
public async getRoomMemberProfile(
roomId: string,
userId: string,
): Promise<RoomUserProfileResponse> {
return (await this.getRoomMemberProfileWithHttpInfo(roomId, userId)).body;
}
/**
* Get multi-person chat member profile.
* This method includes HttpInfo object to return additional information.
* @param roomId Room ID
* @param userId User ID
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-room-member-profile"> Documentation</a>
*/
public async getRoomMemberProfileWithHttpInfo(
roomId: string,
userId: string,
): Promise<Types.ApiResponseType<RoomUserProfileResponse>> {
const res = await this.httpClient.get(
"/v2/bot/room/{roomId}/member/{userId}"
.replace("{roomId}", String(roomId))
.replace("{userId}", String(userId)),
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get multi-person chat member user IDs
* @param roomId Room ID
* @param start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-room-member-user-ids"> Documentation</a>
*/
public async getRoomMembersIds(
roomId: string,
start?: string,
): Promise<MembersIdsResponse> {
return (await this.getRoomMembersIdsWithHttpInfo(roomId, start)).body;
}
/**
* Get multi-person chat member user IDs.
* This method includes HttpInfo object to return additional information.
* @param roomId Room ID
* @param start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-room-member-user-ids"> Documentation</a>
*/
public async getRoomMembersIdsWithHttpInfo(
roomId: string,
start?: string,
): Promise<Types.ApiResponseType<MembersIdsResponse>> {
const queryParams = {
start: start,
};
Object.keys(queryParams).forEach((key: keyof typeof queryParams) => {
if (queryParams[key] === undefined) {
delete queryParams[key];
}
});
const res = await this.httpClient.get(
"/v2/bot/room/{roomId}/members/ids".replace("{roomId}", String(roomId)),
queryParams,
);
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Get webhook endpoint information
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information"> Documentation</a>
*/
public async getWebhookEndpoint(): Promise<GetWebhookEndpointResponse> {
return (await this.getWebhookEndpointWithHttpInfo()).body;
}
/**
* Get webhook endpoint information.
* This method includes HttpInfo object to return additional information.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information"> Documentation</a>
*/
public async getWebhookEndpointWithHttpInfo(): Promise<
Types.ApiResponseType<GetWebhookEndpointResponse>
> {
const res = await this.httpClient.get("/v2/bot/channel/webhook/endpoint");
const text = await res.text();
const parsedBody = text ? JSON.parse(text) : null;
return { httpResponse: res, body: parsedBody };
}
/**
* Issue link token
* @param userId User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#issue-link-token"> Documentation</a>
*/
public async issueLinkToken(userId: string): Promise<IssueLinkTokenResponse> {
ret