From 60d597519a3554f6654111c8ad9a7db231274d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=99=8D=EC=9D=B8=EC=B2=A0=20=EC=B0=B0=EC=8A=A4?= Date: Thu, 27 Jul 2023 17:20:51 +0900 Subject: [PATCH] dev response header --- README.md | 84 +++---- README_kor.md | 85 +++---- Src/LineDevelopers.ConsoleTests/Program.cs | 39 +++- .../Pages/Callback.cshtml.cs | 2 +- .../Pages/Index.cshtml | 2 +- .../LineChannelAccessTokenClient.cs | 66 ++++-- Src/LineDevelopers/Liff/LineLiffClient.cs | 37 ++- Src/LineDevelopers/Login/LineLoginClient.cs | 11 +- .../Login/LineOAuth2dot1Client.cs | 1 - .../Message/IGroupChatClient.cs | 7 + Src/LineDevelopers/Message/IInsightClient.cs | 5 + Src/LineDevelopers/Message/IMessageClient.cs | 6 +- Src/LineDevelopers/Message/IRichMenuClient.cs | 4 +- .../Message/LineAccountLinkClient.cs | 6 + Src/LineDevelopers/Message/LineBotClient.cs | 1 + .../Message/LineGroupChatClient.cs | 38 +++ .../Message/LineInsightClient.cs | 8 +- .../Message/LineMessageClient.cs | 216 +++++++++++++----- .../Message/LineMultiPersonChatClient.cs | 2 +- .../Message/LineRichMenuClient.cs | 96 +++++--- Src/LineDevelopers/Message/LineUserClient.cs | 10 +- .../Message/LineWebhookSettingClient.cs | 18 ++ 22 files changed, 532 insertions(+), 212 deletions(-) diff --git a/README.md b/README.md index 01c90a9..39ca3dc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Nuget](https://img.shields.io/nuget/v/LineDevelopers.svg)](https://www.nuget.org/packages/LineDevelopers) [![Nuget downloads](https://img.shields.io/nuget/dt/LineDevelopers.svg)](https://www.nuget.org/packages/LineDevelopers) * [세종대왕](https://github.com/charles96/LineDevelopers.Net/blob/master/README_kor.md) + # LINE Developers.Net This C# Library is implemented of the [LINE Developers APIs](https://developers.line.biz/en/docs/). and This is an unofficial LINE Developers library. There are so many features in LINE Developers APIs. @@ -18,39 +19,8 @@ Install-Package LineDevelopers * [webhook quick start](https://github.com/charles96/LineDevelopers.Net/blob/master/WEBHOOK_eng.md) # 2. Library introduction -## 2-1. LineChannelAccessTokenClient class -* [Channel access token](https://developers.line.biz/en/reference/messaging-api/#channel-access-token) - -```csharp -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](https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1)|IssueChannelAccessTokenAsync|❌| -|[Verify the validity of the channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token-v2-1)|VerifyChannelAccessTokenAsync|✔| -|[Get all valid channel access token key IDs v2.1](https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1)|GetAllValidChannelAccessTokenKeyIDsAsync|❌| -|[Revoke channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#revoke-channel-access-token-v2-1)|RevokeChannelAccessTokenAsync|❌| -|[Issue short-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token)|IssueShortLivedChannelAccessTokenAsync|✔| -|[Verify the validity of short-lived and long-lived channel access tokens](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token)|VerifyShortLonglivedChannelAccessTokenAsync|✔| -|[Revoke short-lived or long-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#revoke-longlived-or-shortlived-channel-access-token)|RevokeShortLongLivedChannelAccessTokenAsync|✔| -## 2-2. LineMessagingClient class +## 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. @@ -67,7 +37,7 @@ but I recommend that you should use a LineMessagingClient class instead of each await client.RichMenu.DownloadRichMenuImageAsync("test richmenu id", @"c:\temp\test.jpg"); } ``` -### 2-2-1. LineMessageClient class +### 2-1-1. LineMessageClient class * [Message](https://developers.line.biz/en/reference/messaging-api/#messages) |LINE Developers|Methods|Tested| @@ -91,7 +61,7 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get number of units used this month](https://developers.line.biz/en/reference/messaging-api/#get-number-of-units-used-this-month)|GetNumberOfUnitsUsedThisMonthAsync|✔| |[Get name list of units used this month](https://developers.line.biz/en/reference/messaging-api/#get-name-list-of-units-used-this-month)|GetNameListOfUnitsUsedThisMonthAsync|✔| -### 2-2-2. LineInsightClient class +### 2-1-2. LineInsightClient class * [Insight](https://developers.line.biz/en/reference/messaging-api/#get-insight) |LINE Developers|Methods|Tested| @@ -102,7 +72,7 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get user interaction statistics](https://developers.line.biz/en/reference/messaging-api/#get-message-event)|GetUserInteractionStatisticsAsync|✔| |[Get statistics per unit](https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit)|GetStatisticsPerUnitAsync|✔| -### 2-2-3. LineRichMenuClient class +### 2-1-3. LineRichMenuClient class * [Rich menu](https://developers.line.biz/en/reference/messaging-api/#rich-menu) |LINE Developers|Methods|Tested| @@ -131,7 +101,7 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get the status of rich menu batch control](https://developers.line.biz/en/reference/messaging-api/#get-batch-control-rich-menus-progress-status)|GetStatusOfRichMenuBatchControlAsync|❌| |[Validate a request of rich menu batch control](https://developers.line.biz/en/reference/messaging-api/#validate-batch-control-rich-menus-request)|ValidateRequestOfRichMenuBatchControlAsync|✔| -### 2-2-4. LineGroupChatClient class +### 2-1-4. LineGroupChatClient class * [GroupChat](https://developers.line.biz/en/reference/messaging-api/#group) |LINE Developers|Methods|Tested| @@ -142,7 +112,7 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get group chat member profile](https://developers.line.biz/en/reference/messaging-api/#get-group-member-profile)|GetChatMemberProfileAsync|✔| |[Leave group chat](https://developers.line.biz/en/reference/messaging-api/#leave-group)|LeaveAsync|✔| -### 2-2-5. LineMultiPersonChatClient class +### 2-1-5. LineMultiPersonChatClient class * [MultiPersonChat](https://developers.line.biz/en/reference/messaging-api/#chat-room) |LINE Developers|Methods|Tested| @@ -152,7 +122,7 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get multi-person chat member profile](https://developers.line.biz/en/reference/messaging-api/#get-room-member-profile)|GetMemberProfileAsync|❌| |[Leave multi-person chat](https://developers.line.biz/en/reference/messaging-api/#leave-room)|LeaveAsync|❌| -### 2-2-6. LineUserClient class +### 2-1-6. LineUserClient class * [Users](https://developers.line.biz/en/reference/messaging-api/#users) |LINE Developers|Methods|Tested| @@ -160,14 +130,14 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get profile](https://developers.line.biz/en/reference/messaging-api/#get-profile)|GetUserProfileAsync|✔| |[Get a list of users who added your LINE Official Account as a friend](https://developers.line.biz/en/reference/messaging-api/#get-follower-ids)|GetFollowersAsync|❌| -## 2-2-7. LineAccountLinkClient class +## 2-1-7. LineAccountLinkClient class * [Account link](https://developers.line.biz/en/reference/messaging-api/#account-link) |LINE Developers|Methods|Tested| |---|---|---| |[Issue link token](https://developers.line.biz/en/reference/messaging-api/#issue-link-token)|IssueLinkTokenAsync|✔| -## 2-2-8. LineWebhookSettingClient class +## 2-1-8. LineWebhookSettingClient class * [Webhook settings](https://developers.line.biz/en/reference/messaging-api/#webhook-settings) |LINE Developers|Methods|Tested| @@ -176,13 +146,45 @@ but I recommend that you should use a LineMessagingClient class instead of each |[Get webhook endpoint information](https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information)|GetEndpointInformationAsync|✔| |[Test webhook endpoint](https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint)|TestEndpointAsync|✔| -## 2-2-9. LineBotClient class +## 2-1-9. LineBotClient class * [Bot](https://developers.line.biz/en/reference/messaging-api/#bot) |LINE Developers|Methods|Tested| |---|---|---| |[Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info)|GetBotInformationAsync|✔| +## 2-2. LineChannelAccessTokenClient class +* [Channel access token](https://developers.line.biz/en/reference/messaging-api/#channel-access-token) + +```csharp +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](https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1)|IssueChannelAccessTokenAsync|❌| +|[Verify the validity of the channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token-v2-1)|VerifyChannelAccessTokenAsync|❌| +|[Get all valid channel access token key IDs v2.1](https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1)|GetAllValidChannelAccessTokenKeyIDsAsync|❌| +|[Revoke channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#revoke-channel-access-token-v2-1)|RevokeChannelAccessTokenAsync|❌| +|[Issue short-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token)|IssueShortLivedChannelAccessTokenAsync|✔| +|[Verify the validity of short-lived and long-lived channel access tokens](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token)|VerifyShortLonglivedChannelAccessTokenAsync|✔| +|[Revoke short-lived or long-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#revoke-longlived-or-shortlived-channel-access-token)|RevokeShortLongLivedChannelAccessTokenAsync|✔| + ## 2-3 LineLiffClient class * [LIFF Server API](https://developers.line.biz/en/reference/liff-server/) diff --git a/README_kor.md b/README_kor.md index a575b3a..c418fd8 100644 --- a/README_kor.md +++ b/README_kor.md @@ -1,10 +1,12 @@ [![dotnet version](https://img.shields.io/badge/.NET-7.x-blue)](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-7) [![Nuget](https://img.shields.io/nuget/v/LineDevelopers.svg)](https://www.nuget.org/packages/LineDevelopers) [![Nuget downloads](https://img.shields.io/nuget/dt/LineDevelopers.svg)](https://www.nuget.org/packages/LineDevelopers) +* [English](https://github.com/charles96/LineDevelopers.Net/blob/master/README_kor.md) # LINE Developers.Net 이 라이브러리는 [LINE Developers](https://developers.line.biz/en/docs/)의 API를 C# 라이브러리로 개발한 것이며, LINE Developers와 관련없는 비공식 라이브러리 임을 밝힙니다. 한국에서는 지원하지 않거나 유료 기반의 기능들은 테스트를 완료하지 못했습니다. 참고하시기 바라며 LINE Messenger 기반 메시지 발송 또는 챗봇을 개발하시는 분들께 도움이 되길 바랍니다. + * install from nuget ```powershell Install-Package LineDevelopers @@ -15,39 +17,8 @@ Install-Package LineDevelopers * [webhook quick start](https://github.com/charles96/LineDevelopers.Net/blob/master/WEBHOOK_kor.md) # 2. 라이브러리 소개 -## 2-1. LineChannelAccessTokenClient class -* [Channel access token](https://developers.line.biz/en/reference/messaging-api/#channel-access-token) - -```csharp -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](https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1)|IssueChannelAccessTokenAsync|❌| -|[Verify the validity of the channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token-v2-1)|VerifyChannelAccessTokenAsync|✔| -|[Get all valid channel access token key IDs v2.1](https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1)|GetAllValidChannelAccessTokenKeyIDsAsync|❌| -|[Revoke channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#revoke-channel-access-token-v2-1)|RevokeChannelAccessTokenAsync|❌| -|[Issue short-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token)|IssueShortLivedChannelAccessTokenAsync|✔| -|[Verify the validity of short-lived and long-lived channel access tokens](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token)|VerifyShortLonglivedChannelAccessTokenAsync|✔| -|[Revoke short-lived or long-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#revoke-longlived-or-shortlived-channel-access-token)|RevokeShortLongLivedChannelAccessTokenAsync|✔| -## 2-2. LineMessagingClient class +## 2-1. LineMessagingClient class 각 기능 별로 개별 class들이 아래와 같이 존재합니다. 하지만 LineMessagingClient를 통해 아래의 모든 기능들을 사용 할 수 있으며 LineMessagingClient를 통해 구현하는 것을 권장합니다. @@ -63,7 +34,7 @@ using (var client = new LineChannelAccessTokenClient()) await client.RichMenu.DownloadRichMenuImageAsync("test richmenu id", @"c:\temp\test.jpg"); } ``` -### 2-2-1. LineMessageClient class +### 2-1-1. LineMessageClient class * [Message](https://developers.line.biz/en/reference/messaging-api/#messages) |LINE Developers|Methods|Tested| @@ -87,7 +58,7 @@ using (var client = new LineChannelAccessTokenClient()) |[Get number of units used this month](https://developers.line.biz/en/reference/messaging-api/#get-number-of-units-used-this-month)|GetNumberOfUnitsUsedThisMonthAsync|✔| |[Get name list of units used this month](https://developers.line.biz/en/reference/messaging-api/#get-name-list-of-units-used-this-month)|GetNameListOfUnitsUsedThisMonthAsync|✔| -### 2-2-2. LineInsightClient class +### 2-1-2. LineInsightClient class * [Insight](https://developers.line.biz/en/reference/messaging-api/#get-insight) |LINE Developers|Methods|Tested| @@ -98,7 +69,7 @@ using (var client = new LineChannelAccessTokenClient()) |[Get user interaction statistics](https://developers.line.biz/en/reference/messaging-api/#get-message-event)|GetUserInteractionStatisticsAsync|✔| |[Get statistics per unit](https://developers.line.biz/en/reference/messaging-api/#get-statistics-per-unit)|GetStatisticsPerUnitAsync|✔| -### 2-2-3. LineRichMenuClient class +### 2-1-3. LineRichMenuClient class * [Rich menu](https://developers.line.biz/en/reference/messaging-api/#rich-menu) |LINE Developers|Methods|Tested| @@ -127,7 +98,7 @@ using (var client = new LineChannelAccessTokenClient()) |[Get the status of rich menu batch control](https://developers.line.biz/en/reference/messaging-api/#get-batch-control-rich-menus-progress-status)|GetStatusOfRichMenuBatchControlAsync|❌| |[Validate a request of rich menu batch control](https://developers.line.biz/en/reference/messaging-api/#validate-batch-control-rich-menus-request)|ValidateRequestOfRichMenuBatchControlAsync|✔| -### 2-2-4. LineGroupChatClient class +### 2-1-4. LineGroupChatClient class * [GroupChat](https://developers.line.biz/en/reference/messaging-api/#group) |LINE Developers|Methods|Tested| @@ -138,7 +109,7 @@ using (var client = new LineChannelAccessTokenClient()) |[Get group chat member profile](https://developers.line.biz/en/reference/messaging-api/#get-group-member-profile)|GetChatMemberProfileAsync|✔| |[Leave group chat](https://developers.line.biz/en/reference/messaging-api/#leave-group)|LeaveAsync|✔| -### 2-2-5. LineMultiPersonChatClient class +### 2-1-5. LineMultiPersonChatClient class * [MultiPersonChat](https://developers.line.biz/en/reference/messaging-api/#chat-room) |LINE Developers|Methods|Tested| @@ -148,7 +119,7 @@ using (var client = new LineChannelAccessTokenClient()) |[Get multi-person chat member profile](https://developers.line.biz/en/reference/messaging-api/#get-room-member-profile)|GetMemberProfileAsync|❌| |[Leave multi-person chat](https://developers.line.biz/en/reference/messaging-api/#leave-room)|LeaveAsync|❌| -### 2-2-6. LineUserClient class +### 2-1-6. LineUserClient class * [Users](https://developers.line.biz/en/reference/messaging-api/#users) |LINE Developers|Methods|Tested| @@ -156,14 +127,14 @@ using (var client = new LineChannelAccessTokenClient()) |[Get profile](https://developers.line.biz/en/reference/messaging-api/#get-profile)|GetUserProfileAsync|✔| |[Get a list of users who added your LINE Official Account as a friend](https://developers.line.biz/en/reference/messaging-api/#get-follower-ids)|GetFollowersAsync|❌| -## 2-2-7. LineAccountLinkClient class +## 2-1-7. LineAccountLinkClient class * [Account link](https://developers.line.biz/en/reference/messaging-api/#account-link) |LINE Developers|Methods|Tested| |---|---|---| |[Issue link token](https://developers.line.biz/en/reference/messaging-api/#issue-link-token)|IssueLinkTokenAsync|✔| -## 2-2-8. LineWebhookSettingClient class +## 2-1-8. LineWebhookSettingClient class * [Webhook settings](https://developers.line.biz/en/reference/messaging-api/#webhook-settings) |LINE Developers|Methods|Tested| @@ -172,13 +143,45 @@ using (var client = new LineChannelAccessTokenClient()) |[Get webhook endpoint information](https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information)|GetEndpointInformationAsync|✔| |[Test webhook endpoint](https://developers.line.biz/en/reference/messaging-api/#test-webhook-endpoint)|TestEndpointAsync|✔| -## 2-2-9. LineBotClient class +## 2-1-9. LineBotClient class * [Bot](https://developers.line.biz/en/reference/messaging-api/#bot) |LINE Developers|Methods|Tested| |---|---|---| |[Get bot info](https://developers.line.biz/en/reference/messaging-api/#get-bot-info)|GetBotInformationAsync|✔| +## 2-1. LineChannelAccessTokenClient class +* [Channel access token](https://developers.line.biz/en/reference/messaging-api/#channel-access-token) + +```csharp +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](https://developers.line.biz/en/reference/messaging-api/#issue-channel-access-token-v2-1)|IssueChannelAccessTokenAsync|❌| +|[Verify the validity of the channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token-v2-1)|VerifyChannelAccessTokenAsync|❌| +|[Get all valid channel access token key IDs v2.1](https://developers.line.biz/en/reference/messaging-api/#get-all-valid-channel-access-token-key-ids-v2-1)|GetAllValidChannelAccessTokenKeyIDsAsync|❌| +|[Revoke channel access token v2.1](https://developers.line.biz/en/reference/messaging-api/#revoke-channel-access-token-v2-1)|RevokeChannelAccessTokenAsync|❌| +|[Issue short-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#issue-shortlived-channel-access-token)|IssueShortLivedChannelAccessTokenAsync|✔| +|[Verify the validity of short-lived and long-lived channel access tokens](https://developers.line.biz/en/reference/messaging-api/#verfiy-channel-access-token)|VerifyShortLonglivedChannelAccessTokenAsync|✔| +|[Revoke short-lived or long-lived channel access token](https://developers.line.biz/en/reference/messaging-api/#revoke-longlived-or-shortlived-channel-access-token)|RevokeShortLongLivedChannelAccessTokenAsync|✔| + ## 2-3 LineLiffClient class * [LIFF Server API](https://developers.line.biz/en/reference/liff-server/) diff --git a/Src/LineDevelopers.ConsoleTests/Program.cs b/Src/LineDevelopers.ConsoleTests/Program.cs index 4ee9c26..9284b22 100644 --- a/Src/LineDevelopers.ConsoleTests/Program.cs +++ b/Src/LineDevelopers.ConsoleTests/Program.cs @@ -6,11 +6,46 @@ var json = File.ReadAllText(@"c:\temp\test.json"); var config = JsonSerializer.Deserialize(json); +using (var client = new LineMessagingClient("your channelacesstoken")) +{ + await client.Message.SendPushMessageAsync("user id", new TextMessage("hello world")); +} + + +using (var client = new LineMessagingClient("your channelacesstoken")) +{ + await client.Message.SendPushMessageAsync("user id", new TextMessage("hello world"), + xLineRetryKey: Guid.NewGuid().ToString()); +} + +using (var client = new LineMessagingClient("your channelacesstoken")) +{ + await client.Message.SendPushMessageAsync("user id", new TextMessage("hello world"), + xLineRetryKey: Guid.NewGuid().ToString(), + getResponseHeaders: (o) => + { + IEnumerable xLineRequestId; + IEnumerable xLineAcceptedRequestId; + + if (o.TryGetValues("X-Line-Request-Id", out xLineRequestId)) + { + Console.WriteLine(xLineRequestId.First()); + } + + if (o.TryGetValues("X-Line-Accepted-Request-Id", out xLineAcceptedRequestId)) + { + Console.WriteLine(xLineAcceptedRequestId.First()); + } + }); +} + + + using (var test = new LineMessagingClient(config.ChannelAccessToken)) { - await test.Message.SendBroadcastMessageAsync(new TextMessage("fdasfds"), - getResponseHeaders:(o) => + await test.Message.SendPushMessageAsync("", new TextMessage("fdasfds"), + getResponseHeaders: (o) => { IEnumerable xLineRequestId; IEnumerable xLineAcceptedRequestId; diff --git a/Src/LineDevelopers.OAuth.Tests/Pages/Callback.cshtml.cs b/Src/LineDevelopers.OAuth.Tests/Pages/Callback.cshtml.cs index b3a6c37..35f4408 100644 --- a/Src/LineDevelopers.OAuth.Tests/Pages/Callback.cshtml.cs +++ b/Src/LineDevelopers.OAuth.Tests/Pages/Callback.cshtml.cs @@ -17,7 +17,7 @@ public async Task OnGet() var code = Request.Query["code"]; var issued = await client.OAuth2dot1.IssueAccessTokenAsync(code, - HttpUtility.HtmlEncode("https://2100-175-113-116-30.ngrok-free.app/Callback"), + HttpUtility.HtmlEncode("https://5db2-175-113-116-30.ngrok-free.app/Callback"), clientId, secret); diff --git a/Src/LineDevelopers.OAuth.Tests/Pages/Index.cshtml b/Src/LineDevelopers.OAuth.Tests/Pages/Index.cshtml index e2df425..f21ebc5 100644 --- a/Src/LineDevelopers.OAuth.Tests/Pages/Index.cshtml +++ b/Src/LineDevelopers.OAuth.Tests/Pages/Index.cshtml @@ -7,7 +7,7 @@ diff --git a/Src/LineDevelopers/ChannelAccessToken/LineChannelAccessTokenClient.cs b/Src/LineDevelopers/ChannelAccessToken/LineChannelAccessTokenClient.cs index 8a38545..274357f 100644 --- a/Src/LineDevelopers/ChannelAccessToken/LineChannelAccessTokenClient.cs +++ b/Src/LineDevelopers/ChannelAccessToken/LineChannelAccessTokenClient.cs @@ -1,4 +1,5 @@ -using System.Text.Json; +using System.Net.Http.Headers; +using System.Text.Json; namespace Line { @@ -22,8 +23,9 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? /// If you reach the maximum limit, additional requests of issuing channel access tokens are blocked. /// /// + /// Response Headers /// - public async Task IssueChannelAccessTokenAsync(string clientAssertion) + public async Task IssueChannelAccessTokenAsync(string clientAssertion, Action? getResponseHeaders = null) { var request = new List> { @@ -32,25 +34,32 @@ public async Task IssueChannelAccessTokenAsync(string client new KeyValuePair("client_assertion", clientAssertion) }; - return await base.PostAsync("oauth2/v2.1/token", new FormUrlEncodedContent(request)).ConfigureAwait(false); + return await base.PostAsync("oauth2/v2.1/token", new FormUrlEncodedContent(request), getResponseHeaders).ConfigureAwait(false); } - public async Task VerifyChannelAccessTokenAsync(string accessToken) + /// + /// You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid. + /// + /// Channel access token with a user-specified expiration (Channel Access Token v2.1). + /// Response Headers + /// + public async Task VerifyChannelAccessTokenAsync(string accessToken, Action? getResponseHeaders = null) { var request = new List> { new KeyValuePair("access_token", accessToken) }; - return await base.GetAsync($"oauth2/v2.1/verify", new FormUrlEncodedContent(request)).ConfigureAwait(false); + return await base.GetAsync($"oauth2/v2.1/verify", new FormUrlEncodedContent(request), getResponseHeaders).ConfigureAwait(false); } /// /// Gets all valid channel access token key IDs. /// /// A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key. + /// Response Headers /// Array of channel access token key IDs. - public async Task> GetAllValidChannelAccessTokenKeyIDsAsync(string clientAssertion) + public async Task> GetAllValidChannelAccessTokenKeyIDsAsync(string clientAssertion, Action? getResponseHeaders = null) { var request = new List> { @@ -58,12 +67,20 @@ public async Task> GetAllValidChannelAccessTokenKeyIDsAsync(string new KeyValuePair("client_assertion", clientAssertion) }; - var result = await base.GetAsync($"oauth2/v2.1/tokens/kid", new FormUrlEncodedContent(request)).ConfigureAwait(false); + var result = await base.GetAsync($"oauth2/v2.1/tokens/kid", new FormUrlEncodedContent(request),getResponseHeaders).ConfigureAwait(false); return result.Kids; } - public async Task RevokeChannelAccessTokenAsync(string channelId, string client_secret, string channelAccessToken) + /// + /// Revokes a channel access token v2.1. + /// + /// Channel ID + /// Channel Secret + /// Channel access token + /// Response Headers + /// + public async Task RevokeChannelAccessTokenAsync(string channelId, string client_secret, string channelAccessToken, Action? getResponseHeaders = null) { var request = new List> { @@ -72,10 +89,17 @@ public async Task RevokeChannelAccessTokenAsync(string channelId, string client_ new KeyValuePair("access_token", channelAccessToken) }; - await base.PostAsync($"oauth2/v2.1/revoke", new FormUrlEncodedContent(request)).ConfigureAwait(false); + await base.PostAsync($"oauth2/v2.1/revoke", new FormUrlEncodedContent(request), getResponseHeaders).ConfigureAwait(false); } - public async Task IssueShortLivedChannelAccessTokenAsync(string channelId, string clientSecret) + /// + /// Issues a short-lived channel access token that's valid for 30 days. + /// + /// Channel ID + /// Channel secret + /// Response Headers + /// + public async Task IssueShortLivedChannelAccessTokenAsync(string channelId, string clientSecret, Action? getResponseHeaders = null) { var request = new List>() { @@ -84,27 +108,39 @@ public async Task IssueShortLivedChannelAccessTokenAsync(str new KeyValuePair("client_secret", clientSecret) }; - return await base.PostAsync($"v2/oauth/accessToken", new FormUrlEncodedContent(request)).ConfigureAwait(false); + return await base.PostAsync($"v2/oauth/accessToken", new FormUrlEncodedContent(request), getResponseHeaders).ConfigureAwait(false); } - public async Task VerifyShortLonglivedChannelAccessTokenAsync(string channelAccessToken) + /// + /// You can verify whether a short-lived channel access token or a long-lived channel access token is valid. + /// + /// A short-lived or long-lived channel access token. + /// Response Headers + /// + public async Task VerifyShortLonglivedChannelAccessTokenAsync(string channelAccessToken, Action? getResponseHeaders = null) { var request = new List> { new KeyValuePair("access_token", channelAccessToken) }; - return await base.PostAsync($"v2/oauth/verify", new FormUrlEncodedContent(request)).ConfigureAwait(false); + return await base.PostAsync($"v2/oauth/verify", new FormUrlEncodedContent(request), getResponseHeaders).ConfigureAwait(false); } - public async Task RevokeShortLongLivedChannelAccessTokenAsync(string channelAccessToken) + /// + /// Revokes a short-lived or long-lived channel access token. + /// + /// Channel access token + /// Response Headers + /// + public async Task RevokeShortLongLivedChannelAccessTokenAsync(string channelAccessToken, Action? getResponseHeaders = null) { var request = new List> { new KeyValuePair("access_token", channelAccessToken) }; - await base.PostAsync($"v2/oauth/revoke", new FormUrlEncodedContent(request)).ConfigureAwait(false); + await base.PostAsync($"v2/oauth/revoke", new FormUrlEncodedContent(request), getResponseHeaders).ConfigureAwait(false); } } } diff --git a/Src/LineDevelopers/Liff/LineLiffClient.cs b/Src/LineDevelopers/Liff/LineLiffClient.cs index fb2dc0d..6d4ddbe 100644 --- a/Src/LineDevelopers/Liff/LineLiffClient.cs +++ b/Src/LineDevelopers/Liff/LineLiffClient.cs @@ -1,5 +1,4 @@ -using System.Net.Http.Headers; -using System.Text.Json.Nodes; +using System.Text.Json.Nodes; namespace Line.Liff { @@ -12,13 +11,22 @@ public LineLiffClient(string channelAccessToken, double timeout = 100d) protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? httpResponseMessage) => await httpResponseMessage.EnsureSuccessStatusCodeForLineMessageAsync().ConfigureAwait(false); + /// + /// Adds the LIFF app to a channel. You can add up to 30 LIFF apps on one channel. + /// + /// + /// Name of the LIFF app. + /// + /// + /// + /// + /// public async Task AddLiffAppToChannelAsync(View view, string? description = null, Features? features = null, string? permanentLinkPattern = null, IList? scope = null, - BotPromptType? botPrompt = null, - Action? getResponseHeaders = null) + BotPromptType? botPrompt = null) { var request = new LiffApp() { @@ -35,14 +43,24 @@ public async Task AddLiffAppToChannelAsync(View view, return result["liffId"].GetValue(); } + /// + /// Partially updates LIFF app settings. + /// + /// ID of the LIFF app to be updated + /// + /// Name of the LIFF app. + /// + /// + /// + /// + /// public async Task UpdateLiffAppSettingAsync(string liffId, View view, string? description = null, Features? features = null, string? permanentLinkPattern = null, IList? scope = null, - BotPromptType? botPrompt = null, - Action? getResponseHeaders = null) + BotPromptType? botPrompt = null) { var request = new LiffApp() { @@ -54,15 +72,16 @@ public async Task UpdateLiffAppSettingAsync(string liffId, BotPrompt = botPrompt }; - await base.PutAsync($"liff/v1/apps/{liffId}", request, getResponseHeaders: getResponseHeaders).ConfigureAwait(false); + await base.PutAsync($"liff/v1/apps/{liffId}", request).ConfigureAwait(false); } + /// /// Gets information on all the LIFF apps added to the channel. /// /// - public async Task> GetAllLiffAppsAsync(Action? getResponseHeaders = null) + public async Task> GetAllLiffAppsAsync() { - var result = await base.GetAsync("liff/v1/apps", getResponseHeaders: getResponseHeaders).ConfigureAwait(false); + var result = await base.GetAsync("liff/v1/apps", getResponseHeaders:null).ConfigureAwait(false); return result.Apps; } diff --git a/Src/LineDevelopers/Login/LineLoginClient.cs b/Src/LineDevelopers/Login/LineLoginClient.cs index d320582..b4b40c8 100644 --- a/Src/LineDevelopers/Login/LineLoginClient.cs +++ b/Src/LineDevelopers/Login/LineLoginClient.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Nodes; +using System.Net.Http.Headers; +using System.Text.Json.Nodes; namespace Line.Login { @@ -23,17 +24,17 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? /// /// /// - public async Task GetUserProfileAsync(string accessToken) - => await base.GetAsync("v2/profile", "Authorization", $"Bearer {accessToken}").ConfigureAwait(false); + public async Task GetUserProfileAsync(string accessToken, Action? getResponseHeaders = null) + => await base.GetAsync("v2/profile", "Authorization", $"Bearer {accessToken}", getResponseHeaders).ConfigureAwait(false); /// /// Gets the friendship status between a user and the LINE Official Account linked to your LINE Login channel. /// /// access token /// - public async Task GetFriendshipStatusAsync(string accessToken) + public async Task GetFriendshipStatusAsync(string accessToken, Action? getResponseHeaders = null) { - var result = await base.GetAsync("friendship/v1/status", "Authorization", $"Bearer {accessToken}").ConfigureAwait(false); + var result = await base.GetAsync("friendship/v1/status", "Authorization", $"Bearer {accessToken}", getResponseHeaders).ConfigureAwait(false); return result["friendFlag"].GetValue(); } diff --git a/Src/LineDevelopers/Login/LineOAuth2dot1Client.cs b/Src/LineDevelopers/Login/LineOAuth2dot1Client.cs index 4c09e52..5e25b82 100644 --- a/Src/LineDevelopers/Login/LineOAuth2dot1Client.cs +++ b/Src/LineDevelopers/Login/LineOAuth2dot1Client.cs @@ -16,7 +16,6 @@ internal LineOAuth2dot1Client(HttpClient httpClient, JsonSerializerOptions jsonS protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? httpResponseMessage) => await httpResponseMessage.EnsureSuccessStatusCodeForLineCredentialAsync().ConfigureAwait(false); - /// /// Issues access tokens. /// diff --git a/Src/LineDevelopers/Message/IGroupChatClient.cs b/Src/LineDevelopers/Message/IGroupChatClient.cs index 5a6ea4b..2c95960 100644 --- a/Src/LineDevelopers/Message/IGroupChatClient.cs +++ b/Src/LineDevelopers/Message/IGroupChatClient.cs @@ -45,6 +45,13 @@ public interface IGroupChatClient /// Response Headers /// public Task GetChatMemberProfileAsync(string groupId, string userId, Action? getResponseHeaders = null); + + /// + /// Leaves a group chat. + /// + /// Group ID. + /// Response Headers + /// public Task LeaveAsync(string groupId, Action? getResponseHeaders = null); } } diff --git a/Src/LineDevelopers/Message/IInsightClient.cs b/Src/LineDevelopers/Message/IInsightClient.cs index 0c6c242..c24fe83 100644 --- a/Src/LineDevelopers/Message/IInsightClient.cs +++ b/Src/LineDevelopers/Message/IInsightClient.cs @@ -8,6 +8,7 @@ public interface IInsightClient /// Returns the number of messages sent from LINE Official Account on the date specified in date. /// /// Date for which to retrieve number of sent messages. + /// Response Headers /// public Task GetNumberOfMessageDeliveriesAsync(DateOnly date, Action? getResponseHeaders = null); @@ -15,12 +16,14 @@ public interface IInsightClient /// Returns the number of users who have added the LINE Official Account on or before a specified date. /// /// Date for which to retrieve the number of followers. + /// Response Headers /// public Task GetNumberOfFollowersAsync(DateOnly date, Action? getResponseHeaders = null); /// /// Retrieves the demographic attributes for a LINE Official Account's friends. You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). /// + /// Response Headers /// public Task GetFriendsDemographicsAsync(Action? getResponseHeaders = null); @@ -28,6 +31,7 @@ public interface IInsightClient /// Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. /// /// Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. Find it in the response headers. + /// Response Headers /// public Task GetUserInteractionStatisticsAsync(string requestId, Action? getResponseHeaders = null); @@ -37,6 +41,7 @@ public interface IInsightClient /// Name of aggregation unit specified when sending the message. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. /// Start date of aggregation period. /// End date of aggregation period. + /// Response Headers /// public Task GetStatisticsPerUnitAsync(string customAggregationUnit, DateOnly from, DateOnly to, Action? getResponseHeaders = null); } diff --git a/Src/LineDevelopers/Message/IMessageClient.cs b/Src/LineDevelopers/Message/IMessageClient.cs index 282f3dc..a24962e 100644 --- a/Src/LineDevelopers/Message/IMessageClient.cs +++ b/Src/LineDevelopers/Message/IMessageClient.cs @@ -9,7 +9,10 @@ public interface IMessageClient /// /// Reply token received via webhook /// Messages to send - /// + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// /// Response Headers /// public Task SendReplyMessageAsync(string replyToken, IMessage message, bool? notificationDisabled = null, Action? getResponseHeaders = null); @@ -192,6 +195,7 @@ public interface IMessageClient /// Date the messages were sent /// Response Headers /// + /// public Task GetNumberOfSentMessagesAsync(SendType sendType, DateOnly date, Action? getResponseHeaders = null); /// diff --git a/Src/LineDevelopers/Message/IRichMenuClient.cs b/Src/LineDevelopers/Message/IRichMenuClient.cs index 272ccd0..cda4608 100644 --- a/Src/LineDevelopers/Message/IRichMenuClient.cs +++ b/Src/LineDevelopers/Message/IRichMenuClient.cs @@ -50,6 +50,7 @@ public interface IRichMenuClient /// image type /// Response Headers /// + /// public Task UploadRichMenuImageAsync(string richMenuId, string path, MediaType mediaType, Action? getResponseHeaders = null); /// @@ -127,7 +128,6 @@ public interface IRichMenuClient /// Deletes rich menu alias. /// /// Rich menu alias ID that you want to delete. - /// /// Response Headers public Task DeleteRichMenuAliasAsync(string richMenuAliasId, Action? getResponseHeaders = null); @@ -232,7 +232,7 @@ public interface IRichMenuClient /// Key for retry. /// Key value is a string matching the regular expression pattern [0-9a-zA-Z\-_]{1,100}. /// - /// + /// Response Headers /// public Task ValidateRequestOfRichMenuBatchControlAsync(IList richMenuOperationObjects, string? resumeRequestKey = null, Action? getResponseHeaders = null); } diff --git a/Src/LineDevelopers/Message/LineAccountLinkClient.cs b/Src/LineDevelopers/Message/LineAccountLinkClient.cs index 297d352..3899090 100644 --- a/Src/LineDevelopers/Message/LineAccountLinkClient.cs +++ b/Src/LineDevelopers/Message/LineAccountLinkClient.cs @@ -17,6 +17,12 @@ internal LineAccountLinkClient(HttpClient httpClient, JsonSerializerOptions json protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? httpResponseMessage) => await httpResponseMessage.EnsureSuccessStatusCodeForLineMessageAsync().ConfigureAwait(false); + /// + /// Issues a link token used for the account link feature. + /// + /// User ID for the LINE account to be linked. + /// Response headers + /// public async Task IssueLinkTokenAsync(string userId, Action? getResponseHeaders = null) { var result = await base.PostAsJsonAsync($"v2/bot/user/{userId}/linkToken", null, getResponseHeaders).ConfigureAwait(false); diff --git a/Src/LineDevelopers/Message/LineBotClient.cs b/Src/LineDevelopers/Message/LineBotClient.cs index 17f3dbb..69e5353 100644 --- a/Src/LineDevelopers/Message/LineBotClient.cs +++ b/Src/LineDevelopers/Message/LineBotClient.cs @@ -19,6 +19,7 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? /// /// Gets a bot's basic information. /// + /// Response Headers /// public async Task GetBotInformationAsync(Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/info", getResponseHeaders).ConfigureAwait(false); diff --git a/Src/LineDevelopers/Message/LineGroupChatClient.cs b/Src/LineDevelopers/Message/LineGroupChatClient.cs index 8ce4dd0..508b9e2 100644 --- a/Src/LineDevelopers/Message/LineGroupChatClient.cs +++ b/Src/LineDevelopers/Message/LineGroupChatClient.cs @@ -17,24 +17,62 @@ internal LineGroupChatClient(HttpClient httpClient, JsonSerializerOptions jsonSe protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? httpResponseMessage) => await httpResponseMessage.EnsureSuccessStatusCodeForLineMessageAsync().ConfigureAwait(false); + /// + /// Gets the group ID, group name, and group icon URL of a group chat where the LINE Official Account is a member. + /// + /// Group ID. + /// Response Headers + /// public async Task GetSummaryAsync(string groupId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/group/{groupId}/summary", getResponseHeaders).ConfigureAwait(false); + /// + /// Gets the count of users in a group chat. You can get the user in group count even if the user hasn't added the LINE Official Account as a friend or has blocked the LINE Official Account. + /// + /// Group ID. + /// Response Headers + /// public async Task GetNumberOfUsersAsync(string groupId, Action? getResponseHeaders = null) { var result = await base.GetAsync($"v2/bot/group/{groupId}/members/count", getResponseHeaders).ConfigureAwait(false); return result["count"].GetValue(); } + /// + /// Gets the user IDs of the members of a group chat that the LINE Official Account is in. This includes user IDs of users who have not added the LINE Official Account as a friend or has blocked the LINE Official Account. + /// + /// Group ID. + /// Response Headers + /// public async Task GetMemberUserIdsAsync(string groupId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/group/{groupId}/members/ids", getResponseHeaders).ConfigureAwait(false); + /// + /// Gets the user IDs of the members of a group chat that the LINE Official Account is in. This includes user IDs of users who have not added the LINE Official Account as a friend or has blocked the LINE Official Account. + /// + /// Group ID. + /// Value of the continuation token found in the Next property + /// Response Headers + /// public async Task GetMemberUserIdsAsync(string groupId, string start, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/group/{groupId}/members/ids?start={start}", getResponseHeaders).ConfigureAwait(false); + /// + /// Gets the profile information of a member of a group chat that the LINE Official Account is in if the user ID of the group member is known. + /// + /// Group ID. + /// User ID. + /// Response Headers + /// public async Task GetChatMemberProfileAsync(string groupId, string userId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/group/{groupId}/member/{userId}", getResponseHeaders).ConfigureAwait(false); + /// + /// Leaves a group chat. + /// + /// Group ID. + /// Response Headers + /// public async Task LeaveAsync(string groupId, Action? getResponseHeaders = null) => await base.PostAsync($"v2/bot/group/{groupId}/leave", getResponseHeaders).ConfigureAwait(false); } diff --git a/Src/LineDevelopers/Message/LineInsightClient.cs b/Src/LineDevelopers/Message/LineInsightClient.cs index 401d6a3..22bed3d 100644 --- a/Src/LineDevelopers/Message/LineInsightClient.cs +++ b/Src/LineDevelopers/Message/LineInsightClient.cs @@ -51,11 +51,9 @@ public async Task GetUserInteractionStatisticsAsync(s /// /// You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. /// - /// - /// Name of aggregation unit specified when sending the message. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. - /// - /// - /// + /// Name of aggregation unit specified when sending the message. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. + /// Start date of aggregation period. + /// End date of aggregation period. /// public async Task GetStatisticsPerUnitAsync(string customAggregationUnit, DateOnly from, DateOnly to, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/insight/message/event/aggregation?customAggregationUnit={customAggregationUnit}&from={from.ToString("yyyyMMdd")}&to={to.ToString("yyyyMMdd")}", getResponseHeaders).ConfigureAwait(false); diff --git a/Src/LineDevelopers/Message/LineMessageClient.cs b/Src/LineDevelopers/Message/LineMessageClient.cs index f0eca79..5c3fadd 100644 --- a/Src/LineDevelopers/Message/LineMessageClient.cs +++ b/Src/LineDevelopers/Message/LineMessageClient.cs @@ -20,15 +20,20 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? => await httpResponseMessage.EnsureSuccessStatusCodeForLineMessageAsync().ConfigureAwait(false); #region SendReplyMessageAsync + private async Task SendReplyMessageAsync(ReplyMessage replyMessage, Action? getResponseHeaders = null) + => await base.PostAsJsonAsync("v2/bot/message/reply", replyMessage, getResponseHeaders).ConfigureAwait(false); + /// /// Sends a reply message in response to an event from a user, group chat, or multi-person chat. To send reply messages, you need a reply token which is included in the webhook event object. - /// When an event occurs, you'll be notified by a webhook. If the event can be responded to, the reply token is issued. /// - /// + /// Reply token received via webhook + /// Messages to send + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Response Headers /// - private async Task SendReplyMessageAsync(ReplyMessage replyMessage, Action? getResponseHeaders = null) - => await base.PostAsJsonAsync("v2/bot/message/reply", replyMessage, getResponseHeaders).ConfigureAwait(false); - public async Task SendReplyMessageAsync(string replyToken, IMessage message, bool? notificationDisabled = null, Action? getResponseHeaders = null) { var request = new ReplyMessage() @@ -41,6 +46,17 @@ public async Task SendReplyMessageAsync(string replyToken, IMessage message, boo await this.SendReplyMessageAsync(request, getResponseHeaders).ConfigureAwait(false); } + /// + /// Sends a reply message in response to an event from a user, group chat, or multi-person chat. To send reply messages, you need a reply token which is included in the webhook event object. + /// + /// Reply token received via webhook + /// Messages to send. Max: 5 + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Response Headers + /// public async Task SendReplyMessageAsync(string replyToken, IList messages, bool? notificationDisabled = null, Action? getResponseHeaders = null) { var request = new ReplyMessage() @@ -55,22 +71,21 @@ public async Task SendReplyMessageAsync(string replyToken, IList messa #endregion #region SendPushMessageAsync - /// - /// Sends a message to a user, group chat, or multi-person chat at any time. - /// - /// - /// - /// private async Task SendPushMessageAsync(PushMessage pushMessage, string? xLineRetryKey = null, Action? getResponseHeaders = null) => await base.PostAsJsonAsync("v2/bot/message/push", pushMessage, X_LINE_RETRY_KEY, xLineRetryKey, getResponseHeaders).ConfigureAwait(false); /// /// Sends a message to a user, group chat, or multi-person chat at any time. /// - /// - /// - /// - /// + /// ID of the target recipient. + /// Messages to send. Max: 5 + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Name of aggregation unit. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method. + /// Response Headers /// public async Task SendPushMessageAsync(string to, IList messages, bool? notificationDisabled = null, IList? customAggregationUnits = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -88,10 +103,15 @@ public async Task SendPushMessageAsync(string to, IList messages, bool /// /// Sends a message to a user, group chat, or multi-person chat at any time. /// - /// - /// - /// - /// + /// ID of the target recipient. + /// Messages to send. + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Name of aggregation unit. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method. + /// Response Headers /// public async Task SendPushMessageAsync(string to, IMessage message, bool? notificationDisabled = null, IList? customAggregationUnits = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -108,21 +128,21 @@ public async Task SendPushMessageAsync(string to, IMessage message, bool? notifi #endregion #region SendMulticastMessageAsync - /// - /// An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. - /// - /// private async Task SendMulticastMessageAsync(MulticastMessage multicastMessage, string? xLineRetryKey = null, Action? getResponseHeaders = null) => await base.PostAsJsonAsync("v2/bot/message/multicast", multicastMessage, X_LINE_RETRY_KEY, xLineRetryKey, getResponseHeaders).ConfigureAwait(false); /// /// An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. /// - /// - /// - /// - /// - /// + /// Array of user IDs. Use userId values which are returned in webhook event objects. Do not use LINE IDs found on LINE. + /// Messages to send. Max:5 + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Name of aggregation unit. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method + /// Response Headers /// public async Task SendMulticastMessageAsync(IList to, IList messages, bool? notificationDisabled = null, IList? customAggregationUnits = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -140,11 +160,15 @@ public async Task SendMulticastMessageAsync(IList to, IList me /// /// An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. /// - /// - /// - /// - /// - /// + /// Array of user IDs. Use userId values which are returned in webhook event objects. Do not use LINE IDs found on LINE. + /// Messages to send. + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Name of aggregation unit. Case-sensitive. For example, Promotion_a and Promotion_A are regarded as different unit names. + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method + /// Response Headers /// public async Task SendMulticastMessageAsync(IList to, IMessage message, bool? notificationDisabled = null, IList? customAggregationUnits = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -167,12 +191,25 @@ private async Task SendNarrowcastMessageAsync(NarrowcastMessage narrowcastMessag /// /// Sends a message to multiple users. You can specify recipients using attributes (such as age, gender, OS, and region) or by retargeting (audiences). Messages can't be sent to group chats or multi-person chats. /// - /// - /// - /// - /// - /// - /// + /// Messages to send. Max: 5 + /// + /// Recipient object. You can use up to a combined total of 10 audiences and request IDs of the narrowcast messages previously sent to specify message recipients. + /// There is no upper limit on the number of operator objects that you can specify. + /// If this is omitted, messages will be sent to all users who have added your LINE Official Account as a friend. + /// + /// + /// Demographic filter object. You can use friends' attributes to filter the list of recipients. + /// If this is omitted, messages are sent to everyone—including users with attribute values of "unknown". + /// + /// + /// The maximum number of narrowcast messages to send. + /// + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or on their device). + /// + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method. + /// Response Headers /// public async Task SendNarrowcastMessageAsync(IList messages, IRecipientObject? recipient = null, NarrowcastMessageFilter? filter = null, NarrowcastLimit? limit = null, bool? notificationDisabled = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -191,12 +228,25 @@ public async Task SendNarrowcastMessageAsync(IList messages, IRecipien /// /// Sends a message to multiple users. You can specify recipients using attributes (such as age, gender, OS, and region) or by retargeting (audiences). Messages can't be sent to group chats or multi-person chats. /// - /// - /// - /// - /// - /// - /// + /// Messages to send. + /// + /// Recipient object. You can use up to a combined total of 10 audiences and request IDs of the narrowcast messages previously sent to specify message recipients. + /// There is no upper limit on the number of operator objects that you can specify. + /// If this is omitted, messages will be sent to all users who have added your LINE Official Account as a friend. + /// + /// + /// Demographic filter object. You can use friends' attributes to filter the list of recipients. + /// If this is omitted, messages are sent to everyone—including users with attribute values of "unknown". + /// + /// + /// The maximum number of narrowcast messages to send. + /// + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or on their device). + /// + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method. + /// Response Headers /// public async Task SendNarrowcastMessageAsync(IMessage message, IRecipientObject? recipient = null, NarrowcastMessageFilter? filter = null, NarrowcastLimit? limit = null, bool? notificationDisabled = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -222,9 +272,13 @@ private async Task SendBroadcastMessageAsync(BroadcastMessage broadcastMessage, /// /// Sends a message to all users who are friends with your LINE Official Account at any time. /// - /// - /// - /// + /// Messages to send. Max:5 + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method. + /// Response Headers /// public async Task SendBroadcastMessageAsync(IList messages, bool? notificationDisabled = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -240,9 +294,13 @@ public async Task SendBroadcastMessageAsync(IList messages, bool? noti /// /// Sends a message to all users who are friends with your LINE Official Account at any time. /// - /// - /// - /// + /// Messages to send. + /// + /// true: The user doesn't receive a push notification when the message is sent. + /// false: The user receives a push notification when the message is sent(unless they have disabled push notifications in LINE and/or their device). + /// + /// Retry key. Specifies the UUID in hexadecimal format (e.g., 123e4567-e89b-12d3-a456-426614174000) generated by any method. + /// Response Headers /// public async Task SendBroadcastMessageAsync(IMessage message, bool? notificationDisabled = null, string? xLineRetryKey = null, Action? getResponseHeaders = null) { @@ -256,13 +314,19 @@ public async Task SendBroadcastMessageAsync(IMessage message, bool? notification } #endregion + /// + /// Gets the status of a narrowcast message. + /// + /// The narrowcast message's request ID. Each Messaging API request has a request ID. Find it in the response headers. + /// Response Headers + /// public async Task GetNarrowcastMessageStatusAsync(string requestId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/message/progress/narrowcast?requestId={requestId}", getResponseHeaders).ConfigureAwait(false); /// - /// Gets the target limit for sending messages in the current month. - /// The total number of the free messages and the additional messages is returned. + /// Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. /// + /// Response Headers /// public async Task GetTheTargetLimitForSendingMessagesThisMonthAsync(Action? getResponseHeaders = null) => await base.GetAsync("v2/bot/message/quota", getResponseHeaders).ConfigureAwait(false); @@ -270,6 +334,7 @@ public async Task GetTheTargetLimitForSe /// /// Gets the number of messages sent in the current month. /// + /// Response Headers /// public async Task GetNumberOfMessagesSentThisMonthAsync(Action? getResponseHeaders = null) { @@ -278,10 +343,11 @@ public async Task GetNumberOfMessagesSentThisMonthAsync(Action - /// Gets the number of messages sent - /// - /// - /// + /// Gets the number of messages sent with the Send(Reply,Push,Multicast,Narrowcast,Broadcast)MessageAsync method. + /// /// + /// Send Type + /// Date the messages were sent + /// Response Headers /// /// public async Task GetNumberOfSentMessagesAsync(SendType sendType, DateOnly date, Action? getResponseHeaders = null) @@ -290,15 +356,30 @@ public async Task GetNumberOfSentMessagesAsync(SendType se return await base.GetAsync($"v2/bot/message/delivery/{sendType.ToString().ToLower()}?date={date.ToString("yyyyMMdd")}", getResponseHeaders).ConfigureAwait(false); } + /// + /// You can validate that an array of message objects is valid as a value for the messages property of the request body for the Send reply message endpoint. This endpoint doesn't validate the values of the properties other than the messages property. + /// + /// Send Type + /// Array of message objects to validate + /// Response Headers + /// public async Task ValidateMessageObjectsOfMessageAsync(SendType sendType, IList messages, Action? getResponseHeaders = null) => await base.PostAsJsonAsync($"v2/bot/message/validate/{sendType.ToString().ToLower()}", new RequestMessages() { Message = messages }, getResponseHeaders).ConfigureAwait(false); + /// + /// You can validate that an array of message objects is valid as a value for the messages property of the request body for the Send reply message endpoint. This endpoint doesn't validate the values of the properties other than the messages property. + /// + /// Send Type + /// message objects to validate + /// Response Headers + /// public async Task ValidateMessageObjectsOfMessageAsync(SendType sendType, IMessage message, Action? getResponseHeaders = null) => await this.ValidateMessageObjectsOfMessageAsync(sendType, new List { message }, getResponseHeaders).ConfigureAwait(false); /// /// Get the number of aggregation units used this month. /// + /// Response Headers /// public async Task GetNumberOfUnitsUsedThisMonthAsync(Action? getResponseHeaders = null) { @@ -306,9 +387,30 @@ public async Task GetNumberOfUnitsUsedThisMonthAsync(Action(); } + /// + /// You can get the name list of units used this month for statistics aggregation. + /// + /// + /// The maximum number of aggregation units you can get per request. + /// The default value is 100 + /// Max value: 100 + /// + /// Response Headers + /// public async Task GetNameListOfUnitsUsedThisMonthAsync(int limit = 100, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/message/aggregation/list?limit={limit}", getResponseHeaders).ConfigureAwait(false); + /// + /// You can get the name list of units used this month for statistics aggregation. + /// + /// + /// The maximum number of aggregation units you can get per request. + /// The default value is 100 + /// Max value: 100 + /// + /// Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + /// Response Headers + /// public async Task GetNameListOfUnitsUsedThisMonthAsync(int limit, string start, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/message/aggregation/list?limit={limit}&start={start}", getResponseHeaders).ConfigureAwait(false); } diff --git a/Src/LineDevelopers/Message/LineMultiPersonChatClient.cs b/Src/LineDevelopers/Message/LineMultiPersonChatClient.cs index 69a7f0f..f258d4f 100644 --- a/Src/LineDevelopers/Message/LineMultiPersonChatClient.cs +++ b/Src/LineDevelopers/Message/LineMultiPersonChatClient.cs @@ -59,7 +59,7 @@ public async Task GetMemberProfileAsync(string roo /// /// leave multi person chat /// - /// + /// Room ID /// public async Task LeaveAsync(string roomId, Action? getResponseHeaders = null) => await base.PostAsync($"v2/bot/room/{roomId}/leave", getResponseHeaders).ConfigureAwait(false); diff --git a/Src/LineDevelopers/Message/LineRichMenuClient.cs b/Src/LineDevelopers/Message/LineRichMenuClient.cs index 470c74f..df0e349 100644 --- a/Src/LineDevelopers/Message/LineRichMenuClient.cs +++ b/Src/LineDevelopers/Message/LineRichMenuClient.cs @@ -20,7 +20,8 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? /// /// Creates a rich menu. /// - /// + /// Specify a rich menu object to be displayed as a rich menu. + /// Response Headers /// public async Task CreateRichMenuAsync(RichMenuObject richMenuObject, Action? getResponseHeaders = null) { @@ -31,7 +32,8 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? /// /// Validate a rich menu object. /// - /// + /// Specify a rich menu object you want to validate. + /// Response Headers /// public async Task ValidateRichMenuAsync(RichMenuObject richMenuObject, Action? getResponseHeaders = null) => await base.PostAsJsonAsync("v2/bot/richmenu/validate", richMenuObject, getResponseHeaders).ConfigureAwait(false); @@ -45,9 +47,10 @@ public async Task ValidateRichMenuAsync(RichMenuObject richMenuObject, Action - /// - /// - /// + /// The ID of the rich menu to attach the image to + /// image stream + /// image type + /// Response Headers /// public async Task UploadRichMenuImageAsync(string richMenuId, StreamContent streamContent, MediaType mediaType, Action? getResponseHeaders = null) => await base.PostAsync($"https://api-data.line.me/v2/bot/richmenu/{richMenuId}/content", streamContent, mediaType, getResponseHeaders).ConfigureAwait(false); @@ -61,9 +64,10 @@ public async Task UploadRichMenuImageAsync(string richMenuId, StreamContent stre /// Image aspect ratio(width / height) : 1.45 or more /// Max file size: 1 MB /// - /// - /// - /// + /// The ID of the rich menu to attach the image to + /// image file path + /// image type + /// Response Headers /// /// public async Task UploadRichMenuImageAsync(string richMenuId, string path, MediaType mediaType, Action? getResponseHeaders = null) @@ -79,6 +83,7 @@ public async Task UploadRichMenuImageAsync(string richMenuId, string path, Media /// Downloads an image associated with a rich menu. /// /// ID of the rich menu with the image to be downloaded + /// Response Headers /// public async Task DownloadRichMenuImageAsync(string richMenuId, Action? getResponseHeaders = null) => await base.GetStreamAsync($"https://api-data.line.me/v2/bot/richmenu/{richMenuId}/content", getResponseHeaders).ConfigureAwait(false); @@ -87,7 +92,8 @@ public async Task DownloadRichMenuImageAsync(string richMenuId, Action /// ID of the rich menu with the image to be downloaded - /// + /// download path + /// Response Headers /// public async Task DownloadRichMenuImageAsync(string richMenuId, string path, Action? getResponseHeaders = null) { @@ -108,17 +114,19 @@ public async Task DownloadRichMenuImageAsync(string richMenuId, string path, Act /// /// Gets a list of the rich menu response object of all rich menus created by Create a rich menu. /// + /// Response Headers /// public async Task> GetRichMenuListAsync(Action? getResponseHeaders = null) { var result = await base.GetAsync("v2/bot/richmenu/list", getResponseHeaders).ConfigureAwait(false); return result.RichMenus; } - + /// /// Gets a rich menu via a rich menu ID. /// /// ID of a rich menu + /// Response Headers /// public async Task GetRichMenuAsync(string richMenuId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/richmenu/{richMenuId}", getResponseHeaders).ConfigureAwait(false); @@ -127,15 +135,16 @@ public async Task GetRichMenuAsync(string richMenuId, Ac /// Deletes a rich menu. /// /// ID of a rich menu + /// Response Headers /// public async Task DeleteRichMenuAsync(string richMenuId, Action? getResponseHeaders = null) => await base.DeleteAsync($"v2/bot/richmenu/{richMenuId}", getResponseHeaders).ConfigureAwait(false); /// - /// Sets the default rich menu. The default rich menu is displayed to all users who have added your LINE Official Account as a friend and are not linked to any per-user rich menu. - /// If a default rich menu has already been set, calling this endpoint replaces the current default rich menu with the one specified in your request. + /// Sets the default rich menu. /// /// ID of a rich menu + /// Response Headers /// public async Task SetDefaultRichMenuAsync(string richMenuId, Action? getResponseHeaders = null) { @@ -145,7 +154,8 @@ public async Task SetDefaultRichMenuAsync(string richMenuId, Action /// Gets the ID of the default rich menu set with the Messaging API. /// - /// ID of a rich menu + /// Response Headers + /// public async Task GetDefaultRichMenuIdAsync(Action? getResponseHeaders = null) { var result = await base.GetAsync($"v2/bot/user/all/richmenu", getResponseHeaders).ConfigureAwait(false); @@ -155,6 +165,7 @@ public async Task SetDefaultRichMenuAsync(string richMenuId, Action /// Cancels the default rich menu set with the Messaging API. /// + /// Response Headers /// public async Task CancelDefaultRichMenuAsync(Action? getResponseHeaders = null) => await base.DeleteAsync("v2/bot/user/all/richmenu", getResponseHeaders).ConfigureAwait(false); @@ -164,6 +175,7 @@ public async Task CancelDefaultRichMenuAsync(Action? getRes /// /// The rich menu ID to be associated with the rich menu alias. /// Rich menu alias ID, which can be any ID, unique for each channel. + /// Response Headers /// public async Task CreateRichMenuAliasAsync(string richMenuId, string richMenuAliasId, Action? getResponseHeaders = null) { @@ -180,7 +192,7 @@ public async Task CreateRichMenuAliasAsync(string richMenuId, string richMenuAli /// Deletes rich menu alias. /// /// Rich menu alias ID that you want to delete. - /// + /// Response Headers public async Task DeleteRichMenuAliasAsync(string richMenuAliasId, Action? getResponseHeaders = null) => await base.DeleteAsync($"v2/bot/richmenu/alias/{richMenuAliasId}", getResponseHeaders).ConfigureAwait(false); @@ -189,6 +201,7 @@ public async Task DeleteRichMenuAliasAsync(string richMenuAliasId, Action /// The rich menu ID to be associated with the rich menu alias. /// The rich menu alias ID you want to update. + /// Response Headers /// public async Task UpdateRichMenuAliasAsync(string richMenuId, string richMenuAliasId, Action? getResponseHeaders = null) { @@ -201,6 +214,7 @@ public async Task UpdateRichMenuAliasAsync(string richMenuId, string richMenuAli /// Specifies rich menu alias ID to get information of the rich menu alias. /// /// The rich menu alias ID whose information you want to obtain. + /// Response Headers /// public async Task GetRichMenuAliasInformationAsync(string richMenuAliasId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/richmenu/alias/{richMenuAliasId}", getResponseHeaders).ConfigureAwait(false); @@ -208,6 +222,7 @@ public async Task GetRichMenuAliasInformationAsync(string richMen /// /// Gets the rich menu alias list. /// + /// Response Headers /// public async Task> GetListOfRichMenuAliasAsync(Action? getResponseHeaders = null) { @@ -216,11 +231,11 @@ public async Task> GetListOfRichMenuAliasAsync(Action - /// Links a rich menu to a user. Only one rich menu can be linked to a user at one time. - /// If a user already has a rich menu linked, calling this endpoint replaces the existing rich menu with the one specified in your request. + /// Links a rich menu to a user. Only one rich menu can be linked to a user at one time. If a user already has a rich menu linked, calling this endpoint replaces the existing rich menu with the one specified in your request. /// - /// User ID + /// User ID. /// ID of a rich menu + /// Response Headers /// public async Task LinkRichMenuToUserAsync(string userId, string richMenuId, Action? getResponseHeaders = null) => await base.PostAsync($"v2/bot/user/{userId}/richmenu/{richMenuId}", getResponseHeaders).ConfigureAwait(false); @@ -229,7 +244,8 @@ public async Task LinkRichMenuToUserAsync(string userId, string richMenuId, Acti /// Links a rich menu to multiple users. /// /// ID of a rich menu - /// Array of user IDs. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE.Max: 500 user IDs + /// Array of user IDs. + /// Response Headers /// public async Task LinkRichMenuToMultipleUsersAsync(string richMenuId, IList userIds, Action? getResponseHeaders = null) { @@ -245,8 +261,9 @@ public async Task LinkRichMenuToMultipleUsersAsync(string richMenuId, IList /// Gets the ID of the rich menu linked to a user. /// - /// User ID. Found in the source object of webhook event objects. Do not use the LINE ID used in LINE. - /// ID of a rich menu + /// User ID. + /// Response Headers + /// public async Task GetRichMenuIdOfUserAsync(string userId, Action? getResponseHeaders = null) { var result = await base.GetAsync($"v2/bot/user/{userId}/richmenu", getResponseHeaders).ConfigureAwait(false); @@ -254,10 +271,10 @@ public async Task LinkRichMenuToMultipleUsersAsync(string richMenuId, IList - /// removes the per-user rich menu linked to a specified user. + /// API that removes the per-user rich menu linked to a specified user. /// - /// User ID. Found in the source object of webhook event objects. - /// Do not use the LINE ID used in LINE. + /// User ID. + /// Response Headers /// public async Task UnlinkRichMenuFromUserAsync(string userId, Action? getResponseHeaders = null) => await base.DeleteAsync($"v2/bot/user/{userId}/richmenu", getResponseHeaders).ConfigureAwait(false); @@ -265,10 +282,8 @@ public async Task UnlinkRichMenuFromUserAsync(string userId, Action /// Unlinks rich menus from multiple users. /// - /// Array of user IDs. - /// Found in the source object of webhook event objects. - /// Do not use the LINE ID used in LINE. Max: 500 user IDs - /// + /// Array of user IDs. + /// Response Headers /// public async Task UnlinkRichMenusFromMultipleUsersAsync(IList userIds, Action? getResponseHeaders = null) { @@ -280,8 +295,13 @@ public async Task UnlinkRichMenusFromMultipleUsersAsync(IList userIds, A /// /// You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. /// - /// - /// + /// + /// Defines the batch operation to the rich menu. + /// Max: 1,000 objects + /// Rate Limit : 3 requests per hour + /// + /// Key for retry. Key value is a string matching the regular expression pattern [0-9a-zA-Z\-_]{1,100}. + /// Response Headers /// public async Task ReplaceOrUnlinkTheLinkedRichMenusInBatchesAsync(IList richMenuOperationObjects, string? resumeRequestKey = null, Action? getResponseHeaders = null) { @@ -296,11 +316,29 @@ public async Task ReplaceOrUnlinkTheLinkedRichMenusInBatchesAsync(IList /// Get the status of Replace or unlink a linked rich menus in batches. + /// You can't get the status anymore after 14 days (336 hours) past the timestamp displayed in acceptedTime. + /// Rate Limit : 100 requests per hour /// + /// A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. Find it in the response headers. + /// Response Headers /// public async Task GetStatusOfRichMenuBatchControlAsync(string requestId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/richmenu/progress/batch?requestId={requestId}", getResponseHeaders).ConfigureAwait(false); + /// + /// Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + /// Rate Limit : 2,000 requests per second + /// + /// + /// Defines the batch operation to the rich menu. + /// Max: 1,000 objects + /// + /// + /// Key for retry. + /// Key value is a string matching the regular expression pattern [0-9a-zA-Z\-_]{1,100}. + /// + /// Response Headers + /// public async Task ValidateRequestOfRichMenuBatchControlAsync(IList richMenuOperationObjects, string? resumeRequestKey = null, Action? getResponseHeaders = null) { var request = new RichMenuBatchControl() diff --git a/Src/LineDevelopers/Message/LineUserClient.cs b/Src/LineDevelopers/Message/LineUserClient.cs index 52871d3..71dc70d 100644 --- a/Src/LineDevelopers/Message/LineUserClient.cs +++ b/Src/LineDevelopers/Message/LineUserClient.cs @@ -18,12 +18,20 @@ protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? /// /// You can get the profile information of users who meet one of two conditions: + /// Users who have added your LINE Official Account as a friend + /// Users who haven't added your LINE Official Account as a friend but have sent a message to your LINE Official Account (except users who have blocked your LINE Official Account) /// - /// + /// User ID. + /// Response Headers /// public async Task GetUserProfileAsync(string userId, Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/profile/{userId}", getResponseHeaders).ConfigureAwait(false); + /// + /// Gets the list of User IDs of users who have added your LINE Official Account as a friend. + /// + /// Response Headers + /// public async Task GetFollowersAsync(Action? getResponseHeaders = null) => await base.GetAsync($"v2/bot/followers/ids",getResponseHeaders).ConfigureAwait(false); diff --git a/Src/LineDevelopers/Message/LineWebhookSettingClient.cs b/Src/LineDevelopers/Message/LineWebhookSettingClient.cs index c720151..fe257da 100644 --- a/Src/LineDevelopers/Message/LineWebhookSettingClient.cs +++ b/Src/LineDevelopers/Message/LineWebhookSettingClient.cs @@ -17,6 +17,13 @@ internal LineWebhookSettingClient(HttpClient httpClient, JsonSerializerOptions j protected override async Task EnsureSuccessStatusCodeAsync(HttpResponseMessage? httpResponseMessage) => await httpResponseMessage.EnsureSuccessStatusCodeForLineMessageAsync().ConfigureAwait(false); + /// + /// Sets the webhook endpoint URL. + /// It may take up to 1 minute for changes to take place due to caching. + /// + /// A valid webhook URL. + /// Response Headers + /// public async Task SetEndpointUrlAsync(string endpoint, Action? getResponseHeaders = null) { var request = new JsonObject() { ["endpoint"] = endpoint }; @@ -24,9 +31,20 @@ public async Task SetEndpointUrlAsync(string endpoint, Action + /// Gets information on a webhook endpoint. + /// + /// Response Headers + /// public async Task GetEndpointInformationAsync(Action? getResponseHeaders = null) => await base.GetAsync("v2/bot/channel/webhook/endpoint", getResponseHeaders).ConfigureAwait(false); + /// + /// Checks if the configured webhook endpoint can receive a test webhook event. + /// + /// A webhook URL to be validated. + /// Response Headers + /// public async Task TestEndpointAsync(string endpoint, Action? getResponseHeaders = null) { var request = new JsonObject() { ["endpoint"] = endpoint };