-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ea6461
commit 9d8805c
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#nullable enable | ||
// Notice: | ||
// This class is auto-generated from a template. Please do not edit it or change it directly. | ||
|
||
using ShopifySharp.Credentials; | ||
using ShopifySharp.Utilities; | ||
using ShopifySharp.Services; | ||
|
||
namespace ShopifySharp.Factories; | ||
|
||
public interface IShopPlanServiceFactory | ||
{ | ||
/// Creates a new instance of the <see cref="IShopPlanService" /> with the given credentials. | ||
/// <param name="shopDomain">The shop's *.myshopify.com URL.</param> | ||
/// <param name="accessToken">An API access token for the shop.</param> | ||
IShopPlanService Create(string shopDomain, string accessToken); | ||
|
||
/// Creates a new instance of the <see cref="IShopPlanService" /> with the given credentials. | ||
/// <param name="credentials">Credentials for authenticating with the Shopify API.</param> | ||
IShopPlanService Create(ShopifyApiCredentials credentials); | ||
} | ||
|
||
public class ShopPlanServiceFactory(IRequestExecutionPolicy? requestExecutionPolicy = null, IShopifyDomainUtility? shopifyDomainUtility = null) : IShopPlanServiceFactory | ||
{ | ||
/// <inheritDoc /> | ||
public virtual IShopPlanService Create(string shopDomain, string accessToken) | ||
{ | ||
IShopPlanService service = shopifyDomainUtility is null ? new ShopPlanService(shopDomain, accessToken) : new ShopPlanService(shopDomain, accessToken, shopifyDomainUtility); | ||
|
||
if (requestExecutionPolicy is not null) | ||
{ | ||
service.SetExecutionPolicy(requestExecutionPolicy); | ||
} | ||
|
||
return service; | ||
} | ||
|
||
/// <inheritDoc /> | ||
public virtual IShopPlanService Create(ShopifyApiCredentials credentials) => | ||
Create(credentials.ShopDomain, credentials.AccessToken); | ||
} |