|
90 | 90 | * @method Verify\Client verify() |
91 | 91 | * @method Verify2\Client verify2() |
92 | 92 | * @method Voice\Client voice() |
| 93 | + * @method Vonage\Video\Client video() |
93 | 94 | * |
94 | 95 | * @property string restUrl |
95 | 96 | * @property string apiUrl |
@@ -211,29 +212,39 @@ public function __construct( |
211 | 212 | $this->debug = $options['debug']; |
212 | 213 | } |
213 | 214 |
|
| 215 | + $services = [ |
| 216 | + // Registered Services by name |
| 217 | + 'account' => ClientFactory::class, |
| 218 | + 'applications' => ApplicationClientFactory::class, |
| 219 | + 'conversion' => ConversionClientFactory::class, |
| 220 | + 'insights' => InsightsClientFactory::class, |
| 221 | + 'numbers' => NumbersClientFactory::class, |
| 222 | + 'meetings' => MeetingsClientFactory::class, |
| 223 | + 'messages' => MessagesClientFactory::class, |
| 224 | + 'redact' => RedactClientFactory::class, |
| 225 | + 'secrets' => SecretsClientFactory::class, |
| 226 | + 'sms' => SMSClientFactory::class, |
| 227 | + 'subaccount' => SubaccountClientFactory::class, |
| 228 | + 'users' => UsersClientFactory::class, |
| 229 | + 'verify' => VerifyClientFactory::class, |
| 230 | + 'verify2' => Verify2ClientFactory::class, |
| 231 | + 'voice' => VoiceClientFactory::class, |
| 232 | + |
| 233 | + // Additional utility classes |
| 234 | + APIResource::class => APIResource::class, |
| 235 | + ]; |
| 236 | + |
| 237 | + if (class_exists('Vonage\Video\ClientFactory')) { |
| 238 | + $services['video'] = 'Vonage\Video\ClientFactory'; |
| 239 | + } else { |
| 240 | + $services['video'] = function() { |
| 241 | + throw new \RuntimeException('Please install @vonage/video to use the Video API'); |
| 242 | + }; |
| 243 | + } |
| 244 | + |
214 | 245 | $this->setFactory( |
215 | 246 | new MapFactory( |
216 | | - [ |
217 | | - // Registered Services by name |
218 | | - 'account' => ClientFactory::class, |
219 | | - 'applications' => ApplicationClientFactory::class, |
220 | | - 'conversion' => ConversionClientFactory::class, |
221 | | - 'insights' => InsightsClientFactory::class, |
222 | | - 'numbers' => NumbersClientFactory::class, |
223 | | - 'meetings' => MeetingsClientFactory::class, |
224 | | - 'messages' => MessagesClientFactory::class, |
225 | | - 'redact' => RedactClientFactory::class, |
226 | | - 'secrets' => SecretsClientFactory::class, |
227 | | - 'sms' => SMSClientFactory::class, |
228 | | - 'subaccount' => SubaccountClientFactory::class, |
229 | | - 'users' => UsersClientFactory::class, |
230 | | - 'verify' => VerifyClientFactory::class, |
231 | | - 'verify2' => Verify2ClientFactory::class, |
232 | | - 'voice' => VoiceClientFactory::class, |
233 | | - |
234 | | - // Additional utility classes |
235 | | - APIResource::class => APIResource::class, |
236 | | - ], |
| 247 | + $services, |
237 | 248 | $this |
238 | 249 | ) |
239 | 250 | ); |
|
0 commit comments