public interface

LineApiClient

com.linecorp.linesdk.api.LineApiClient

Class Overview

An API client that provides you with access to the LINE Social API to perform operations such as getting the current access token, getting the user profile, logging out the user, refreshing the access token, and verifying the access token.

Summary

Public Methods
abstract LineApiResponse<LineAccessToken> getCurrentAccessToken()
Gets the access token that the SDK is using for the user.
abstract LineApiResponse<LineFriendshipStatus> getFriendshipStatus()
Gets the friendship status between the bot (which is linked to the current channel) and the user.
abstract LineApiResponse<LineProfile> getProfile()
Gets the user profile information.
abstract LineApiResponse<?> logout()
Revokes the access token.
abstract LineApiResponse<LineAccessToken> refreshAccessToken()
Refreshes the access token that the SDK is using for the user.
abstract LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(List<String> targetUserIds, List<MessageData> messages, boolean isOttUsed)
Sends messages to multiple users on behalf of the current user.
abstract LineApiResponse<LineCredential> verifyToken()
Checks whether the access token that the SDK is using for the user is valid.

Public Methods

public abstract LineApiResponse<LineAccessToken> getCurrentAccessToken ()

Gets the access token that the SDK is using for the user.

Returns

public abstract LineApiResponse<LineFriendshipStatus> getFriendshipStatus ()

Gets the friendship status between the bot (which is linked to the current channel) and the user.

Returns

public abstract LineApiResponse<LineProfile> getProfile ()

Gets the user profile information.

Returns

public abstract LineApiResponse<?> logout ()

Revokes the access token.

Returns

public abstract LineApiResponse<LineAccessToken> refreshAccessToken ()

Refreshes the access token that the SDK is using for the user.

Returns

public abstract LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers (List<String> targetUserIds, List<MessageData> messages, boolean isOttUsed)

Sends messages to multiple users on behalf of the current user. To know the message delivery result for each recipient, check the response data.

In the following cases, messages are not delivered even though the API call is successful. The response status is "discarded" for such API calls.

  • The recipient has blocked the current user.
  • The recipient has turned off messages from the channel.
  • The recipient hasn't authorized the channel to use their profile information and has turned off messages from unauthorized channels.
  • The current user is not a friend of the recipient that is not a bot but a human.

To call this method, you need a channel with the MESSAGE permission and an access token with the message.write scope.

Parameters
targetUserIds 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.
Returns
  • A 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.
See Also
  • SendMessageResponse

public abstract LineApiResponse<LineCredential> verifyToken ()

Checks whether the access token that the SDK is using for the user is valid.

Returns