Nabin
Nabin

Reputation: 163

implement getIterator method in version 5.x of twilio sdk

I have used following code in twilio version 4.x:

$events = $this->client->workspace->events->getIterator(0, 50, array(
            'Minutes' => round((time() - strtotime('today')) / 60),
            'ResourceType' => 'Task'
        ));

I have upgraded to version 5.x now. And I am not sure how to use getiterator in version 5.16. I tried several ways and also tried to find solution on internet but could not succeed. Any help?

Upvotes: 0

Views: 76

Answers (1)

Nabin
Nabin

Reputation: 163

II got it. It should be done by read method like this:

$events = $this->client->taskrouter
            ->workspaces($this->workspaceSid)
            ->events->read(
                array('Minutes' => round((time() - strtotime('today')) / 60),'ResourceType' => 'Task'),
                50
            );

I was putting parameter for read method in the other way around so it was not working before.

Upvotes: 1

Related Questions