private static TResponse Get <TResponse>(string url, string accessToken, string clientSecret, IHtmlScraper scraper = null) where TResponse : ResponseBase, new() { if (scraper.IsNull()) { scraper = new HtmlScraper(); } RequestHelper.MakeGetRequest(url, accessToken, clientSecret, scraper); var response = scraper.LastContent; var deserialized = Deserialize <TResponse>(response); return(deserialized); }
private static string MakeRequest(string url, string postdata, string accessToken, string clientSecret, IHtmlScraper scraper) { var headers = new List <Header> { new Header { HeaderName = Constants.FortnoxConstants.ACCESS_TOKEN, HeaderValue = accessToken }, new Header { HeaderName = Constants.FortnoxConstants.CLIENT_SECRET, HeaderValue = clientSecret } }; return(scraper.PerformRequest(url, postdata, null, Constants.FortnoxConstants.CONTENT_TYPE, Constants.FortnoxConstants.ACCEPT, headers)); }
public static Account GetAccount(string accessToken, string clientSecret, string number, IHtmlScraper scraper = null) { var url = UrlHelper.GetAccount(number); return(Get <Account>(url, accessToken, clientSecret, scraper)); }
public static Accounts GetAllAccounts(string accessToken, string clientSecret, IHtmlScraper scraper = null) { var url = UrlHelper.GetAllAccounts(); return(Get <Accounts>(url, accessToken, clientSecret, scraper)); }
public static string MakeGetRequest(string url, string accessToken, string clientSecret, IHtmlScraper scraper) { return(MakeRequest(url, null, accessToken, clientSecret, scraper)); }
public static string MakePostRequest(string url, string postdata, string accessToken, string clientSecret, IHtmlScraper scraper) { return(MakeRequest(url, postdata, accessToken, clientSecret, scraper)); }
public CelebRepository() { _htmlRepository = new HtmlScraper(); _serilizeJsonFile = new SerilizeJsonFile(); }