-
-
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
99389e8
commit a4af82c
Showing
1 changed file
with
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#nullable enable | ||
// Notice: | ||
// This class is auto-generated from a template. Please do not edit it or change it directly. | ||
|
||
using ShopifySharp.Credentials; | ||
|
||
namespace ShopifySharp.Factories; | ||
|
||
public interface IProductServiceFactory | ||
{ | ||
/// Creates a new instance of the <see cref="IProductService" /> 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> | ||
IProductService Create(string shopDomain, string accessToken); | ||
|
||
/// Creates a new instance of the <see cref="IProductService" /> with the given credentials. | ||
/// <param name="credentials">Credentials for authenticating with the Shopify API.</param> | ||
IProductService Create(ShopifyApiCredentials credentials); | ||
} | ||
|
||
public class ProductServiceFactory(IRequestExecutionPolicy? requestExecutionPolicy = null) : IProductServiceFactory | ||
{ | ||
/// <inheritDoc /> | ||
public virtual IProductService Create(string shopDomain, string accessToken) | ||
{ | ||
var service = new ProductService(shopDomain, accessToken); | ||
|
||
if (requestExecutionPolicy is not null) | ||
{ | ||
service.SetExecutionPolicy(requestExecutionPolicy); | ||
} | ||
|
||
return service; | ||
} | ||
|
||
/// <inheritDoc /> | ||
public virtual IProductService Create(ShopifyApiCredentials credentials) => | ||
Create(credentials.ShopDomain, credentials.AccessToken); | ||
} |