src/Services/CallApiServices.php line 682

Open in your IDE?
  1. <?php
  2. namespace App\Services;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\Routing\RouterInterface;
  5. use Symfony\Component\HttpFoundation\RedirectResponse;
  6. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  7. class CallApiServices
  8. {
  9.     private $apiKey;
  10.     private $apiToken;
  11.     private $accountId;
  12.     private $serviceId;
  13.     private $apiURL;
  14.     private $baseURL;
  15.     private $session;
  16.     /* @var $router RouterInterface */
  17.     private $router;
  18.     public function __construct(SessionInterface $session$apiKey$accountId$baseURL$apiToken$serviceId$apiURLRouterInterface $router)
  19.     {
  20.         $this->apiKey $apiKey;
  21.         $this->apiToken $apiToken;
  22.         $this->accountId $accountId;
  23.         $this->serviceId $serviceId;
  24.         $this->apiURL $apiURL;
  25.         $this->baseURL $baseURL;
  26.         $this->session $session;
  27.         $this->router $router;
  28.     }
  29.     public function postApi($endpoint, array $data): array
  30.     {
  31.         $url "https://api-rest.media-technologie.bee-dev.fr/" "$endpoint";
  32.         $httpHost "https://allolesanges.com";
  33.         $dataEncoded json_encode($data);
  34.         $headers = array(
  35.             "Accept: application/json",
  36.             "Content-Type: application/json",
  37.         );
  38.         $curl curl_init($url);
  39.         curl_setopt($curlCURLOPT_REFERER$httpHost);
  40.         curl_setopt($curlCURLOPT_POSTtrue);
  41.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  42.         curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
  43.         curl_setopt($curlCURLOPT_HTTPHEADER$headers);
  44.         curl_setopt($curlCURLOPT_POSTFIELDS$dataEncoded);
  45.         $response curl_exec($curl);
  46.         $curl_http_code curl_getinfo($curlCURLINFO_HTTP_CODE);
  47.         $curl_error curl_error($curl);
  48.         $curl_errno curl_errno($curl);
  49.         curl_close($curl);
  50.         if ($response === false) {
  51.             throw new \Exception($curl_error$curl_errno);
  52.             return ["null" => null];
  53.         } else {
  54.             $results = [];
  55.             // if (curl_getinfo($curl, CURLINFO_HTTP_CODE) === 200) {
  56.             //   $results = json_decode($response, true);
  57.             // } else if (curl_getinfo($curl, CURLINFO_HTTP_CODE) === 401) {
  58.             //   throw $results =  new \Exception('identifiant incorecte');
  59.             // } else if (curl_getinfo($curl, CURLINFO_HTTP_CODE) === 404) {
  60.             //   $response = json_decode($response, true);
  61.             //   $results =  $response;
  62.             // } else if (curl_getinfo($curl, CURLINFO_HTTP_CODE) === 403) {
  63.             //   $response = json_decode($response, true);
  64.             //   $results = $response;
  65.             // }
  66.             switch ($curl_http_code) {
  67.                 case 200:
  68.                     $results json_decode($responsetrue);
  69.                     break;
  70.                 case 401// Accès non autorisé, l'apiKey n'existe pas
  71.                     // a rediriger vers un page d'erreur qui dirait joindre le support, car c'est une erreur qui ne devrait jamais arrivée
  72.                     die(new RedirectResponse($this->router->generate('app_login')));
  73.                     //throw $results =  new \Exception('identifiant incorrecte');
  74.                     break;
  75.                 case 403:
  76.                 case 404:
  77.                     $response json_decode($responsetrue);
  78.                     $results =  $response;
  79.                     break;
  80.                 case 409// Conflit avec le compte ID ou service ID, l'apiKey existe, mais un conflit avec les valeurs configurées
  81.                     // a rediriger vers un page d'erreur qui dirait joindre le support, car c'est une erreur qui ne devrait jamais arrivée
  82.                     die(new RedirectResponse($this->router->generate('app_login')));
  83.                     break;
  84.                 case 410// apiToken n'exite pas ou la date est dépassée, vous devez démarrer une nouvelle session
  85.                     die(new RedirectResponse($this->router->generate('app_login')));
  86.                     break;
  87.                 default:
  88.                     $response json_decode($responsetrue);
  89.                     $results =  $response;
  90.                     break;
  91.             }
  92.         }
  93.         // $data = [ 'message' => "Accès non autorisé", 'responseCode' => "401" ];  l'apiKey n'existe pas
  94.         // $data = [ 'message' => "Conflit avec le référent HTTP", 'responseCode' => "409" ]; l'apiKey existe, mais un conflit avec les valeurs configurées
  95.         // $data = [ 'message' => "Conflit avec le compte ID", 'responseCode' => "409" ];
  96.         // $data = [ 'message' => "Conflit avec le service ID", 'responseCode' => "409" ];
  97.         // $data = [ 'message' => "token n’est plus disponible, vous devez démarrer une nouvelle session", "responseCode" => "410"}]
  98.         return $results;
  99.     }
  100.     public function getData(string $colletionName): array
  101.     {
  102.         $url 'http://localhost:8080/api';
  103.         $request_url $url '/' $colletionName;
  104.         $curl curl_init($request_url);
  105.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  106.         $response curl_exec($curl);
  107.         if ($response === false) {
  108.             return null;
  109.         } else {
  110.             $results = [];
  111.             if (curl_getinfo($curlCURLINFO_HTTP_CODE) === 200) {
  112.                 $response json_decode($responsetrue);
  113.             }
  114.         }
  115.         curl_close($curl);
  116.         return $response;
  117.     }
  118.     public function getDataById(string $colletionNamestring $id): array
  119.     {
  120.         $url 'http://localhost:8080/api';
  121.         $request_url $url '/' $colletionName '/' $id;
  122.         $curl curl_init($request_url);
  123.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  124.         $response curl_exec($curl);
  125.         if ($response === false) {
  126.             return null;
  127.         } else {
  128.             $results = [];
  129.             if (curl_getinfo($curlCURLINFO_HTTP_CODE) === 200) {
  130.                 $response json_decode($responsetrue);
  131.             }
  132.         }
  133.         curl_close($curl);
  134.         return $response;
  135.     }
  136.     public function authApi(string $loginstring $password): array
  137.     {
  138.         $url 'http://localhost:8080/api/login';
  139.         $curl curl_init($url);
  140.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  141.         $headers = array(
  142.             "Accept: application/json",
  143.             "Content-Type: application/json",
  144.         );
  145.         $data = [
  146.             "username" => $login,
  147.             "password" => $password
  148.         ];
  149.         $dataEncoded json_encode($data);
  150.         curl_setopt($curlCURLOPT_HTTPHEADER$headers);
  151.         curl_setopt($curlCURLOPT_POSTFIELDS$dataEncoded);
  152.         $response curl_exec($curl);
  153.         if ($response === false) {
  154.             return ["null" => null];
  155.         } else {
  156.             $results = [];
  157.             if (curl_getinfo($curlCURLINFO_HTTP_CODE) === 200) {
  158.                 $response json_decode($responsetrue);
  159.             } else if (curl_getinfo($curlCURLINFO_HTTP_CODE) === 401) {
  160.                 throw new \Exception('identifiant incorecte');
  161.             }
  162.         }
  163.         curl_close($curl);
  164.         return $response;
  165.     }
  166.     public function getUserDetails(string $token): array
  167.     {
  168.         $url 'http://localhost:8080/api/me';
  169.         $curl curl_init($url);
  170.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  171.         $headers = array(
  172.             "Accept: application/json",
  173.             "Content-Type: application/json",
  174.             "Authorization: Bearer " $token ""
  175.         );
  176.         curl_setopt($curlCURLOPT_HTTPHEADER$headers);
  177.         $response curl_exec($curl);
  178.         if ($response === false) {
  179.             return ["null" => null];
  180.         } else {
  181.             $results = [];
  182.             if (curl_getinfo($curlCURLINFO_HTTP_CODE) === 200) {
  183.                 $response json_decode($responsetrue);
  184.             }
  185.         }
  186.         curl_close($curl);
  187.         return $response;
  188.     }
  189.     // ** +++++++++++++++++ ------------        --------- +++++++++++++++++ **
  190.     // ** +++++++++++++++++ ------------        --------- +++++++++++++++++ **
  191.     public function getListConseillers($accountId$serviceId): array
  192.     {
  193.         $data = [
  194.             "accountId" => $accountId,
  195.             "serviceId" => $serviceId
  196.         ];
  197.         $results $this->restApiPOSTcURL('/plateforme/listeConseillersEtPresence'$data);
  198.         return $results;
  199.     }
  200.     public function configuratationPlateforme($accountId$serviceId): array
  201.     {
  202.         $data = [
  203.             "accountId" => $accountId,
  204.             "serviceId" => $serviceId
  205.         ];
  206.         $results $this->restApiPOSTcURL('/plateforme/configuratationPlateforme'$data);
  207.         return $results;
  208.     }
  209.     public function conseillerEtPlanning($pseudoId$serviceId): array
  210.     {
  211.         $data = [
  212.             "complementId" => $pseudoId,
  213.             "serviceId" => $serviceId
  214.         ];
  215.         $results $this->restApiPOSTcURL('/plateforme/conseillerEtPlanning'$data);
  216.         return $results;
  217.     }
  218.     public function prestationEcriteMails($accountId$serviceId): array
  219.     {
  220.         $data = [
  221.             "accountId" => $accountId,
  222.             "serviceId" => $serviceId
  223.         ];
  224.         $results $this->restApiPOSTcURL('/paramaters/PrestationEcriteMails'$data);
  225.         return $results;
  226.     }
  227.     public function clientAvisNoter($apiToken$sendAvisData): array
  228.     {
  229.         $data array_merge($apiToken$sendAvisData);
  230.         $results $this->restApiPOSTcURL('/plateforme/clientAvisNoter'$data);
  231.         return $results;
  232.     }
  233.     public function clientAuthentification(string $loginstring $password$serviceId): array
  234.     {
  235.         $data = [
  236.             "serviceId" => $serviceId,
  237.             "login" => $login,
  238.             "password" => $password
  239.         ];
  240.         $results $this->restApiPOSTcURL('/plateforme/clientAuthentification'$data);
  241.         if (isset($results['responseCode']) && ($results['responseCode'] != 200)) {
  242.             return $results;
  243.         }
  244.         $this->session->set('apiToken'$results["apiToken"]);
  245.         return $results;
  246.     }
  247.     //Avis
  248.     public function conseillerAvis($serviceId$complementId): array
  249.     {
  250.         $data = [
  251.             "serviceId" => $serviceId,
  252.             "complementId" => $complementId
  253.         ];
  254.         $results $this->restApiPOSTcURL("/avis/conseiller/$complementId"$data);
  255.         return $results;
  256.     }
  257.     public function clientAvis($serviceId$clientId): array
  258.     {
  259.         $data = [
  260.             "serviceId" => $serviceId,
  261.             "clientId" => $clientId
  262.         ];
  263.         $results $this->restApiPOSTcURL('/plateforme/clientAvis'$data);
  264.         return $results;
  265.     }
  266.     public function listePlateformeAvis($serviceId): array
  267.     {
  268.         $data = [
  269.             "serviceId" => $serviceId,
  270.         ];
  271.         $results $this->restApiPOSTcURL('/plateforme/listePlateformeAvis'$data);
  272.         return $results;
  273.     }
  274.     public function clientOperations($serviceId$clientId): array
  275.     {
  276.         $data = [
  277.             "serviceId" => $serviceId,
  278.             "clientId" => $clientId
  279.         ];
  280.         $results $this->restApiPOSTcURL('/plateforme/clientOperations'$data);
  281.         return $results;
  282.     }
  283.     public function clientProfile($serviceId$clientId$reqToken): array
  284.     {
  285.         $data = [
  286.             "apiToken" => $reqToken,
  287.             "serviceId" => $serviceId,
  288.             "clientId" => $clientId
  289.         ];
  290.         $results $this->restApiPOSTcURLWithOUtToken('/plateforme/clientProfile'$data);
  291.         return $results;
  292.     }
  293.     public function clientProfileCheck($serviceId$clientId): array
  294.     {
  295.         $data = [
  296.             "serviceId" => $serviceId,
  297.             "clientId" => $clientId
  298.         ];
  299.         $results $this->restApiPOSTcURL('/plateforme/clientProfile'$data);
  300.         return $results;
  301.     }
  302.     public function clientTransactions($serviceId$clientId): array
  303.     {
  304.         $data = [
  305.             "serviceId" => $serviceId,
  306.             "clientId" => $clientId
  307.         ];
  308.         $results $this->restApiPOSTcURL('/plateforme/clientTransactions'$data);
  309.         return $results;
  310.     }
  311.     public function clientConsultations($serviceId$clientId): array
  312.     {
  313.         $data = [
  314.             "serviceId" => $serviceId,
  315.             "clientId" => $clientId
  316.         ];
  317.         $results $this->restApiPOSTcURL('/plateforme/clientConsultations'$data);
  318.         return $results;
  319.     }
  320.     public function clientInscription($serviceId$parrainID$genre$email$password$firtsname$lastname$phoneNumber): ?array
  321.     {
  322.         $data = [
  323.             "serviceId" => $serviceId,
  324.             "parrainId" => $parrainID,
  325.             "genre" => $genre,
  326.             "username" => $email,
  327.             "password" => $password,
  328.             "nom" => $firtsname,
  329.             "prenom" => $lastname,
  330.             "pays" => "FRANCE",
  331.             "telephone" => $phoneNumber
  332.         ];
  333.         $results $this->restApiPOSTcURL('/plateforme/clientInscription'$data);
  334.         return $results;
  335.     }
  336.     public function socialInscription($serviceId$genre$email$password$firtsname$lastname$country$phoneNumber$social$socialUid): ?array
  337.     {
  338.         $data = [
  339.             "apiKey" =>  $this->apiKey,
  340.             "serviceId" => $serviceId,
  341.             "parrainId" => "0",
  342.             "genre" => $genre,
  343.             "username" => $email,
  344.             "password" => $password,
  345.             "nom" => $firtsname,
  346.             "prenom" => $lastname,
  347.             "pays" => $country,
  348.             "telephone" => $phoneNumber,
  349.             "social" => $social,
  350.             "socialUid" => $socialUid
  351.         ];
  352.         $results $this->restApiPOSTcURL('/plateforme/clientInscription'$data);
  353.         return $results;
  354.     }
  355.     public function clientForgotPassword($serviceId$username): ?array
  356.     {
  357.         $data = [
  358.             "serviceId" => $serviceId,
  359.             "username" => $username
  360.         ];
  361.         $results $this->restApiPOSTcURL('/plateforme/clientForgotPassword'$data);
  362.         return $results;
  363.     }
  364.     public function clientResetPassword($serviceId$username$oldPassword$newPassword$reqToken$limitToken): ?array
  365.     {
  366.         $data = [
  367.             "serviceId" => $serviceId,
  368.             "username" => $username,
  369.             "oldPassword" => $oldPassword,
  370.             "newPassword" => $newPassword
  371.         ]; 
  372.         $results $this->restApiPOSTcURL('/plateforme/clientResetPassword' $data);
  373.         return $results;
  374.     }
  375.     public function clientInscriptionValidation($serviceId$email$password$code$actif): ?array
  376.     {
  377.         $data = [
  378.             "serviceId" => $serviceId,
  379.             "username" => $email,
  380.             "password" => $password,
  381.             "code" => $code,
  382.             "actif" => $actif
  383.         ];
  384.         $results $this->restApiPOSTcURL('/plateforme/clientInscriptionValidation'$data);
  385.         return $results;
  386.     }
  387.     //Tarifs
  388.     //Tous les tarifs
  389.     public function tarifsPlateforme($serviceId): ?array
  390.     {
  391.         $data = [
  392.             "serviceId" => $serviceId,
  393.         ];
  394.         $results $this->restApiPOSTcURL('/plateforme/tarifsPlateforme'$data);
  395.         return $results;
  396.     }
  397.     public function cbTransaction($data): ?array
  398.     {
  399.         $results $this->restApiPOSTcURL('/plateforme/cbTransaction'$data);
  400.         return $results;
  401.     }
  402.     //Question Mail
  403.     //Test mise a jour lu et repondu
  404.     public function questionsMailMajMessage($serviceId$clientId$complementId$emailId$answered$isRead): ?array
  405.     {
  406.         $data = [
  407.             "serviceId" => $serviceId,
  408.             "clientId" => $clientId,
  409.             "complementId" => $complementId,
  410.             "emailsId" => $emailId,
  411.             "answered" => $answered,
  412.             "isRead" => $isRead
  413.         ];
  414.         $results $this->restApiPOSTcURL('/plateforme/questionsMailMajMessage'$data);
  415.         return $results;
  416.     }
  417.     //Info Mail
  418.     public function questionsMailConseillersListe($serviceId$clientId): ?array
  419.     {
  420.         $data = [
  421.             "serviceId" => $serviceId,
  422.             "clientId" => $clientId
  423.         ];
  424.         $results $this->restApiPOSTcURL('/plateforme/questionsMailConseillersListe'$data);
  425.         return $results;
  426.     }
  427.     //no route found for POST and GET
  428.     public function questionsMailConseiller($serviceId$clientid$complementId): ?array
  429.     {
  430.         $data = [
  431.             "serviceId" => $serviceId,
  432.             "clientId" => $clientid,
  433.             "complementId" => $complementId,
  434.         ];
  435.         $results $this->restApiPOSTcURL('/plateforme/questionsMailConseiller'$data);
  436.         return $results;
  437.     }
  438.     //Envoi de Mail
  439.     public function questionsMailEnvoiMessage($serviceId$clientId$complementId$titre$content$date$cost): ?array
  440.     {
  441.         $data = [
  442.             "serviceId" => $serviceId,
  443.             "clientId" => $clientId,
  444.             "complementId" => $complementId,
  445.             "title" => $titre,
  446.             "content" => $content,
  447.             "date" => $date->format('Y-m-d H:i:s'),
  448.             "client" => "1",
  449.             "answered" => "0",
  450.             "isRead" => "0",
  451.             "messageCost" => $cost
  452.         ];
  453.         $results $this->restApiPOSTcURL('/plateforme/questionsMailEnvoiMessage'$data);
  454.         return $results;
  455.     }
  456.     //Reponse Mail
  457.     public function questionsMailConseillerReponse(): ?array
  458.     {
  459.         $data = [
  460.             "serviceId" => "1010",
  461.             "clientId" => "1006",
  462.             "complementId" => "45",
  463.             "title" => " réponse de test titre",
  464.             "content" => "il va faire beau",
  465.             "date" => "2022-02-22 02:22:22",
  466.             "client" => "0",
  467.             "answered" => "0",
  468.             "isRead" => "0"
  469.         ];
  470.         $results $this->restApiPOSTcURL('/plateforme/questionsMailConseillerReponse'$data);
  471.         return $results;
  472.     }
  473.     //Horoscope
  474.     public function horoscopeJour(): ?array
  475.     {
  476.         $data = [
  477.             "accountId" => $this->accountId
  478.         ];
  479.         $results $this->restApiPOSTcURL('/horoscope/horoscopeJour'$data);
  480.         return $results;
  481.     }
  482.     public function horoscopeHebdomadaire(): ?array
  483.     {
  484.         $data = [
  485.             "accountId" => $this->accountId
  486.         ];
  487.         $results $this->restApiPOSTcURL('/horoscope/horoscopeHebdomadaire'$data);
  488.         return $results;
  489.     }
  490.     public function horoscopeMensuel(): ?array
  491.     {
  492.         $data = [
  493.             "accountId" => $this->accountId
  494.         ];
  495.         $results $this->restApiPOSTcURL('/horoscope/horoscopeMensuel'$data);
  496.         return $results;
  497.     }
  498.     public function request($data$endpoint): ?array
  499.     {
  500.         $results $this->restApiPOSTcURL($endpoint$data);
  501.         return $results;
  502.     }
  503.     public function restApiPOSTcURL($endpoint$data)
  504.     {
  505.         $results = [];
  506.         $this->apiToken $this->session->get('apiToken');
  507.         // ajouter les clés
  508.         $data['apiKey'] =  $this->apiKey;
  509.         $data['apiToken'] =  $this->apiToken;
  510.         $url $this->apiURL $endpoint;
  511.         $dataEncoded json_encode($data);
  512.         $headers = array(
  513.             "Accept: application/json",
  514.             "Content-Type: application/json",
  515.         );
  516.         $curl curl_init($url);
  517.         curl_setopt($curlCURLOPT_POSTtrue);
  518.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  519.         curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
  520.         curl_setopt($curlCURLOPT_HTTPHEADER$headers);
  521.         curl_setopt($curlCURLOPT_POSTFIELDS$dataEncoded);
  522.         curl_setopt($curlCURLOPT_REFERER$this->baseURL);
  523.         $response curl_exec($curl);
  524.         $curl_error curl_error($curl);
  525.         $curl_errno curl_errno($curl);
  526.         $http_code curl_getinfo($curlCURLINFO_HTTP_CODE);
  527.         curl_close($curl);
  528.         //echo "<br> url:". print_r($url, 1)."<br>";
  529.         if ($response === false) {
  530.             $res =  ['responseCode' => $curl_error'message' => $curl_errno];
  531.             $results[throw new \Exception($res['message'])];
  532.         } else {
  533.             if ($http_code === 200) {
  534.                 $results json_decode($responsetrue);
  535.             } else {
  536.                 $results json_decode($responsetrue);
  537.                 if (!is_array($results)) {
  538.                     $results =  ['responseCode' => $http_code'message' => $results];
  539.                 }
  540.                 if ($http_code === 401) {
  541.                     // Accès non autorisé
  542.                 } else if ($http_code === 403) {
  543.                     // Aucun enregistrement correspondant
  544.                 } else if ($http_code === 404) {
  545.                     // Erreur sauvegarde
  546.                 } else if ($http_code === 409) {
  547.                     // Conflit 
  548.                 } else if ($http_code === 410) {
  549.                     // token n’est plus disponible
  550.                 }
  551.                 //$results [throw new \Exception( $res['message'] )];
  552.             }
  553.         }
  554.         return $results;
  555.     }
  556.     public function restApiPOSTcURLWithOUtToken($endpoint$data)
  557.     {
  558.         $results = [];
  559.         $this->apiToken $this->session->get('apiToken');
  560.         // ajouter les clés
  561.         $data['apiKey'] =  $this->apiKey;
  562.         $url $this->apiURL $endpoint;
  563.         $dataEncoded json_encode($data);
  564.         $headers = array(
  565.             "Accept: application/json",
  566.             "Content-Type: application/json",
  567.         );
  568.         $curl curl_init($url);
  569.         curl_setopt($curlCURLOPT_POSTtrue);
  570.         curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
  571.         curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
  572.         curl_setopt($curlCURLOPT_HTTPHEADER$headers);
  573.         curl_setopt($curlCURLOPT_POSTFIELDS$dataEncoded);
  574.         curl_setopt($curlCURLOPT_REFERER$this->baseURL);
  575.         $response curl_exec($curl);
  576.         $curl_error curl_error($curl);
  577.         $curl_errno curl_errno($curl);
  578.         $http_code curl_getinfo($curlCURLINFO_HTTP_CODE);
  579.         curl_close($curl);
  580.         //echo "<br> url:". print_r($url, 1)."<br>";
  581.         if ($response === false) {
  582.             $res =  ['responseCode' => $curl_error'message' => $curl_errno];
  583.             $results[throw new \Exception($res['message'])];
  584.         } else {
  585.             if ($http_code === 200) {
  586.                 $results json_decode($responsetrue);
  587.             } else {
  588.                 $results json_decode($responsetrue);
  589.                 if (!is_array($results)) {
  590.                     $results =  ['responseCode' => $http_code'message' => $results];
  591.                 }
  592.                 if ($http_code === 401) {
  593.                     // Accès non autorisé
  594.                 } else if ($http_code === 403) {
  595.                     // Aucun enregistrement correspondant
  596.                 } else if ($http_code === 404) {
  597.                     // Erreur sauvegarde
  598.                 } else if ($http_code === 409) {
  599.                     // Conflit 
  600.                 } else if ($http_code === 410) {
  601.                     // token n’est plus disponible
  602.                 }
  603.                 //$results [throw new \Exception( $res['message'] )];
  604.             }
  605.         }
  606.         return $results;
  607.     }
  608. }