Skip to content

Commit b19fb5d

Browse files
authored
Merge pull request #145 from cnblogs/add-list-item-api
feat: add list item api
2 parents d433dcb + 20e4d54 commit b19fb5d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent/CqrsServiceAgent.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public async Task<PagedList<TItem>> ListPagedItemsAsync<TItem>(
208208
}
209209

210210
/// <summary>
211-
/// Get paged list of items based on url.
211+
/// Get paged list of items.
212212
/// </summary>
213213
/// <param name="url">The route of the API.</param>
214214
/// <param name="pageIndex">The page index.</param>
@@ -231,6 +231,18 @@ public async Task<PagedList<TItem>> ListPagedItemsAsync<TItem>(
231231
return await HttpClient.GetFromJsonAsync<PagedList<TItem>>(url) ?? new PagedList<TItem>();
232232
}
233233

234+
/// <summary>
235+
/// Get list of items.
236+
/// </summary>
237+
/// <param name="url">The url to send GET request.</param>
238+
/// <typeparam name="TList">The type of list.</typeparam>
239+
/// <returns>The fetched list.</returns>
240+
public async Task<TList> ListItemsAsync<TList>(string url)
241+
where TList : new()
242+
{
243+
return await HttpClient.GetFromJsonAsync<TList>(url) ?? new TList();
244+
}
245+
234246
private static async Task<CommandResponse<TResponse, ServiceAgentError>> HandleCommandResponseAsync<TResponse>(
235247
HttpResponseMessage httpResponseMessage)
236248
{

src/Cnblogs.Architecture.Ddd.Infrastructure.Abstractions/DispatchDomainEventExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace MediatR;
55

66
/// <summary>
7-
/// 发布领域时间的拓展方法
7+
/// 发布领域事件的拓展方法
88
/// </summary>
99
public static class DispatchDomainEventExtensions
1010
{

0 commit comments

Comments
 (0)