Skip to content

Commit c6ed4fa

Browse files
wzh425wuzihao
and
wuzihao
authored
feat(mc-sdk) :Add GetUnreadAsync (#623)
* reactor : Use AspNetCore Authentication * reactor(stack-mc) : Some SDK methods support channel code * chore : Restore project reference * reactor(stack-mc) : Remove API Route Get Prefix * test : Unit Test Adjustment * fix :GetListByTagAsync supports channel code * feat(mc-sdk) : Add GetUnreadAsync --------- Co-authored-by: wuzihao <lsd@123>
1 parent bc132ad commit c6ed4fa

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) MASA Stack All rights reserved.
2+
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
3+
4+
namespace Masa.BuildingBlocks.StackSdks.Mc.Model;
5+
6+
public class WebsiteMessageTagModel
7+
{
8+
public string Tag { get; set; } = string.Empty;
9+
10+
public int Unread { get; set; }
11+
12+
public Guid ChannelId { get; set; }
13+
14+
public string Title { get; set; } = string.Empty;
15+
16+
public DateTimeOffset SendTime { get; set; }
17+
18+
public Guid UserId { get; set; }
19+
}

src/BuildingBlocks/StackSdks/Masa.BuildingBlocks.StackSdks.Mc/Service/IWebsiteMessageService.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ public interface IWebsiteMessageService
2525

2626
Task SendGetNotificationAsync(List<string> userIds);
2727

28-
Task<List<WebsiteMessageModel>> GetListByTagAsync(List<string> tags, string channelCode);
28+
Task<List<WebsiteMessageTagModel>> GetListByTagAsync(List<string> tags, string channelCode);
29+
30+
Task<int> GetUnreadAsync(string channelCode);
2931
}

src/Contrib/StackSdks/Masa.Contrib.StackSdks.Mc/Service/WebsiteMessageService.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,17 @@ public async Task SendGetNotificationAsync(List<string> userIds)
7070
await _caller.PostAsync(requestUri, userIds);
7171
}
7272

73-
public async Task<List<WebsiteMessageModel>> GetListByTagAsync(List<string> tags, string channelCode)
73+
public async Task<List<WebsiteMessageTagModel>> GetListByTagAsync(List<string> tags, string channelCode)
7474
{
7575
var requestUri = $"{_party}/ListByTag";
7676
var options = new { tags = string.Join(",", tags), channelCode };
77-
return await _caller.GetAsync<List<WebsiteMessageModel>>(requestUri, options) ?? new();
77+
return await _caller.GetAsync<List<WebsiteMessageTagModel>>(requestUri, options) ?? new();
78+
}
79+
80+
public async Task<int> GetUnreadAsync(string channelCode)
81+
{
82+
var requestUri = $"{_party}/Unread";
83+
var options = new { channelCode };
84+
return await _caller.GetAsync<int>(requestUri, options);
7885
}
7986
}

0 commit comments

Comments
 (0)