I am trying to shift to usingShopifySharp.Extensions.DependencyInjection to register ShopifySharp dependecies, but I am having trouble figuring out how to specify the apiVersion.
I am currently using the GraphService
This is how I was previously registering IGraphService:
services.AddSingleton<IGraphService, GraphService>((provider) =>
{
var config = provider.GetRequiredService<IOptions<ShopifyConfiguration>>().Value;
return new GraphService(config.BaseUrl, config.AccessToken, apiVersion: "unstable");
});
This is my attempt through the DependencyIntjection package, attempting to utilize the LeakyBucketExecutionPolicy
services.AddShopifySharp<LeakyBucketExecutionPolicy>();
services.AddSingleton<IGraphService, GraphService>((provider) =>
{
var factory = provider.GetRequiredService<IGraphServiceFactory>();
var config = provider.GetRequiredService<IOptions<ShopifyConfiguration>>().Value;
var credentials = new ShopifyApiCredentials(config.BaseUrl, config.AccessToken);
// no option to set api version
var service = factory.Create(credentials);
});
Is it possible to set the apiVersion through the DependencyInjection package?
I am trying to shift to using
ShopifySharp.Extensions.DependencyInjectionto register ShopifySharp dependecies, but I am having trouble figuring out how to specify the apiVersion.I am currently using the
GraphServiceThis is how I was previously registering
IGraphService:This is my attempt through the DependencyIntjection package, attempting to utilize the
LeakyBucketExecutionPolicyIs it possible to set the apiVersion through the DependencyInjection package?