Пример #1
0
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'fileContent' is set
            if (this.FileContent == null)
            {
                throw new ApiException(400, "Missing required parameter 'fileContent' when calling UploadFile");
            }

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

            var path = configuration.GetApiRootUrl() + "/words/storage/file/{path}";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddPathParameter(path, "path", this.Path);
            path = UrlHelper.AddQueryParameterToUrl(path, "storageName", this.StorageName);

            var result   = new HttpRequestMessage(HttpMethod.Put, path);
            var formData = new Dictionary <string, object>();

            if (this.FileContent != null)
            {
                formData.Add("fileContent", new Aspose.Words.Cloud.Sdk.FileInfo()
                {
                    Name = "FileContent", FileContent = StreamHelper.ReadAsBytes(this.FileContent)
                });
            }

            if (formData.Count > 0)
            {
                result.Content = ApiInvoker.GetMultipartFormData(formData);
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
        /// </summary>
        /// <param name="OrderId">ID of pet that needs to be fetched</param>

        /// <returns></returns>
        public Order  getOrderById(string OrderId)
        {
            // create path and map variables
            var path = "/store/order/{orderId}".Replace("{format}", "json").Replace("{" + "orderId" + "}", apiInvoker.escapeString(OrderId.ToString()));

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



            try {
                if (typeof(Order) == typeof(byte[]))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    return(((object)response) as Order);
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((Order)ApiInvoker.deserialize(response, typeof(Order)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
        /// <summary>
        /// create or update a user name by id saveUserComplete
        /// </summary>
        /// <param name="Body">user</param>

        /// <returns></returns>
        public User  saveUserComplete(User Body)
        {
            // create path and map variables
            var path = "/user_complete_post_complete".Replace("{format}", "json");

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



            try {
                if (typeof(User) == typeof(byte[]))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    return(((object)response) as User);
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, Body, headerParams, formParams);
                    if (response != null)
                    {
                        return((User)ApiInvoker.deserialize(response, typeof(User)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'name' is set
            if (this.Name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling UpdateStyle");
            }

            // verify the required parameter 'styleName' is set
            if (this.StyleName == null)
            {
                throw new ApiException(400, "Missing required parameter 'styleName' when calling UpdateStyle");
            }

            // verify the required parameter 'styleUpdate' is set
            if (this.StyleUpdate == null)
            {
                throw new ApiException(400, "Missing required parameter 'styleUpdate' when calling UpdateStyle");
            }

            var path = configuration.GetApiRootUrl() + "/words/{name}/styles/{styleName}/update";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddPathParameter(path, "name", this.Name);
            path = UrlHelper.AddPathParameter(path, "styleName", this.StyleName);
            path = UrlHelper.AddQueryParameterToUrl(path, "folder", this.Folder);
            path = UrlHelper.AddQueryParameterToUrl(path, "storage", this.Storage);
            path = UrlHelper.AddQueryParameterToUrl(path, "loadEncoding", this.LoadEncoding);
            path = UrlHelper.AddQueryParameterToUrl(path, "password", this.Password);
            path = UrlHelper.AddQueryParameterToUrl(path, "destFileName", this.DestFileName);
            path = UrlHelper.AddQueryParameterToUrl(path, "revisionAuthor", this.RevisionAuthor);
            path = UrlHelper.AddQueryParameterToUrl(path, "revisionDateTime", this.RevisionDateTime);

            var result = new HttpRequestMessage(HttpMethod.Put, path);

            result.Content = ApiInvoker.GetBodyParameterData(this.StyleUpdate);
            return(result);
        }
Пример #5
0
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'data' is set
            if (this.Data == null)
            {
                throw new ApiException(400, "Missing required parameter 'data' when calling LoadWebDocument");
            }

            var path = configuration.GetApiRootUrl() + "/words/loadWebDocument";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddQueryParameterToUrl(path, "storage", this.Storage);

            var result = new HttpRequestMessage(HttpMethod.Put, path);

            result.Content = ApiInvoker.GetBodyParameterData(this.Data);
            return(result);
        }
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'text' is set
            if (this.Text == null)
            {
                throw new ApiException(400, "Missing required parameter 'text' when calling Classify");
            }

            var path = configuration.GetApiRootUrl() + "/words/classify";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddQueryParameterToUrl(path, "bestClassesCount", this.BestClassesCount);

            var result = new HttpRequestMessage(HttpMethod.Put, path);

            result.Content = ApiInvoker.GetBodyParameterData(this.Text);
            return(result);
        }
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'document' is set
            if (this.Document == null)
            {
                throw new ApiException(400, "Missing required parameter 'document' when calling DeleteTableRowOnline");
            }

            var path = configuration.GetApiRootUrl() + "/words/online/delete/{tablePath}/rows/{index}";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddPathParameter(path, "tablePath", this.TablePath);
            path = UrlHelper.AddPathParameter(path, "index", this.Index);
            path = UrlHelper.AddQueryParameterToUrl(path, "loadEncoding", this.LoadEncoding);
            path = UrlHelper.AddQueryParameterToUrl(path, "password", this.Password);
            path = UrlHelper.AddQueryParameterToUrl(path, "destFileName", this.DestFileName);
            path = UrlHelper.AddQueryParameterToUrl(path, "revisionAuthor", this.RevisionAuthor);
            path = UrlHelper.AddQueryParameterToUrl(path, "revisionDateTime", this.RevisionDateTime);

            var result   = new HttpRequestMessage(HttpMethod.Put, path);
            var formData = new Dictionary <string, object>();

            if (this.Document != null)
            {
                formData.Add("document", new Aspose.Words.Cloud.Sdk.FileInfo()
                {
                    Name = "Document", FileContent = StreamHelper.ReadAsBytes(this.Document)
                });
            }

            if (formData.Count > 0)
            {
                result.Content = ApiInvoker.GetMultipartFormData(formData);
            }

            return(result);
        }
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'name' is set
            if (this.Name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling ReplaceWithText");
            }

            // verify the required parameter 'rangeStartIdentifier' is set
            if (this.RangeStartIdentifier == null)
            {
                throw new ApiException(400, "Missing required parameter 'rangeStartIdentifier' when calling ReplaceWithText");
            }

            // verify the required parameter 'rangeText' is set
            if (this.RangeText == null)
            {
                throw new ApiException(400, "Missing required parameter 'rangeText' when calling ReplaceWithText");
            }

            var path = configuration.GetApiRootUrl() + "/words/{name}/range/{rangeStartIdentifier}/{rangeEndIdentifier}";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddPathParameter(path, "name", this.Name);
            path = UrlHelper.AddPathParameter(path, "rangeStartIdentifier", this.RangeStartIdentifier);
            path = UrlHelper.AddPathParameter(path, "rangeEndIdentifier", this.RangeEndIdentifier);
            path = UrlHelper.AddQueryParameterToUrl(path, "folder", this.Folder);
            path = UrlHelper.AddQueryParameterToUrl(path, "storage", this.Storage);
            path = UrlHelper.AddQueryParameterToUrl(path, "loadEncoding", this.LoadEncoding);
            path = UrlHelper.AddQueryParameterToUrl(path, "password", this.Password);
            path = UrlHelper.AddQueryParameterToUrl(path, "destFileName", this.DestFileName);

            var result = new HttpRequestMessage(HttpMethod.Post, path);

            result.Content = ApiInvoker.GetBodyParameterData(this.RangeText);
            return(result);
        }
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'name' is set
            if (this.Name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling ExecuteMailMerge");
            }

            var path = configuration.GetApiRootUrl() + "/words/{name}/MailMerge";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddPathParameter(path, "name", this.Name);
            path = UrlHelper.AddQueryParameterToUrl(path, "folder", this.Folder);
            path = UrlHelper.AddQueryParameterToUrl(path, "storage", this.Storage);
            path = UrlHelper.AddQueryParameterToUrl(path, "loadEncoding", this.LoadEncoding);
            path = UrlHelper.AddQueryParameterToUrl(path, "password", this.Password);
            path = UrlHelper.AddQueryParameterToUrl(path, "withRegions", this.WithRegions);
            path = UrlHelper.AddQueryParameterToUrl(path, "mailMergeDataFile", this.MailMergeDataFile);
            path = UrlHelper.AddQueryParameterToUrl(path, "cleanup", this.Cleanup);
            path = UrlHelper.AddQueryParameterToUrl(path, "useWholeParagraphAsRegion", this.UseWholeParagraphAsRegion);
            path = UrlHelper.AddQueryParameterToUrl(path, "destFileName", this.DestFileName);

            var result   = new HttpRequestMessage(HttpMethod.Put, path);
            var formData = new Dictionary <string, object>();

            if (this.Data != null)
            {
                formData.Add("Data", this.Data);
            }

            if (formData.Count > 0)
            {
                result.Content = ApiInvoker.GetMultipartFormData(formData);
            }

            return(result);
        }
Пример #10
0
        /// <summary>
        /// Returns help text &amp; subject list for websocket usage.
        /// </summary>
        /// <returns></returns>
        public object websocketHelp()
        {
            // create path and map variables
            var path = "/schema/websocketHelp".Replace("{format}", "json");

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

            try {
                if (typeof(object) == typeof(byte[]))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    return(((object)response) as object);
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((object)ApiInvoker.deserialize(response, typeof(object)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #11
0
        public List <Pet> findPetsByTags(string Tags)
        {
            // create path and map variables
            var path = "/pet.{format}/findByTags".Replace("{format}", "json");

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

            // verify required params are set
            if (Tags == null)
            {
                throw new ApiException(400, "missing required params");
            }
            if (Tags != null)
            {
                queryParams.Add("Tags", Tags);
            }
            try {
                var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
                if (response != null)
                {
                    return((List <Pet>)ApiInvoker.deserialize(response, typeof(List <Pet>)));
                }
                else
                {
                    return(null);
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'document' is set
            if (this.Document == null)
            {
                throw new ApiException(400, "Missing required parameter 'document' when calling GetDocumentStatisticsOnline");
            }

            var path = configuration.GetApiRootUrl() + "/words/online/get/statistics";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddQueryParameterToUrl(path, "loadEncoding", this.LoadEncoding);
            path = UrlHelper.AddQueryParameterToUrl(path, "password", this.Password);
            path = UrlHelper.AddQueryParameterToUrl(path, "includeComments", this.IncludeComments);
            path = UrlHelper.AddQueryParameterToUrl(path, "includeFootnotes", this.IncludeFootnotes);
            path = UrlHelper.AddQueryParameterToUrl(path, "includeTextInShapes", this.IncludeTextInShapes);

            var result   = new HttpRequestMessage(HttpMethod.Put, path);
            var formData = new Dictionary <string, object>();

            if (this.Document != null)
            {
                formData.Add("document", new Aspose.Words.Cloud.Sdk.FileInfo()
                {
                    Name = "Document", FileContent = StreamHelper.ReadAsBytes(this.Document)
                });
            }

            if (formData.Count > 0)
            {
                result.Content = ApiInvoker.GetMultipartFormData(formData);
            }

            return(result);
        }
Пример #13
0
        /// <summary>
        /// Creates the http request based on this request.
        /// </summary>
        /// <param name="configuration">SDK configuration.</param>
        /// <returns>The http request instance.</returns>
        public HttpRequestMessage CreateHttpRequest(Configuration configuration)
        {
            // verify the required parameter 'document' is set
            if (this.Document == null)
            {
                throw new ApiException(400, "Missing required parameter 'document' when calling GetHeaderFooterOfSectionOnline");
            }

            var path = configuration.GetApiRootUrl() + "/words/online/get/sections/{sectionIndex}/headersfooters/{headerFooterIndex}";

            path = Regex
                   .Replace(path, "\\*", string.Empty)
                   .Replace("&amp;", "&")
                   .Replace("/?", "?");
            path = UrlHelper.AddPathParameter(path, "headerFooterIndex", this.HeaderFooterIndex);
            path = UrlHelper.AddPathParameter(path, "sectionIndex", this.SectionIndex);
            path = UrlHelper.AddQueryParameterToUrl(path, "loadEncoding", this.LoadEncoding);
            path = UrlHelper.AddQueryParameterToUrl(path, "password", this.Password);
            path = UrlHelper.AddQueryParameterToUrl(path, "filterByType", this.FilterByType);

            var result   = new HttpRequestMessage(HttpMethod.Put, path);
            var formData = new Dictionary <string, object>();

            if (this.Document != null)
            {
                formData.Add("document", new Aspose.Words.Cloud.Sdk.FileInfo()
                {
                    Name = "Document", FileContent = StreamHelper.ReadAsBytes(this.Document)
                });
            }

            if (formData.Count > 0)
            {
                result.Content = ApiInvoker.GetMultipartFormData(formData);
            }

            return(result);
        }
Пример #14
0
        /// <summary>
        /// Find pet by ID Returns a pet based on ID
        /// </summary>
        /// <param name="petId">ID of pet that needs to be fetched</param>
        /// <returns></returns>
        public Pet getPetById(string petId)
        {
            // create path and map variables
            var path = "/pet/{petId}".Replace("{format}", "json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));

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

            // verify required params are set
            if (petId == null)
            {
                throw new ApiException(400, "missing required params");
            }
            string paramStr = null;

            try {
                var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
                if (response != null)
                {
                    return((Pet)ApiInvoker.deserialize(response, typeof(Pet)));
                }
                else
                {
                    return(null);
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="FileApi" /> class.
        /// </summary>
        /// <param name="configuration">Configuration settings</param>
        public FileApi(Configuration configuration)
        {
            _configuration = configuration;

            var requestHandlers = new List <IRequestHandler>();

            switch (_configuration.AuthType)
            {
            case AuthType.JWT:
                requestHandlers.Add(new JwtRequestHandler(_configuration));
                break;

            case AuthType.ExternalAuth:
                requestHandlers.Add(new ExternalAuthorizationRequestHandler(_configuration));
                break;

            default:
                throw new ArgumentOutOfRangeException($"Unknown AuthType={_configuration.AuthType}.");
            }

            requestHandlers.Add(new DebugLogRequestHandler(_configuration));
            requestHandlers.Add(new ApiExceptionRequestHandler());
            _apiInvoker = new ApiInvoker(configuration, requestHandlers);
        }
Пример #16
0
        /// <summary>
        /// Recognition of a barcode from file on server with parameters in body. Recognition of a barcode from file on server with parameters in body.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="folder"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        public BarcodeResponseList PutBarcodeRecognizeFromBody(string name, string type, string folder, BarcodeReader body)
        {
            // create path and map variables
            var ResourcePath = "/barcode/{name}/recognize/?appSid={appSid}&amp;type={type}&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 || body == 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 (type == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])type=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "type" + "}", apiInvoker.ToPathValue(type));
            }
            if (folder == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder));
            }
            try {
                if (typeof(BarcodeResponseList) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "PUT", queryParams, null, headerParams, formParams);
                    return((BarcodeResponseList)ApiInvoker.deserialize(response, typeof(BarcodeResponseList)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "PUT", queryParams, body, headerParams, formParams);
                    if (response != null)
                    {
                        return((BarcodeResponseList)ApiInvoker.deserialize(response, typeof(BarcodeResponseList)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #17
0
        /// <summary>
        /// Copy a folder. Parameters: path - source folder path e.g. /Folder1, storage - user's source storage name, newdest - destination folder path e.g. /Folder2, destStorage - user's destination storage name. Copy a folder. Parameters: path - source folder path e.g. /Folder1, storage - user's source storage name, newdest - destination folder path e.g. /Folder2, destStorage - user's destination storage name.
        /// </summary>
        /// <param name="Path"></param>
        /// <param name="newdest"></param>
        /// <param name="storage"></param>
        /// <param name="destStorage"></param>
        /// <returns></returns>
        public ResponseMessage PutCopyFolder(string Path, string newdest, string storage, string destStorage)
        {
            // create path and map variables
            var ResourcePath = "/storage/folder/{Path}/?appSid={appSid}&amp;newdest={newdest}&amp;storage={storage}&amp;destStorage={destStorage}".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 || newdest == 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 (newdest == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])newdest=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "newdest" + "}", apiInvoker.ToPathValue(newdest));
            }
            if (storage == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage));
            }
            if (destStorage == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])destStorage=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "destStorage" + "}", apiInvoker.ToPathValue(destStorage));
            }
            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, "PUT", 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;
                }
            }
        }
Пример #18
0
        /// <summary>
        /// Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file's version, storage - user's source storage name, newdest - destination file path, destStorage - user's destination storage name. Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file's version, storage - user's source storage name, newdest - destination file path, destStorage - user's destination storage name.
        /// </summary>
        /// <param name="Path"></param>
        /// <param name="versionId"></param>
        /// <param name="storage"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public ResponseMessage PutCreate(string Path, string versionId, string storage, byte[] file)
        {
            // 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 || file == 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));
            }
            if (file != null)
            {
                if (file is byte[])
                {
                    formParams.Add("file", file);
                }
                else
                {
                    //string paramStr = (file is DateTime) ? ((DateTime)(object)file).ToString("u") : Convert.ToString(file);
                    string paramStr = Convert.ToString(file);
                    formParams.Add("file", paramStr);
                }
            }
            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, "PUT", 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;
                }
            }
        }
Пример #19
0
        /// <summary>
        /// Move a specific file. Move a specific file.
        /// </summary>
        /// <param name="src">source file path e.g. /file.ext</param>
        /// <param name="dest"></param>
        /// <param name="versionId">source file's version,</param>
        /// <param name="storage">user's source storage name</param>
        /// <param name="destStorage">user's destination storage name</param>
        /// <returns></returns>
        public MoveFileResponse PostMoveFile(string src, string dest, string versionId, string storage, string destStorage)
        {
            // create path and map variables
            var ResourcePath = "/storage/file/{src}/?dest={dest}&amp;appSid={appSid}&amp;versionId={versionId}&amp;storage={storage}&amp;destStorage={destStorage}".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 (src == null || dest == null)
            {
                throw new ApiException(400, "missing required params");
            }
            if (src == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])src=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "src" + "}", apiInvoker.ToPathValue(src));
            }
            if (dest == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])dest=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "dest" + "}", apiInvoker.ToPathValue(dest));
            }
            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));
            }
            if (destStorage == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])destStorage=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "destStorage" + "}", apiInvoker.ToPathValue(destStorage));
            }
            try {
                if (typeof(MoveFileResponse) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    return((MoveFileResponse)ApiInvoker.deserialize(response, typeof(MoveFileResponse)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "POST", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((MoveFileResponse)ApiInvoker.deserialize(response, typeof(MoveFileResponse)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #20
0
 public async Task <IEnumerable <BusinessComponent> > GetAllBusinessComponents()
 {
     return(await ApiInvoker.GetAll <BusinessComponent>(Constants.BusinessComponentsEndpointKey, Constants.BaseBusinessComponentsRoutePrefix));
 }
Пример #21
0
 public async Task DeleteBusinessComponent(int id)
 {
     await ApiInvoker.Delete(Constants.BusinessComponentsEndpointKey, Constants.BaseBusinessComponentsRoutePrefix, id);
 }
Пример #22
0
 public async Task <BusinessComponent> UpdateBusinessComponent(BusinessComponent businessComponent)
 {
     return(await ApiInvoker.Update(Constants.BusinessComponentsEndpointKey, Constants.BaseBusinessComponentsRoutePrefix, businessComponent));
 }
Пример #23
0
 public async Task <BusinessComponent> GetBusinessComponent(int id)
 {
     return(await ApiInvoker.Get <BusinessComponent, int>(Constants.BusinessComponentsEndpointKey, Constants.BaseBusinessComponentsRoutePrefix, id));
 }
Пример #24
0
        /// <summary>
        /// Recognize barcode from a file on server. Recognize barcode from a file on server.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <param name="checksumValidation"></param>
        /// <param name="stripFnc"></param>
        /// <param name="rotationAngle"></param>
        /// <param name="barcodesCount"></param>
        /// <param name="rectX"></param>
        /// <param name="rectY"></param>
        /// <param name="rectWidth"></param>
        /// <param name="rectHeight"></param>
        /// <param name="storage"></param>
        /// <param name="folder"></param>
        /// <returns></returns>
        public BarcodeResponseList GetBarcodeRecognize(string name, string type, string checksumValidation, bool?stripFnc, int?rotationAngle, int?barcodesCount, int?rectX, int?rectY, int?rectWidth, int?rectHeight, string storage, string folder)
        {
            // create path and map variables
            var ResourcePath = "/barcode/{name}/recognize/?appSid={appSid}&amp;type={type}&amp;checksumValidation={checksumValidation}&amp;stripFnc={stripFnc}&amp;rotationAngle={rotationAngle}&amp;barcodesCount={barcodesCount}&amp;rectX={rectX}&amp;rectY={rectY}&amp;rectWidth={rectWidth}&amp;rectHeight={rectHeight}&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 (type == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])type=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "type" + "}", apiInvoker.ToPathValue(type));
            }
            if (checksumValidation == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])checksumValidation=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "checksumValidation" + "}", apiInvoker.ToPathValue(checksumValidation));
            }
            if (stripFnc == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])stripFnc=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "stripFnc" + "}", apiInvoker.ToPathValue(stripFnc));
            }
            if (rotationAngle == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rotationAngle=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rotationAngle" + "}", apiInvoker.ToPathValue(rotationAngle));
            }
            if (barcodesCount == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])barcodesCount=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "barcodesCount" + "}", apiInvoker.ToPathValue(barcodesCount));
            }
            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 (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(BarcodeResponseList) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    return((BarcodeResponseList)ApiInvoker.deserialize(response, typeof(BarcodeResponseList)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "GET", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((BarcodeResponseList)ApiInvoker.deserialize(response, typeof(BarcodeResponseList)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #25
0
        /// <summary>
        /// Recognize barcode from an url. Recognize barcode from an url.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="checksumValidation"></param>
        /// <param name="stripFnc"></param>
        /// <param name="rotationAngle"></param>
        /// <param name="url"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public BarcodeResponseList PostBarcodeRecognizeFromUrlorContent(string type, string checksumValidation, bool?stripFnc, int?rotationAngle, string url, byte[] file)
        {
            // create path and map variables
            var ResourcePath = "/barcode/recognize/?appSid={appSid}&amp;type={type}&amp;checksumValidation={checksumValidation}&amp;stripFnc={stripFnc}&amp;rotationAngle={rotationAngle}&amp;url={url}".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 (file == null ) {
            //   throw new ApiException(400, "missing required params");
            //}
            if (type == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])type=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "type" + "}", apiInvoker.ToPathValue(type));
            }
            if (checksumValidation == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])checksumValidation=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "checksumValidation" + "}", apiInvoker.ToPathValue(checksumValidation));
            }
            if (stripFnc == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])stripFnc=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "stripFnc" + "}", apiInvoker.ToPathValue(stripFnc));
            }
            if (rotationAngle == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rotationAngle=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rotationAngle" + "}", apiInvoker.ToPathValue(rotationAngle));
            }
            if (url == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])url=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "url" + "}", apiInvoker.ToPathValue(url));
            }
            if (file != null)
            {
                if (file is byte[])
                {
                    var docFile = new FileInfo();
                    docFile.file     = file;
                    docFile.MimeType = "application/octet-stream";
                    formParams.Add("file", docFile);
                }
                else
                {
                    //string paramStr = (file is DateTime) ? ((DateTime)(object)file).ToString("u") : Convert.ToString(file);
                    string paramStr = Convert.ToString(file);
                    formParams.Add("file", paramStr);
                }
            }
            try {
                if (typeof(BarcodeResponseList) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "POST", queryParams, null, headerParams, formParams);
                    return((BarcodeResponseList)ApiInvoker.deserialize(response, typeof(BarcodeResponseList)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "POST", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((BarcodeResponseList)ApiInvoker.deserialize(response, typeof(BarcodeResponseList)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #26
0
        /// <summary>
        /// Get previous quotes in time buckets.
        /// </summary>
        /// <param name="symbol">Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series.</param>
        /// <param name="filter">Generic table filter. Send JSON key/value pairs, such as {&quot;key&quot;: &quot;value&quot;}.</param>
        /// <param name="columns">Array of column names to fetch. If omitted, will return all columns. Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.</param>
        /// <param name="start">Starting point for results.</param>
        /// <param name="reverse">If true, will sort results newest first.</param>
        /// <param name="startTime">Starting date filter for results.</param>
        /// <param name="endTime">Ending date filter for results.</param>
        /// <param name="binSize">Time interval to bucket by. Available options: ['30s', '1m', '5m', '1h', '1d'].</param>
        /// <param name="count">Number of results to fetch.</param>
        /// <returns></returns>
        public List <Quote> getBucketed(string symbol, object filter, List <string> columns, double?start, bool?reverse, DateTime?startTime, DateTime?endTime, string binSize, double?count)
        {
            // create path and map variables
            var path = "/quote/bucketed".Replace("{format}", "json");

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

            if (binSize != null)
            {
                string paramStr = (binSize is DateTime) ? ((DateTime)(object)binSize).ToString("u") : Convert.ToString(binSize);
                queryParams.Add("binSize", paramStr);
            }
            if (symbol != null)
            {
                string paramStr = (symbol is DateTime) ? ((DateTime)(object)symbol).ToString("u") : Convert.ToString(symbol);
                queryParams.Add("symbol", paramStr);
            }
            if (filter != null)
            {
                string paramStr = (filter is DateTime) ? ((DateTime)(object)filter).ToString("u") : Convert.ToString(filter);
                queryParams.Add("filter", paramStr);
            }
            if (columns != null)
            {
                string paramStr = (columns is DateTime) ? ((DateTime)(object)columns).ToString("u") : Convert.ToString(columns);
                queryParams.Add("columns", paramStr);
            }
            if (count != null)
            {
                string paramStr = (count is DateTime) ? ((DateTime)(object)count).ToString("u") : Convert.ToString(count);
                queryParams.Add("count", paramStr);
            }
            if (start != null)
            {
                string paramStr = (start is DateTime) ? ((DateTime)(object)start).ToString("u") : Convert.ToString(start);
                queryParams.Add("start", paramStr);
            }
            if (reverse != null)
            {
                string paramStr = (reverse is DateTime) ? ((DateTime)(object)reverse).ToString("u") : Convert.ToString(reverse);
                queryParams.Add("reverse", paramStr);
            }
            if (startTime != null)
            {
                string paramStr = (startTime is DateTime) ? ((DateTime)(object)startTime).ToString("u") : Convert.ToString(startTime);
                queryParams.Add("startTime", paramStr);
            }
            if (endTime != null)
            {
                string paramStr = (endTime is DateTime) ? ((DateTime)(object)endTime).ToString("u") : Convert.ToString(endTime);
                queryParams.Add("endTime", paramStr);
            }
            try {
                if (typeof(List <Quote>) == typeof(byte[]))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    return(((object)response) as List <Quote>);
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((List <Quote>)ApiInvoker.deserialize(response, typeof(List <Quote>)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #27
0
        /// <summary>
        /// Create a new API Key. API Keys can also be created via&lt;a href=&quot;https://github.com/BitMEX/market-maker/blob/master/generate-api-key.py&quot;&gt;this Python script&lt;/a&gt;.
        /// </summary>
        /// <param name="name">Key name. This name is for reference only.</param>
        /// <param name="cidr">CIDR block to restrict this key to. To restrict to a single address, append &quot;/32&quot;, e.g. 207.39.29.22/32. Leave blank or set to 0.0.0.0/0 to allow all IPs. Only one block may be set. &lt;a href=&quot;http://software77.net/cidr-101.html&quot;&gt;More on CIDR blocks&lt;/a&gt;</param>
        /// <param name="enabled">Set to true to enable this key on creation. Otherwise, it must be explicitly enabled via /apiKey/enable.</param>
        /// <returns></returns>
        public ApiKey createKey(string name, string cidr, bool?enabled)
        {
            // create path and map variables
            var path = "/apiKey".Replace("{format}", "json");

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

            if (name != null)
            {
                if (name is byte[])
                {
                    formParams.Add("name", name);
                }
                else
                {
                    string paramStr = (name is DateTime) ? ((DateTime)(object)name).ToString("u") : Convert.ToString(name);
                    formParams.Add("name", paramStr);
                }
            }
            if (cidr != null)
            {
                if (cidr is byte[])
                {
                    formParams.Add("cidr", cidr);
                }
                else
                {
                    string paramStr = (cidr is DateTime) ? ((DateTime)(object)cidr).ToString("u") : Convert.ToString(cidr);
                    formParams.Add("cidr", paramStr);
                }
            }
            if (enabled != null)
            {
                if (enabled is byte[])
                {
                    formParams.Add("enabled", enabled);
                }
                else
                {
                    string paramStr = (enabled is DateTime) ? ((DateTime)(object)enabled).ToString("u") : Convert.ToString(enabled);
                    formParams.Add("enabled", paramStr);
                }
            }
            try {
                if (typeof(ApiKey) == typeof(byte[]))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, path, "GET", queryParams, null, headerParams, formParams);
                    return(((object)response) as ApiKey);
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((ApiKey)ApiInvoker.deserialize(response, typeof(ApiKey)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #28
0
        /// <summary>
        /// Generate image with multiple barcodes and put new file on server Generate image with multiple barcodes and put new file on server
        /// </summary>
        /// <param name="name"></param>
        /// <param name="format"></param>
        /// <param name="folder"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public SaaSposeResponse PutGenerateMultiple(string name, string format, string folder, BarcodeBuilders body)
        {
            // create path and map variables
            var ResourcePath = "/barcode/{name}/generateMultiple/?appSid={appSid}&amp;toFormat={toFormat}&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 || body == 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 (format == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])format=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "format" + "}", apiInvoker.ToPathValue(format));
            }
            if (folder == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder));
            }
            //if (file != null){
            // if(file is byte[]) {

            //     var docFile = new FileInfo();
            //     docFile.file = file;
            //     docFile.MimeType = "application/octet-stream";
            //     formParams.Add("file", docFile);
            // } else {
            //   //string paramStr = (file is DateTime) ? ((DateTime)(object)file).ToString("u") : Convert.ToString(file);
            //    string paramStr = Convert.ToString(file);
            //   formParams.Add("file", paramStr);
            // }
            //}
            try {
                if (typeof(SaaSposeResponse) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "PUT", queryParams, null, headerParams, formParams);
                    return((SaaSposeResponse)ApiInvoker.deserialize(response, typeof(SaaSposeResponse)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "PUT", queryParams, body, headerParams, formParams);
                    if (response != null)
                    {
                        return((SaaSposeResponse)ApiInvoker.deserialize(response, typeof(SaaSposeResponse)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #29
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;
                }
            }
        }
Пример #30
0
        /// <summary>
        /// Generate barcode and save on server. Generate barcode and save on server.
        /// </summary>
        /// <param name="name"></param>
        /// <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="codeLocation"></param>
        /// <param name="grUnit"></param>
        /// <param name="autoSize"></param>
        /// <param name="barHeight"></param>
        /// <param name="imageHeight"></param>
        /// <param name="imageWidth"></param>
        /// <param name="imageQuality"></param>
        /// <param name="rotAngle"></param>
        /// <param name="topMargin"></param>
        /// <param name="bottomMargin"></param>
        /// <param name="leftMargin"></param>
        /// <param name="rightMargin"></param>
        /// <param name="enableChecksum"></param>
        /// <param name="storage"></param>
        /// <param name="folder"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public SaaSposeResponse PutBarcodeGenerateFile(string name, string text, string type, string format, float?resolutionX, float?resolutionY, float?dimensionX, float?dimensionY, string codeLocation, string grUnit, string autoSize, float?barHeight, float?imageHeight, float?imageWidth, string imageQuality, float?rotAngle, float?topMargin, float?bottomMargin, float?leftMargin, float?rightMargin, string enableChecksum, string storage, string folder, byte[] file)
        {
            // create path and map variables
            var ResourcePath = "/barcode/{name}/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;codeLocation={codeLocation}&amp;grUnit={grUnit}&amp;autoSize={autoSize}&amp;barHeight={barHeight}&amp;imageHeight={imageHeight}&amp;imageWidth={imageWidth}&amp;imageQuality={imageQuality}&amp;rotAngle={rotAngle}&amp;topMargin={topMargin}&amp;bottomMargin={bottomMargin}&amp;leftMargin={leftMargin}&amp;rightMargin={rightMargin}&amp;enableChecksum={enableChecksum}&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 (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 (codeLocation == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])codeLocation=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "codeLocation" + "}", apiInvoker.ToPathValue(codeLocation));
            }
            if (grUnit == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])grUnit=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "grUnit" + "}", apiInvoker.ToPathValue(grUnit));
            }
            if (autoSize == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])autoSize=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "autoSize" + "}", apiInvoker.ToPathValue(autoSize));
            }
            if (barHeight == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])barHeight=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "barHeight" + "}", apiInvoker.ToPathValue(barHeight));
            }
            if (imageHeight == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])imageHeight=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "imageHeight" + "}", apiInvoker.ToPathValue(imageHeight));
            }
            if (imageWidth == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])imageWidth=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "imageWidth" + "}", apiInvoker.ToPathValue(imageWidth));
            }
            if (imageQuality == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])imageQuality=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "imageQuality" + "}", apiInvoker.ToPathValue(imageQuality));
            }
            if (rotAngle == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rotAngle=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rotAngle" + "}", apiInvoker.ToPathValue(rotAngle));
            }
            if (topMargin == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])topMargin=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "topMargin" + "}", apiInvoker.ToPathValue(topMargin));
            }
            if (bottomMargin == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])bottomMargin=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "bottomMargin" + "}", apiInvoker.ToPathValue(bottomMargin));
            }
            if (leftMargin == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])leftMargin=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "leftMargin" + "}", apiInvoker.ToPathValue(leftMargin));
            }
            if (rightMargin == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])rightMargin=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "rightMargin" + "}", apiInvoker.ToPathValue(rightMargin));
            }
            if (enableChecksum == null)
            {
                ResourcePath = Regex.Replace(ResourcePath, @"([&?])enableChecksum=", "");
            }
            else
            {
                ResourcePath = ResourcePath.Replace("{" + "enableChecksum" + "}", apiInvoker.ToPathValue(enableChecksum));
            }
            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));
            }
            if (file != null)
            {
                if (file is byte[])
                {
                    var docFile = new FileInfo();
                    docFile.file     = file;
                    docFile.MimeType = "application/octet-stream";
                    formParams.Add("file", docFile);
                }
                else
                {
                    //string paramStr = (file is DateTime) ? ((DateTime)(object)file).ToString("u") : Convert.ToString(file);
                    string paramStr = Convert.ToString(file);
                    formParams.Add("file", paramStr);
                }
            }
            try {
                if (typeof(SaaSposeResponse) == typeof(ResponseMessage))
                {
                    var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "PUT", queryParams, null, headerParams, formParams);
                    return((SaaSposeResponse)ApiInvoker.deserialize(response, typeof(SaaSposeResponse)));
                }
                else
                {
                    var response = apiInvoker.invokeAPI(basePath, ResourcePath, "PUT", queryParams, null, headerParams, formParams);
                    if (response != null)
                    {
                        return((SaaSposeResponse)ApiInvoker.deserialize(response, typeof(SaaSposeResponse)));
                    }
                    else
                    {
                        return(null);
                    }
                }
            } catch (ApiException ex) {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }
                else
                {
                    throw ex;
                }
            }
        }