Skip to content

Commit 5c32660

Browse files
committed
Update README.md
1 parent ebe35f8 commit 5c32660

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,22 @@ The `close()` method can be used to force-close the AMI connection and reject al
102102

103103
The `end()` method can be used to soft-close the AMI connection once all pending actions are completed.
104104

105-
> Advanced: Creating `Action` objects, sending them via AMI and waiting for incoming
106-
> `Response` objects is usually hidden behind the `Api` interface.
105+
> Advanced: Creating [`Action`](#action) objects, sending them via AMI and waiting for incoming
106+
> [`Response`](#response) objects is usually hidden behind the [`Api`](#api) interface.
107107
>
108108
> If you happen to need a custom or otherwise unsupported action, you can also do so manually
109109
> as follows. Consider filing a PR though :)
110110
>
111111
> The `createAction($name, $fields)` method can be used to construct a custom AMI action.
112-
> A unique ActionID will be added automatically (needed to match incoming responses).
112+
> A unique value will be added to "ActionID" field automatically (needed to match incoming responses).
113113
>
114114
> The `request(Action $action)` method can be used to queue the given messages to be sent via AMI
115-
> and wait for a `Response` object that matches its ActionID.
115+
> and wait for a [`Response`](#response) object that matches the value of its "ActionID" field.
116116
117117
### Api
118118

119-
The `Api` wraps a given `Client` instance to provide a simple way to execute common actions.
119+
The `Api` wraps a given [`Client`](#client) instance to provide a simple way to execute common actions.
120+
This class represents the main interface to execute actions and wait for the corresponding responses.
120121

121122
```php
122123
$api = new Api($client);
@@ -127,10 +128,10 @@ $api->ping()->then(function (Response $response) {
127128
```
128129

129130
All public methods resemble their respective AMI actions.
130-
Listing all available actions is out of scope here, please refer to the class outline.
131+
Listing all available actions is out of scope here, please refer to the [class outline](src/Api.php).
131132

132133
Sending actions is async (non-blocking), so you can actually send multiple action requests in parallel.
133-
The AMI will respond to each action with a `Response` object. The order is not guaranteed.
134+
The AMI will respond to each action with a [`Response`](#response) object. The order is not guaranteed.
134135
Sending actions uses a Promise-based interface that makes it easy to react to when an action is *fulfilled*
135136
(i.e. either successfully resolved or rejected with an error):
136137

@@ -155,12 +156,12 @@ $api->ping()->then(
155156
> Advanced: Using the `Api` is not strictly necessary, but is the recommended way to execute common actions.
156157
>
157158
> If you happen to need a new or otherwise unsupported action, or additional arguments,
158-
> you can also do so manually. See the advanced `Client` usage above for details.
159-
> A PR that updates the `API` is very much appreciated :)
159+
> you can also do so manually. See the advanced [`Client`](#client) usage above for details.
160+
> A PR that updates the `Api` is very much appreciated :)
160161
161162
### Message
162163

163-
The `Message` is an abstract base class for the `Response`, `Action` and `Event` value objects.
164+
The `Message` is an abstract base class for the [`Response`](#response), [`Action`](#action) and [`Event`](#event) value objects.
164165
It provides a common interface for these three message types.
165166

166167
Each `Message` consists of any number of fields with each having a name and one or multiple values.
@@ -174,22 +175,26 @@ If no value was found, an empty `array()` is returned.
174175

175176
The `getFields()` method can be used to get an array of all fields.
176177

177-
The `getActionId()` method is a shortcut for accessing the value of the "ActionID" field.
178+
The `getActionId()` method can be used to get the unique action ID of this message.
179+
This is a shortcut to get the value of the "ActionID" field.
178180

179181
#### Response
180182

181183
The `Response` value object represents the incoming response received from the AMI.
184+
It shares all properties of the [`Message`](#message) parent class.
182185

183186
#### Action
184187

185-
The `Action` value object represents an outgoing action messages to be sent to the AMI.
188+
The `Action` value object represents an outgoing action message to be sent to the AMI.
189+
It shares all properties of the [`Message`](#message) parent class.
186190

187191
#### Event
188192

189193
The `Event` value object represents the incoming event received from the AMI.
194+
It shares all properties of the [`Message`](#message) parent class.
190195

191-
The `getName()` method can be used to get the name of the event. This is a shortcut to
192-
get the value of the "Event" field.
196+
The `getName()` method can be used to get the name of the event.
197+
This is a shortcut to get the value of the "Event" field.
193198

194199
## Install
195200

0 commit comments

Comments
 (0)