forked from LeanKit/LeanKit.API.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskCard.cs
More file actions
51 lines (46 loc) · 1.41 KB
/
TaskCard.cs
File metadata and controls
51 lines (46 loc) · 1.41 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Threading.Tasks;
using LeanKit.Models;
using LeanKit.Extensions;
using System.Collections.Generic;
namespace LeanKit.API
{
public class TaskCard
{
private readonly Client _client;
public TaskCard(Client client)
{
_client = client;
}
public async Task<TaskCardListResponse> List(long cardId, TaskCardListRequest request = null)
{
var parameters = new Dictionary<string, string>();
if (request != null)
{
if (request.Offset.HasValue)
{
parameters.Add("offset", request.Offset.Value.ToString());
}
if (request.Limit.HasValue)
{
parameters.Add("limit", request.Limit.Value.ToString());
}
}
var path = string.Format("io/card/{0}/tasks", cardId);
return await _client.Request<TaskCardListResponse>(path, parameters: parameters);
}
public async Task<TaskCardResponse> Get(long cardId, long taskId)
{
var path = string.Format("io/card/{0}/tasks/{1}", cardId, taskId);
return await _client.Request<TaskCardResponse>(path);
}
public async Task<TaskCardResponse> Create(TaskCardCreateRequest request)
{
if ( !request.LaneType.HasValue && string.IsNullOrEmpty(request.LaneTitle))
{
request.LaneType = LaneType.Ready;
}
var path = string.Format("io/card/{0}/tasks", request.CardId);
return await _client.Request<TaskCardResponse>(path, "post", null, request.ToJSON());
}
}
}