-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference | ||
Include="..\..\..\src\Marketplaces\Integration.Marketplaces.Hepsiburada\Integration.Marketplaces.Hepsiburada.csproj" /> | ||
</ItemGroup> | ||
|
||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var hepsiburadaProductIntegration = new HepsiburadaProductIntegration( | ||
username: "username", | ||
password: "password", | ||
isInProduction: false); | ||
|
||
//Get All Categories | ||
var categories = await hepsiburadaProductIntegration.GetCategoriesAsync(); | ||
|
||
//Get Category Attributes | ||
var categoryAttributes = await hepsiburadaProductIntegration.GetCategoryAttributesAsync(categoryId: 80844002); | ||
|
||
// Get Category Attribute Values | ||
var categoryAttributeValues = await hepsiburadaProductIntegration.GetCategoryAttributeValuesAsync(categoryId: 80844002, attributeId: "gram"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
using Integration.Core; | ||
using Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration; | ||
using Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration.Models.Response; | ||
using Integration.Marketplaces.Trendyol.Infrastructure; | ||
|
||
public class HepsiburadaProductIntegration : HepsiburadaIntegrationBase, IHepsiburadaProductIntegration, IMarketplaceIntegration | ||
{ | ||
private string GetCategoriesUrl() => $"{GetBaseUrl}product/api/categories/get-all-categories"; | ||
private string GetCategoryAttributesUrl(int categoryId) => $"{GetBaseUrl}product/api/categories/{categoryId}/attributes"; | ||
private string GetCategoryAttributeValueUrl(int categoryId, string attributeId) => $"{GetBaseUrl}product/api/categories/{categoryId}/attribute/{attributeId}/v"; | ||
|
||
public HepsiburadaProductIntegration(string username, string password, bool isInProduction = true) : base(username, password, isInProduction) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
/// <returns><inheritdoc/></returns> | ||
public async Task<GetCategoriesResponseModel> GetCategoriesAsync() | ||
{ | ||
return await InvokeRequestAsync<GetCategoriesResponseModel>((client) => client.GetAsync(GetCategoriesUrl())); | ||
} | ||
|
||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
/// <param name="categoryId"><inheritdoc/></param> | ||
/// <returns><inheritdoc/></returns> | ||
public async Task<GetCategoryAttributesResponseModel> GetCategoryAttributesAsync(int categoryId) | ||
{ | ||
return await InvokeRequestAsync<GetCategoryAttributesResponseModel>((client) => client.GetAsync(GetCategoryAttributesUrl(categoryId))); | ||
} | ||
|
||
/// <summary> | ||
/// <inheritdoc/> | ||
/// </summary> | ||
/// <param name="categoryId"><inheritdoc/></param> | ||
/// <param name="attributeId"><inheritdoc/></param> | ||
/// <returns><inheritdoc/></returns> | ||
public async Task<GetCategoryAttributeValuesResponseModel> GetCategoryAttributeValuesAsync(int categoryId, string attributeId) | ||
{ | ||
return await InvokeRequestAsync<GetCategoryAttributeValuesResponseModel>((client) => client.GetAsync(GetCategoryAttributeValueUrl(categoryId, attributeId))); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
using Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration.Models.Response; | ||
|
||
namespace Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration; | ||
public interface IHepsiburadaProductIntegration | ||
{ | ||
/// <summary> | ||
/// Bu metod ile Hepsiburada kategorileri bilgilerini alabilirsiniz. | ||
/// </summary> | ||
/// <returns><see cref="GetCategoriesResponseModel"/></returns> | ||
public Task<GetCategoriesResponseModel> GetCategoriesAsync(); | ||
|
||
/// <summary> | ||
/// Bu metod ile Hepsiburada’ daki uç kategorilerin özellik bilgilerini alabilirsiniz. | ||
/// Kategori özellikleri, sadece ‘leaf’ ve ‘available’ değerleri ‘true’ olan kategorilerde mevcuttur. | ||
/// </summary> | ||
/// <returns><see cref="GetCategoryAttributesResponseModel"/></returns> | ||
public Task<GetCategoryAttributesResponseModel> GetCategoryAttributesAsync(int categoryId); | ||
|
||
/// <summary> | ||
/// Bu metod ile ‘type’ alanı değeri ‘enum’ olan özellikler için kullanılabilecek değerleri alabilirsiniz. | ||
/// </summary> | ||
/// <param name="categoryId">Category id</param> | ||
/// <param name="attributeId">Attribute id</param> | ||
/// <returns><see cref="GetCategoryAttributeValuesResponseModel"/></returns> | ||
public Task<GetCategoryAttributeValuesResponseModel> GetCategoryAttributeValuesAsync(int categoryId, string attributeId); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Integration.Core; | ||
|
||
namespace Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration.Models.Response; | ||
|
||
public class GetCategoriesResponseModel : HepsiburadaBaseResponseModel | ||
{ | ||
public List<GetCategoryResponseModel> Data { get; set; } | ||
Check warning on line 7 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
} | ||
|
||
public class GetCategoryResponseModel : IResponseModel | ||
{ | ||
public int CategoryId { get; set; } | ||
public string Name { get; set; } | ||
Check warning on line 13 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
public string DisplayName { get; set; } | ||
Check warning on line 14 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
public int ParentCategoryId { get; set; } | ||
public List<string> Paths { get; set; } | ||
Check warning on line 16 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
public bool Leaf { get; set; } | ||
public string Status { get; set; } | ||
Check warning on line 18 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
public string Type { get; set; } | ||
Check warning on line 19 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
public string SortId { get; set; } | ||
public bool Available { get; set; } | ||
public List<GetCategoryProductTypeResponseModel> ProductTypes { get; set; } | ||
public bool Merge { get; set; } | ||
} | ||
|
||
public class GetCategoryProductTypeResponseModel : IResponseModel | ||
{ | ||
public string Name { get; set; } | ||
Check warning on line 28 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoriesResponseModel.cs GitHub Actions / Build Lib
|
||
public int ProductTypeId { get; set; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Integration.Core; | ||
|
||
namespace Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration.Models.Response; | ||
|
||
public class GetCategoryAttributeValuesResponseModel : HepsiburadaBaseResponseModel | ||
{ | ||
public List<GetCategoryAttributeValueResponseModel> Data { get; set; } | ||
} | ||
|
||
public class GetCategoryAttributeValueResponseModel : IResponseModel | ||
{ | ||
public string Value { get; set; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Integration.Core; | ||
|
||
namespace Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration.Models.Response; | ||
|
||
public class GetCategoryAttributesResponseModel : HepsiburadaBaseResponseModel | ||
{ | ||
public List<GetCategoryAttributesMappingResponseModel> Data { get; set; } | ||
Check warning on line 7 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/GetCategoryAttributesResponseModel.cs GitHub Actions / Build Lib
|
||
} | ||
|
||
public class GetCategoryAttributesMappingResponseModel : IResponseModel | ||
{ | ||
public List<GetCategoryAttributeResponseModel> BaseAttributes { get; set; } | ||
public List<GetCategoryAttributeResponseModel> Attributes { get; set; } | ||
public List<GetCategoryAttributeResponseModel> VariantAttributes { get; set; } | ||
} | ||
|
||
public class GetCategoryAttributeResponseModel : IResponseModel | ||
{ | ||
public string Id { get; set; } | ||
public string Name { get; set; } | ||
public bool Mandatory { get; set; } | ||
public string Type { get; set; } | ||
public bool MultiValue { get; set; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Integration.Core; | ||
|
||
namespace Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration.Models.Response; | ||
public class HepsiburadaBaseResponseModel : IResponseModel | ||
{ | ||
public bool Success { get; set; } | ||
public int Code { get; set; } | ||
public int Version { get; set; } | ||
public string Message { get; set; } | ||
Check warning on line 9 in src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/Models/Response/HepsiburadaBaseResponseModel.cs GitHub Actions / Build Lib
|
||
} |