Skip to content

Commit 7f7b882

Browse files
authored
Merge pull request #137 from liammclennan/add-expressionindex-find
Add ExpressionIndexesResourceGroup.FindAsync
2 parents f6f2588 + 83a2dca commit 7f7b882

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Seq.Api/ResourceGroups/ExpressionIndexesResourceGroup.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Threading;
34
using System.Threading.Tasks;
45
using Seq.Api.Model;
6+
using Seq.Api.Model.Indexes;
57
using Seq.Api.Model.Indexing;
68

79
namespace Seq.Api.ResourceGroups
@@ -24,6 +26,18 @@ public async Task<List<ExpressionIndexEntity>> ListAsync(CancellationToken cance
2426
{
2527
return await GroupListAsync<ExpressionIndexEntity>("Items", cancellationToken: cancellationToken).ConfigureAwait(false);
2628
}
29+
30+
/// <summary>
31+
/// Retrieve the expression index with the given id; throws if the entity does not exist.
32+
/// </summary>
33+
/// <param name="id">The id of the expression index.</param>
34+
/// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
35+
/// <returns>The expression index.</returns>
36+
public async Task<ExpressionIndexEntity> FindAsync(string id, CancellationToken cancellationToken = default)
37+
{
38+
if (id == null) throw new ArgumentNullException(nameof(id));
39+
return await GroupGetAsync<ExpressionIndexEntity>("Item", new Dictionary<string, object> { { "id", id } }, cancellationToken).ConfigureAwait(false);
40+
}
2741

2842
/// <summary>
2943
/// Construct an expression index with server defaults pre-initialized.

0 commit comments

Comments
 (0)