public async Task <string> PreviewFile([FromBody] SearchData data) { var baseURI = $"{Configuration["DvelopInfos:BaseURL"]}"; var apiKey = $"{Configuration["DvelopInfos:API_Key"]}"; var repoId = $"{Configuration["DvelopInfos:repoId"]}"; string filePathRoot = $"{_env.WebRootPath}\\Data\\D3_Previews\\"; var sessionId = new DvelopAccessHandler().Authenticate(baseURI, apiKey); if (sessionId != null) { string downloadFile = ""; DocumentHandlers docHandler = new DocumentHandlers(); string getDocumentInfo = await docHandler.GetDocumentInfo(baseURI, sessionId, repoId, data.query); if (getDocumentInfo != "") { downloadFile = await docHandler.DownloadDocument(baseURI, sessionId, repoId, getDocumentInfo, filePathRoot); //data.query //DeleteDocumentInTimer(filePathRoot); } return(downloadFile); } return(String.Empty); }
public string runUpload(string uploadFile, string uploadMappingFile) { ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; var result = ""; var baseURI = $"{Configuration["DvelopInfos:BaseURL"]}"; var apiKey = $"{Configuration["DvelopInfos:API_Key"]}"; var repoId = $"{Configuration["DvelopInfos:repoId"]}"; var sessionId = new DvelopAccessHandler().Authenticate(baseURI, apiKey); if (null != sessionId) { try { var documentLink = new FileHandlers(Configuration).UploadFile(baseURI, sessionId, repoId, uploadFile, uploadMappingFile).Result; result = documentLink; } catch (Exception ex) { result = "Couldn't upload the file to D3"; Console.WriteLine(ex); } } else { result = "D3 sessionId error"; } return(result); }
public async Task <string> searchForDocument([FromBody] SearchData data) { var baseURI = $"{Configuration["DvelopInfos:BaseURL"]}"; var apiKey = $"{Configuration["DvelopInfos:API_Key"]}"; var repoId = $"{Configuration["DvelopInfos:repoId"]}"; var sessionId = new DvelopAccessHandler().Authenticate(baseURI, apiKey); if (sessionId != null) { var newData = await new DocumentHandlers().SearchDocument(baseURI, sessionId, repoId, data.query); //data.query return(newData); } return(String.Empty); }