forked from LeanKit/LeanKit.API.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.Comment.cs
More file actions
40 lines (35 loc) · 1.19 KB
/
Card.Comment.cs
File metadata and controls
40 lines (35 loc) · 1.19 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
using System.Threading.Tasks;
using LeanKit.Models;
using LeanKit.Extensions;
namespace LeanKit.API
{
public class Comment
{
private readonly Client _client;
public Comment(Client client)
{
_client = client;
}
public async Task<CardCommentListResponse> List(long cardId)
{
var path = string.Format("io/card/{0}/comment", cardId);
return await _client.Request<CardCommentListResponse>(path);
}
public async Task<CardCommentResponse> Create(long cardId, string text)
{
var request = new { text };
var body = request.ToJSON();
return await _client.Request<CardCommentResponse>(string.Format("io/card/{0}/comment", cardId), "post", null, body);
}
public async Task<CardCommentResponse> Update(long cardId, long commentId, string text)
{
var request = new { text };
var body = request.ToJSON();
return await _client.Request<CardCommentResponse>(string.Format("io/card/{0}/comment/{1}", cardId, commentId), "put", null, body);
}
public async Task Delete(long cardId, long commentId)
{
await _client.Request<string>(string.Format("io/card/{0}/comment/{1}", cardId, commentId), "DELETE");
}
}
}