public IOmbiService CreateGlobal(OmbiOptions options = null) { var client = new HttpClient(); var service = RestService.For <IOmbiService>(client); options = options ?? _options.Value; if (options.BaseUrl.IsNullOrEmpty() || options.ApiKey.IsNullOrEmpty()) { return(service); } client.BaseAddress = new Uri(_options.Value.BaseUrl); client.DefaultRequestHeaders.Add("ApiKey", _options.Value.ApiKey); return(service); }
public IBotOmbiService CreateForBot(OmbiOptions options = null) { var client = new HttpClient(); var service = RestService.For <IBotOmbiService>(client); options = options ?? _options.Value; var botUser = _context.BotUsers.FirstOrDefault(x => x.TelegramId == _capture.Data.Chat.Id); if (botUser == null || options.BaseUrl.IsNullOrEmpty() || options.ApiKey.IsNullOrEmpty()) { return(service); } client.BaseAddress = new Uri(options.BaseUrl); client.DefaultRequestHeaders.Add("ApiKey", options.ApiKey); client.DefaultRequestHeaders.Add("UserName", "Francis"); return(service); }
public async Task <AboutOmbi> UpdateOmbiOptions(OmbiOptions options) { _updater.Save(options); return(await _ombi.CreateGlobal(options).About()); }