internal static WebApisDocLinksResponse GetEuDocLinks(String domain, int limit, String celex, String toPar) { var url = $"{webapisdomain}/euLinksChecker.php?&limit={limit}&celex={celex}&domain={domain}&toPar={toPar}"; try { var responseContentJson = GetAsString(url); var deserilizedResponseContent = JsonConvert.DeserializeObject <link_wrapper_json_friendly>(responseContentJson); var linksResult = deserilizedResponseContent .links .Select(x => new WebApisDocumentLink( title: x.title, officialUrl: $"{webapisdomain}/{x.doc_url}", publisher: String.Empty, uniqueId: x.unique_id, domain: x.domainIs)); var result = new WebApisDocLinksResponse { All_Url = $"{webapisdomain}/{deserilizedResponseContent.all_url}", Full_Count = deserilizedResponseContent.full_count, Links = new List <DocumentLink>(linksResult), Caption = deserilizedResponseContent.doc_caption ?? String.Empty, }; return(result); } catch (Exception e) { // TOOD: log return(null); } }
internal static WebApisDocLinksResponse SearchByText(String domain, String text, int limit) { try { // http://87.121.111.213/euLinksChecker.php?search=1&limit=2&searchText=вносители var url = $"{WebApisRequest.webapisdomain}/euLinksChecker.php?search=1&limit={limit}&searchText={System.Net.WebUtility.UrlEncode(text)}&domain={domain}"; var responseContentJson = GetAsString(url); var deserilizedResponseContent = JsonConvert.DeserializeObject <link_wrapper_json_friendly>(responseContentJson); var linksResult = deserilizedResponseContent .links .Select(x => new WebApisDocumentLink(title: x.title, officialUrl: $"{webapisdomain}/{x.doc_url}", publisher: String.Empty, uniqueId: x.unique_id, domain: x.domainIs)); var result = new WebApisDocLinksResponse { All_Url = $"{webapisdomain}/{deserilizedResponseContent.all_url}", Full_Count = deserilizedResponseContent.full_count, Links = new List <DocumentLink>(linksResult) }; return(result); } catch (Exception e) { // TODO: log return(null); } }