using System;
using System.Threading.Tasks;
using RestSharp;
using System.Collections.Generic;
public static async Task> GetProductVariantsAsync(long customerId, long configuratorRawMaterialId)
{
var client = new RestClient("https://apim-fe-staging.tailoor.com");
var request = new RestRequest($"/api-catalog/v2/customers/{customerId}/products/{configuratorRawMaterialId}/variants", Method.Get);
var currentToken = "token-recuperato-dalla-login";
request.AddHeader("Authorization", $"Bearer {currentToken}");
try
{
var response = await client.ExecuteAsync>(request);
if (response.IsSuccessful)
{
return response.Data;
}
else
{
Console.WriteLine($"Error: {response.StatusCode} - {response.ErrorMessage}");
return null;
}
}
catch (Exception ex)
{
Console.WriteLine($"Exception: {ex.Message}");
return null;
}
}
public class ProductVariant
{
public long Id { get; set; }
public long ParentProductId { get; set; }
public string Sku { get; set; }
public bool IsActive { get; set; }
public int WarehouseQuantity { get; set; }
}