diff --git a/.vs/WHMCS API/v15/.suo b/.vs/WHMCS API/v15/.suo index 30ea27154fb64af3c7ccd6f657c295d5c472f727..3c0eaff3b6cc7be23211bcc17f87cb0e35d5d34f 100644 Binary files a/.vs/WHMCS API/v15/.suo and b/.vs/WHMCS API/v15/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 77d26f0df43e1b9d700c25aa381541df576087a0..993f137056df00f8eda11c3def4f5e178fa3589d 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/API.cs b/API.cs index 3a500510faae40c42e3e36ad07c1f05c0fd7ad72..d88a3b56f13b45b39c45c8a6762854ddc0cdd3d8 100644 --- a/API.cs +++ b/API.cs @@ -26,7 +26,7 @@ namespace WHMCS_API /// Returns the result of the call /// The userid string for the session Session["uid"] /// The passwordhash for the session Session["upw"] - public ValidateLogin ValidateLogin(string Email, string Password) + public ValidateLogin.ValidateLogin ValidateLogin(string Email, string Password) { NameValueCollection data = new NameValueCollection() { @@ -35,7 +35,7 @@ namespace WHMCS_API { EnumUtil.GetString(APIEnums.ValidateLoginParams.Password), Password } }; - return JsonConvert.DeserializeObject(_call.MakeCall(data)); + return JsonConvert.DeserializeObject(_call.MakeCall(data)); } /// @@ -96,7 +96,7 @@ namespace WHMCS_API /// The client Email to search /// Get extended stats for the client /// All details of the client - public GetClientsDetails GetClientsDetails(int ClientID = -1, string ClientEmail = "", bool Stats = false) + public GetClientsDetails.GetClientsDetails GetClientsDetails(int ClientID = -1, string ClientEmail = "", bool Stats = false) { if (ClientID == -1 && ClientEmail == "") throw new Exception("ClientID or ClientEmail needed"); @@ -114,11 +114,10 @@ namespace WHMCS_API string req = _call.MakeCall(data); JObject result = JObject.Parse(req); if (result["result"].ToString() == "success") - return JsonConvert.DeserializeObject(req); + return JsonConvert.DeserializeObject(req); else throw new Exception("An API Error occurred", new Exception(result["message"].ToString())); } -<<<<<<< HEAD /// /// Get the orders (for all clients/specific client/specific order/specific status) @@ -129,7 +128,7 @@ namespace WHMCS_API /// Find orders for a specific client id /// Find orders for a specific status /// In a modelm, total results, start number, the number of results returned - public GetOrders GetOrders(int LimitStart = 0, int LimitNumber = 25, int OrderID = -1, int UserID = -1, string Status = "") + public GetOrders.GetOrders GetOrders(int LimitStart = 0, int LimitNumber = 25, int OrderID = -1, int UserID = -1, string Status = "") { NameValueCollection data = new NameValueCollection() { @@ -144,10 +143,10 @@ namespace WHMCS_API if (Status != "") data.Add(EnumUtil.GetString(APIEnums.GetOrdersParams.Status), Status); - return JsonConvert.DeserializeObject(_call.MakeCall(data)); + return JsonConvert.DeserializeObject(_call.MakeCall(data)); } - public GetTransactions GetTransactions(int InvoiceID = -1, int ClientID = -1, string TransactionID = "") + public GetTransactions.GetTransactions GetTransactions(int InvoiceID = -1, int ClientID = -1, string TransactionID = "") { NameValueCollection data = new NameValueCollection() { @@ -160,9 +159,31 @@ namespace WHMCS_API if (TransactionID != "") data.Add(EnumUtil.GetString(APIEnums.GetTransactionsParams.TransactionID), TransactionID); - return JsonConvert.DeserializeObject(_call.MakeCall(data)); + return JsonConvert.DeserializeObject(_call.MakeCall(data)); + } + + public string GetClientsProducts(int LimitStart = 0, int LimitNum = 25, int ClientID = -1, int ServiceID = -1, int ProductID = -1, string Domain = "", string Username = "") + { + NameValueCollection data = new NameValueCollection() + { + { "action", APIEnums.Actions.GetClientsProducts.ToString() }, + { EnumUtil.GetString(APIEnums.GetClientsProductsParams.ResultsStartOffset), LimitStart.ToString()}, + { EnumUtil.GetString(APIEnums.GetClientsProductsParams.ResultsLimit), LimitNum.ToString()}, + }; + + if (ClientID != -1) + data.Add(EnumUtil.GetString(APIEnums.GetClientsProductsParams.ClientID), ClientID.ToString()); + if (ServiceID != -1) + data.Add(EnumUtil.GetString(APIEnums.GetClientsProductsParams.ServiceID), ServiceID.ToString()); + if (ProductID != -1) + data.Add(EnumUtil.GetString(APIEnums.GetClientsProductsParams.ProductID), ProductID.ToString()); + if (Domain != "") + data.Add(EnumUtil.GetString(APIEnums.GetClientsProductsParams.Domain), Domain); + if (Username != "") + data.Add(EnumUtil.GetString(APIEnums.GetClientsProductsParams.Username), Username); + + return _call.MakeCall(data); + //return JsonConvert.DeserializeObject(_call.MakeCall(data)); } -======= ->>>>>>> origin/master } } diff --git a/Enums.cs b/Enums.cs index 9c9a61fbdea529de6d99c2be6513e785ff3083d7..b2da36f3dfd38cf015307759b99e8ef63912690c 100644 --- a/Enums.cs +++ b/Enums.cs @@ -59,7 +59,6 @@ namespace WHMCS_API [StringValue("stats")] Stats } -<<<<<<< HEAD public enum GetOrdersParams { [StringValue("limitstart")] LimitStart, @@ -76,8 +75,17 @@ namespace WHMCS_API [StringValue("transid")] TransactionID } -======= ->>>>>>> origin/master + public enum GetClientsProductsParams + { + [StringValue("limitstart")] ResultsStartOffset, + [StringValue("limitnum")] ResultsLimit, + [StringValue("clientid")] ClientID, + [StringValue("serviceid")] ServiceID, + [StringValue("pid")] ProductID, + [StringValue("domain")] Domain, + [StringValue("username2")] Username + } + /// /// Actions Supported by the WHMCS API that are implemented in this Wrapper /// @@ -86,13 +94,10 @@ namespace WHMCS_API [StringValue("ValidateLogin")] ValidateLogin, [StringValue("DomainWhois")] DomainWhois, [StringValue("AddClient")] AddClient, -<<<<<<< HEAD [StringValue("GetClientsDetails")] GetClientsDetails, [StringValue("GetOrders")] GetOrders, - [StringValue("GetTransactions")] GetTransactions -======= - [StringValue("GetClientsDetails")] GetClientsDetails ->>>>>>> origin/master + [StringValue("GetTransactions")] GetTransactions, + [StringValue("GetClientsProducts")] GetClientsProducts } } diff --git a/GetClientsDetails.cs b/GetClientsDetails.cs index 8deccda6dac9c76a2b7794e2687fc8b5c1c77eb0..4acb49e0d3e687fa95ba2b0947900680fb084491 100644 --- a/GetClientsDetails.cs +++ b/GetClientsDetails.cs @@ -5,7 +5,7 @@ using System.IO; using System.Linq; using System.Text; -namespace WHMCS_API +namespace WHMCS_API.GetClientsDetails { public class Client { diff --git a/GetClientsProducts.cs b/GetClientsProducts.cs new file mode 100644 index 0000000000000000000000000000000000000000..c993e3e8f4ce8742cc0a8be35a812d9d10f5fc34 --- /dev/null +++ b/GetClientsProducts.cs @@ -0,0 +1,185 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WHMCS_API.GetClientsProducts +{ + public class Customfields + { + + [JsonProperty("customfield")] + public IList CustomField { get; set; } + } + + public class Configoptions + { + + [JsonProperty("configoption")] + public IList ConfigOption { get; set; } + } + + public class Product + { + + [JsonProperty("id")] + public string ID { get; set; } + + [JsonProperty("clientid")] + public string ClientID { get; set; } + + [JsonProperty("orderid")] + public string OrderID { get; set; } + + [JsonProperty("pid")] + public string ProductID { get; set; } + + [JsonProperty("regdate")] + public string RegistryDate { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("translated_name")] + public string TranslatedName { get; set; } + + [JsonProperty("groupname")] + public string GroupName { get; set; } + + [JsonProperty("translated_groupname")] + public string TranslatedGroupName { get; set; } + + [JsonProperty("domain")] + public string Domain { get; set; } + + [JsonProperty("dedicatedip")] + public string DedicatedIP { get; set; } + + [JsonProperty("serverid")] + public string ServerID { get; set; } + + [JsonProperty("servername")] + public string ServerName { get; set; } + + [JsonProperty("serverip")] + public string ServerIP { get; set; } + + [JsonProperty("serverhostname")] + public string ServerHostname { get; set; } + + [JsonProperty("suspensionreason")] + public string SuspensionReason { get; set; } + + [JsonProperty("firstpaymentamount")] + public string FirstPaymentAmount { get; set; } + + [JsonProperty("recurringamount")] + public string RecurringAmount { get; set; } + + [JsonProperty("paymentmethod")] + public string PaymentMethod { get; set; } + + [JsonProperty("paymentmethodname")] + public string PaymentMethodName { get; set; } + + [JsonProperty("billingcycle")] + public string BillingCycle { get; set; } + + [JsonProperty("nextduedate")] + public string NextDueDate { get; set; } + + [JsonProperty("status")] + public string Status { get; set; } + + [JsonProperty("username")] + public string username { get; set; } + + [JsonProperty("password")] + public string Username { get; set; } + + [JsonProperty("subscriptionid")] + public string Subscription { get; set; } + + [JsonProperty("promoid")] + public string PromotionID { get; set; } + + [JsonProperty("overideautosuspend")] + public string OverideAutoSuspend { get; set; } + + [JsonProperty("overidesuspenduntil")] + public string OverideSuspendUntil { get; set; } + + [JsonProperty("ns1")] + public string Nameserver1 { get; set; } + + [JsonProperty("ns2")] + public string Nameserver2 { get; set; } + + [JsonProperty("assignedips")] + public string AssignedIPs { get; set; } + + [JsonProperty("notes")] + public string Notes { get; set; } + + [JsonProperty("diskusage")] + public string DiskUsage { get; set; } + + [JsonProperty("disklimit")] + public string DiskLimit { get; set; } + + [JsonProperty("bwusage")] + public string BandwithUsage { get; set; } + + [JsonProperty("bwlimit")] + public string BandwithLimit { get; set; } + + [JsonProperty("lastupdate")] + public string LastUpdate { get; set; } + + [JsonProperty("customfields")] + public Customfields CustomFields { get; set; } + + [JsonProperty("configoptions")] + public Configoptions ConfigOptions { get; set; } + } + + public class Products + { + + [JsonProperty("product")] + public IList Product { get; set; } + } + + public class GetClientsProducts + { + + [JsonProperty("result")] + public string Result { get; set; } + + [JsonProperty("clientid")] + public string ClientID { get; set; } + + [JsonProperty("serviceid")] + public object ServiceID { get; set; } + + [JsonProperty("pid")] + public object ProductID { get; set; } + + [JsonProperty("domain")] + public object Domain { get; set; } + + [JsonProperty("totalresults")] + public string TotalResults { get; set; } + + [JsonProperty("startnumber")] + public int StartNumber { get; set; } + + [JsonProperty("numreturned")] + public int NumberReturned { get; set; } + + [JsonProperty("products")] + public Products Products { get; set; } + } +} diff --git a/GetOrders.cs b/GetOrders.cs index 23c4afd6738c45f506f5c60156b99db5f95986b8..e28d41420144eb201a5c3a66580659052250193e 100644 --- a/GetOrders.cs +++ b/GetOrders.cs @@ -5,160 +5,160 @@ using System.IO; using System.Linq; using System.Text; -namespace WHMCS_API +namespace WHMCS_API.GetOrders { public class Lineitem { [JsonProperty("type")] - public string type { get; set; } + public string Type { get; set; } [JsonProperty("relid")] public string relid { get; set; } [JsonProperty("producttype")] - public string producttype { get; set; } + public string ProductType { get; set; } [JsonProperty("product")] - public string product { get; set; } + public string Product { get; set; } [JsonProperty("domain")] - public string domain { get; set; } + public string Domain { get; set; } [JsonProperty("billingcycle")] - public string billingcycle { get; set; } + public string BillingCycle { get; set; } [JsonProperty("amount")] - public string amount { get; set; } + public string Amount { get; set; } [JsonProperty("status")] - public string status { get; set; } + public string Status { get; set; } [JsonProperty("dnsmanagement")] - public string dnsmanagement { get; set; } + public string DNSManagment { get; set; } [JsonProperty("emailforwarding")] - public string emailforwarding { get; set; } + public string EmailFowarding { get; set; } [JsonProperty("idprotection")] - public string idprotection { get; set; } + public string IDProtection { get; set; } } public class Lineitems { [JsonProperty("lineitem")] - public IList lineitem { get; set; } + public IList LineItem { get; set; } } public class Order { [JsonProperty("id")] - public string id { get; set; } + public string ID { get; set; } [JsonProperty("ordernum")] - public string ordernum { get; set; } + public string OrderNumber { get; set; } [JsonProperty("userid")] - public string userid { get; set; } + public string UserID { get; set; } [JsonProperty("contactid")] - public string contactid { get; set; } + public string ContactID { get; set; } [JsonProperty("date")] - public string date { get; set; } + public string Date { get; set; } [JsonProperty("nameservers")] - public string nameservers { get; set; } + public string NameServers { get; set; } [JsonProperty("transfersecret")] - public string transfersecret { get; set; } + public string TransfererSecret { get; set; } [JsonProperty("renewals")] - public string renewals { get; set; } + public string RenewalsSecret { get; set; } [JsonProperty("promocode")] - public string promocode { get; set; } + public string PromoCode { get; set; } [JsonProperty("promotype")] - public string promotype { get; set; } + public string PromoType { get; set; } [JsonProperty("promovalue")] - public string promovalue { get; set; } + public string PromoValue { get; set; } [JsonProperty("orderdata")] - public string orderdata { get; set; } + public string OrderData { get; set; } [JsonProperty("amount")] - public string amount { get; set; } + public string Amount { get; set; } [JsonProperty("paymentmethod")] - public string paymentmethod { get; set; } + public string PaymentMethod { get; set; } [JsonProperty("invoiceid")] - public string invoiceid { get; set; } + public string InvoiceID { get; set; } [JsonProperty("status")] - public string status { get; set; } + public string Status { get; set; } [JsonProperty("ipaddress")] - public string ipaddress { get; set; } + public string IPAddress { get; set; } [JsonProperty("fraudmodule")] - public string fraudmodule { get; set; } + public string FraudModule { get; set; } [JsonProperty("fraudoutput")] - public string fraudoutput { get; set; } + public string FraudOutput { get; set; } [JsonProperty("notes")] - public string notes { get; set; } + public string Notes { get; set; } [JsonProperty("paymentmethodname")] - public string paymentmethodname { get; set; } + public string PaymentMethodName { get; set; } [JsonProperty("paymentstatus")] - public object paymentstatus { get; set; } + public object PaymentStatus { get; set; } [JsonProperty("name")] - public string name { get; set; } + public string Name { get; set; } [JsonProperty("currencyprefix")] - public string currencyprefix { get; set; } + public string CurrencyPrefix { get; set; } [JsonProperty("currencysuffix")] - public string currencysuffix { get; set; } + public string CurrencySuffix { get; set; } [JsonProperty("frauddata")] - public string frauddata { get; set; } + public string FraudData { get; set; } [JsonProperty("lineitems")] - public Lineitems lineitems { get; set; } + public Lineitems LineItems { get; set; } } public class Orders { [JsonProperty("order")] - public IList order { get; set; } + public IList Order { get; set; } } public class GetOrders { [JsonProperty("result")] - public string result { get; set; } + public string Result { get; set; } [JsonProperty("totalresults")] - public string totalresults { get; set; } + public string TotalResults { get; set; } [JsonProperty("startnumber")] - public int startnumber { get; set; } + public int StartNumber { get; set; } [JsonProperty("numreturned")] - public int numreturned { get; set; } + public int NumberReturned { get; set; } [JsonProperty("orders")] - public Orders orders { get; set; } + public Orders Orders { get; set; } } } \ No newline at end of file diff --git a/GetTransactions.cs b/GetTransactions.cs index 42cf39bb189b971328db3c12abe864ef993eba24..7c9e52399b7d58ff82d912f7186aca879fa3a8ce 100644 --- a/GetTransactions.cs +++ b/GetTransactions.cs @@ -5,75 +5,75 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace WHMCS_API +namespace WHMCS_API.GetTransactions { public class Transaction { [JsonProperty("id")] - public string id { get; set; } + public string ID { get; set; } [JsonProperty("userid")] - public string userid { get; set; } + public string UserID { get; set; } [JsonProperty("currency")] - public string currency { get; set; } + public string Currency { get; set; } [JsonProperty("gateway")] - public string gateway { get; set; } + public string PaymentGateway { get; set; } [JsonProperty("date")] - public string date { get; set; } + public string Date { get; set; } [JsonProperty("description")] - public string description { get; set; } + public string Description { get; set; } [JsonProperty("amountin")] - public string amountin { get; set; } + public string AmountIn { get; set; } [JsonProperty("fees")] - public string fees { get; set; } + public string Fees { get; set; } [JsonProperty("amountout")] - public string amountout { get; set; } + public string AmountOut { get; set; } [JsonProperty("rate")] - public string rate { get; set; } + public string Rate { get; set; } [JsonProperty("transid")] - public string transid { get; set; } + public string TransactionID { get; set; } [JsonProperty("invoiceid")] - public string invoiceid { get; set; } + public string InvoiceID { get; set; } [JsonProperty("refundid")] - public string refundid { get; set; } + public string RefundID { get; set; } } public class Transactions { [JsonProperty("transaction")] - public IList transaction { get; set; } + public IList Transaction { get; set; } } public class GetTransactions { [JsonProperty("result")] - public string result { get; set; } + public string Result { get; set; } [JsonProperty("totalresults")] - public int totalresults { get; set; } + public int TotalResults { get; set; } [JsonProperty("startnumber")] - public int startnumber { get; set; } + public int StartNumber { get; set; } [JsonProperty("numreturned")] - public int numreturned { get; set; } + public int NumberReturned { get; set; } [JsonProperty("transactions")] - public Transactions transactions { get; set; } + public Transactions Transactions { get; set; } } } diff --git a/ValidateLogin.cs b/ValidateLogin.cs index 799fe420d9928f4d0ff95ed09614966bf938ced4..a175f310daf5e0aab100b1f3c161822c89f87d31 100644 --- a/ValidateLogin.cs +++ b/ValidateLogin.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace WHMCS_API +namespace WHMCS_API.ValidateLogin { public class ValidateLogin { diff --git a/WHMCS API.csproj b/WHMCS API.csproj index ea5896e2fae69ebe4d2a426caab82c0cb59a6cfb..436fd506a8985ce620dd0cc234c48118a6491987 100644 --- a/WHMCS API.csproj +++ b/WHMCS API.csproj @@ -44,20 +44,14 @@ -<<<<<<< HEAD -======= - ->>>>>>> origin/master -<<<<<<< HEAD + -======= ->>>>>>> origin/master diff --git a/bin/Debug/WHMCS API.dll b/bin/Debug/WHMCS API.dll index cf4aef8ae80b3b24384eb407b1d1765f6becf032..84dce71630304a004b660d464f93aabf8a24087a 100644 Binary files a/bin/Debug/WHMCS API.dll and b/bin/Debug/WHMCS API.dll differ diff --git a/bin/Debug/WHMCS API.pdb b/bin/Debug/WHMCS API.pdb index c0ab79ce87126e5ec80b412bfbe57467dcc9863f..a37300e1eaadcef32f928cc2fc0772d3c02677f3 100644 Binary files a/bin/Debug/WHMCS API.pdb and b/bin/Debug/WHMCS API.pdb differ diff --git a/obj/Debug/CoreCompileInputs.cache b/obj/Debug/CoreCompileInputs.cache index 823b2cbd612d9ca82907e5e8d1bb8c2102876d0f..e55d23cafc3b01b7e3fbcfc67838949555b7ffcd 100644 --- a/obj/Debug/CoreCompileInputs.cache +++ b/obj/Debug/CoreCompileInputs.cache @@ -1 +1 @@ -a9211ff72989fdd7a0227985eee9222a9f5fb034 +67d26d3f8e599944ac917887812327b96760ec4f diff --git a/obj/Debug/WHMCS API.csproj.FileListAbsolute.txt b/obj/Debug/WHMCS API.csproj.FileListAbsolute.txt index 7f9c6c2321aa4a0a9f55837bdc2a7b0424cabf0c..d3bc4c62f72f972879de1d62576d58a98251ffec 100644 --- a/obj/Debug/WHMCS API.csproj.FileListAbsolute.txt +++ b/obj/Debug/WHMCS API.csproj.FileListAbsolute.txt @@ -4,4 +4,3 @@ C:\Users\pmcav\Source\Repos\PCDev\WHMCS API\bin\Debug\Newtonsoft.Json.dll C:\Users\pmcav\Source\Repos\PCDev\WHMCS API\bin\Debug\Newtonsoft.Json.xml C:\Users\pmcav\Source\Repos\PCDev\WHMCS API\obj\Debug\WHMCS API.dll C:\Users\pmcav\Source\Repos\PCDev\WHMCS API\obj\Debug\WHMCS API.pdb -C:\Users\pmcav\Source\Repos\PCDev\WHMCS API\obj\Debug\WHMCS API.csprojResolveAssemblyReference.cache diff --git a/obj/Debug/WHMCS API.dll b/obj/Debug/WHMCS API.dll index cf4aef8ae80b3b24384eb407b1d1765f6becf032..84dce71630304a004b660d464f93aabf8a24087a 100644 Binary files a/obj/Debug/WHMCS API.dll and b/obj/Debug/WHMCS API.dll differ diff --git a/obj/Debug/WHMCS API.pdb b/obj/Debug/WHMCS API.pdb index c0ab79ce87126e5ec80b412bfbe57467dcc9863f..a37300e1eaadcef32f928cc2fc0772d3c02677f3 100644 Binary files a/obj/Debug/WHMCS API.pdb and b/obj/Debug/WHMCS API.pdb differ diff --git a/obj/Release/CoreCompileInputs.cache b/obj/Release/CoreCompileInputs.cache index 0b19ba5cf2dfd3579a2706c86354219c718c7d1c..e55d23cafc3b01b7e3fbcfc67838949555b7ffcd 100644 --- a/obj/Release/CoreCompileInputs.cache +++ b/obj/Release/CoreCompileInputs.cache @@ -1,5 +1 @@ -<<<<<<< HEAD -6c3f1616b75e387981e8bc28f6eca8ccfc0bd29b -======= -5eb4fb84540e61ea2545bd966a0bb918182bb6f4 ->>>>>>> origin/master +67d26d3f8e599944ac917887812327b96760ec4f