7272 * Vonage API Client, allows access to the API from PHP.
7373 *
7474 * @method Account\Client account()
75- * @method Message\Client message()
7675 * @method Messages\Client messages()
7776 * @method Application\Client applications()
7877 * @method Conversion\Client conversion()
@@ -291,7 +290,8 @@ public function getFactory(): ContainerInterface
291290 }
292291
293292 /**
294- * @throws ClientException
293+ * @deprecated Use a configured APIResource with a HandlerInterface
294+ * Request business logic is being removed from the User Client Layer.
295295 */
296296 public static function signRequest (RequestInterface $ request , SignatureSecret $ credentials ): RequestInterface
297297 {
@@ -304,6 +304,10 @@ public static function signRequest(RequestInterface $request, SignatureSecret $c
304304 return $ handler ($ request , $ credentials );
305305 }
306306
307+ /**
308+ * @deprecated Use a configured APIResource with a HandlerInterface
309+ * Request business logic is being removed from the User Client Layer.
310+ */
307311 public static function authRequest (RequestInterface $ request , Basic $ credentials ): RequestInterface
308312 {
309313 switch ($ request ->getHeaderLine ('content-type ' )) {
@@ -344,10 +348,8 @@ public function generateJwt($claims = []): Token
344348 }
345349
346350 /**
347- * Takes a URL and a key=>value array to generate a GET PSR-7 request object
348- *
349- * @throws ClientExceptionInterface
350- * @throws ClientException
351+ * @deprecated Use a configured APIResource with a HandlerInterface
352+ * Request business logic is being removed from the User Client Layer.
351353 */
352354 public function get (string $ url , array $ params = []): ResponseInterface
353355 {
@@ -360,10 +362,8 @@ public function get(string $url, array $params = []): ResponseInterface
360362 }
361363
362364 /**
363- * Takes a URL and a key=>value array to generate a POST PSR-7 request object
364- *
365- * @throws ClientExceptionInterface
366- * @throws ClientException
365+ * @deprecated Use a configured APIResource with a HandlerInterface
366+ * Request business logic is being removed from the User Client Layer.
367367 */
368368 public function post (string $ url , array $ params ): ResponseInterface
369369 {
@@ -380,10 +380,8 @@ public function post(string $url, array $params): ResponseInterface
380380 }
381381
382382 /**
383- * Takes a URL and a key=>value array to generate a POST PSR-7 request object
384- *
385- * @throws ClientExceptionInterface
386- * @throws ClientException
383+ * @deprecated Use a configured APIResource with a HandlerInterface
384+ * Request business logic is being removed from the User Client Layer.
387385 */
388386 public function postUrlEncoded (string $ url , array $ params ): ResponseInterface
389387 {
@@ -399,11 +397,10 @@ public function postUrlEncoded(string $url, array $params): ResponseInterface
399397 return $ this ->send ($ request );
400398 }
401399
400+
402401 /**
403- * Takes a URL and a key=>value array to generate a PUT PSR-7 request object
404- *
405- * @throws ClientExceptionInterface
406- * @throws ClientException
402+ * @deprecated Use a configured APIResource with a HandlerInterface
403+ * Request business logic is being removed from the User Client Layer.
407404 */
408405 public function put (string $ url , array $ params ): ResponseInterface
409406 {
@@ -420,10 +417,8 @@ public function put(string $url, array $params): ResponseInterface
420417 }
421418
422419 /**
423- * Takes a URL and a key=>value array to generate a DELETE PSR-7 request object
424- *
425- * @throws ClientExceptionInterface
426- * @throws ClientException
420+ * @deprecated Use a configured APIResource with a HandlerInterface
421+ * Request business logic is being removed from the User Client Layer.
427422 */
428423 public function delete (string $ url ): ResponseInterface
429424 {
@@ -439,7 +434,6 @@ public function delete(string $url): ResponseInterface
439434 * Wraps the HTTP Client, creates a new PSR-7 request adding authentication, signatures, etc.
440435 *
441436 * @throws ClientExceptionInterface
442- * @throws ClientException
443437 */
444438 public function send (RequestInterface $ request ): ResponseInterface
445439 {
@@ -523,22 +517,13 @@ protected function validateAppOptions($app): void
523517 }
524518 }
525519
526- public function serialize (EntityInterface $ entity ): string
527- {
528- if ($ entity instanceof Verification) {
529- return $ this ->verify ()->serialize ($ entity );
530- }
531-
532- throw new RuntimeException ('unknown class ` ' . $ entity ::class . '`` ' );
533- }
534-
535520 public function __call ($ name , $ args )
536521 {
537- if (!$ this ->factory ->hasApi ($ name )) {
522+ if (!$ this ->factory ->has ($ name )) {
538523 throw new RuntimeException ('no api namespace found: ' . $ name );
539524 }
540525
541- $ collection = $ this ->factory ->getApi ($ name );
526+ $ collection = $ this ->factory ->get ($ name );
542527
543528 if (empty ($ args )) {
544529 return $ collection ;
@@ -552,13 +537,48 @@ public function __call($name, $args)
552537 */
553538 public function __get ($ name )
554539 {
555- if (!$ this ->factory ->hasApi ($ name )) {
540+ if (!$ this ->factory ->has ($ name )) {
556541 throw new RuntimeException ('no api namespace found: ' . $ name );
557542 }
558543
559- return $ this ->factory ->getApi ($ name );
544+ return $ this ->factory ->get ($ name );
545+ }
546+
547+ /**
548+ * @deprecated Use the Verify Client, this shouldn't be here and will be removed.
549+ */
550+ public function serialize (EntityInterface $ entity ): string
551+ {
552+ if ($ entity instanceof Verification) {
553+ return $ this ->verify ()->serialize ($ entity );
554+ }
555+
556+ throw new RuntimeException ('unknown class ` ' . $ entity ::class . '`` ' );
557+ }
558+
559+ protected function getVersion (): string
560+ {
561+ return InstalledVersions::getVersion ('vonage/client-core ' );
562+ }
563+
564+ public function getLogger (): ?LoggerInterface
565+ {
566+ if (!$ this ->logger && $ this ->getFactory ()->has (LoggerInterface::class)) {
567+ $ this ->setLogger ($ this ->getFactory ()->get (LoggerInterface::class));
568+ }
569+
570+ return $ this ->logger ;
571+ }
572+
573+ public function getCredentials (): CredentialsInterface
574+ {
575+ return $ this ->credentials ;
560576 }
561577
578+ /**
579+ * @deprecated Use a configured APIResource with a HandlerInterface
580+ * Request business logic is being removed from the User Client Layer.
581+ */
562582 protected static function requiresBasicAuth (RequestInterface $ request ): bool
563583 {
564584 $ path = $ request ->getUri ()->getPath ();
@@ -568,6 +588,10 @@ protected static function requiresBasicAuth(RequestInterface $request): bool
568588 return $ isSecretManagementEndpoint || $ isApplicationV2 ;
569589 }
570590
591+ /**
592+ * @deprecated Use a configured APIResource with a HandlerInterface
593+ * Request business logic is being removed from the User Client Layer.
594+ */
571595 protected static function requiresAuthInUrlNotBody (RequestInterface $ request ): bool
572596 {
573597 $ path = $ request ->getUri ()->getPath ();
@@ -578,6 +602,10 @@ protected static function requiresAuthInUrlNotBody(RequestInterface $request): b
578602 return $ isRedact || $ isMessages ;
579603 }
580604
605+ /**
606+ * @deprecated Use a configured APIResource with a HandlerInterface
607+ * Request business logic is being removed from the User Client Layer.
608+ */
581609 protected function needsKeypairAuthentication (RequestInterface $ request ): bool
582610 {
583611 $ path = $ request ->getUri ()->getPath ();
@@ -588,23 +616,4 @@ protected function needsKeypairAuthentication(RequestInterface $request): bool
588616
589617 return $ isCallEndpoint || $ isRecordingUrl || $ isStitchEndpoint || $ isUserEndpoint ;
590618 }
591-
592- protected function getVersion (): string
593- {
594- return InstalledVersions::getVersion ('vonage/client-core ' );
595- }
596-
597- public function getLogger (): ?LoggerInterface
598- {
599- if (!$ this ->logger && $ this ->getFactory ()->has (LoggerInterface::class)) {
600- $ this ->setLogger ($ this ->getFactory ()->get (LoggerInterface::class));
601- }
602-
603- return $ this ->logger ;
604- }
605-
606- public function getCredentials (): CredentialsInterface
607- {
608- return $ this ->credentials ;
609- }
610619}
0 commit comments