cwmiller / broadworks-connector

Simple library for connecting to BroadWorks OCI-P API
MIT License
8 stars 5 forks source link

ModifyRequest Response #6

Closed TwinMist closed 6 years ago

TwinMist commented 6 years ago

Hi What is the best way to hand the responce for example a UserModifyRequest17sp4 as there is no response object that i can see?

ie like ... if ($response instanceof SuccessResponse) { echo "Success: ".$response . PHP_EOL; } else if ($response instanceof ErrorResponse) { echo "Error: ".$response->getSummary() . PHP_EOL; exit(); }

many thanks

cwmiller commented 6 years ago

UserModifyRequest17sp4 will only return SuccessResponse or ErrorResponse. SuccessResponse does not contain any data, but if it is returned then you know your request was completed successfully.

TwinMist commented 6 years ago

What is the best way in php write this please?

On Sat, 21 Apr 2018, 15:54 Chase Miller, notifications@github.com wrote:

UserModifyRequest17sp4 will only return SuccessResponse or ErrorResponse. SuccessResponse does not contain any data, but if it is returned then you know your request was completed successfully.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cwmiller/broadworks-connector/issues/6#issuecomment-383302999, or mute the thread https://github.com/notifications/unsubscribe-auth/ADRHy-YmHGNxCZKwRRqGKb7OlFTXL53lks5tq0hAgaJpZM4TODJU .

cwmiller commented 6 years ago

Basically, it's what you already pasted.


if ($response instanceof SuccessResponse) {
    // Request was successful. Do whatever you need to do on success
} else {
    // Do something in case of an error, like just echoing the error message:
    echo 'Error: ' . $response->getSummary() . PHP_EOL;
}