twilio / twilio-php

A PHP library for communicating with the Twilio REST API and generating TwiML.
MIT License
1.57k stars 561 forks source link

Can't list a particular Queue Members #788

Closed pkaser closed 1 year ago

pkaser commented 1 year ago

Issue Summary

When attempting to list Queue Mermbers you receive an error

Steps to Reproduce

Try to list queue members directly. The endpoint should be: /2010-04-01/Accounts/ACXXXX/Queues/QUXXX/Members.json

Code Snippet

$queues = $twilio->queues($holdQueue)->members()->fetch();

Exception/Log

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Twilio\Rest\Api\V2010\Account\Queue\MemberList::getContext(), 0 passed in D:\WEBCONTENT\twilio.srboots.com\vendor\twilio\sdk\src\Twilio\Rest\Api\V2010\Account\QueueContext.php on line 172 and exactly 1 expected in D:\WEBCONTENT\twilio.srboots.com\vendor\twilio\sdk\src\Twilio\Rest\Api\V2010\Account\Queue\MemberList.php:153 Stack trace: #0 D:\WEBCONTENT\twilio.srboots.com\vendor\twilio\sdk\src\Twilio\Rest\Api\V2010\Account\QueueContext.php(172): Twilio\Rest\Api\V2010\Account\Queue\MemberList->getContext() #1 D:\WEBCONTENT\twilio.srboots.com\public\TwiML\index.php(59): Twilio\Rest\Api\V2010\Account\QueueContext->__call('members', Array) #2 {main} thrown in D:\WEBCONTENT\twilio.srboots.com\vendor\twilio\sdk\src\Twilio\Rest\Api\V2010\Account\Queue\MemberList.php on line 153

Technical details:

pkaser commented 1 year ago

To be clear: You should be able to get a list of all callers that are members in the queue thst is referenced. It should be a gt call to /2010-04-01/Accounts/ACXXXX/Queues/QUXXX/Members.json ~ NOT ~ /2010-04-01/Accounts/ACXXXX/Queues/QUXXX/Members/.json

You should get a list of CallSids of calls holding in the referenced Queue. These returned CallSids from Members.json are passed into /2010-04-01/Accounts/ACXXXX/Queues/QUXXX/Members/CAXXXXXX.json to get the call details

tiwarishubham635 commented 1 year ago

Hi @pkaser! I have a slight confusion. So are you not able to access the list of all calls in a given queue or not able to fetch a particular call from that queue?

pkaser commented 1 year ago

I did some more debugging it seems to be retrieving the data on a var_dump. I can see queue_members in the json, but I can't get to the actual data retrieved. So apparently the /Members/.json is ok. And I can't even get the json retrieved.

The documentation is unclear and doesn't really tell me what I should be expecting back and where and how to access it. Things are listed as GET in the docs, but I the wrapper there isn't a get(), there is a fetch(). And how do we know what to iterate through and read() if we don't know what we got back?

pkaser commented 1 year ago

The issue was my lack of understanding the documentation and lack of example showing proper use.