-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathITodoistRestClient.cs
50 lines (47 loc) · 2.83 KB
/
ITodoistRestClient.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace Todoist.Net
{
/// <summary>
/// Represents a REST client.
/// </summary>
public interface ITodoistRestClient : IDisposable
{
/// <summary>
/// Sends a <c>GET</c> request, and handles response asynchronously.
/// </summary>
/// <param name="resource">The resource.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Returns <see cref="T:System.Threading.Tasks.Task" />.The task object representing the asynchronous operation.</returns>
/// <exception cref="System.ArgumentException">Value cannot be null or empty - resource</exception>
/// <exception cref="ArgumentNullException"><paramref name="parameters" /> is <see langword="null" /></exception>
Task<HttpResponseMessage> GetAsync(string resource, IEnumerable<KeyValuePair<string, string>> parameters, CancellationToken cancellationToken = default);
/// <summary>
/// Sends a <c>POST</c> request, and handles response asynchronously.
/// </summary>
/// <param name="resource">The resource.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Returns <see cref="T:System.Threading.Tasks.Task" />.The task object representing the asynchronous operation.</returns>
/// <exception cref="System.ArgumentException">Value cannot be null or empty - resource</exception>
/// <exception cref="ArgumentNullException"><paramref name="parameters" /> is <see langword="null" /></exception>
Task<HttpResponseMessage> PostAsync(string resource, IEnumerable<KeyValuePair<string, string>> parameters, CancellationToken cancellationToken = default);
/// <summary>
/// Sends a <c>POST</c> request with form data, and handles response asynchronously.
/// </summary>
/// <param name="resource">The resource.</param>
/// <param name="parameters">The parameters.</param>
/// <param name="files">The files.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>The response.</returns>
Task<HttpResponseMessage> PostFormAsync(
string resource,
IEnumerable<KeyValuePair<string, string>> parameters,
IEnumerable<ByteArrayContent> files,
CancellationToken cancellationToken = default);
}
}