Skip to content

Commit

Permalink
Empty checkDictionaries query fixed (#19)
Browse files Browse the repository at this point in the history
Error while querying checkDictionaries without timestamp has been fixed. Thanks for your recent update in 3.1.2 but it doesn't work - error "Params cannot be null" error is coming back from Yandex Direct API.

`stdClass` is required cuz you have to `json_encode` not empty params (`[]`) but the empty object (`{}`) due to YD API.

I also advise not to stick to the list of parameters - it is gonna be easier to change them in the future.
  • Loading branch information
pavemaksim authored Jul 30, 2020
1 parent c42f859 commit 2943150
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Service/Changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ final class Changes extends Service
*/
public function checkDictionaries($Timestamp = null)
{
$params = compact(get_param_names(__METHOD__));

if (!is_null($Timestamp)) {
$params = ['Timestamp' => $Timestamp];
} else {
$params = new \stdClass();
}

return $this->request([
'method' => 'checkDictionaries',
'params' => $params
Expand Down

0 comments on commit 2943150

Please sign in to comment.