HotlineYbEnterpriseStartupExtensions.cs 699 B

123456789101112131415161718192021
  1. using Hotline.Ai.Quality;
  2. using Microsoft.Extensions.DependencyInjection;
  3. using Hotline.Enterprise;
  4. using Hotline.YbEnterprise.Sdk;
  5. namespace Hotline.Api.Sdk
  6. {
  7. public static class HotlineYbEnterpriseStartupExtensions
  8. {
  9. public static IServiceCollection AddYbEnterpriseSdk(this IServiceCollection services, string? baseAddress)
  10. {
  11. services.AddScoped<IEnterpriseService, EnterpriseService>();
  12. if (!string.IsNullOrEmpty(baseAddress))
  13. services.AddHttpClient(YbEnterpriseDefaults.HttpName, d =>
  14. {
  15. d.BaseAddress = new Uri(baseAddress);
  16. });
  17. return services;
  18. }
  19. }
  20. }