Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codes are generated by openapi #821

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/messaging-api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ model/roomUserProfileResponse.ts
model/sender.ts
model/sentMessage.ts
model/setWebhookEndpointRequest.ts
model/showLoadingAnimationRequest.ts
model/stickerMessage.ts
model/subscribedMembershipPlan.ts
model/subscribedMembershipUser.ts
Expand Down
33 changes: 33 additions & 0 deletions lib/messaging-api/api/messagingApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ 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";
Expand Down Expand Up @@ -1720,6 +1721,38 @@ export class MessagingApiClient {
);
return { httpResponse: res, body: await res.json() };
}
/**
* Display a loading animation in one-on-one chats between users and LINE Official Accounts.
* @param showLoadingAnimationRequest
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator"> Documentation</a>
*/
public async showLoadingAnimation(
showLoadingAnimationRequest: ShowLoadingAnimationRequest,
): Promise<object> {
return (
await this.showLoadingAnimationWithHttpInfo(showLoadingAnimationRequest)
).body;
}

/**
* Display a loading animation in one-on-one chats between users and LINE Official Accounts..
* This method includes HttpInfo object to return additional information.
* @param showLoadingAnimationRequest
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator"> Documentation</a>
*/
public async showLoadingAnimationWithHttpInfo(
showLoadingAnimationRequest: ShowLoadingAnimationRequest,
): Promise<Types.ApiResponseType<object>> {
const params = showLoadingAnimationRequest;

const res = await this.httpClient.post(
"/v2/bot/chat/loading/start",
params,
);
return { httpResponse: res, body: await res.json() };
}
/**
* Test webhook endpoint
* @param testWebhookEndpointRequest
Expand Down
1 change: 1 addition & 0 deletions lib/messaging-api/model/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export * from "./roomUserProfileResponse.js";
export * from "./sender.js";
export * from "./sentMessage.js";
export * from "./setWebhookEndpointRequest.js";
export * from "./showLoadingAnimationRequest.js";
export * from "./stickerMessage.js";
export * from "./subscribedMembershipPlan.js";
export * from "./subscribedMembershipUser.js";
Expand Down
26 changes: 26 additions & 0 deletions lib/messaging-api/model/showLoadingAnimationRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* 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.
*/

export type ShowLoadingAnimationRequest = {
/**
* User ID of the target user for whom the loading animation is to be displayed.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator-request-body">chatId Documentation</a>
*/
chatId: string /**/;
/**
* The number of seconds to display the loading indicator. It must be a multiple of 5. The maximum value is 60 seconds.
*
* @see <a href="https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator-request-body">loadingSeconds Documentation</a>
*/
loadingSeconds?: number /**/;
};
87 changes: 87 additions & 0 deletions lib/messaging-api/tests/api/MessagingApiClientTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ 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";
Expand Down Expand Up @@ -5057,6 +5058,92 @@ describe("MessagingApiClient", () => {
server.close();
});

it("showLoadingAnimationWithHttpInfo", async () => {
let requestCount = 0;

const server = createServer((req, res) => {
requestCount++;

equal(req.method, "POST");
const reqUrl = new URL(req.url, "http://localhost/");
equal(reqUrl.pathname, "/v2/bot/chat/loading/start");

equal(req.headers["authorization"], `Bearer ${channel_access_token}`);
equal(
req.headers["user-agent"],
"@line/bot-sdk/__LINE_BOT_SDK_NODEJS_VERSION__",
);

res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify({}));
});
await new Promise(resolve => {
server.listen(0);
server.on("listening", resolve);
});

const serverAddress = server.address();
if (typeof serverAddress === "string" || serverAddress === null) {
throw new Error("Unexpected server address: " + serverAddress);
}

const client = new MessagingApiClient({
channelAccessToken: channel_access_token,
baseURL: `http://localhost:${String(serverAddress.port)}/`,
});

const res = await client.showLoadingAnimationWithHttpInfo(
// showLoadingAnimationRequest: ShowLoadingAnimationRequest
{} as unknown as ShowLoadingAnimationRequest, // paramName=showLoadingAnimationRequest
);

equal(requestCount, 1);
server.close();
});

it("showLoadingAnimation", async () => {
let requestCount = 0;

const server = createServer((req, res) => {
requestCount++;

equal(req.method, "POST");
const reqUrl = new URL(req.url, "http://localhost/");
equal(reqUrl.pathname, "/v2/bot/chat/loading/start");

equal(req.headers["authorization"], `Bearer ${channel_access_token}`);
equal(
req.headers["user-agent"],
"@line/bot-sdk/__LINE_BOT_SDK_NODEJS_VERSION__",
);

res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify({}));
});
await new Promise(resolve => {
server.listen(0);
server.on("listening", resolve);
});

const serverAddress = server.address();
if (typeof serverAddress === "string" || serverAddress === null) {
throw new Error("Unexpected server address: " + serverAddress);
}

const client = new MessagingApiClient({
channelAccessToken: channel_access_token,
baseURL: `http://localhost:${String(serverAddress.port)}/`,
});

const res = await client.showLoadingAnimation(
// showLoadingAnimationRequest: ShowLoadingAnimationRequest
{} as unknown as ShowLoadingAnimationRequest, // paramName=showLoadingAnimationRequest
);

equal(requestCount, 1);
server.close();
});

it("testWebhookEndpointWithHttpInfo", async () => {
let requestCount = 0;

Expand Down
2 changes: 1 addition & 1 deletion line-openapi
Submodule line-openapi updated 1 files
+50 −0 messaging-api.yml