Code Monkey home page Code Monkey logo

linedevelopers.net's Introduction

dotnet version Nuget Nuget downloads

LINE Developers.Net

This C# Library is implemented of the LINE Developers APIs. and This is an unofficial LINE Developers library. There are so many features in LINE Developers APIs. However couldn't test such of features which are not offer in KOREA and some of pay features. but It'll works well. I hope it's helpful to develop message send and chatbot via LINE Messenger.

install from nuget

Since v1.1.20, It communicates based on HTTP/2.0 between LineDevelopers.NET and LINE APIs.
And it's not necessary to any migrate(such as code change) for the update.
so I strongly recommend to update v1.1.20

Install-Package LineDevelopers -Version 1.1.20 

1. Getting started

2. Library introduction

2-1. LineMessagingClient class

There are exists each class by unit of feature. for instance, it offer same features both a LineMessaingClient.Insight and a LineInsightClient class. but I recommend that you should use a LineMessagingClient class instead of each class.

  • example)
    using Line.Message;
    
    using (var client = new LineMessagingClient("your access token"))
    {
        await client.Message.SendBroadcastMessageAsync(new TextMessage("hello world"));
        await client.Message.SendReplyMessageAsync("reply token", new TextMessage("hello world"));
        await client.Insight.GetNumberOfMessageDeliveriesAsync(new DateOnly(2022, 10, 31));
        await client.RichMenu.DownloadRichMenuImageAsync("test richmenu id", @"c:\temp\test.jpg");
    }

2-1-1. LineMessageClient class

LINE Developers Methods Tested
Send reply message SendReplyMessageAsync
Send push message SendPushMessageAsync
Send multicast message SendMulticastMessageAsync
Send narrowcast message SendNarrowcastMessageAsync
Send broadcast message SendBroadcastMessageAsync
Get the target limit for sending messages this month GetTheTargetLimitForSendingMessagesThisMonthAsync
Get number of messages sent this month GetNumberOfMessagesSentThisMonthAsync
Get number of sent reply messages GetNumberOfSentMessagesAsync
Get number of sent push messages GetNumberOfSentMessagesAsync
Get number of sent multicast messages GetNumberOfSentMessagesAsync
Get number of sent broadcast messages GetNumberOfSentMessagesAsync
Validate message objects of a reply message ValidateMessageObjectsOfMessageAsync
Validate message objects of a push message ValidateMessageObjectsOfMessageAsync
Validate message objects of a multicast message ValidateMessageObjectsOfMessageAsync
Validate message objects of a narrowcast message ValidateMessageObjectsOfMessageAsync
Validate message objects of a broadcast message ValidateMessageObjectsOfMessageAsync
Get number of units used this month GetNumberOfUnitsUsedThisMonthAsync
Get name list of units used this month GetNameListOfUnitsUsedThisMonthAsync

2-1-2. LineInsightClient class

LINE Developers Methods Tested
Get number of message deliveries GetNumberOfMessageDeliveriesAsync
Get number of followers GetNumberOfFollowersAsync
Get friend demographics GetFriendsDemographicsAsync
Get user interaction statistics GetUserInteractionStatisticsAsync
Get statistics per unit GetStatisticsPerUnitAsync

2-1-3. LineRichMenuClient class

LINE Developers Methods Tested
Create rich menu CreateRichMenuAsync
Validate rich menu object ValidateRichMenuAsync
Upload rich menu image UploadRichMenuImageAsync
Download rich menu image DownloadRichMenuImageAsync
Get rich menu list GetRichMenuListAsync
Get rich menu GetRichMenuAsync
Delete rich menu DeleteRichMenuAsync
Set default rich menu SetDefaultRichMenuAsync
Get default rich menu ID GetDefaultRichMenuIdAsync
Cancel default rich menu CancelDefaultRichMenuAsync
Create rich menu alias CreateRichMenuAliasAsync
Delete rich menu alias DeleteRichMenuAliasAsync
Update rich menu alias UpdateRichMenuAliasAsync
Get rich menu alias information GetRichMenuAliasInformationAsync
Get list of rich menu alias GetListOfRichMenuAliasAsync
Link rich menu to user LinkRichMenuToUserAsync
Link rich menu to multiple users LinkRichMenuToMultipleUsersAsync
Get rich menu ID of user GetRichMenuIdOfUserAsync
Unlink rich menu from user UnlinkRichMenuFromUserAsync
Unlink rich menus from multiple users UnlinkRichMenusFromMultipleUsersAsync
Replace or unlink the linked rich menus in batches ReplaceOrUnlinkTheLinkedRichMenusInBatchesAsync
Get the status of rich menu batch control GetStatusOfRichMenuBatchControlAsync
Validate a request of rich menu batch control ValidateRequestOfRichMenuBatchControlAsync

2-1-4. LineGroupChatClient class

LINE Developers Methods Tested
Get group chat summary GetSummaryAsync
Get number of users in a group chat GetNumberOfUsersAsync
Get group chat member user IDs GetMemberUserIdsAsync
Get group chat member profile GetChatMemberProfileAsync
Leave group chat LeaveAsync

2-1-5. LineMultiPersonChatClient class

LINE Developers Methods Tested
Get number of users in a multi-person chat GetNumberOfUsersAsync
Get multi-person chat member user IDs GetMemberUserIdsAsync
Get multi-person chat member profile GetMemberProfileAsync
Leave multi-person chat LeaveAsync

2-1-6. LineUserClient class

LINE Developers Methods Tested
Get profile GetUserProfileAsync
Get a list of users who added your LINE Official Account as a friend GetFollowersAsync

2-1-7. LineAccountLinkClient class

LINE Developers Methods Tested
Issue link token IssueLinkTokenAsync

2-1-8. LineWebhookSettingClient class

LINE Developers Methods Tested
Set webhook endpoint URL SetEndpointUrlAsync
Get webhook endpoint information GetEndpointInformationAsync
Test webhook endpoint TestEndpointAsync

2-1-9. LineBotClient class

LINE Developers Methods Tested
Get bot info GetBotInformationAsync

2-2. LineChannelAccessTokenClient class

using Line;

using (var client = new LineChannelAccessTokenClient())
{
    try
    {
        var result = await client.IssueShortLivedChannelAccessTokenAsync("client id", "secret");

        await client.VerifyShortLonglivedChannelAccessTokenAsync(result.AccessToken);
    }
    catch (LineCredentialException ex)
    {
        Console.WriteLine($"error : {ex.Message}");
        Console.WriteLine($"error_description : {ex.Detail}");
    }
}
LINE Developers Methods Tested
Issue channel access token v2.1 IssueChannelAccessTokenAsync
Verify the validity of the channel access token v2.1 VerifyChannelAccessTokenAsync
Get all valid channel access token key IDs v2.1 GetAllValidChannelAccessTokenKeyIDsAsync
Revoke channel access token v2.1 RevokeChannelAccessTokenAsync
Issue short-lived channel access token IssueShortLivedChannelAccessTokenAsync
Verify the validity of short-lived and long-lived channel access tokens VerifyShortLonglivedChannelAccessTokenAsync
Revoke short-lived or long-lived channel access token RevokeShortLongLivedChannelAccessTokenAsync

2-3 LineLiffClient class

using Line;
using Line.Liff;

using (var client = new LineLiffClient("access token"))
{
    try
    {
        var liffs = await client.GetAllLiffAppsAsync();

        foreach (var liff in liffs)
        {
            await client.DeleteLiffAppsFromChannelAsync(liff.LiffId);
        }
    }
    catch (LineException ex)
    {
        Console.WriteLine(ex.Message);

        foreach (var detail in ex.Details ?? Enumerable.Empty<Detail>())
        {
            Console.WriteLine(detail.Message);
            Console.WriteLine(detail.Property);
        }
    }
}
LINE Developers Methods Tested
Adding the LIFF app to a channel AddLiffAppToChannelAsync
Update LIFF app settings UpdateLiffAppSettingAsync
Get all LIFF apps GetAllLiffAppsAsync
Delete LIFF app from a channel DeleteLiffAppsFromChannelAsync

2-4 LineLoginClient

using Line.Login;

using (LineLoginClient client = new LineLoginClient())
{
    var issued = await client.OAuth2dot1.IssueAccessTokenAsync("code", "redirectUrl", "clientId", "secret");
    var profile = await client.GetUserProfileAsync(issued.AccessToken);
}
LINE Developers Methods Tested
Issue access token OAuth2dot1.IssueAccessTokenAsync
Verify access token validity OAuth2dot1.VerifyAccessTokenValidityAsync
Refresh access token OAuth2dot1.RefreshAccessTokenAsync
Revoke access token OAuth2dot1.RevokeAccessTokenAsync
Verify ID token OAuth2dot1.VerifyIdTokenAsync
Get user information OAuth2dot1.GetUserInformationAsync
Get user profile GetUserProfileAsync
Get friendship status GetFriendshipStatusAsync

3. reference doc

linedevelopers.net's People

Contributors

10hic31 avatar charles96 avatar psmon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.