public class LineApiClientImpl extends java.lang.Object implements LineApiClient
LineApiClient.| Constructor and Description |
|---|
LineApiClientImpl(java.lang.String channelId,
LineAuthenticationApiClient oauthApiClient,
TalkApiClient talkApiClient,
AccessTokenCache accessTokenCache) |
| Modifier and Type | Method and Description |
|---|---|
LineApiResponse<LineAccessToken> |
getCurrentAccessToken()
Gets the access token that the SDK is using for the user.
|
LineApiResponse<GetFriendsResponse> |
getFriends(FriendSortField sort,
java.lang.String nextPageRequestToken) |
LineApiResponse<GetFriendsResponse> |
getFriends(FriendSortField sort,
java.lang.String nextPageRequestToken,
boolean isForOttShareMessage) |
LineApiResponse<GetFriendsResponse> |
getFriendsApprovers(FriendSortField sort,
java.lang.String nextPageRequestToken) |
LineApiResponse<LineFriendshipStatus> |
getFriendshipStatus()
Gets the friendship status between the bot (which is linked to the current channel) and the user.
|
LineApiResponse<GetFriendsResponse> |
getGroupApprovers(java.lang.String groupId,
java.lang.String nextPageRequestToken) |
LineApiResponse<GetGroupsResponse> |
getGroups(java.lang.String nextPageRequestToken) |
LineApiResponse<GetGroupsResponse> |
getGroups(java.lang.String nextPageRequestToken,
boolean isForOttShareMessage) |
LineApiResponse<LineProfile> |
getProfile()
Gets the user profile information.
|
LineApiResponse<?> |
logout()
Revokes the access token.
|
LineApiResponse<LineAccessToken> |
refreshAccessToken()
Refreshes the access token that the SDK is using for the user.
|
LineApiResponse<java.lang.String> |
sendMessage(java.lang.String targetUserId,
java.util.List<MessageData> messages) |
LineApiResponse<java.util.List<SendMessageResponse>> |
sendMessageToMultipleUsers(java.util.List<java.lang.String> targetUserIds,
java.util.List<MessageData> messages) |
LineApiResponse<java.util.List<SendMessageResponse>> |
sendMessageToMultipleUsers(java.util.List<java.lang.String> targetUserIds,
java.util.List<MessageData> messages,
boolean isOttUsed)
Sends messages to multiple users on behalf of the current user.
|
LineApiResponse<LineCredential> |
verifyToken()
Checks whether the access token that the SDK is using for the user is valid.
|
public LineApiClientImpl(@NonNull
java.lang.String channelId,
@NonNull
LineAuthenticationApiClient oauthApiClient,
@NonNull
TalkApiClient talkApiClient,
@NonNull
AccessTokenCache accessTokenCache)
@NonNull public LineApiResponse<?> logout()
LineApiClientlogout in interface LineApiClientLineApiResponse object containing information about the response.@NonNull public LineApiResponse<LineAccessToken> refreshAccessToken()
LineApiClientrefreshAccessToken in interface LineApiClientLineApiResponse object. If the API call is successful, the
LineApiResponse object contains a LineAccessToken object that contains
a new access token. If the API call fails, the payload of the LineApiResponse
object is null.@NonNull public LineApiResponse<LineCredential> verifyToken()
LineApiClientverifyToken in interface LineApiClientLineApiResponse object. If the access token is valid, the
LineApiResponse object contains a success response and the LineCredential
object that contains the access token. If the access token is invalid, the
LineApiResponse object contains a failure response.@NonNull public LineApiResponse<LineAccessToken> getCurrentAccessToken()
LineApiClientgetCurrentAccessToken in interface LineApiClientLineApiResponse object. If the API call is successful,
a LineApiResponse object contains the LineAccessToken object that contains
the access token. If the API call fails, the payload of the LineApiResponse object is
null.@NonNull public LineApiResponse<LineProfile> getProfile()
LineApiClientgetProfile in interface LineApiClientLineApiResponse object. If the API call is successful, the
LineApiResponse object contains a LineProfile object that contains the
user's profile. If the API call fails, the payload of the LineApiResponse object is
null.@NonNull public LineApiResponse<LineFriendshipStatus> getFriendshipStatus()
LineApiClientgetFriendshipStatus in interface LineApiClientLineApiResponse object. If the API call is successful, the
LineApiResponse object contains a LineFriendshipStatus object
that contains the friendship status information. If the API call fails, the payload of
the LineApiResponse object is null.@NonNull public LineApiResponse<GetFriendsResponse> getFriends(@NonNull FriendSortField sort, @Nullable java.lang.String nextPageRequestToken)
getFriends in interface LineApiClientsort - Optional. The way to sort the friend list. See the
FriendSortField section for more information.nextPageRequestToken - Optional. The continuation token to get the next friend list.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains a GetFriendsResponse object that contains
up to 200 friends of the user. The GetFriendsResponse object also contains a
continuation token if there are remaining friends that the original API call didn't return.
If the API call fails, the payload of the LineApiResponse object is@NonNull public LineApiResponse<GetFriendsResponse> getFriends(@NonNull FriendSortField sort, @Nullable java.lang.String nextPageRequestToken, boolean isForOttShareMessage)
getFriends in interface LineApiClientsort - Optional. The way to sort the friend list. See the
FriendSortField section for more information.nextPageRequestToken - Optional. The continuation token to get the next friend list.isForOttShareMessage - True if this API is called for sharing messages with OTT,
false otherwise.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains a GetFriendsResponse object that contains
up to 200 friends of the user. The GetFriendsResponse object also contains a
continuation token if there are remaining friends that the original API call didn't return.
If the API call fails, the payload of the LineApiResponse object is
null.FriendSortField@NonNull public LineApiResponse<GetFriendsResponse> getFriendsApprovers(FriendSortField sort, @Nullable java.lang.String nextPageRequestToken)
getFriendsApprovers in interface LineApiClientsort - Optional. The way to sort the friend list. See the
FriendSortField section for more information.nextPageRequestToken - Optional. The continuation token to get the next friend list.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains a GetFriendsResponse object that contains
up to 200 friends of the user. The GetFriendsResponse object also contains a
continuation token if there are remaining friends that the original API call didn't return.
If the API call fails, the payload of the LineApiResponse object is
null.FriendSortField@NonNull public LineApiResponse<GetGroupsResponse> getGroups(@Nullable java.lang.String nextPageRequestToken)
getGroups in interface LineApiClientnextPageRequestToken - Optional. The continuation token to get the next group list.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains a GetGroupsResponse object that contains
up to 200 groups that the user is a member of. The GetGroupsResponse object also
contains a continuation token if there are remaining groups that the original API call
didn't return. If the API call fails, the payload of the LineApiResponse object is
null.@NonNull public LineApiResponse<GetGroupsResponse> getGroups(@Nullable java.lang.String nextPageRequestToken, boolean isForOttShareMessage)
getGroups in interface LineApiClientnextPageRequestToken - Optional. The continuation token to get the next group list.isForOttShareMessage - True if this API is called for sharing messages with OTT,
false otherwise.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains a GetGroupsResponse object that contains
up to 200 groups that the user is a member of. The GetGroupsResponse object also
contains a continuation token if there are remaining groups that the original API call
didn't return. If the API call fails, the payload of the LineApiResponse object is
null.@NonNull public LineApiResponse<GetFriendsResponse> getGroupApprovers(@NonNull java.lang.String groupId, @Nullable java.lang.String nextPageRequestToken)
getGroupApprovers in interface LineApiClientgroupId - Required. The ID of the group to get its members.nextPageRequestToken - Optional. The continuation token to get the next member list.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains a GetFriendsResponse object that contains
up to 200 members. The GetFriendsResponse object also contains a continuation token
if there are remaining members that the original API call didn't return. If the API call
fails, the payload of the LineApiResponse object is null.@NonNull public LineApiResponse<java.lang.String> sendMessage(@NonNull java.lang.String targetUserId, @NonNull java.util.List<MessageData> messages)
sendMessage in interface LineApiClienttargetUserId - Required. The ID of the user or group that receives messages from the
current user.messages - Required. The messages to send. Available message types are: text, audio,
image, location, video, and template. You can send up to five messages.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains the delivery result. If the API call fails, the payload
of the LineApiResponse object is null. The delivery result is either of
the followings:
ok: The messages have been delivered successfully.discarded: The messages have been discarded because one of the conditions
above is met. This code is returned only when you attempt to send messages to a user.
MessageData@NonNull public LineApiResponse<java.util.List<SendMessageResponse>> sendMessageToMultipleUsers(@NonNull java.util.List<java.lang.String> targetUserIds, @NonNull java.util.List<MessageData> messages)
sendMessageToMultipleUsers in interface LineApiClienttargetUserIds - The IDs of the users that receive messages from the user. You can
specify up to 10 users.messages - The messages to send. Available message types are: text, audio, image,
location, video, and template. You can send up to five messages.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains the SendMessageResponse objects that contain
the delivery results. If the API call fails, the payload of the LineApiResponse
object is null. The delivery result is either of the followings:
ok: The messages have been delivered successfully.discarded: The messages have been discarded because one of the conditions
above is met or a server error occurred.
SendMessageResponse@NonNull public LineApiResponse<java.util.List<SendMessageResponse>> sendMessageToMultipleUsers(@NonNull java.util.List<java.lang.String> targetUserIds, @NonNull java.util.List<MessageData> messages, boolean isOttUsed)
LineApiClientIn the following cases, messages are not delivered even though the API call is successful. The response status is "discarded" for such API calls.
To call this method, you need a channel with the MESSAGE permission and an
access token with the message.write scope.
sendMessageToMultipleUsers in interface LineApiClienttargetUserIds - The IDs of the users that receive messages from the user. You can
specify up to 10 users.messages - The messages to send. Available message types are: text, audio, image,
location, video, and template. You can send up to five messages.isOttUsed - True if you want to send messages using OTT instead of using the user ids;
false otherwise.LineApiResponse object. If the API call is successful, the
LineApiResponse object contains the SendMessageResponse objects that contain
the delivery results. If the API call fails, the payload of the LineApiResponse
object is null. The delivery result is either of the following:
ok: The messages have been delivered successfully.discarded: The messages have been discarded because one of the conditions
above is met or a server error occurred.
SendMessageResponse