Skip to content

Commit ae5c982

Browse files
github-actions[bot]github-actions
andauthored
Codes are generated by openapi generator (#1296)
In the Messaging API, we've added a new endpoint that allows you to [display a loading animation](https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator). After your LINE Official Account receives a message from a user, the response may takes some time due to message preparation or reservation processing. In such cases, you can visually tell the user that you want them to wait by displaying a loading animation. news: https://developers.line.biz/en/news/2024/04/17/loading-indicator/ ![loading-animation 7aad3d6c](https://github.com/line/line-openapi/assets/24933664/4435a2c1-db0c-409a-92f1-7c5fb64903c3) line/line-openapi#54 Co-authored-by: github-actions <[email protected]>
1 parent a3c6e11 commit ae5c982

File tree

5 files changed

+109
-1
lines changed

5 files changed

+109
-1
lines changed

clients/line-bot-messaging-api-client/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ src/main/java/com/linecorp/bot/messaging/model/RoomUserProfileResponse.java
131131
src/main/java/com/linecorp/bot/messaging/model/Sender.java
132132
src/main/java/com/linecorp/bot/messaging/model/SentMessage.java
133133
src/main/java/com/linecorp/bot/messaging/model/SetWebhookEndpointRequest.java
134+
src/main/java/com/linecorp/bot/messaging/model/ShowLoadingAnimationRequest.java
134135
src/main/java/com/linecorp/bot/messaging/model/StickerMessage.java
135136
src/main/java/com/linecorp/bot/messaging/model/SubscribedMembershipPlan.java
136137
src/main/java/com/linecorp/bot/messaging/model/SubscribedMembershipUser.java

clients/line-bot-messaging-api-client/src/main/java/com/linecorp/bot/messaging/client/MessagingApiClient.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import com.linecorp.bot.messaging.model.RoomMemberCountResponse;
6464
import com.linecorp.bot.messaging.model.RoomUserProfileResponse;
6565
import com.linecorp.bot.messaging.model.SetWebhookEndpointRequest;
66+
import com.linecorp.bot.messaging.model.ShowLoadingAnimationRequest;
6667
import com.linecorp.bot.messaging.model.TestWebhookEndpointRequest;
6768
import com.linecorp.bot.messaging.model.TestWebhookEndpointResponse;
6869
import com.linecorp.bot.messaging.model.UpdateRichMenuAliasRequest;
@@ -689,6 +690,18 @@ CompletableFuture<Result<ReplyMessageResponse>> replyMessage(
689690
CompletableFuture<Result<Void>> setWebhookEndpoint(
690691
@Body SetWebhookEndpointRequest setWebhookEndpointRequest);
691692

693+
/**
694+
* Display a loading animation in one-on-one chats between users and LINE Official Accounts.
695+
*
696+
* @param showLoadingAnimationRequest (required)
697+
* @see <a
698+
* href="https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator">
699+
* Documentation</a>
700+
*/
701+
@POST("/v2/bot/chat/loading/start")
702+
CompletableFuture<Result<Object>> showLoadingAnimation(
703+
@Body ShowLoadingAnimationRequest showLoadingAnimationRequest);
704+
692705
/**
693706
* Test webhook endpoint
694707
*
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright 2023 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
/**
18+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
19+
* https://openapi-generator.tech Do not edit the class manually.
20+
*/
21+
package com.linecorp.bot.messaging.model;
22+
23+
24+
25+
import com.fasterxml.jackson.annotation.JsonInclude;
26+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
27+
import com.fasterxml.jackson.annotation.JsonProperty;
28+
29+
/**
30+
* ShowLoadingAnimationRequest
31+
*
32+
* @see <a
33+
* href="https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator-request-body">
34+
* Documentation</a>
35+
*/
36+
@JsonInclude(Include.NON_NULL)
37+
@javax.annotation.Generated(value = "com.linecorp.bot.codegen.LineJavaCodegenGenerator")
38+
public record ShowLoadingAnimationRequest(
39+
/** User ID of the target user for whom the loading animation is to be displayed. */
40+
@JsonProperty("chatId") String chatId,
41+
/**
42+
* The number of seconds to display the loading indicator. It must be a multiple of 5. The
43+
* maximum value is 60 seconds. minimum: 5 maximum: 60
44+
*/
45+
@JsonProperty("loadingSeconds") Integer loadingSeconds) {
46+
47+
public static class Builder {
48+
private String chatId;
49+
private Integer loadingSeconds;
50+
51+
public Builder(String chatId) {
52+
53+
this.chatId = chatId;
54+
}
55+
56+
public Builder loadingSeconds(Integer loadingSeconds) {
57+
this.loadingSeconds = loadingSeconds;
58+
return this;
59+
}
60+
61+
public ShowLoadingAnimationRequest build() {
62+
return new ShowLoadingAnimationRequest(chatId, loadingSeconds);
63+
}
64+
}
65+
}

clients/line-bot-messaging-api-client/src/test/java/com/linecorp/bot/messaging/client/MessagingApiClientTest.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
import com.linecorp.bot.messaging.model.RoomMemberCountResponse;
7373
import com.linecorp.bot.messaging.model.RoomUserProfileResponse;
7474
import com.linecorp.bot.messaging.model.SetWebhookEndpointRequest;
75+
import com.linecorp.bot.messaging.model.ShowLoadingAnimationRequest;
7576
import com.linecorp.bot.messaging.model.TestWebhookEndpointRequest;
7677
import com.linecorp.bot.messaging.model.TestWebhookEndpointResponse;
7778
import com.linecorp.bot.messaging.model.TextMessage;
@@ -1568,6 +1569,34 @@ public void setWebhookEndpointTest() {
15681569
// TODO: test validations
15691570
}
15701571

1572+
@Test
1573+
public void showLoadingAnimationTest() {
1574+
stubFor(
1575+
post(urlPathTemplate("/v2/bot/chat/loading/start"))
1576+
.willReturn(
1577+
aResponse()
1578+
.withStatus(200)
1579+
.withHeader("content-type", "application/json")
1580+
.withBody("{}")));
1581+
1582+
ShowLoadingAnimationRequest showLoadingAnimationRequest =
1583+
Arranger.some(
1584+
ShowLoadingAnimationRequest.class,
1585+
Map.of(
1586+
"message",
1587+
() -> new TextMessage("hello"),
1588+
"recipient",
1589+
() -> null,
1590+
"filter",
1591+
() -> null));
1592+
1593+
Object response = api.showLoadingAnimation(showLoadingAnimationRequest).join().body();
1594+
1595+
assertThat(response).isNotNull();
1596+
1597+
// TODO: test validations
1598+
}
1599+
15711600
@Test
15721601
public void testWebhookEndpointTest() {
15731602
stubFor(

line-openapi

0 commit comments

Comments
 (0)