workaround for getpurchases api call
This commit is contained in:
parent
5511f8ed32
commit
29344451d6
|
@ -2,6 +2,7 @@
|
||||||
using Core;
|
using Core;
|
||||||
using KubernetesWorkflow;
|
using KubernetesWorkflow;
|
||||||
using KubernetesWorkflow.Types;
|
using KubernetesWorkflow.Types;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Utils;
|
using Utils;
|
||||||
|
|
||||||
namespace CodexPlugin
|
namespace CodexPlugin
|
||||||
|
@ -90,7 +91,16 @@ namespace CodexPlugin
|
||||||
|
|
||||||
public StoragePurchase GetPurchaseStatus(string purchaseId)
|
public StoragePurchase GetPurchaseStatus(string purchaseId)
|
||||||
{
|
{
|
||||||
return mapper.Map(OnCodex(api => api.GetPurchaseAsync(purchaseId)));
|
var endpoint = GetEndpoint();
|
||||||
|
return Time.Retry(() =>
|
||||||
|
{
|
||||||
|
var str = endpoint.HttpGetString($"storage/purchases/{purchaseId}");
|
||||||
|
if (string.IsNullOrEmpty(str)) throw new Exception("Empty response.");
|
||||||
|
return JsonConvert.DeserializeObject<StoragePurchase>(str)!;
|
||||||
|
}, nameof(GetPurchaseStatus));
|
||||||
|
|
||||||
|
// TODO: current getpurchase api does not line up with its openapi spec.
|
||||||
|
// return mapper.Map(OnCodex(api => api.GetPurchaseAsync(purchaseId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetName()
|
public string GetName()
|
||||||
|
|
Loading…
Reference in New Issue