Example #1
0
        /// <summary>
        /// Remove a specific file. Parameters: path - file path e.g. /file.ext, versionID - file's version, storage - user's storage name. Remove a specific file. Parameters: path - file path e.g. /file.ext, versionID - file's version, storage - user's storage name.
        /// </summary>
        /// <param name="Path"></param>
        /// <param name="versionId"></param>
        /// <param name="storage"></param>
        /// <returns></returns>
        public RemoveFileResponse DeleteFile(string Path, string versionId, string storage)
        {
            // create path and map variables
            var ResourcePath = "/storage/file/{Path}/?appSid={appSid}&amp;versionId={versionId}&amp;storage={storage}".Replace("{format}", "json");

            ResourcePath = Regex.Replace(ResourcePath, "\\*", "").Replace("&amp;", "&").Replace("/?", "?").Replace("toFormat={toFormat}", "format={format}");

            // query params
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();
            var formParams   = new Dictionary <String, object>();

            // verify required params are set
            if (Path == null)
            {
                throw new ApiException(400, "missing required params");
            }
            if (Path == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])Path=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "Path" + "}", apiInvoker.ToPathValue(Path));
            }
            if (versionId == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])versionId=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "versionId" + "}", apiInvoker.ToPathValue(versionId));
            }
            if (storage == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage));
            }
            try {
                if (typeof(RemoveFileResponse) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    return((RemoveFileResponse)ApiInvoker.deserialize(response, typeof(RemoveFileResponse)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "DELETE", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((RemoveFileResponse)ApiInvoker.deserialize(response, typeof(RemoveFileResponse)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Example #2
0
        /// <summary>
        /// PostRunOmrTask
        /// </summary>
        /// <param name="name"></param>
        /// <param name="actionName"></param>
        /// <param name="functionParams"></param>
        /// <param name="additionalParams"></param>
        /// <param name="storage"></param>
        /// <param name="folder"></param>
        /// <returns></returns>
        public OMRResponse PostRunOmrTask(string name, string actionName, OMRFunctionParam functionParam,
                                          string storage, string folder)
        {
            // create path and map variables
            string ResourcePath =
                "/omr/{name}/runOmrTask/?appSid={appSid}&amp;actionName={actionName}&amp;storage={storage}&amp;folder={folder}"
                .Replace("{format}", "json");

            ResourcePath = Regex.Replace(ResourcePath, "\\*", "")
                           .Replace("&amp;", "&")
                           .Replace("/?", "?")
                           .Replace("toFormat={toFormat}", "format={format}");

            // query params
            Dictionary <string, string> queryParams  = new Dictionary <String, String>();
            Dictionary <string, string> headerParams = new Dictionary <String, String>();
            Dictionary <string, object> formParams   = new Dictionary <String, object>();

            // verify required params are set
            if (name == null)
            {
                throw new ApiException(400, "missing required params");
            }
            if (name == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])name=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "name" + "}", apiInvoker.ToPathValue(name));
            }
            if (actionName == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])actionName=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "actionName" + "}", apiInvoker.ToPathValue(actionName));
            }
            if (storage == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage));
            }
            if (folder == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder));
            }
            try
            {
                if (typeof(OMRResponse) == typeof(ResponseMessage))
                {
                    byte[] response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "POST", queryParams,
                                                                 functionParam, headerParams, formParams);
                    return((OMRResponse)ApiInvoker.deserialize(response, typeof(OMRResponse)));
                }
                else
                {
                    string response = apiInvoker.invokeAPI(basePath, ResourcePath, "POST", queryParams, functionParam,
                                                           headerParams, formParams);
                    if (response != null)
                    {
                        return((OMRResponse)ApiInvoker.deserialize(response, typeof(OMRResponse)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Example #3
0
        /// <summary>
        /// Generate barcode. Generate barcode.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="type"></param>
        /// <param name="format"></param>
        /// <param name="resolutionX"></param>
        /// <param name="resolutionY"></param>
        /// <param name="dimensionX"></param>
        /// <param name="dimensionY"></param>
        /// <param name="enableChecksum"></param>
        /// <returns></returns>
        public ResponseMessage GetBarcodeGenerate(string text, string type, string format, float?resolutionX, float?resolutionY, float?dimensionX, float?dimensionY, string enableChecksum)
        {
            // create path and map variables
            var ResourcePath = "/barcode/generate/?appSid={appSid}&amp;text={text}&amp;type={type}&amp;toFormat={toFormat}&amp;resolutionX={resolutionX}&amp;resolutionY={resolutionY}&amp;dimensionX={dimensionX}&amp;dimensionY={dimensionY}&amp;enableChecksum={enableChecksum}".Replace("{format}", "json");

            ResourcePath = Regex.Replace(ResourcePath, "\\*", "").Replace("&amp;", "&").Replace("/?", "?").Replace("toFormat={toFormat}", "format={format}");

            // query params
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();
            var formParams   = new Dictionary <String, object>();

            if (text == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])text=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "text" + "}", apiInvoker.ToPathValue(text));
            }
            if (type == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])type=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "type" + "}", apiInvoker.ToPathValue(type));
            }
            if (format == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])format=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "format" + "}", apiInvoker.ToPathValue(format));
            }
            if (resolutionX == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])resolutionX=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "resolutionX" + "}", apiInvoker.ToPathValue(resolutionX));
            }
            if (resolutionY == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])resolutionY=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "resolutionY" + "}", apiInvoker.ToPathValue(resolutionY));
            }
            if (dimensionX == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])dimensionX=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "dimensionX" + "}", apiInvoker.ToPathValue(dimensionX));
            }
            if (dimensionY == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])dimensionY=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "dimensionY" + "}", apiInvoker.ToPathValue(dimensionY));
            }
            if (enableChecksum == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])enableChecksum=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "enableChecksum" + "}", apiInvoker.ToPathValue(enableChecksum));
            }
            try {
                if (typeof(ResponseMessage) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    return((ResponseMessage)ApiInvoker.deserialize(response, typeof(ResponseMessage)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((ResponseMessage)ApiInvoker.deserialize(response, typeof(ResponseMessage)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Example #4
0
        /// <summary>
        /// Recognize image text, language and text region can be selected, default dictionaries can be used for correction. Recognize image text, language and text region can be selected, default dictionaries can be used for correction.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="language"></param>
        /// <param name="rectX"></param>
        /// <param name="rectY"></param>
        /// <param name="rectWidth"></param>
        /// <param name="rectHeight"></param>
        /// <param name="useDefaultDictionaries"></param>
        /// <param name="storage"></param>
        /// <param name="folder"></param>
        /// <returns></returns>
        public OCRResponse GetRecognizeDocument(string name, string language, int?rectX, int?rectY, int?rectWidth, int?rectHeight, bool?useDefaultDictionaries, string storage, string folder)
        {
            // create path and map variables
            var ResourcePath = "/ocr/{name}/recognize/?appSid={appSid}&amp;language={language}&amp;rectX={rectX}&amp;rectY={rectY}&amp;rectWidth={rectWidth}&amp;rectHeight={rectHeight}&amp;useDefaultDictionaries={useDefaultDictionaries}&amp;storage={storage}&amp;folder={folder}".Replace("{format}", "json");

            ResourcePath = Regex.Replace(ResourcePath, "\\*", "").Replace("&amp;", "&").Replace("/?", "?").Replace("toFormat={toFormat}", "format={format}");

            // query params
            var queryParams  = new Dictionary <String, String>();
            var headerParams = new Dictionary <String, String>();
            var formParams   = new Dictionary <String, object>();

            // verify required params are set
            if (name == null)
            {
                throw new ApiException(400, "missing required params");
            }
            if (name == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])name=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "name" + "}", apiInvoker.ToPathValue(name));
            }
            if (language == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])language=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "language" + "}", apiInvoker.ToPathValue(language));
            }
            if (rectX == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rectX=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rectX" + "}", apiInvoker.ToPathValue(rectX));
            }
            if (rectY == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rectY=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rectY" + "}", apiInvoker.ToPathValue(rectY));
            }
            if (rectWidth == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rectWidth=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rectWidth" + "}", apiInvoker.ToPathValue(rectWidth));
            }
            if (rectHeight == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rectHeight=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rectHeight" + "}", apiInvoker.ToPathValue(rectHeight));
            }
            if (useDefaultDictionaries == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])useDefaultDictionaries=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "useDefaultDictionaries" + "}", apiInvoker.ToPathValue(useDefaultDictionaries));
            }
            if (storage == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage));
            }
            if (folder == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder));
            }
            try {
                if (typeof(OCRResponse) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    return((OCRResponse)ApiInvoker.deserialize(response, typeof(OCRResponse)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((OCRResponse)ApiInvoker.deserialize(response, typeof(OCRResponse)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }