-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathTeamService.cs
32 lines (26 loc) · 984 Bytes
/
TeamService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
namespace Masa.Contrib.BasicAbility.Auth.Service;
public class TeamService : ITeamService
{
readonly ICallerProvider _callerProvider;
readonly string _party = "api/team/";
public TeamService(ICallerProvider callerProvider)
{
_callerProvider = callerProvider;
}
public async Task<TeamDetailModel?> GetDetailAsync(Guid id)
{
var requestUri = $"{_party}detail";
return await _callerProvider.GetAsync<object, TeamDetailModel>(requestUri, new { id });
}
public async Task<List<TeamModel>> GetListAsync(Guid userId = default)
{
var requestUri = $"{_party}list";
if (Guid.Empty != userId)
{
requestUri = $"{requestUri}?userId={userId}";
}
return await _callerProvider.GetAsync<List<TeamModel>>(requestUri) ?? new();
}
}