public AsposeResponse PostImportMarkdownToHtml(Stream inStream, string outPath, string storage = null)
        {
            var methodName = "PostImportMarkdownToHtml";

            // verify the required parameter 'inStream' is set
            if (inStream == null)
            {
                throw new ApiException(400, $"Missing required parameter 'inStream' when calling {methodName}");
            }
            // verify the required parameter 'outPath' is set
            if (outPath == null)
            {
                throw new ApiException(400, $"Missing required parameter 'outPath' when calling {methodName}");
            }

            var path = "/html/import/md";

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("outPath", ApiClientUtils.ParameterToString(outPath)); // required query parameter

            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            var response = CallPostApi(path, queryParams, headerParams, inStream, methodName);

            return(response);
        }
        public AsposeResponse PutImportMarkdownToHtml(string name, string outPath, string folder = null, string storage = null)
        {
            var methodName = "PutImportMarkdownToHtml";

            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new ApiException(400, $"Missing required parameter 'name' when calling {methodName}");
            }

            var path         = $"/html/{name}/import/md";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("outPath", ApiClientUtils.ParameterToString(outPath)); // required query parameter

            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            var response = CallPutApi(path, queryParams, headerParams, null, methodName);

            return(response);
        }
        /// <summary>
        /// Return the HTML document by the name from default or specified storage.
        /// </summary>
        /// <param name="name">The document name.</param>
        /// <param name="storage">The document folder</param>
        /// <param name="folder">The document folder.</param>
        /// <returns>System.IO.Stream | Stream containing the requested document</returns>
        public Stream GetDocument(string name, string storage, string folder)
        {
            var methodName = "GetDocument";

            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling GetDocument");
            }


            var path = "/html/{name}";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "name" + "}", ApiClientUtils.ParameterToString(name));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] {  };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
        public AsposeResponse DeleteFolder(string path, string storage = null, bool recursive = false)
        {
            var methodName = "DeleteFolder";

            // verify the required parameter 'path' is set
            if (path == null)
            {
                throw new ApiException(400, $"Missing required parameter 'path' when calling {methodName}");
            }

            if (path.First <char>() == '/')
            {
                path = path.Substring(1, path.Length - 1);
            }
            var apiPath = $"/html/storage/folder/{path}";

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallDeleteApi(apiPath, queryParams, methodName);

            return(response);
        }
        public AsposeResponse UploadFile(Stream stream, string path, string storage = null)
        {
            var methodName = "UploadFile";

            // verify the required parameter 'path' is set
            if (path == null)
            {
                throw new ApiException(400, $"Missing required parameter 'path' when calling {methodName}");
            }
            // verify the required parameter 'stream' is set
            if (stream == null)
            {
                throw new ApiException(400, $"Missing required parameter 'stream' when calling {methodName}");
            }

            if (path.First <char>() == '/')
            {
                path = path.Substring(1, path.Length - 1);
            }
            var apiPath      = $"/html/storage/file/{path}";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storageName", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallPutApi(apiPath, queryParams, headerParams, stream, methodName);

            return(response);
        }
        public AsposeResponse DeleteFile(string path, string storage = null, string versionId = null)
        {
            var methodName = "DeleteFile";

            // verify the required parameter 'path' is set
            if (path == null)
            {
                throw new ApiException(400, $"Missing required parameter 'path' when calling {methodName}");
            }

            if (path.First <char>() == '/')
            {
                path = path.Substring(1, path.Length - 1);
            }
            var apiPath = $"/html/storage/file/{path}";

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storageName", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (versionId != null)
            {
                queryParams.Add("versionId", ApiClientUtils.ParameterToString(versionId));                    // query parameter
            }
            var response = CallDeleteApi(apiPath, queryParams, methodName);

            return(response);

            throw new NotImplementedException();
        }
Esempio n. 7
0
        /// <summary>
        /// Detect the keywords in the HTML document specified by its URL.
        /// </summary>
        /// <param name="sourceUrl"></param>
        /// <returns></returns>
        public Stream GetDetectHtmlKeywordsByUrl(string sourceUrl)
        {
            var methodName = "GetDetectHtmlKeywordsByUrl";

            // verify the required parameter 'sourceUrl' is set
            if (sourceUrl == null)
            {
                throw new ApiException(400, "Missing required parameter 'sourceUrl' when calling GetTranslateDocumentByUrl");
            }

            var path = "/html/summ/keywords";

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (sourceUrl != null)
            {
                queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(sourceUrl));                    // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
Esempio n. 8
0
        public DiscUsage GetDiscUsage(string storage = null)
        {
            var methodName = "GetDiscUsage";

            // verify the required parameter 'path' is set
            if (storage == null)
            {
                throw new ApiException(400, $"Missing required parameter 'storage' when calling {methodName}");
            }

            var apiPath      = $"/html/storage/disc";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storageName", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response    = CallGetApi(apiPath, queryParams, methodName);
            var jsonContent = response.ContentAsString;

            if (jsonContent != null)
            {
                DiscUsage res = JsonConvert.DeserializeObject <DiscUsage>(jsonContent);
                return(res);
            }
            return(null);
        }
Esempio n. 9
0
        public StreamResponse GetDocumentByUrl(string sourceUrl)
        {
            var methodName = "GetDocumentByUrl";

            // verify the required parameter 'name' is set
            if (sourceUrl == null)
            {
                throw new ApiException(400, $"Missing required parameter 'sourceUrl' when calling {methodName}");
            }
            var path         = "/html/download";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(sourceUrl)); // query parameter

            // authentication setting, if any
            String[] authSettings = new String[] { };

            var defTimeout = this.ApiClient.Timeout;

            this.ApiClient.Timeout = new TimeSpan(1, 0, 0); // long timeout for the site download API

            var response = CallGetApi(path, queryParams, methodName);

            this.ApiClient.Timeout = defTimeout;
            return(response);
        }
        /// <summary>
        /// Convert the HTML document to PDF.
        /// </summary>
        /// <param name="name">The source file name.</param>
        /// <param name="width">Resulting image width. </param>
        /// <param name="height">Resulting image height. </param>
        /// <param name="leftMargin">Left image margin.</param>
        /// <param name="rightMargin">Right image margin.</param>
        /// <param name="topMargin">Top image margin.</param>
        /// <param name="bottomMargin">Bottom image margin.</param>
        /// <param name="folder">The document folder.</param>
        /// <param name="storage">The document storage.</param>
        /// <returns>System.IO.Stream | Stream of the resulting PDF document.</returns>
        public Stream GetConvertDocumentToPdf(string name,
                                              int?width     = default(int?), int?height       = default(int?), int?leftMargin = default(int?), int?rightMargin = default(int?),
                                              int?topMargin = default(int?), int?bottomMargin = default(int?),
                                              string folder = null, string storage            = null)
        {
            var methodName = "GetConvertDocumentToPdf";

            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling GetConvertDocumentToPdf");
            }

            var path = "/html/{name}/convert/pdf";

            path = path.Replace("{" + "name" + "}", ApiClientUtils.ParameterToString(name));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (width != null)
            {
                queryParams.Add("width", ApiClientUtils.ParameterToString(width));                // query parameter
            }
            if (height != null)
            {
                queryParams.Add("height", ApiClientUtils.ParameterToString(height));                 // query parameter
            }
            if (leftMargin != null)
            {
                queryParams.Add("leftMargin", ApiClientUtils.ParameterToString(leftMargin));                     // query parameter
            }
            if (rightMargin != null)
            {
                queryParams.Add("rightMargin", ApiClientUtils.ParameterToString(rightMargin));                      // query parameter
            }
            if (topMargin != null)
            {
                queryParams.Add("topMargin", ApiClientUtils.ParameterToString(topMargin));                    // query parameter
            }
            if (bottomMargin != null)
            {
                queryParams.Add("bottomMargin", ApiClientUtils.ParameterToString(bottomMargin));                       // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
        /// <summary>
        /// Default constructor. Initalizes a new instance of an inherited class trying to get the user credentials
        /// (application SID and application key), REST API service URL and authentication service URL
        /// from the application configuration file and then, if it don't succeed, from environment variables.
        /// If needed settings were not found both in the config file or in the environment variables, throws an exception.
        /// </summary>
        protected internal ApiBase()
        {
            var clientId     = System.Configuration.ConfigurationManager.AppSettings["clientId"];
            var clientSecret = System.Configuration.ConfigurationManager.AppSettings["clientSecret"];
            var apiBaseUrl   = System.Configuration.ConfigurationManager.AppSettings["baseUrl"];
            var authUrl      = System.Configuration.ConfigurationManager.AppSettings["authUrl"];

            if (string.IsNullOrEmpty(clientId))
            {
                clientId = Environment.GetEnvironmentVariable("clientId");
                if (string.IsNullOrEmpty(clientId))
                {
                    clientId = Environment.GetEnvironmentVariable("client_id");
                }
                if (string.IsNullOrEmpty(clientId))
                {
                    throw new ArgumentException("\"clientId\" is required and isn't specified.");
                }
            }

            if (string.IsNullOrEmpty(clientSecret))
            {
                clientSecret = Environment.GetEnvironmentVariable("clientSecret");
                if (string.IsNullOrEmpty(clientSecret))
                {
                    clientSecret = Environment.GetEnvironmentVariable("client_secret");
                }
                if (string.IsNullOrEmpty(clientSecret))
                {
                    throw new ArgumentException("\"clientSecret\" is required and isn't specified.");
                }
            }

            if (string.IsNullOrEmpty(apiBaseUrl))
            {
                apiBaseUrl = Environment.GetEnvironmentVariable("baseUrl");
                if (string.IsNullOrEmpty(apiBaseUrl))
                {
                    apiBaseUrl = DefaultApiBaseUrl;
                }
            }

            if (string.IsNullOrEmpty(authUrl))
            {
                authUrl = Environment.GetEnvironmentVariable("authUrl");
                if (string.IsNullOrEmpty(authUrl))
                {
                    authUrl = DefaultApiBaseUrl;
                }
            }

            if (!ApiClientUtils.UrlContainsVersion(apiBaseUrl))
            {
                var baseUrl = apiBaseUrl + "/v" + DefaultApiVersion;
                apiBaseUrl = baseUrl;
            }
            this.ApiClient = new ApiClient(clientId, clientSecret, apiBaseUrl, authUrl);
        }
 /// <summary>
 /// Constructor. Initalizes a new instance of ApiBase class with specified user credentials (application SID and application key),
 /// REST API service URL and authentication service URL.
 /// </summary>
 /// <param name="clientId">Client ID</param>
 /// <param name="clientSecret">Client secret</param>
 /// <param name="basePath">REST API service URL</param>
 /// <param name="authPath">Authorization service URL</param>
 protected internal ApiBase(String clientId, String clientSecret, String basePath, String authPath)
 {
     if (!ApiClientUtils.UrlContainsVersion(basePath))
     {
         var baseUrl = $"{basePath}/v{DefaultApiVersion}";
         basePath = baseUrl;
     }
     this.ApiClient = new ApiClient(clientId, clientSecret, basePath, authPath);
 }
        /// <summary>
        /// Constructor. Initalizes a new instance of ApiBase class with Configuration object.
        /// </summary>
        /// <param name="config"></param>
        protected internal ApiBase(Configuration config)
        {
            if (!ApiClientUtils.UrlContainsVersion(config.ApiBaseUrl))
            {
                var baseUrl = config.ApiBaseUrl + "/v" + config.ApiVersion;
                config.ApiBaseUrl = baseUrl;
            }

            this.ApiClient = new ApiClient(
                config.ClientId, config.ClientSecret, config.ApiBaseUrl, config.AuthUrl);
        }
        /// <summary>
        /// Convert the HTML document to XPS by URL.
        /// </summary>
        /// <param name="sourceUrl">The source page URL.</param>
        /// <param name="width">Resulting document page width. </param>
        /// <param name="height">Resulting document page height. </param>
        /// <param name="leftMargin">Left document page margin.</param>
        /// <param name="rightMargin">Right document page margin.</param>
        /// <param name="topMargin">Top document page margin.</param>
        /// <param name="bottomMargin">Bottom document page margin.</param>
        /// <param name="storage">The document storage.</param>
        /// <returns>System.IO.Stream | Stream of the resulting XPS document.</returns>
        public Stream GetConvertDocumentToXpsByUrl(string sourceUrl,
                                                   int?width     = default(int?), int?height       = default(int?), int?leftMargin = default(int?), int?rightMargin = default(int?),
                                                   int?topMargin = default(int?), int?bottomMargin = default(int?), string storage = null)
        {
            var methodName = "GetConvertDocumentToXpsByUrl";

            // verify the required parameter 'sourceUrl' is set
            if (sourceUrl == null)
            {
                throw new ApiException(400, "Missing required parameter 'sourceUrl' when calling GetConvertDocumentToXpsByUrl");
            }

            var path = "/html/convert/xps";

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(sourceUrl)); // query parameter

            if (width != null)
            {
                queryParams.Add("width", ApiClientUtils.ParameterToString(width));                // query parameter
            }
            if (height != null)
            {
                queryParams.Add("height", ApiClientUtils.ParameterToString(height));                 // query parameter
            }
            if (leftMargin != null)
            {
                queryParams.Add("leftMargin", ApiClientUtils.ParameterToString(leftMargin));                     // query parameter
            }
            if (rightMargin != null)
            {
                queryParams.Add("rightMargin", ApiClientUtils.ParameterToString(rightMargin));                      // query parameter
            }
            if (topMargin != null)
            {
                queryParams.Add("topMargin", ApiClientUtils.ParameterToString(topMargin));                    // query parameter
            }
            if (bottomMargin != null)
            {
                queryParams.Add("bottomMargin", ApiClientUtils.ParameterToString(bottomMargin));                       // query parameter
            }
            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
        public virtual Dictionary <string, string> ToQueryParamList()
        {
            var queryParams = new Dictionary <string, string>();

            if (SourceUrl != null)
            {
                queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(SourceUrl));
            }

            if (Page != null)
            {
                if (Width != null)
                {
                    queryParams.Add("width", ApiClientUtils.ParameterToString(Width));
                }
                if (Height != null)
                {
                    queryParams.Add("height", ApiClientUtils.ParameterToString(Height));
                }
                if (Page.Margin != null)
                {
                    if (Page.Margin.Top != null)
                    {
                        queryParams.Add("topMargin", ApiClientUtils.ParameterToString(Page.Margin.Top));
                    }
                    if (Page.Margin.Left != null)
                    {
                        queryParams.Add("leftMargin", ApiClientUtils.ParameterToString(Page.Margin.Left));
                    }
                    if (Page.Margin.Right != null)
                    {
                        queryParams.Add("rightMargin", ApiClientUtils.ParameterToString(Page.Margin.Right));
                    }
                    if (Page.Margin.Bottom != null)
                    {
                        queryParams.Add("bottomMargin", ApiClientUtils.ParameterToString(Page.Margin.Bottom));
                    }
                }
            }

            if (Resolution != null)
            {
                queryParams.Add("resolution", ApiClientUtils.ParameterToString(Resolution));
            }
            if (Folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(Folder));
            }

            return(queryParams);
        }
Esempio n. 16
0
        public StreamResponse GetDocumentFragmentByCSSSelector(string name, string selector, string outFormat, string storage, string folder)
        {
            var methodName = "GetDocumentFragmentByCSSSelector";

            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new ApiException(400, $"Missing required parameter 'name' when calling {methodName}");
            }

            // verify the required parameter 'xPath' is set
            if (selector == null)
            {
                throw new ApiException(400, $"Missing required parameter 'selector' when calling {methodName}");
            }

            // verify the required parameter 'outFormat' is set
            if (outFormat == null)
            {
                throw new ApiException(400, $"Missing required parameter 'outFormat' when calling {methodName}");
            }

            var path = "/html/{name}/fragments/css/{outFormat}";

            path = path.Replace("{" + "name" + "}", ApiClientUtils.ParameterToString(name));
            path = path.Replace("{" + "outFormat" + "}", ApiClientUtils.ParameterToString(outFormat));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (selector != null)
            {
                queryParams.Add("selector", ApiClientUtils.ParameterToString(selector));                   // query parameter
            }
            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
        /// <summary>
        /// Recognize text content from the source image file by its name from default or specified storage, and create an HTML document translated to the specified language.
        /// </summary>
        /// <param name="name">String | Document name.</param>
        /// <param name="srcLang">String | Source language (considered as OCR engine language too).</param>
        /// <param name="resLang">String | Result language.</param>
        /// <param name="folder">String | Optional. The document folder.</param>
        /// <param name="storage">String | Optional. The document storage.</param>
        /// <returns>System.IO.Stream |  Stream of resulting document.</returns>
        public Stream GetRecognizeAndTranslateToHtml(string name, string srcLang, string resLang, string folder = null, string storage = null)
        {
            var methodName = "GetRecognizeAndTranslateToHtml";

            // verify the required parameter 'name' is set
            if (name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling GetRecognizeAndTranslateToHtml");
            }
            // verify the required parameter 'srcLang' is set
            if (srcLang == null)
            {
                throw new ApiException(400, "Missing required parameter 'srcLang' when calling GetRecognizeAndTranslateToHtml");
            }

            // verify the required parameter 'resLang' is set
            if (resLang == null)
            {
                throw new ApiException(400, "Missing required parameter 'resLang' when calling GetRecognizeAndTranslateToHtml");
            }

            var path = "/html/{name}/ocr/translate/{srcLang}/{resLang}";

            path = path.Replace("{" + "name" + "}", ApiClientUtils.ParameterToString(name));
            path = path.Replace("{" + "srcLang" + "}", ApiClientUtils.ParameterToString(srcLang));
            path = path.Replace("{" + "resLang" + "}", ApiClientUtils.ParameterToString(resLang));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
        public AsposeResponse MoveFile(string srcPath, string destPath, string srcStorage = null, string destStorage = null, string versionId = null)
        {
            var methodName = "MoveFile";

            // verify the required parameter 'srcPath' is set
            if (srcPath == null)
            {
                throw new ApiException(400, $"Missing required parameter 'srcPath' when calling {methodName}");
            }
            // verify the required parameter 'destPath' is set
            if (destPath == null)
            {
                throw new ApiException(400, $"Missing required parameter 'destPath' when calling {methodName}");
            }

            if (srcPath.First <char>() == '/')
            {
                srcPath = srcPath.Substring(1, srcPath.Length - 1);
            }
            var apiPath      = $"/html/storage/file/move/{srcPath}";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("destPath", ApiClientUtils.ParameterToString(destPath)); // query parameter
            if (srcStorage != null)
            {
                queryParams.Add("srcStorageName", ApiClientUtils.ParameterToString(srcStorage));                     // query parameter
            }
            if (destStorage != null)
            {
                queryParams.Add("destStorageName", ApiClientUtils.ParameterToString(destStorage));                      // query parameter
            }
            if (versionId != null)
            {
                queryParams.Add("versionId", ApiClientUtils.ParameterToString(versionId));                    // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallPutApi(apiPath, queryParams, headerParams, null, methodName);

            return(response);
        }
Esempio n. 19
0
        /// <summary>
        /// Translate the HTML document specified by its URL.
        /// </summary>
        /// <param name="sourceUrl">Source document URL.</param>
        /// <param name="srcLang">Source language.</param>
        /// <param name="resLang">Result language.</param>
        /// <returns>Stream | Stream of resulting document.</returns>
        public Stream GetTranslateDocumentByUrl(string sourceUrl, string srcLang, string resLang)
        {
            var methodName = "GetTranslateDocumentByUrl";

            // verify the required parameter 'sourceUrl' is set
            if (sourceUrl == null)
            {
                throw new ApiException(400, "Missing required parameter 'sourceUrl' when calling GetTranslateDocumentByUrl");
            }

            // verify the required parameter 'srcLang' is set
            if (srcLang == null)
            {
                throw new ApiException(400, "Missing required parameter 'srcLang' when calling GetTranslateDocumentByUrl");
            }

            // verify the required parameter 'resLang' is set
            if (resLang == null)
            {
                throw new ApiException(400, "Missing required parameter 'resLang' when calling GetTranslateDocumentByUrl");
            }

            var path = "/html/translate/{srcLang}/{resLang}";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "srcLang" + "}", ApiClientUtils.ParameterToString(srcLang));
            path = path.Replace("{" + "resLang" + "}", ApiClientUtils.ParameterToString(resLang));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (sourceUrl != null)
            {
                queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(sourceUrl));                     // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] {  };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
Esempio n. 20
0
        public StreamResponse GetMergeHtmlTemplate(string templateName, string dataPath, string options = null, string folder = null, string storage = null)
        {
            var methodName = "GetMergeHtmlTemplate";

            // verify the required parameter 'name' is set
            if (templateName == null)
            {
                throw new ApiException(400, $"Missing required parameter 'templateName' when calling {methodName}");
            }
            // verify the required parameter 'outFormat' is set
            if (dataPath == null)
            {
                throw new ApiException(400, $"Missing required parameter 'dataPath' when calling {methodName}");
            }

            var path = "/html/{templateName}/merge";

            //path = path.Replace("{format}", "json");
            path = path.Replace("{" + "templateName" + "}", ApiClientUtils.ParameterToString(templateName));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("dataPath", ApiClientUtils.ParameterToString(dataPath)); // query parameter
            if (options != null)
            {
                queryParams.Add("options", ApiClientUtils.ParameterToString(options));                  // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[]       authSettings = new String[] { };
            StreamResponse response     = CallGetApi(path, queryParams, methodName);

            return(response);
        }
Esempio n. 21
0
        public bool FileOrFolderExists(string path, string storage = null, string versionId = null)
        {
            var methodName = "FileOrFolderExists";

            // verify the required parameter 'path' is set
            if (path == null)
            {
                throw new ApiException(400, $"Missing required parameter 'path' when calling {methodName}");
            }

            if (path.First <char>() == '/')
            {
                path = path.Substring(1, path.Length - 1);
            }
            var apiPath      = $"/html/storage/exist/{path}";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storageName", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (versionId != null)
            {
                queryParams.Add("versionId", ApiClientUtils.ParameterToString(versionId));                    // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response   = CallGetApi(apiPath, queryParams, methodName);
            var strContent = response.ContentAsString;

            if (!string.IsNullOrEmpty(strContent))
            {
                var dictResp = JsonConvert.DeserializeObject <Dictionary <string, object> >(strContent);
                if (dictResp.ContainsKey("exists"))
                {
                    return(bool.Parse(dictResp["exists"].ToString()));
                }
            }
            return(false);
        }
Esempio n. 22
0
        public StreamResponse GetDocumentFragmentByXPathByUrl(string sourceUrl, string xPath, string outFormat)
        {
            var methodName = "GetDocumentFragmentByXPathByUrl";

            // verify the required parameter 'sourceUrl' is set
            if (sourceUrl == null)
            {
                throw new ApiException(400, $"Missing required parameter 'sourceUrl' when calling {methodName}");
            }
            // verify the required parameter 'xPath' is set
            if (xPath == null)
            {
                throw new ApiException(400, $"Missing required parameter 'selector' when calling {methodName}");
            }
            // verify the required parameter 'outFormat' is set
            if (outFormat == null)
            {
                throw new ApiException(400, $"Missing required parameter 'outFormat' when calling {methodName}");
            }

            var path = "/html/fragments/css/{outFormat}";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "outFormat" + "}", ApiClientUtils.ParameterToString(outFormat));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(sourceUrl)); // query parameter
            queryParams.Add("selector", ApiClientUtils.ParameterToString(xPath));      // query parameter

            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
Esempio n. 23
0
        public StreamResponse GetDocumentImagesByUrl(string sourceUrl)
        {
            var methodName = "GetDocumentImagesByUrl";

            // verify the required parameter 'name' is set
            if (sourceUrl == null)
            {
                throw new ApiException(400, $"Missing required parameter 'sourceUrl' when calling {methodName}");
            }

            var path         = "/html/images/all";
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("sourceUrl", ApiClientUtils.ParameterToString(sourceUrl)); // query parameter

            // authentication setting, if any
            String[] authSettings = new String[] { };

            var response = CallGetApi(path, queryParams, methodName);

            return(response);
        }
        public List <StorageItem> GetFolderContentList(string path, string storage = null)
        {
            var methodName = "GetFolderList";

            // verify the required parameter 'path' is set
            if (path == null)
            {
                throw new ApiException(400, $"Missing required parameter 'path' when calling {methodName}");
            }

            if (path.First <char>() == '/')
            {
                path = path.Substring(1, path.Length - 1);
            }
            var apiPath = $"/html/storage/folder/{path}";

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            // authentication setting, if any
            String[] authSettings = new String[] { };

            var    response = CallGetApi(apiPath, queryParams, methodName);
            string content  = null;

            using (StreamReader rdr = new StreamReader(response.ContentStream))
            {
                content = rdr.ReadToEnd();
            }
            var listResp = JsonConvert.DeserializeObject <StorageItemList>(content);

            return(listResp.ItemList);
        }
Esempio n. 25
0
        protected AsposeResponse PostMergeHtmlTemplate_Impl(string templateName, Stream inStream, string dataFileName, string outPath, string options = null, string folder = null, string storage = null)
        {
            var methodName = "PostMergeHtmlTemplate";

            // verify the required parameter 'templateName' is set
            if (templateName == null)
            {
                throw new ApiException(400, $"Missing required parameter 'templateName' when calling {methodName}");
            }
            // verify the required parameter 'outPath' is set
            if (outPath == null)
            {
                throw new ApiException(400, $"Missing required parameter 'outPath' when calling {methodName}");
            }
            // verify the required parameter 'inStream' is set
            if (inStream == null)
            {
                throw new ApiException(400, $"Missing required parameter 'inStream' when calling {methodName}");
            }

            var path = "/html/{templateName}/merge";

            path = path.Replace("{" + "templateName" + "}", ApiClientUtils.ParameterToString(templateName));

            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();

            queryParams.Add("outPath", ApiClientUtils.ParameterToString(outPath)); // required query parameter

            if (options != null)
            {
                queryParams.Add("options", ApiClientUtils.ParameterToString(options));                  // query parameter
            }
            if (folder != null)
            {
                queryParams.Add("folder", ApiClientUtils.ParameterToString(folder));                 // query parameter
            }
            if (storage != null)
            {
                queryParams.Add("storage", ApiClientUtils.ParameterToString(storage));                  // query parameter
            }
            if (!string.IsNullOrEmpty(dataFileName))
            {
                var dataType = MimeHelper.GetFormatByExtension(Path.GetExtension(dataFileName).Replace(".", ""));
                if (!(dataType.ToLower() == "json" || dataType.ToLower() == "xml"))
                {
                    throw new ApiException(400, $"'dataType' parameter: Unsupported data type when calling {methodName}");
                }

                queryParams.Add(PAR_FILENAME_I, dataFileName);
                var contentType = MimeHelper.GetMimeType(dataType);
                if (contentType == null)
                {
                    throw new ApiException(400, $"'dataType' parameter: Unsupported data type provided when calling {methodName}");
                }

                headerParams.Add("Content-Type", contentType);
            }
            headerParams.Add("Content-Length", inStream.Length.ToString());
            // authentication setting, if contentType
            String[] authSettings = new String[] { };

            var response = CallPostApi(path, queryParams, headerParams, inStream, methodName);

            return(response);
        }