@@ -47,6 +47,9 @@ monitor the status of subscribers, channels or queues.
4747 * [ getActionId()] ( #getactionid )
4848 * [ Response] ( #response )
4949 * [ getCommandOutput()] ( #getcommandoutput )
50+ * [ Collection] ( #collection )
51+ * [ getEntryEvents()] ( #getentryevents )
52+ * [ getCompleteEvent()] ( #getcompleteevent )
5053 * [ Action] ( #action )
5154 * [ Event] ( #event )
5255 * [ getName()] ( #getname )
@@ -205,9 +208,8 @@ $sender = new ActionSender($client);
205208All public methods resemble their respective AMI actions.
206209
207210``` php
208- $sender->ping()->then(function (Response $response) {
209- // response received for ping action
210- });
211+ $sender->ping();
212+ // many more…
211213```
212214
213215Listing all available actions is out of scope here, please refer to the [ class outline] ( src/ActionSender.php ) .
@@ -247,7 +249,8 @@ A PR that updates the `ActionSender` is very much appreciated :)
247249
248250### Message
249251
250- The ` Message ` is an abstract base class for the [ ` Response ` ] ( #response ) , [ ` Action ` ] ( #action ) and [ ` Event ` ] ( #event ) value objects.
252+ The ` Message ` is an abstract base class for the [ ` Response ` ] ( #response ) ,
253+ [ ` Action ` ] ( #action ) and [ ` Event ` ] ( #event ) value objects.
251254It provides a common interface for these three message types.
252255
253256Each ` Message ` consists of any number of fields with each having a name and one or multiple values.
@@ -272,12 +275,12 @@ The `getFields(): array` method can be used to get an array of all fields.
272275The ` getActionId(): string ` method can be used to get the unique action ID of this message.
273276This is a shortcut to get the value of the "ActionID" field.
274277
275- #### Response
278+ ### Response
276279
277280The ` Response ` value object represents the incoming response received from the AMI.
278281It shares all properties of the [ ` Message ` ] ( #message ) parent class.
279282
280- ##### getCommandOutput()
283+ #### getCommandOutput()
281284
282285The ` getCommandOutput(): ?string ` method can be used to get the resulting output of
283286a "command" [ ` Action ` ] ( #action ) .
@@ -290,17 +293,78 @@ $sender->command('help')->then(function (Response $response) {
290293});
291294```
292295
293- #### Action
296+ ### Collection
297+
298+ The ` Collection ` value object represents an incoming response received from the AMI
299+ for certain actions that return a list of entries.
300+ It shares all properties of the [ ` Response ` ] ( #response ) parent class.
301+
302+ You can access the ` Collection ` like a normal ` Response ` in order to access
303+ the leading ` Response ` for this collection or you can use the below methods
304+ to access the list entries and completion event.
305+
306+ ```
307+ Action: CoreShowChannels
308+ Response: Success
309+ EventList: start
310+ Message: Channels will follow
311+
312+ Event: CoreShowChannel
313+ Channel: SIP / 123
314+ ChannelState: 6
315+ ChannelStateDesc: Up
316+ …
317+
318+ Event: CoreShowChannel
319+ Channel: SIP / 456
320+ ChannelState: 6
321+ ChannelStateDesc: Up
322+ …
323+
324+ Event: CoreShowChannel
325+ Channel: SIP / 789
326+ ChannelState: 6
327+ ChannelStateDesc: Up
328+ …
329+
330+ Event: CoreShowChannelsComplete
331+ EventList: Complete
332+ ListItems: 3
333+ ```
334+
335+ #### getEntryEvents()
336+
337+ The ` getEntryEvents(): Event[] ` method can be used to get the list of all
338+ intermediary ` Event ` objects where each entry represents a single entry in the
339+ collection.
340+
341+ ``` php
342+ foreach ($collection->getEntryEvents() as $entry) {
343+ /* @var $entry Event */
344+ echo $entry->getFieldValue('Channel') . PHP_EOL;
345+ }
346+ ```
347+
348+ #### getCompleteEvent()
349+
350+ The ` getCompleteEvent(): Event ` method can be used to get the trailing
351+ ` Event ` that completes this collection.
352+
353+ ``` php
354+ echo $collection->getCompleteEvent()->getFieldValue('ListItems') . PHP_EOL;
355+ ```
356+
357+ ### Action
294358
295359The ` Action ` value object represents an outgoing action message to be sent to the AMI.
296360It shares all properties of the [ ` Message ` ] ( #message ) parent class.
297361
298- #### Event
362+ ### Event
299363
300364The ` Event ` value object represents the incoming event received from the AMI.
301365It shares all properties of the [ ` Message ` ] ( #message ) parent class.
302366
303- ##### getName()
367+ #### getName()
304368
305369The ` getName(): ?string ` method can be used to get the name of the event.
306370This is a shortcut to get the value of the "Event" field.
0 commit comments