//configure /// <summary> /// configure app & feeds from config.json /// </summary> public static void Configure(IConfiguration cfg) { //app daysToShow = Int32.Parse(cfg.Get("app:days_to_show") ?? "0"); //feeds //todo make this more robust //hack in feeds:0 as twitter var fcfg = cfg.GetConfigurationSection("feeds:0"); var ocfg = fcfg.GetConfigurationSection("oauth"); //create OAuthTokenProvider var token = new OAuthAppTokenProvider(ocfg.Get("key"), ocfg.Get("secret"), ocfg.Get("app_token_url"), Int32.Parse(ocfg.Get("cache_for_min") ?? "0")); //create feed services var fiService = new TwitterFeedItemService(new OAuthRequestData(token)); var aService = new AccountFeedService(fiService); //create twitter feed object and save twitterFeed = new Feed("twitter", fcfg.Get("default_account"), fcfg.GetArray("default_accounts"), fiService, aService); }
/// <summary> /// configure this OAuth ApiClient to use the given token provider /// </summary> public OAuthRequestData(OAuthAppTokenProvider tokenProvider) { this.tokenProvider = tokenProvider; _client = new HttpClient(); }