php-rest-api icon indicating copy to clipboard operation
php-rest-api copied to clipboard

Recipient Class - Extend to include additional data i.e. messagePartCount

Open chris-skilltech opened this issue 3 years ago • 2 comments

We're currently building an integration using this API and have become a little stuck, hoping for any advice if there is a different way forward.

After calling the create method and receiving a response the recipients are looped over an created using the loadFromArray function in base however this only populates variables that are defined on the class. The Recipient class only contains the status and statusDatetime fields however the response returned from the API contains many more e.g. messagePartCount, messageLength, mccmnc, etc...

The general issue this causes is that you lack possibly useful information that the code throws away. In our specific case the messagePartCount is useful for determining specifically how many messages were used but I'm sure that many others may have other cases.

Is there any reason why the Recipient class could not simply be extended with all of the fields available? Or allow it to be extended by a custom instance (perhaps using a config file to determine which class to use as a recipient)? As I said the method of fixing is completely up for debate but any help would be greatly appreciated.

chris-skilltech avatar Jan 17 '22 15:01 chris-skilltech

hi @chris-skilltech , can you please checkout latest master and let me know if #186 fixes your issue?

CoolGoose avatar Jan 19 '22 06:01 CoolGoose

Hi @CoolGoose, that works wonderfully thank you. Apologies for the delayed response.

chris-skilltech avatar Feb 14 '22 10:02 chris-skilltech