예제 #1
0
        public static string GetContactList(string username, string password, Guid?productId = null)
        {
            string method = "Contact_GetContactList";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #2
0
        public static string GetLoginInfo(string username, string password)
        {
            string method = "Security_GetLoginInfo";
            var    http   = FaxInterfaceRaw.GetHttp(username, password);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #3
0
        /// <summary>
        /// ProductType can be FaxForward, BroadcastFax, FaxRelay
        /// </summary>
        public static string GetProductList(string username, string password)
        {
            string method = "Profile_GetProductList";
            var    http   = FaxInterfaceRaw.GetHttp(username, password);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #4
0
        /// <summary>
        /// Detail of product with counts
        /// </summary>
        public static string GetF2EProductDetail(string username, string password, Guid productId)
        {
            string method = "Profile_GetF2EProductDetail";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #5
0
        /// <summary>
        /// Create a Fax Tiff, and send it back in the format we want.
        /// </summary>
        public static string ConvertToFaxDocument(string username, string password,
                                                  byte[] fileContent, string fileName, string faxQuality = "Fine", string format = "png")
        {
            string method = "Fax_ConvertToFaxDocument";
            var    http   = FaxInterfaceRaw.GetHttp(username, password);

            //Add the files collection
            //Required
            if (fileName == null)
            {
                fileName = "FaxDocument";
            }
            http.AddPostFile("Files1", fileContent, fileName);

            if (!String.IsNullOrEmpty(faxQuality))
            {
                http.AddPostKey("FaxQuality", faxQuality);
            }                                                                                //Optional
            if (!String.IsNullOrEmpty(format))
            {
                http.AddPostKey("Format", format);
            }                                                                   //Optional

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #6
0
        public static string Authenticate(string username, string password, Guid?productId = null)
        {
            string method = "Security_Authenticate";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #7
0
        /// <summary>
        /// ProductType can be FaxForward, BroadcastFax, FaxRelay.
        /// </summary>
        public static string GetAccountInfo(string username, string password, Guid?productId = null)
        {
            string method = "Profile_GetAccountInfo";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #8
0
        /// <summary>
        /// Create a Fax Tiff, and send it back in the format we want.
        /// </summary>
        public static string ConvertToFaxDocument(string username, string password,
                                                  HttpFileCollection files, string faxQuality = "Fine", string format = "png")
        {
            string method = "Fax_ConvertToFaxDocument";
            var    http   = FaxInterfaceRaw.GetHttp(username, password);

            //Add the files collection
            //Required
            for (int i = 0; i < files.Count; i++)
            {
                byte[] lcFile = new byte[files[i].ContentLength];
                files[i].InputStream.Read(lcFile, 0, (int)files[i].InputStream.Length);
                http.AddPostFile("Files" + (i + 1).ToString(), lcFile, files[i].FileName);
            }

            if (!String.IsNullOrEmpty(faxQuality))
            {
                http.AddPostKey("FaxQuality", faxQuality);
            }                                                                                //Optional
            if (!String.IsNullOrEmpty(format))
            {
                http.AddPostKey("Format", format);
            }                                                                   //Optional

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #9
0
        /// <summary>
        /// Get the products that have faxes matching the given filter.  Usually used to
        /// determine if there are faxes waiting for download, and what products may have them.
        /// </summary>
        public static string GetProductsWithInboundFaxes(string username, string password, string filter = "None")
        {
            string method = "Fax_GetProductsWithInboundFaxes";
            var    http   = FaxInterfaceRaw.GetHttp(username, password);

            http.AddPostKey("Filter", filter);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #10
0
        /// <summary>
        /// Get the fax statuses
        /// </summary>
        public static string GetBroadcastFaxStatus(string username, string password, Guid productId, List <Guid> ids)
        {
            string method = "Fax_GetBroadcastFaxStatus";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            //Put them on the http object
            Common.wwHttpHelper.AddParameterList <Guid>(http, ids, "Ids");

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #11
0
        /// <summary>
        /// Get the requested Faxes
        /// </summary>
        public static string GetFaxDescriptions(string username, string password, Guid productId, List <FaxIdItem> items)
        {
            string method = "Fax_GetFaxDescriptionsUsingIds";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            //Put them on the http object
            Common.wwHttpHelper.AddParameterList <FaxIdItem>(http, items, "FaxIds");

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #12
0
        /// <summary>
        /// Get The outbound Faxes
        /// </summary>
        public static string GetOutboundFaxDescriptions(string username, string password, Guid productId)
        {
            string method = "Fax_GetFaxDescriptions";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            http.AddPostKey("StartDate", DateTime.Now.AddDays(-32).ToShortDateString());
            http.AddPostKey("FaxDirection", "Outbound");

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #13
0
        /// <summary>
        /// Changes the filter value to prevent them from showing -  Filter can
        /// "Removed" = deleted
        /// "Retrieved" = read
        /// "None" = unread (reset)
        /// This is an unauthenticated method.
        /// </summary>
        public static string ChangeFaxFilterValue(string username, string password, Guid productId, List <FaxIdItem> items, string filter = "Retrieved")
        {
            string method = "Fax_ChangeFaxFilterValue";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            //Put them on the http object
            Common.wwHttpHelper.AddParameterList <FaxIdItem>(http, items, "FaxIds");
            //Add the filter value
            http.AddPostKey("Filter", filter);

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #14
0
        /// <summary>
        /// Re-sends the notification for an inbound fax just as when it was first sent. Only for inbound faxes.
        /// </summary>
        public static string ResendFaxNotification(string username, string password, Guid productId, FaxIdItem item)
        {
            string method = "Fax_ResendFaxNotification";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            //Put them on the http object
            Common.wwHttpHelper.AddParameterList <FaxIdItem>(http, new List <FaxIdItem>()
            {
                item
            }, "FaxIds");

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #15
0
        /// <summary>
        /// Send the fax as an email.  Works on inbound and outbound faxes.
        /// </summary>
        public static string SendFaxAsEmail(string username, string password, Guid productId, FaxIdItem item, string emailAddress)
        {
            string method = "Fax_SendFaxAsEmail";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            http.AddPostKey("FeedbackEmail", emailAddress);

            //Put them on the http object
            Common.wwHttpHelper.AddParameterList <FaxIdItem>(http, new List <FaxIdItem>()
            {
                item
            }, "FaxIds");

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #16
0
        public static string Ping(string pingStr)
        {
            string method = "Security_Ping";
            var    http   = FaxInterfaceRaw.GetHttp(null, null, null);

            List <string> arg = new List <string>()
            {
                pingStr
            };

            //Put them on the http object
            Common.wwHttpHelper.AddParameterList <string>(http, arg, "StringParams");

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #17
0
        /// <summary>
        /// Send a Fax now.
        /// Fax quality is Fine or Normal.
        /// </summary>
        public static string SendFax(string username, string password, Guid productId,
                                     List <string> numbers, List <string> filePaths,
                                     string csid, string ani, DateTime?startDate = null, string faxQuality = "Fine",
                                     string jobname       = "", string header = "", string billingCode = "",
                                     string feedbackEmail = null, string callbackUrl = null, List <string> custKeys1 = null)
        {
            //Username : <input name="Username" type="text" value="<?php print $username; ?>"><br>
            //Password : <input name="Password" type="text" value="<?php print $password; ?>"><br>
            //ProductId : <input name="ProductId" type="text" value="<?php print $prodid;?>"><br>
            //Number 1 : <input name="Numbers1" type="text" value="8002075529"><br>
            //Number 2 : <input name="Numbers2" type="text" value="8002075529"><br>
            //JobName : <input name="JobName" type="text" value="Test 1234"><br>
            //Header : <input name="Header" type="text" value="Test Header"><br>
            //Billing Code : <input name="BillingCode" type="text" value="Billing Code 123"><br>
            //Csid : <input name="CSID" type="text" value="My Company 1234567890"><br>
            //Quality : <input name="FaxQuality" type="text" value="Normal"><br>
            //Start : <input name="StartDate" type="text" value="6/1/2015"><br>
            //Feedback : <input name="FeedbackEmail" type="text" value="<?php print $feedback;?>"><br>
            //File 1 : <input name="Files1" type="file"><br>
            //File 2 : <input name="Files2" type="file"><br>

            string method = "Fax_SendFax";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            //Add the numbers collection
            Common.wwHttpHelper.AddParameterList(http, numbers, "Numbers"); //Required

            //These will get tacked on to the CustomerKey1
            //Make sure the Names and numbers collections are the same.  Otherwise don't include.
            if (custKeys1 != null && custKeys1.Count == numbers.Count)
            {
                Common.wwHttpHelper.AddParameterList(http, custKeys1, "StringParams"); //Not Required
            }

            //Add the files collection
            //Required
            int counter = 0;

            foreach (var file in filePaths)
            {
                if (!System.IO.File.Exists(file))
                {
                    return(Common.JSONSerializerHelper.SerializeToString(new Models.ApiResult <string>(false, "File does not exist.", "")));
                }
                //Get the bytes from the file.
                var content = System.IO.File.ReadAllBytes(file);
                //Get the fileName from the file.
                var filename = System.IO.Path.GetFileName(file);
                //Add it to the post collection
                counter++;
                http.AddPostFile("Files" + counter.ToString(), content, filename);
            }

            http.AddPostKey("JobName", jobname ?? "");         //Required
            http.AddPostKey("Header", header ?? "");           //Required
            http.AddPostKey("BillingCode", billingCode ?? ""); //Required

            if (!String.IsNullOrEmpty(csid))
            {
                http.AddPostKey("CSID", csid);
            }                                                              //Optional
            if (!String.IsNullOrEmpty(ani))
            {
                http.AddPostKey("ANI", ani);
            }                                                           //Optional
            if (startDate.HasValue)
            {
                http.AddPostKey("StartDate", startDate.Value.ToString("G"));
            }                                                                                   //Optional
            if (!String.IsNullOrEmpty(faxQuality))
            {
                http.AddPostKey("FaxQuality", faxQuality);
            }                                                                                //Optional
            if (!String.IsNullOrEmpty(feedbackEmail))
            {
                http.AddPostKey("FeedbackEmail", feedbackEmail);
            }                                                                                         //Optional
            if (!String.IsNullOrEmpty(callbackUrl))
            {
                http.AddPostKey("CallbackUrl", callbackUrl);
            }                                                                                   //Optional

            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }
예제 #18
0
        /// <summary>
        /// Send a Fax now.
        /// Fax quality is Fine or Normal.
        /// </summary>
        public static string SendFax(string username, string password, Guid productId,
                                     List <string> numbers, byte[] fileContent, string fileName,
                                     string csid, string ani, DateTime?startDate = null, string faxQuality = "Fine",
                                     string jobname       = "", string header = "", string billingCode = "",
                                     string feedbackEmail = null, string callbackUrl = null, List <string> custKeys1 = null)
        {
            //Username : <input name="Username" type="text" value="<?php print $username; ?>"><br>
            //Password : <input name="Password" type="text" value="<?php print $password; ?>"><br>
            //ProductId : <input name="ProductId" type="text" value="<?php print $prodid;?>"><br>
            //Number 1 : <input name="Numbers1" type="text" value="8002075529"><br>
            //Number 2 : <input name="Numbers2" type="text" value="8002075529"><br>
            //JobName : <input name="JobName" type="text" value="Test 1234"><br>
            //Header : <input name="Header" type="text" value="Test Header"><br>
            //Billing Code : <input name="BillingCode" type="text" value="Billing Code 123"><br>
            //Csid : <input name="CSID" type="text" value="My Company 1234567890"><br>
            //Quality : <input name="FaxQuality" type="text" value="Normal"><br>
            //Start : <input name="StartDate" type="text" value="6/1/2015"><br>
            //Feedback : <input name="FeedbackEmail" type="text" value="<?php print $feedback;?>"><br>
            //File 1 : <input name="Files1" type="file"><br>
            //File 2 : <input name="Files2" type="file"><br>

            string method = "Fax_SendFax";
            var    http   = FaxInterfaceRaw.GetHttp(username, password, productId);

            //Add the numbers collection
            Common.wwHttpHelper.AddParameterList(http, numbers, "Numbers"); //Required

            //These will get tacked on to the CustomerKey1
            //Make sure the Names and numbers collections are the same.  Otherwise don't include.
            if (custKeys1 != null && custKeys1.Count == numbers.Count)
            {
                Common.wwHttpHelper.AddParameterList(http, custKeys1, "StringParams"); //Not Required
            }

            //Add the files collection
            //Required
            if (fileName == null)
            {
                fileName = "FaxDocument.pdf";
            }
            http.AddPostFile("Files1", fileContent, fileName);

            http.AddPostKey("JobName", jobname);         //Required
            http.AddPostKey("Header", header);           //Required
            http.AddPostKey("BillingCode", billingCode); //Required

            if (!String.IsNullOrEmpty(csid))
            {
                http.AddPostKey("CSID", csid);
            }                                                              //Optional
            if (!String.IsNullOrEmpty(ani))
            {
                http.AddPostKey("ANI", ani);
            }                                                           //Optional
            if (startDate.HasValue)
            {
                http.AddPostKey("StartDate", startDate.Value.ToString("G"));
            }                                                                                   //Optional
            if (!String.IsNullOrEmpty(faxQuality))
            {
                http.AddPostKey("FaxQuality", faxQuality);
            }                                                                                //Optional
            if (!String.IsNullOrEmpty(feedbackEmail))
            {
                http.AddPostKey("FeedbackEmail", feedbackEmail);
            }                                                                                         //Optional
            if (!String.IsNullOrEmpty(callbackUrl))
            {
                http.AddPostKey("CallbackUrl", callbackUrl);
            }                                                                                   //Optional


            return(FaxInterfaceRaw.GetResponseStr(http, String.Format(FaxInterfaceRaw.RestUrlTemplate, method)));
        }