PHPExpertsInc / RESTSpeaker

A quick and easy GuzzleHTTP extension for effortlessly handling RESTful APIs.
MIT License
7 stars 3 forks source link

Integrate SimpleDTO #16

Open hopeseekr opened 5 years ago

hopeseekr commented 5 years ago

It would be awesome to integrate phpexpertsinc/SimpleDTO with this project.

Minimally, we need the ability to specify what SimpleDTO class to return for any particular HTTP call.

Ideally, we would return every response as a blank + permissive SimpleDTO.

hopeseekr commented 4 years ago

A year+ later, I still can't figure out how to actually architect this.

What I've been doing is this:

    $response = $api->post('/uri', ['post' => 'data']);
    return new Read\AccountDTO((array) $response);

SimpleDTO's validation takes care of whether or not the API call succeeded or not.

I don't even know if this is so necessary anymore.