internal static string GetRelatedUri <T>(string id) { RelatedContentOption action; switch (typeof(T).Name) { case nameof(QuestionDetailPageViewModel): { action = RelatedContentOption.Question; break; } case nameof(EssayDetailPageViewModel): { action = RelatedContentOption.Essay; break; } case nameof(SerialDetailPageViewModel): { action = RelatedContentOption.Serial; break; } default: { action = RelatedContentOption.Question; break; } } return(string.Format(ServicesUrl.GetRelatedContent(action), id)); }
public ProductClient(IOptions <ServicesUrl> servicesUrl, IDiscoveryClient discoveryClient) { _servicesUrl = servicesUrl.Value; var handler = new DiscoveryHttpClientHandler(discoveryClient); handler.ServerCertificateCustomValidationCallback = delegate { return(true); }; var httpClient = new HttpClient(handler, false) { BaseAddress = new Uri(_servicesUrl.ProductApiUrl) }; client = RestClient.For <IProductClient>(httpClient); }