diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..2deb00d
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+ latest
+
+
\ No newline at end of file
diff --git a/Seq.Api.sln.DotSettings b/Seq.Api.sln.DotSettings
deleted file mode 100644
index d50635d..0000000
--- a/Seq.Api.sln.DotSettings
+++ /dev/null
@@ -1,2 +0,0 @@
-
- AD
\ No newline at end of file
diff --git a/example/SeqTail/Program.cs b/example/SeqTail/Program.cs
index 1504705..162fdd1 100644
--- a/example/SeqTail/Program.cs
+++ b/example/SeqTail/Program.cs
@@ -1,5 +1,4 @@
using System;
-using System.Linq;
using System.Threading.Tasks;
using DocoptNet;
using Seq.Api;
diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs
index bb5abfc..fb097a6 100644
--- a/src/Seq.Api/Client/SeqApiClient.cs
+++ b/src/Seq.Api/Client/SeqApiClient.cs
@@ -60,95 +60,95 @@ public SeqApiClient(string serverUrl, string apiKey = null, bool useDefaultCrede
public HttpClient HttpClient => _httpClient;
- public Task GetRootAsync()
+ public Task GetRootAsync(CancellationToken token = default)
{
- return HttpGetAsync("api");
+ return HttpGetAsync("api", token);
}
- public Task GetAsync(ILinked entity, string link, IDictionary parameters = null)
+ public Task GetAsync(ILinked entity, string link, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
- return HttpGetAsync(linkUri);
+ return HttpGetAsync(linkUri, token);
}
- public Task GetStringAsync(ILinked entity, string link, IDictionary parameters = null)
+ public Task GetStringAsync(ILinked entity, string link, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
- return HttpGetStringAsync(linkUri);
+ return HttpGetStringAsync(linkUri, token);
}
- public Task> ListAsync(ILinked entity, string link, IDictionary parameters = null)
+ public Task> ListAsync(ILinked entity, string link, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
- return HttpGetAsync>(linkUri);
+ return HttpGetAsync>(linkUri, token);
}
- public async Task PostAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task PostAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Post, linkUri) { Content = MakeJsonContent(content) };
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
new StreamReader(stream).ReadToEnd();
}
- public async Task PostAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task PostAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Post, linkUri) { Content = MakeJsonContent(content) };
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
return _serializer.Deserialize(new JsonTextReader(new StreamReader(stream)));
}
- public async Task PostReadStringAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task PostReadStringAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Post, linkUri) { Content = MakeJsonContent(content) };
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
return await new StreamReader(stream).ReadToEndAsync();
}
- public async Task PostReadStreamAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task PostReadStreamAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Post, linkUri) { Content = MakeJsonContent(content) };
- return await HttpSendAsync(request).ConfigureAwait(false);
+ return await HttpSendAsync(request, token).ConfigureAwait(false);
}
- public async Task PutAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task PutAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Put, linkUri) { Content = MakeJsonContent(content) };
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
new StreamReader(stream).ReadToEnd();
}
- public async Task DeleteAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task DeleteAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Delete, linkUri) { Content = MakeJsonContent(content) };
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
new StreamReader(stream).ReadToEnd();
}
- public async Task DeleteAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null)
+ public async Task DeleteAsync(ILinked entity, string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
var request = new HttpRequestMessage(HttpMethod.Delete, linkUri) { Content = MakeJsonContent(content) };
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
return _serializer.Deserialize(new JsonTextReader(new StreamReader(stream)));
}
- public async Task> StreamAsync(ILinked entity, string link, IDictionary parameters = null)
+ public async Task> StreamAsync(ILinked entity, string link, IDictionary parameters = null, CancellationToken token = default)
{
- return await WebSocketStreamAsync(entity, link, parameters, reader => _serializer.Deserialize(new JsonTextReader(reader)));
+ return await WebSocketStreamAsync(entity, link, parameters, reader => _serializer.Deserialize(new JsonTextReader(reader)), token);
}
- public async Task> StreamTextAsync(ILinked entity, string link, IDictionary parameters = null)
+ public async Task> StreamTextAsync(ILinked entity, string link, IDictionary parameters = null, CancellationToken token = default)
{
- return await WebSocketStreamAsync(entity, link, parameters, reader => reader.ReadToEnd());
+ return await WebSocketStreamAsync(entity, link, parameters, reader => reader.ReadToEnd(), token);
}
- async Task> WebSocketStreamAsync(ILinked entity, string link, IDictionary parameters, Func deserialize)
+ async Task> WebSocketStreamAsync(ILinked entity, string link, IDictionary parameters, Func deserialize, CancellationToken token = default)
{
var linkUri = ResolveLink(entity, link, parameters);
@@ -157,35 +157,35 @@ async Task> WebSocketStreamAsync(ILinked entity, string l
if (_apiKey != null)
socket.Options.SetRequestHeader("X-Seq-ApiKey", _apiKey);
- await socket.ConnectAsync(new Uri(linkUri), CancellationToken.None);
+ await socket.ConnectAsync(new Uri(linkUri), token);
return new ObservableStream(socket, deserialize);
}
- async Task HttpGetAsync(string url)
+ async Task HttpGetAsync(string url, CancellationToken token = default)
{
var request = new HttpRequestMessage(HttpMethod.Get, url);
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
return _serializer.Deserialize(new JsonTextReader(new StreamReader(stream)));
}
- async Task HttpGetStringAsync(string url)
+ async Task HttpGetStringAsync(string url, CancellationToken token = default)
{
var request = new HttpRequestMessage(HttpMethod.Get, url);
- var stream = await HttpSendAsync(request).ConfigureAwait(false);
+ var stream = await HttpSendAsync(request, token).ConfigureAwait(false);
return await new StreamReader(stream).ReadToEndAsync();
}
- async Task HttpSendAsync(HttpRequestMessage request)
+ async Task HttpSendAsync(HttpRequestMessage request, CancellationToken token = default)
{
if (_apiKey != null)
request.Headers.Add("X-Seq-ApiKey", _apiKey);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(SeqApiV6MediaType));
- var response = await _httpClient.SendAsync(request).ConfigureAwait(false);
+ var response = await _httpClient.SendAsync(request, token).ConfigureAwait(false);
var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
-
+
if (response.IsSuccessStatusCode)
return stream;
diff --git a/src/Seq.Api/Model/Backups/BackupEntity.cs b/src/Seq.Api/Model/Backups/BackupEntity.cs
index a59bd0b..4631a56 100644
--- a/src/Seq.Api/Model/Backups/BackupEntity.cs
+++ b/src/Seq.Api/Model/Backups/BackupEntity.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace Seq.Api.Model.Backups
+namespace Seq.Api.Model.Backups
{
public class BackupEntity : Entity
{
diff --git a/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs b/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs
index 6047ff2..f46b805 100644
--- a/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs
+++ b/src/Seq.Api/ResourceGroups/ApiKeysResourceGroup.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
using Seq.Api.Model.Inputs;
@@ -12,36 +13,36 @@ internal ApiKeysResourceGroup(ISeqConnection connection)
{
}
- public async Task FindAsync(string id)
+ public async Task FindAsync(string id, CancellationToken token = default)
{
if (id == null) throw new ArgumentNullException(nameof(id));
- return await GroupGetAsync("Item", new Dictionary { { "id", id } }).ConfigureAwait(false);
+ return await GroupGetAsync("Item", new Dictionary { { "id", id } }, token).ConfigureAwait(false);
}
- public async Task> ListAsync(string ownerId = null)
+ public async Task> ListAsync(string ownerId = null, CancellationToken token = default)
{
var parameters = new Dictionary { { "ownerId", ownerId } };
- return await GroupListAsync("Items", parameters).ConfigureAwait(false);
+ return await GroupListAsync("Items", parameters, token).ConfigureAwait(false);
}
- public async Task TemplateAsync()
+ public async Task TemplateAsync(CancellationToken token = default)
{
- return await GroupGetAsync("Template").ConfigureAwait(false);
+ return await GroupGetAsync("Template", token: token).ConfigureAwait(false);
}
- public async Task AddAsync(ApiKeyEntity entity)
+ public async Task AddAsync(ApiKeyEntity entity, CancellationToken token = default)
{
- return await GroupCreateAsync(entity).ConfigureAwait(false);
+ return await GroupCreateAsync(entity, token: token).ConfigureAwait(false);
}
- public async Task RemoveAsync(ApiKeyEntity entity)
+ public async Task RemoveAsync(ApiKeyEntity entity, CancellationToken token = default)
{
- await Client.DeleteAsync(entity, "Self", entity).ConfigureAwait(false);
+ await Client.DeleteAsync(entity, "Self", entity, token: token).ConfigureAwait(false);
}
- public async Task UpdateAsync(ApiKeyEntity entity)
+ public async Task UpdateAsync(ApiKeyEntity entity, CancellationToken token = default)
{
- await Client.PutAsync(entity, "Self", entity).ConfigureAwait(false);
+ await Client.PutAsync(entity, "Self", entity, token: token).ConfigureAwait(false);
}
}
}
diff --git a/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs b/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs
index 23cf62b..97bd4e3 100644
--- a/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs
+++ b/src/Seq.Api/ResourceGroups/ApiResourceGroup.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Threading;
using System.Threading.Tasks;
using Seq.Api.Client;
using Seq.Api.Model;
@@ -21,69 +22,69 @@ internal ApiResourceGroup(string name, ISeqConnection connection)
protected SeqApiClient Client { get { return _connection.Client; } }
- protected Task LoadGroupAsync()
+ protected Task LoadGroupAsync(CancellationToken token = default)
{
- return _connection.LoadResourceGroupAsync(_name);
+ return _connection.LoadResourceGroupAsync(_name, token);
}
- protected async Task GroupGetAsync(string link, IDictionary parameters = null)
+ protected async Task GroupGetAsync(string link, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.GetAsync(group, link, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.GetAsync(group, link, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupGetStringAsync(string link, IDictionary parameters = null)
+ protected async Task GroupGetStringAsync(string link, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.GetStringAsync(group, link, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.GetStringAsync(group, link, parameters, token).ConfigureAwait(false);
}
- protected async Task> GroupListAsync(string link, IDictionary parameters = null)
+ protected async Task> GroupListAsync(string link, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.ListAsync(group, link, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.ListAsync(group, link, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupPostAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupPostAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- await Client.PostAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ await Client.PostAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupPostReadStringAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupPostReadStringAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.PostReadStringAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.PostReadStringAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupPostReadBytesAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupPostReadBytesAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.PostReadStreamAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.PostReadStreamAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupPostAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupPostAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.PostAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.PostAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupPutAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupPutAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- await Client.PutAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ await Client.PutAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupDeleteAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupDeleteAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- await Client.DeleteAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ await Client.DeleteAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
- protected async Task GroupDeleteAsync(string link, TEntity content, IDictionary parameters = null)
+ protected async Task GroupDeleteAsync(string link, TEntity content, IDictionary parameters = null, CancellationToken token = default)
{
- var group = await LoadGroupAsync().ConfigureAwait(false);
- return await Client.DeleteAsync(group, link, content, parameters).ConfigureAwait(false);
+ var group = await LoadGroupAsync(token).ConfigureAwait(false);
+ return await Client.DeleteAsync(group, link, content, parameters, token).ConfigureAwait(false);
}
protected string GetLink(TEntity entity, string link, string orElse) where TEntity : ILinked
@@ -92,7 +93,8 @@ protected string GetLink(TEntity entity, string link, string orElse) wh
}
protected async Task GroupCreateAsync(TEntity entity,
- IDictionary parameters = null) where TEntity : ILinked
+ IDictionary parameters = null, CancellationToken token = default)
+ where TEntity : ILinked
{
ILinked resource;
string link;
@@ -104,11 +106,11 @@ protected async Task GroupCreateAsync(TEntity ent
}
else
{
- resource = await LoadGroupAsync().ConfigureAwait(false);
+ resource = await LoadGroupAsync(token).ConfigureAwait(false);
link = "Items";
}
- return await Client.PostAsync(resource, link, entity, parameters).ConfigureAwait(false);
+ return await Client.PostAsync(resource, link, entity, parameters, token).ConfigureAwait(false);
}
}
}
diff --git a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs
index fe64248..7672744 100644
--- a/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs
+++ b/src/Seq.Api/ResourceGroups/AppInstancesResourceGroup.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
using Seq.Api.Model.AppInstances;
@@ -12,48 +13,49 @@ internal AppInstancesResourceGroup(ISeqConnection connection)
{
}
- public async Task FindAsync(string id)
+ public async Task FindAsync(string id, CancellationToken token = default)
{
if (id == null) throw new ArgumentNullException(nameof(id));
- return await GroupGetAsync("Item", new Dictionary { { "id", id } }).ConfigureAwait(false);
+ return await GroupGetAsync("Item", new Dictionary { { "id", id } }, token).ConfigureAwait(false);
}
- public async Task> ListAsync()
+ public async Task> ListAsync(CancellationToken token = default)
{
- return await GroupListAsync("Items").ConfigureAwait(false);
+ return await GroupListAsync("Items", token: token).ConfigureAwait(false);
}
- public async Task TemplateAsync(string appId)
+ public async Task TemplateAsync(string appId, CancellationToken token = default)
{
if (appId == null) throw new ArgumentNullException(nameof(appId));
- return await GroupGetAsync("Template", new Dictionary { { "appId", appId } }).ConfigureAwait(false);
+ return await GroupGetAsync("Template", new Dictionary { { "appId", appId } }, token).ConfigureAwait(false);
}
- public async Task AddAsync(AppInstanceEntity entity, bool runOnExisting = false)
+ public async Task AddAsync(AppInstanceEntity entity, bool runOnExisting = false, CancellationToken token = default)
{
if (entity == null) throw new ArgumentNullException(nameof(entity));
- return await Client.PostAsync(entity, "Create", entity, new Dictionary { { "runOnExisting", runOnExisting } }).ConfigureAwait(false);
+ return await Client.PostAsync(entity, "Create", entity, new Dictionary { { "runOnExisting", runOnExisting } }, token)
+ .ConfigureAwait(false);
}
- public async Task RemoveAsync(AppInstanceEntity entity)
+ public async Task RemoveAsync(AppInstanceEntity entity, CancellationToken token = default)
{
if (entity == null) throw new ArgumentNullException(nameof(entity));
- await Client.DeleteAsync(entity, "Self", entity).ConfigureAwait(false);
+ await Client.DeleteAsync(entity, "Self", entity, token: token).ConfigureAwait(false);
}
- public async Task UpdateAsync(AppInstanceEntity entity)
+ public async Task UpdateAsync(AppInstanceEntity entity, CancellationToken token = default)
{
if (entity == null) throw new ArgumentNullException(nameof(entity));
- await Client.PutAsync(entity, "Self", entity).ConfigureAwait(false);
+ await Client.PutAsync(entity, "Self", entity, token: token).ConfigureAwait(false);
}
- public async Task InvokeAsync(AppInstanceEntity entity, string eventId, IReadOnlyDictionary settingOverrides)
+ public async Task InvokeAsync(AppInstanceEntity entity, string eventId, IReadOnlyDictionary settingOverrides, CancellationToken token = default)
{
if (entity == null) throw new ArgumentNullException(nameof(entity));
if (eventId == null) throw new ArgumentNullException(nameof(eventId));
var postedSettings = settingOverrides ?? new Dictionary();
- await Client.PostAsync(entity, "Invoke", postedSettings, new Dictionary{{"eventId", eventId}});
+ await Client.PostAsync(entity, "Invoke", postedSettings, new Dictionary{{"eventId", eventId}}, token);
}
}
}
diff --git a/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs b/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs
index 6488b3b..a26cd7e 100644
--- a/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs
+++ b/src/Seq.Api/ResourceGroups/AppsResourceGroup.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
using Seq.Api.Model.Apps;
@@ -12,44 +13,44 @@ internal AppsResourceGroup(ISeqConnection connection)
{
}
- public async Task FindAsync(string id)
+ public async Task FindAsync(string id, CancellationToken token = default)
{
if (id == null) throw new ArgumentNullException(nameof(id));
- return await GroupGetAsync("Item", new Dictionary { { "id", id } }).ConfigureAwait(false);
+ return await GroupGetAsync("Item", new Dictionary { { "id", id } }, token).ConfigureAwait(false);
}
- public async Task> ListAsync()
+ public async Task> ListAsync(CancellationToken token = default)
{
- return await GroupListAsync("Items").ConfigureAwait(false);
+ return await GroupListAsync("Items", token: token).ConfigureAwait(false);
}
- public async Task TemplateAsync()
+ public async Task TemplateAsync(CancellationToken token = default)
{
- return await GroupGetAsync("Template").ConfigureAwait(false);
+ return await GroupGetAsync("Template", token: token).ConfigureAwait(false);
}
- public async Task AddAsync(AppEntity entity)
+ public async Task AddAsync(AppEntity entity, CancellationToken token = default)
{
- return await Client.PostAsync(entity, "Create", entity).ConfigureAwait(false);
+ return await Client.PostAsync(entity, "Create", entity, token: token).ConfigureAwait(false);
}
- public async Task RemoveAsync(AppEntity entity)
+ public async Task RemoveAsync(AppEntity entity, CancellationToken token = default)
{
- await Client.DeleteAsync(entity, "Self", entity).ConfigureAwait(false);
+ await Client.DeleteAsync(entity, "Self", entity, token: token).ConfigureAwait(false);
}
- public async Task UpdateAsync(AppEntity entity)
+ public async Task UpdateAsync(AppEntity entity, CancellationToken token = default)
{
- await Client.PutAsync(entity, "Self", entity).ConfigureAwait(false);
+ await Client.PutAsync(entity, "Self", entity, token: token).ConfigureAwait(false);
}
- public async Task InstallPackageAsync(string feedId, string packageId, string version = null)
+ public async Task InstallPackageAsync(string feedId, string packageId, string version = null, CancellationToken token = default)
{
if (feedId == null) throw new ArgumentNullException(nameof(feedId));
if (packageId == null) throw new ArgumentNullException(nameof(packageId));
var parameters = new Dictionary{{ "feedId", feedId}, {"packageId", packageId}};
if (version != null) parameters.Add("version", version);
- return await GroupPostAsync