Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
josephlugo committed Nov 14, 2024
2 parents 0f6a45c + 0d2f027 commit 2df9f2a
Show file tree
Hide file tree
Showing 656 changed files with 36,293 additions and 384 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 7 additions & 1 deletion BigCommerceNET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BigCommerceNET", "BigCommerceNET\BigCommerceNET.csproj", "{9D10C335-98F3-4487-BC09-FBB6A01709AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "TestProject\TestProject.csproj", "{358C2241-CA89-4035-88EE-7649C66C7AFC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestProject", "TestProject\TestProject.csproj", "{358C2241-CA89-4035-88EE-7649C66C7AFC}"
EndProject
Project("{7CF6DF6D-3B04-46F8-A40B-537D21BCA0B4}") = "Documentation", "Documentation\Documentation.shfbproj", "{0345FBFC-1627-4EB7-9AA3-039702C5F0D2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -21,6 +23,10 @@ Global
{358C2241-CA89-4035-88EE-7649C66C7AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{358C2241-CA89-4035-88EE-7649C66C7AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{358C2241-CA89-4035-88EE-7649C66C7AFC}.Release|Any CPU.Build.0 = Release|Any CPU
{0345FBFC-1627-4EB7-9AA3-039702C5F0D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0345FBFC-1627-4EB7-9AA3-039702C5F0D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0345FBFC-1627-4EB7-9AA3-039702C5F0D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0345FBFC-1627-4EB7-9AA3-039702C5F0D2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 12 additions & 2 deletions BigCommerceNET/BigCommerceBaseCategoriesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@

namespace BigCommerceNET
{
/// <summary>
/// The big commerce base categories service.
/// </summary>
abstract class BigCommerceBaseCategoriesService : BigCommerceServiceBase
{
protected readonly WebRequestServices? _webRequestServices;
/// <summary>
/// The web request services.
/// </summary>
protected readonly WebRequestServices? _webRequestServices;

public BigCommerceBaseCategoriesService( WebRequestServices services )
/// <summary>
/// Initializes a new instance of the <see cref="BigCommerceBaseCategoriesService"/> class.
/// </summary>
/// <param name="services">The services.</param>
public BigCommerceBaseCategoriesService( WebRequestServices services )
{
if (services is not null)
{
Expand Down
84 changes: 73 additions & 11 deletions BigCommerceNET/BigCommerceBaseProductsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@
using BigCommerceNET.Models.Product;
using BigCommerceNET.Services;
using Netco.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace BigCommerceNET
{
abstract class BigCommerceBaseProductsService : BigCommerceServiceBase
/// <summary>
/// The big commerce base products service.
/// </summary>
abstract class BigCommerceBaseProductsService : BigCommerceServiceBase
{
protected readonly WebRequestServices _webRequestServices;

public BigCommerceBaseProductsService(WebRequestServices services)
/// <summary>
/// The web request services.
/// </summary>
protected readonly WebRequestServices _webRequestServices;

/// <summary>
/// Initializes a new instance of the <see cref="BigCommerceBaseProductsService"/> class.
/// </summary>
/// <param name="services">The services.</param>
public BigCommerceBaseProductsService(WebRequestServices services)
{
if (services is not null)
{
Expand All @@ -26,6 +31,11 @@ public BigCommerceBaseProductsService(WebRequestServices services)
throw new ArgumentException("The 'services' parameter is missing or empty.");
}

/// <summary>
/// Fill weight unit.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="marker">The marker.</param>
protected virtual void FillWeightUnit(IEnumerable<BigCommerceProduct> products, string marker)
{
var command = BigCommerceCommand.GetStoreV2_OAuth;
Expand All @@ -40,6 +50,13 @@ protected virtual void FillWeightUnit(IEnumerable<BigCommerceProduct> products,
}


/// <summary>
/// Fill weight unit asynchronously.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="token">The token.</param>
/// <param name="marker">The marker.</param>
/// <returns>A Task.</returns>
protected virtual async Task FillWeightUnitAsync(IEnumerable<BigCommerceProduct> products, CancellationToken token, string marker)
{
var command = BigCommerceCommand.GetStoreV2_OAuth;
Expand All @@ -53,6 +70,11 @@ protected virtual async Task FillWeightUnitAsync(IEnumerable<BigCommerceProduct>
}
}

/// <summary>
/// Fill brands.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="marker">The marker.</param>
protected virtual void FillBrands(IEnumerable<BigCommerceProduct> products, string marker)
{
var brands = new List<BigCommerceBrand>();
Expand All @@ -74,6 +96,13 @@ protected virtual void FillBrands(IEnumerable<BigCommerceProduct> products, stri
this.FillBrandsForProducts(products, brands);
}

/// <summary>
/// Fill brands asynchronously.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="token">The token.</param>
/// <param name="marker">The marker.</param>
/// <returns>A Task.</returns>
protected virtual async Task FillBrandsAsync(IEnumerable<BigCommerceProduct> products, CancellationToken token, string marker)
{
var brands = new List<BigCommerceBrand>();
Expand All @@ -95,6 +124,11 @@ protected virtual async Task FillBrandsAsync(IEnumerable<BigCommerceProduct> pro
this.FillBrandsForProducts(products, brands);
}

/// <summary>
/// Fill products skus.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="marker">The marker.</param>
protected void FillProductsSkus(IEnumerable<BigCommerceProduct> products, string marker)
{
foreach (var product in products.Where(product => product.InventoryTracking.Equals(InventoryTrackingEnum.sku)))
Expand All @@ -115,6 +149,14 @@ protected void FillProductsSkus(IEnumerable<BigCommerceProduct> products, string
}
}

/// <summary>
/// Fill products skus asynchronously.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="isUnlimit">If true, is unlimit.</param>
/// <param name="token">The token.</param>
/// <param name="marker">The marker.</param>
/// <returns>A Task.</returns>
protected async Task FillProductsSkusAsync(IEnumerable<BigCommerceProduct> products, bool isUnlimit, CancellationToken token, string marker)
{
var threadCount = isUnlimit ? MaxThreadsCount : 1;
Expand All @@ -137,7 +179,12 @@ await skuProducts.DoInBatchAsync(threadCount, async product =>
});
}

protected void FillBrandsForProducts(IEnumerable<BigCommerceProduct> products, List<BigCommerceBrand> brands)
/// <summary>
/// Fill brands for products.
/// </summary>
/// <param name="products">The products.</param>
/// <param name="brands">The brands.</param>
protected void FillBrandsForProducts(IEnumerable<BigCommerceProduct> products, List<BigCommerceBrand> brands)
{
foreach (var product in products)
{
Expand All @@ -156,8 +203,13 @@ protected void FillBrandsForProducts(IEnumerable<BigCommerceProduct> products, L

product.BrandName = brand.Name;
}
}
}

/// <summary>
/// Get the store name.
/// </summary>
/// <param name="marker">The marker.</param>
/// <returns>A string.</returns>
protected virtual string GetStoreName(string marker)
{
var command = BigCommerceCommand.GetStoreV2_OAuth;
Expand All @@ -169,6 +221,11 @@ protected virtual string GetStoreName(string marker)

}

/// <summary>
/// Gets the domain.
/// </summary>
/// <param name="marker">The marker.</param>
/// <returns>A string.</returns>
protected virtual string GetDomain(string marker)
{
var command = BigCommerceCommand.GetStoreV2_OAuth;
Expand All @@ -179,6 +236,11 @@ protected virtual string GetDomain(string marker)
return store.Response.Domain!;
}

/// <summary>
/// Gets the secure URL.
/// </summary>
/// <param name="marker">The marker.</param>
/// <returns>A string.</returns>
protected virtual string GetSecureURL(string marker)
{
var command = BigCommerceCommand.GetStoreV2_OAuth;
Expand Down
20 changes: 18 additions & 2 deletions BigCommerceNET/BigCommerceCategoriesServiceV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@

namespace BigCommerceNET
{
/// <summary>
/// The big commerce categories service v3.
/// </summary>
sealed class BigCommerceCategoriesServiceV3 : BigCommerceBaseCategoriesService, IBigCommerceCategoriesService
{

public BigCommerceCategoriesServiceV3( WebRequestServices services ) : base( services )

/// <summary>
/// Initializes a new instance of the <see cref="BigCommerceCategoriesServiceV3"/> class.
/// </summary>
/// <param name="services">The services.</param>
public BigCommerceCategoriesServiceV3( WebRequestServices services ) : base( services )
{
}

#region Get

/// <summary>
/// Gets the categories.
/// </summary>
/// <returns><![CDATA[A List<BigCommerceCategory>.]]></returns>
public List<BigCommerceCategory> GetCategories()
{
var categories = new List<BigCommerceCategory>();
Expand Down Expand Up @@ -67,6 +78,11 @@ public List<BigCommerceCategory> GetCategories()
return categories;
}

/// <summary>
/// Gets the categories asynchronously.
/// </summary>
/// <param name="token">The token.</param>
/// <returns><![CDATA[A Task<List<BigCommerceCategory>>.]]></returns>
public async Task<List<BigCommerceCategory>> GetCategoriesAsync(CancellationToken token)
{
var categories = new List<BigCommerceCategory>();
Expand Down
52 changes: 44 additions & 8 deletions BigCommerceNET/BigCommerceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,52 @@

namespace BigCommerceNET
{
public interface IBigCommerceFactory
/// <summary>
/// The big commerce factory interface.
/// </summary>
public interface IBigCommerceFactory
{
IBigCommerceOrdersService CreateOrdersService( BigCommerceConfig config );
IBigCommerceProductsService CreateProductsService( BigCommerceConfig config );
IBigCommerceCategoriesService CreateCategoriesService(BigCommerceConfig config);
/// <summary>
/// Creates the orders service.
/// </summary>
/// <param name="config">The config.</param>
/// <returns>An IBigCommerceOrdersService.</returns>
IBigCommerceOrdersService CreateOrdersService( BigCommerceConfig config );
/// <summary>
/// Creates the products service.
/// </summary>
/// <param name="config">The config.</param>
/// <returns>An IBigCommerceProductsService.</returns>
IBigCommerceProductsService CreateProductsService( BigCommerceConfig config );
/// <summary>
/// Creates the categories service.
/// </summary>
/// <param name="config">The config.</param>
/// <returns>An IBigCommerceCategoriesService.</returns>
IBigCommerceCategoriesService CreateCategoriesService(BigCommerceConfig config);
}

public sealed class BigCommerceFactory : IBigCommerceFactory
/// <summary>
/// The big commerce factory.
/// </summary>
public sealed class BigCommerceFactory : IBigCommerceFactory
{
public IBigCommerceOrdersService CreateOrdersService( BigCommerceConfig config )
/// <summary>
/// Creates the orders service.
/// </summary>
/// <param name="config">The config.</param>
/// <returns>An IBigCommerceOrdersService.</returns>
public IBigCommerceOrdersService CreateOrdersService( BigCommerceConfig config )
{
return new BigCommerceOrdersService( config );
}

public IBigCommerceCategoriesService CreateCategoriesService(BigCommerceConfig config)
/// <summary>
/// Creates the categories service.
/// </summary>
/// <param name="config">The config.</param>
/// <returns>An IBigCommerceCategoriesService.</returns>
public IBigCommerceCategoriesService CreateCategoriesService(BigCommerceConfig config)
{
var apiVersion = config.GetAPIVersion();
var marker = Guid.NewGuid().ToString();
Expand All @@ -27,7 +58,12 @@ public IBigCommerceCategoriesService CreateCategoriesService(BigCommerceConfig c
return new BigCommerceCategoriesServiceV3(services);
}

public IBigCommerceProductsService CreateProductsService( BigCommerceConfig config )
/// <summary>
/// Creates the products service.
/// </summary>
/// <param name="config">The config.</param>
/// <returns>An IBigCommerceProductsService.</returns>
public IBigCommerceProductsService CreateProductsService( BigCommerceConfig config )
{
var apiVersion = config.GetAPIVersion();
var marker = Guid.NewGuid().ToString();
Expand Down
2 changes: 2 additions & 0 deletions BigCommerceNET/BigCommerceNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<Version>0.11.3</Version>
<Company>ON INITIATIVE LLC</Company>
<Authors>ON INITIATIVE LLC</Authors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>C:\Users\jalug\source\repos\BigCommerceNET\BigCommerceNET\bin\Debug\net8.0\BigCommerceNET.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 2df9f2a

Please sign in to comment.