Browse Source

Add ApiFactory option for custom refit settings

pull/495/head
Ionite 9 months ago
parent
commit
942013673a
No known key found for this signature in database
  1. 8
      StabilityMatrix.Core/Api/ApiFactory.cs
  2. 6
      StabilityMatrix.Core/Api/IApiFactory.cs

8
StabilityMatrix.Core/Api/ApiFactory.cs

@ -18,4 +18,12 @@ public class ApiFactory : IApiFactory
httpClient.BaseAddress = baseAddress;
return RestService.For<T>(httpClient, RefitSettings);
}
public T CreateRefitClient<T>(Uri baseAddress, RefitSettings refitSettings)
{
var httpClient = httpClientFactory.CreateClient(nameof(T));
httpClient.BaseAddress = baseAddress;
return RestService.For<T>(httpClient, refitSettings);
}
}

6
StabilityMatrix.Core/Api/IApiFactory.cs

@ -1,6 +1,10 @@
namespace StabilityMatrix.Core.Api;
using Refit;
namespace StabilityMatrix.Core.Api;
public interface IApiFactory
{
public T CreateRefitClient<T>(Uri baseAddress);
public T CreateRefitClient<T>(Uri baseAddress, RefitSettings refitSettings);
}

Loading…
Cancel
Save