Example #1
0
        /// <summary>
        /// Get specific product https://apidocs.unleashedsoftware.com/Products
        /// </summary>
        /// <returns>ApiResponse with product</returns>
        public ApiResponse GetProduct(Guid guid)
        {
            var uri     = $"Products/{guid}";
            var headers = UnleashedApiHelpers.GetAuthenticationHeaders(ApiClient.BuildRequestFullUri(uri));

            return(ApiClient.Get(uri, headers));
        }
Example #2
0
        /// <summary>
        /// Get specific product by product code https://apidocs.unleashedsoftware.com/Products
        /// </summary>
        /// <returns>ApiResponse with product</returns>
        public ApiResponse GetProduct(string productCode)
        {
            var uri     = $"Products?productCode={productCode}";
            var headers = UnleashedApiHelpers.GetAuthenticationHeaders(ApiClient.BuildRequestFullUri(uri));

            return(ApiClient.Get(uri, headers));
        }
Example #3
0
        /// <summary>
        /// Obsolete existing product https://apidocs.unleashedsoftware.com/Products
        /// </summary>
        /// <returns>ApiResponse indicating if call was successful</returns>
        public ApiResponse ObsoleteProduct(Guid guid)
        {
            var    uri      = $"/Products/Obsolete/{guid}";
            var    headers  = UnleashedApiHelpers.GetAuthenticationHeaders(ApiClient.BuildRequestFullUri(uri));
            string postData = JsonHelper.Serialize(new Dictionary <string, string> {
            });

            return(ApiClient.Post(uri, postData, headers));
        }
Example #4
0
        /// <summary>
        /// Update existing product https://apidocs.unleashedsoftware.com/Products
        /// </summary>
        /// <returns>ApiResponse indicating if call was successful</returns>
        public ApiResponse UpdateProduct(string guid, string productCode, string productDescription)
        {
            var    uri      = $"Products/{guid}";
            var    headers  = UnleashedApiHelpers.GetAuthenticationHeaders(ApiClient.BuildRequestFullUri(uri));
            string postData = JsonHelper.Serialize(new Dictionary <string, string> {
                { "Guid", guid }, { "ProductCode", productCode }, { "ProductDescription", productDescription }
            });

            return(ApiClient.Post(uri, postData, headers));
        }
Example #5
0
        /// <summary>
        /// Add a new customer https://apidocs.unleashedsoftware.com/Customers
        /// </summary>
        /// <returns>ApiResponse indicating if call was successful</returns>
        public ApiResponse AddCustomer(string customerCode, string customerName)
        {
            var    guid     = Guid.NewGuid();
            var    uri      = $"Customers/{guid}";
            var    headers  = UnleashedApiHelpers.GetAuthenticationHeaders(ApiClient.BuildRequestFullUri(uri));
            string postData = JsonHelper.Serialize(new Dictionary <string, string> {
                { "Guid", guid.ToString() }, { "CustomerCode", customerCode }, { "CustomerName", customerName }
            });

            return(ApiClient.Post(uri, postData, headers));
        }