helpscout / helpscout-api-php

PHP Wrapper for the Help Scout API
MIT License
98 stars 62 forks source link

example/threads.php is broken #151

Closed nextend closed 5 years ago

nextend commented 5 years ago

The threads.php example is broken, located at: https://github.com/helpscout/helpscout-api-php/blob/master/examples/threads.php

$threads = $client->getThreads($conversationId); should be: $threads = $client->threads()->list($conversationId);

Also the getThreads method on a conversation does not work and returns noting: $client->conversations()->get(12)->getThreads();

bkuhl commented 5 years ago

Thanks for reporting the issue with invalid syntax in our example. We updated our syntax prior to initial launch of this version and missed updating that example 😞

Also the getThreads method on a conversation does not work and returns noting:

A conversation's threads are not eagerly loaded and getThreads() only loads them when they're already loaded (I've updated the phpdoc on that method to clarify this). To get the threads using getThreads() you need to do this:

$conversationRequest = new ConversationRequest();
$conversationRequest->withThreads();
$conversation = $client->conversations()->get(12, $conversationRequest);