public async Task <string> DownloadAndExtractAsync() { var req = RequestEngine.CreateClient(_AccessConfig); var gzipFilePath = await RequestEngine.DownloadFileAsync(req, XmlFileUrl, _AccessConfig.DownloadDirectory); var unzipFilePath = await GZipUtils.DecompressAsync(new FileInfo(gzipFilePath)); return(unzipFilePath); }
public async Task <IceCatProduct> GetAsync(long productId) { var req = RequestEngine.CreateClient(_AccessConfig); var productXmlUrl = BuildXmlFileUrl($"{productId}.xml"); var productXml = await RequestEngine.GetAsStringAsync(req, productXmlUrl); return(CustomXmlParser.Parse <IceCatProduct>(productXml, "Product")); }
protected virtual TEntity MakeRequest <TEntity>(string path, Method method, string rootElement = null, object payload = null, List <Parameter> parameters = null) { var request = CreateRestRequest(path, method, rootElement, payload, parameters); var client = RequestEngine.CreateClient(_AccessInfo); var response = RequestEngine.ExecuteRequest <TEntity>(client, request); return(response); }
public async Task <string> DownloadAsync(string xmlUrlPath, string saveFilePath = null) { var req = RequestEngine.CreateClient(_AccessConfig); if (string.IsNullOrEmpty(saveFilePath)) { saveFilePath = _AccessConfig.DownloadDirectory + xmlUrlPath.Split('/').Last(); } return(await RequestEngine.DownloadFileAsync(req, xmlUrlPath, saveFilePath)); }
public async Task <string> GetAsync(string xmlUrlPath, string nodeName = null) { var req = RequestEngine.CreateClient(_AccessConfig); var xmlBody = await RequestEngine.GetAsStringAsync(req, xmlUrlPath); if (string.IsNullOrEmpty(nodeName)) { return(xmlBody); } return(await CustomXmlParser.ParseAsync(nodeName, xmlBody)); }
public async Task <string> DownloadAndExtractAsync(string xmlUrlPath, string saveFilePath = null) { var req = RequestEngine.CreateClient(_AccessConfig); var saveDirectoryPath = _AccessConfig.DownloadDirectory; if (!string.IsNullOrEmpty(saveFilePath)) { saveDirectoryPath = Path.GetDirectoryName(saveFilePath); } var gzipFilePath = await RequestEngine.DownloadFileToDirectoryAsync(req, xmlUrlPath, saveDirectoryPath); var unzipFilePath = await GZipUtils.DecompressAsync(new FileInfo(gzipFilePath), saveFilePath); return(unzipFilePath); }
protected BaseService(IceCatAccessConfig config) { _AccessConfig = config; _Client = RequestEngine.CreateClient(config); }
/// <summary> /// Creates a new instance of <see cref="ConvertKitService" />. /// </summary> /// <param name="apiKey">The API or secret key for the ConvertKit account.</param> protected ConvertKitService(string apiKey) { _RestClient = RequestEngine.CreateClient(apiKey); }