-
-
Notifications
You must be signed in to change notification settings - Fork 299
/
IRequestExecutionPolicy.cs
21 lines (18 loc) · 1.11 KB
/
IRequestExecutionPolicy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System.Threading;
using System.Threading.Tasks;
using ShopifySharp.Infrastructure;
// ReSharper disable once CheckNamespace
namespace ShopifySharp;
public delegate Task<RequestResult<T>> ExecuteRequestAsync<T>(CloneableRequestMessage request);
/// <summary>
/// Used to specify centralized logic that should run when executing shopify requests.
/// It is most useful to implement retry logic, but it can also be used for other concerns (i.e. tracing)
/// </summary>
public interface IRequestExecutionPolicy
{
/// <param name="baseRequestMessage">The base request that was built by a service to execute.</param>
/// <param name="executeRequestAsync">A delegate that executes the request you pass to it.</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="graphqlQueryCost">Optional expected Graphql query cost (as seen in GraphQL response at extensions.cost.requestedQueryCost</param>
Task<RequestResult<T>> Run<T>(CloneableRequestMessage baseRequestMessage, ExecuteRequestAsync<T> executeRequestAsync, CancellationToken cancellationToken, int? graphqlQueryCost = null);
}