Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #8 from hitmanpt/PCDev
Browse files Browse the repository at this point in the history
Added Functions ModuleCustom and ModuleChangePw
  • Loading branch information
PedroCavaleiro authored Feb 17, 2017
2 parents 3af9a3f + 920281f commit 546649d
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 3 deletions.
Binary file modified .vs/WHMCS API/v15/.suo
Binary file not shown.
37 changes: 37 additions & 0 deletions API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,42 @@ public GetClientsDomains.GetClientsDomains GetClientsDomains(int LimitStart = 0,

return JsonConvert.DeserializeObject<GetClientsDomains.GetClientsDomains>(_call.MakeCall(data), settings);
}

public bool ModuleChangePassword(int ServiceID, string NewPassword, bool getException = true)
{
NameValueCollection data = new NameValueCollection()
{
{ "action", EnumUtil.GetString(APIEnums.Actions.ModuleChangePassword) },
{ EnumUtil.GetString(APIEnums.ModuleChangePasswordParams.ServiceID), ServiceID.ToString() },
{ EnumUtil.GetString(APIEnums.ModuleChangePasswordParams.NewPassword), NewPassword }
};

JObject result = JObject.Parse(_call.MakeCall(data));

if (result["result"].ToString() == "success")
return true;
else if(result["result"].ToString() != "success" && getException)
throw new Exception("An API Error Ocurred", new Exception(result["message"].ToString()));
return false;
}

public bool ModuleCustomCommand(int ServiceID, string Command, bool getException = true)
{
NameValueCollection data = new NameValueCollection()
{
{ "action", EnumUtil.GetString(APIEnums.Actions.ModuleCustomCommand) },
{ EnumUtil.GetString(APIEnums.ModuleCustomCommandParams.ServiceID), ServiceID.ToString() },
{ EnumUtil.GetString(APIEnums.ModuleCustomCommandParams.Command), Command }
};

JObject result = JObject.Parse(_call.MakeCall(data));

if (result["result"].ToString() == "success")
return true;
else if (result["result"].ToString() != "success" && getException)
throw new Exception("An API Error Ocurred", new Exception(result["message"].ToString()));
return false;

}
}
}
16 changes: 15 additions & 1 deletion Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ public enum GetInvoicesParams
[StringValue("status")] Status
}

public enum ModuleChangePasswordParams
{
[StringValue("accountid")] ServiceID,
[StringValue("servicepassword")] NewPassword
}

public enum ModuleCustomCommandParams
{
[StringValue("accountid")] ServiceID,
[StringValue("func_name")] Command
}

public enum GetInvoiceParams
{
[StringValue("invoiceid")] InvoiceID
Expand Down Expand Up @@ -122,7 +134,9 @@ public enum Actions
[StringValue("GetClientsProducts")] GetClientsProducts,
[StringValue("GetInvoices")] GetInvoices,
[StringValue("GetInvoice")] GetInvoice,
[StringValue("GetClientsDomains")] GetClientsDomains
[StringValue("GetClientsDomains")] GetClientsDomains,
[StringValue("ModuleChangePw")] ModuleChangePassword,
[StringValue("ModuleCustom")] ModuleCustomCommand
}
}

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão
// usando o '*' como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.10")]
[assembly: AssemblyFileVersion("0.7.10")]
[assembly: AssemblyVersion("0.7.12")]
[assembly: AssemblyFileVersion("0.7.12")]
Binary file modified bin/Debug/WHMCS API.dll
Binary file not shown.
Binary file modified bin/Debug/WHMCS API.pdb
Binary file not shown.
Binary file modified bin/Release/WHMCS API.dll
Binary file not shown.
Binary file modified bin/Release/WHMCS API.pdb
Binary file not shown.
Binary file modified obj/Debug/WHMCS API.dll
Binary file not shown.
Binary file modified obj/Debug/WHMCS API.pdb
Binary file not shown.
Empty file added obj/Debug/build.force
Empty file.
Binary file modified obj/Release/WHMCS API.dll
Binary file not shown.
Binary file modified obj/Release/WHMCS API.pdb
Binary file not shown.

0 comments on commit 546649d

Please sign in to comment.