CWIS Developer Documentation
Public Member Functions | List of all members
RestAPIHelper Class Reference

Public Member Functions

 __construct ($APIUrl, $APIPassword, $CheckForDuplicateFn, $RegisterMessageFn)
 Constructor. More...
 
 DoRestCommand ($Params)
 Run a REST API command against a remote site. More...
 
 EncodeEncryptedMessage ($Data)
 Construct an encrypted message packet from provided data. More...
 
 DecodeEncryptedMessage ($PostData)
 Decrypt an encrypted message packet. More...
 

Detailed Description

Definition at line 10 of file RestAPIHelper.php.

Constructor & Destructor Documentation

RestAPIHelper::__construct (   $APIUrl,
  $APIPassword,
  $CheckForDuplicateFn,
  $RegisterMessageFn 
)

Constructor.

Parameters
string$APIUrlUrl to which REST calls will be directed.
string$APIPasswordPassword for encrypting and authenticating rest calls.
callable$CheckForDuplicateFnFunction to check for duplicated messages.
callable$RegisterMessageFnFunction to register a message as received.

Definition at line 22 of file RestAPIHelper.php.

Member Function Documentation

RestAPIHelper::DecodeEncryptedMessage (   $PostData)

Decrypt an encrypted message packet.

Parameters
array$PostDataEncrypted data.
Returns
array Result, always has a "Status" member that will either be "OK" on success or "Error". In the case of an error, there will also be a "Message" giving a description of the issue. On success, there will be a "Data" member giving the decrypted payload.

Definition at line 146 of file RestAPIHelper.php.

Referenced by DoRestCommand().

Here is the caller graph for this function:

RestAPIHelper::DoRestCommand (   $Params)

Run a REST API command against a remote site.

Parameters
array$ParamsREST API call parameters (often from $_POST).
Returns
response from the remote site (format depends on the command issued) or NULL on command failure.

Definition at line 37 of file RestAPIHelper.php.

References DecodeEncryptedMessage(), and EncodeEncryptedMessage().

RestAPIHelper::EncodeEncryptedMessage (   $Data)

Construct an encrypted message packet from provided data.

Parameters
array$DataData to encapsulate
Returns
array Encrypted packet

Definition at line 91 of file RestAPIHelper.php.

Referenced by DoRestCommand().

Here is the caller graph for this function:


The documentation for this class was generated from the following file: