src/Services/UlteamApiService.php line 319

Open in your IDE?
  1. <?php
  2. namespace App\Services;
  3. use App\Security\User;
  4. use DateTime;
  5. use stdClass;
  6. use Symfony\Component\HttpFoundation\File\UploadedFile;
  7. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  8. use Symfony\Component\Mime\Part\DataPart;
  9. use Symfony\Component\Mime\Part\Multipart\FormDataPart;
  10. use Symfony\Component\Routing\RouterInterface;
  11. use Symfony\Component\Security\Core\Security;
  12. use Symfony\Component\Security\Core\User\UserInterface;
  13. use Symfony\Component\String\Slugger\SluggerInterface;
  14. use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
  15. use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
  16. use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
  17. use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
  18. use Symfony\Contracts\HttpClient\HttpClientInterface;
  19. class UlteamApiService
  20. {
  21.     const MERGE_CONTENT_TYPE 'application/merge-patch+json';
  22.     /**
  23.      * @var HttpClientInterface
  24.      */
  25.     private $client;
  26.     /**
  27.      * @var array
  28.      */
  29.     private $headers = [];
  30.     /**
  31.      * @var SessionInterface
  32.      */
  33.     private $session;
  34.     /**
  35.      * @var Security
  36.      */
  37.     private $security;
  38.     /**
  39.      * @var RouterInterface
  40.      */
  41.     private $router;
  42.     /**
  43.      * @var SluggerInterface
  44.      */
  45.     private $slugger;
  46.     /**
  47.      * UserProvider constructor.
  48.      * @param HttpClientInterface $client
  49.      * @param Security $security
  50.      * @param SessionInterface $session
  51.      * @param RouterInterface $router
  52.      */
  53.     public function __construct(HttpClientInterface $clientSecurity $securitySessionInterface $sessionRouterInterface $routerSluggerInterface $slugger)
  54.     {
  55.         $this->client $client;
  56.         $this->session $session;
  57.         $this->security $security;
  58.         $this->router $router;
  59.         $this->slugger $slugger;
  60.     }
  61.     private function sessionNameConverter($name$direction 'normalize')
  62.     {
  63.         if ($direction == 'normalize') {
  64.             $name str_replace('/''_'$name);
  65.         } elseif ($direction == 'denormalize') {
  66.             $name str_replace('_''/'$name);
  67.         }
  68.         return $name;
  69.     }
  70.     /**
  71.      * @param array $body
  72.      * @return mixed
  73.      * @throws ClientExceptionInterface
  74.      * @throws RedirectionExceptionInterface
  75.      * @throws ServerExceptionInterface
  76.      * @throws TransportExceptionInterface
  77.      */
  78.     public function login(array $body$type 'admin')
  79.     {
  80.         // $entrypoint = 'api/login_check';
  81.         $entrypoint '/api/admin/login_check';
  82.         if($type == 'entreprise'){
  83.             $entrypoint '/api/company/login_check';
  84.         }
  85.         return $this->callUrl($entrypoint'POST', [], json_encode($body));
  86.     }
  87.     /**
  88.      * Calls an entrypoint to be stored in session
  89.      * @param $entrypoint
  90.      * @return mixed
  91.      * @throws ClientExceptionInterface
  92.      * @throws RedirectionExceptionInterface
  93.      * @throws ServerExceptionInterface
  94.      * @throws TransportExceptionInterface
  95.      */
  96.     private function sessionStorageCall($entrypoint)
  97.     {
  98.         $sessionName $this->sessionNameConverter($entrypoint);
  99.         if ($this->session->has($sessionName)) {
  100.             $result $this->session->get($sessionName);
  101.         } else {
  102.             $result $this->callUrl($entrypoint);
  103.             $this->session->set($sessionName$result);
  104.         }
  105.         return $result;
  106.     }
  107.     /**
  108.      * Gets the subject for the given messages
  109.      * @return mixed
  110.      * @throws ClientExceptionInterface
  111.      * @throws RedirectionExceptionInterface
  112.      * @throws ServerExceptionInterface
  113.      * @throws TransportExceptionInterface
  114.      */
  115.     public function getMessageSubjects()
  116.     {
  117.         $entrypoint 'api/messages/subjects';
  118.         $result $this->sessionStorageCall($entrypoint);
  119.         foreach ($result as $key => $item) {
  120.             $result[$item] = $item;
  121.             unset($result[$key]);
  122.         }
  123.         return $result;
  124.     }
  125.     /**
  126.      * @param array $query
  127.      * 2021-01-24 15:17:43.489344
  128.      * @return array
  129.      */
  130.     public function convertQueryDates(array $query): array
  131.     {
  132.         foreach ($query as $key=>$item) {
  133.             if ($item instanceof DateTime){
  134.                 $query[$key] = $item->format('Y-m-d H:i:s');
  135.             }
  136.         }
  137.         return $query;
  138.     }
  139.     /**
  140.      * Function to call an url and recover the decoded content
  141.      * @param $entrypoint
  142.      * @param string $method
  143.      * @param array $headers
  144.      * @param array $body
  145.      * @param array $query
  146.      * @param bool $json
  147.      * @return mixed
  148.      * @throws ClientExceptionInterface
  149.      * @throws RedirectionExceptionInterface
  150.      * @throws ServerExceptionInterface
  151.      * @throws TransportExceptionInterface
  152.      */
  153.     private function callUrl($entrypoint$method 'GET'$headers = [], $body = [], $query = [], $json true)
  154.     {
  155.         $_headers array_merge($this->headers$headers);
  156.         $_url $entrypoint;
  157.         $query $this->convertQueryDates($query);
  158.         $params = [
  159.             'headers' => $_headers,
  160.             'body' => $body,
  161.             'query' => $query,
  162.         ];
  163.         $user $this->security->getUser();
  164.         if ($user instanceof User) {
  165.             $params['auth_bearer'] = $user->getToken();
  166.         }
  167.         $response $this->client->request($method$_url$params);
  168.         if ($json) {
  169.             return json_decode($response->getContent());
  170.         }
  171.         return $response->getContent();
  172.     }
  173.     /**
  174.      * @param string $entrypoint
  175.      * @param array $query
  176.      * @return mixed
  177.      * @throws ClientExceptionInterface
  178.      * @throws RedirectionExceptionInterface
  179.      * @throws ServerExceptionInterface
  180.      * @throws TransportExceptionInterface
  181.      */
  182.     private function callGetUrl(string $entrypoint, array $query = [])
  183.     {
  184.         return $this->callUrl($entrypoint'GET', [], [], $query);
  185.     }
  186.     /**
  187.      * @param array $filters
  188.      * @return mixed
  189.      * @throws ClientExceptionInterface
  190.      * @throws RedirectionExceptionInterface
  191.      * @throws ServerExceptionInterface
  192.      * @throws TransportExceptionInterface
  193.      */
  194.     public function getCompanies(array $filters = [], ?array $extra = [])
  195.     {
  196.         $entrypoint '/api/companies';
  197.         $filters array_merge($filters$extra);
  198.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  199.     }
  200.     /**
  201.      * @param array $filters
  202.      * @return mixed
  203.      * @throws ClientExceptionInterface
  204.      * @throws RedirectionExceptionInterface
  205.      * @throws ServerExceptionInterface
  206.      * @throws TransportExceptionInterface
  207.      */
  208.     public function getFirstSurvey(array $filters = [])
  209.     {
  210.         $entrypoint '/api/surveys_homepage';
  211.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  212.     }
  213.     /**
  214.      * @param array $filters
  215.      * @return mixed
  216.      * @throws ClientExceptionInterface
  217.      * @throws RedirectionExceptionInterface
  218.      * @throws ServerExceptionInterface
  219.      * @throws TransportExceptionInterface
  220.      */
  221.     public function getFirstSurveyTags(int $id, array $filters = [])
  222.     {
  223.         $entrypoint "/api/surveys/{$id}/tv_tags";
  224.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  225.     }
  226.     /**
  227.      * @param array $filters
  228.      * @return mixed
  229.      * @throws ClientExceptionInterface
  230.      * @throws RedirectionExceptionInterface
  231.      * @throws ServerExceptionInterface
  232.      * @throws TransportExceptionInterface
  233.      */
  234.     public function getHpSurveys(array $filters = [])
  235.     {
  236.         $entrypoint '/api/surveys?active=1&type=homepage_survey';
  237.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  238.     }
  239.     /**
  240.      * @param array $filters
  241.      * @return mixed
  242.      * @throws ClientExceptionInterface
  243.      * @throws RedirectionExceptionInterface
  244.      * @throws ServerExceptionInterface
  245.      * @throws TransportExceptionInterface
  246.      */
  247.     public function getQuestions(array $filters = [], array $extra = [])
  248.     {
  249.         $filters array_merge($filters$extra);
  250.         $entrypoint '/api/questions';
  251.         // $entrypoint = strtr($entrypoint, ['{id}' => $filters['id']]);
  252.         // unset($filters['id']);
  253.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  254.     }
  255.     /**
  256.      * @param string $id
  257.      * @return mixed
  258.      * @throws ClientExceptionInterface
  259.      * @throws RedirectionExceptionInterface
  260.      * @throws ServerExceptionInterface
  261.      * @throws TransportExceptionInterface
  262.      */
  263.     public function getQuestion(int $id, array $filters = [])
  264.     {
  265.         $entrypoint "/api/questions/$id";
  266.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  267.     }
  268.     /**
  269.      * @param int $id
  270.      * @param array $filters
  271.      * @return mixed
  272.      * @throws ClientExceptionInterface
  273.      * @throws RedirectionExceptionInterface
  274.      * @throws ServerExceptionInterface
  275.      * @throws TransportExceptionInterface
  276.      */
  277.     public function getTags(array $filters = [], array $extra = [])
  278.     {
  279.         $filters array_merge($filters$extra);
  280.         $entrypoint "/api/tv_tags";
  281.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  282.     }
  283.     /**
  284.      * @param int $id
  285.      * @param array $filters
  286.      * @return mixed
  287.      * @throws ClientExceptionInterface
  288.      * @throws RedirectionExceptionInterface
  289.      * @throws ServerExceptionInterface
  290.      * @throws TransportExceptionInterface
  291.      */
  292.     public function getProgramTags(array $filters = [], array $extra = [], int $id)
  293.     {
  294.         $filters array_merge($filters$extra);
  295.         $entrypoint "/api/programs/"$id ."/program_tags";
  296.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  297.     }
  298.     /**
  299.      * @return null
  300.      * @throws ClientExceptionInterface
  301.      * @throws RedirectionExceptionInterface
  302.      * @throws ServerExceptionInterface
  303.      * @throws TransportExceptionInterface
  304.      */
  305.     public function postProgramTag(array $data)
  306.     {
  307.         $entrypoint '/api/program-tag/submit';
  308.         $data json_encode($data);
  309.         return $this->callUrl($entrypoint'POST', [], $data);
  310.     }
  311.     /**
  312.      * @param string $id
  313.      * @return mixed
  314.      * @throws ClientExceptionInterface
  315.      * @throws RedirectionExceptionInterface
  316.      * @throws ServerExceptionInterface
  317.      * @throws TransportExceptionInterface
  318.      */
  319.     public function getTag(int $id, array $filters = [])
  320.     {
  321.         $entrypoint "/api/tv_tags/$id";
  322.         return $this->callUrl($entrypoint"GET", [], [], $filters);
  323.     }
  324.     /**
  325.      * @param array $filters
  326.      * @return mixed
  327.      * @throws ClientExceptionInterface
  328.      * @throws RedirectionExceptionInterface
  329.      * @throws ServerExceptionInterface
  330.      * @throws TransportExceptionInterface
  331.      */
  332.     public function deleteTag(int $id)
  333.     {
  334.         $entrypoint '/api/tv_tags/' $id;
  335.         return $this->callUrl($entrypoint'DELETE');
  336.     }
  337.     /**
  338.      * @return null
  339.      * @throws ClientExceptionInterface
  340.      * @throws RedirectionExceptionInterface
  341.      * @throws ServerExceptionInterface
  342.      * @throws TransportExceptionInterface
  343.      */
  344.     public function postSurvey(array $data)
  345.     {
  346.         $entrypoint '/api/surveys';
  347.         $data json_encode($data);
  348.         return $this->callUrl($entrypoint'POST', [], $data);
  349.     }
  350.     /**
  351.      * @return null
  352.      * @throws ClientExceptionInterface
  353.      * @throws RedirectionExceptionInterface
  354.      * @throws ServerExceptionInterface
  355.      * @throws TransportExceptionInterface
  356.      */
  357.     public function postTag(array $data)
  358.     {
  359.         $entrypoint '/api/tv_tags';
  360.         $data json_encode($data);
  361.         return $this->callUrl($entrypoint'POST', [], $data);
  362.     }
  363.     /**
  364.      * @return null
  365.      * @throws ClientExceptionInterface
  366.      * @throws RedirectionExceptionInterface
  367.      * @throws ServerExceptionInterface
  368.      * @throws TransportExceptionInterface
  369.      */
  370.     public function updateTag(int $id$data)
  371.     {
  372.         $entrypoint '/api/tv_tags/'$id;
  373.         $_data $data;
  374.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  375.         $data =  str_replace('\\/''/'$data);
  376.         return $this->callUrl($entrypoint'PATCH', [
  377.             'Content-Type' => self::MERGE_CONTENT_TYPE
  378.         ], $data);
  379.     }
  380.     /**
  381.      * @return null
  382.      * @throws ClientExceptionInterface
  383.      * @throws RedirectionExceptionInterface
  384.      * @throws ServerExceptionInterface
  385.      * @throws TransportExceptionInterface
  386.      */
  387.     public function activateTag(int $id$data)
  388.     {
  389.         $entrypoint '/api/tv_tags/'$id;
  390.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  391.         return $this->callUrl($entrypoint'PATCH', [
  392.             'Content-Type' => self::MERGE_CONTENT_TYPE
  393.         ], $data);
  394.     }
  395.     /**
  396.      * @return null
  397.      * @throws ClientExceptionInterface
  398.      * @throws RedirectionExceptionInterface
  399.      * @throws ServerExceptionInterface
  400.      * @throws TransportExceptionInterface
  401.      */
  402.     public function postQuestion(array $data)
  403.     {
  404.         $entrypoint '/api/questions';
  405.         $data json_encode($data);
  406.         return $this->callUrl($entrypoint'POST', [], $data);
  407.     }
  408.     /**
  409.      * @param mixed $company infos on the company to be modified
  410.      * @return null
  411.      * @throws ClientExceptionInterface
  412.      * @throws RedirectionExceptionInterface
  413.      * @throws ServerExceptionInterface
  414.      * @throws TransportExceptionInterface
  415.      */
  416.     public function updateQuestion(int $id$data)
  417.     {
  418.         $entrypoint '/api/questions/'$id;
  419.         $_data $data;
  420.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  421.         $data =  str_replace('\\/''/'$data);
  422.         return $this->callUrl($entrypoint'PATCH', [
  423.             'Content-Type' => self::MERGE_CONTENT_TYPE
  424.         ], $data);
  425.     }
  426.     /**
  427.      * @return null
  428.      * @throws ClientExceptionInterface
  429.      * @throws RedirectionExceptionInterface
  430.      * @throws ServerExceptionInterface
  431.      * @throws TransportExceptionInterface
  432.      */
  433.     public function activateQuestion(int $id$data)
  434.     {
  435.         $entrypoint '/api/questions/'$id;
  436.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  437.         return $this->callUrl($entrypoint'PATCH', [
  438.             'Content-Type' => self::MERGE_CONTENT_TYPE
  439.         ], $data);
  440.     }
  441.     /**
  442.      * @param int $id
  443.      * @param array $filters
  444.      * @return mixed
  445.      * @throws ClientExceptionInterface
  446.      * @throws RedirectionExceptionInterface
  447.      * @throws ServerExceptionInterface
  448.      * @throws TransportExceptionInterface
  449.      */
  450.     public function getProgramSurveys(array $filters = [], array $extra = [])
  451.     {
  452.         $filters array_merge($filters$extra);
  453.         $entrypoint "/api/surveys_program";
  454.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  455.     }
  456.     /**
  457.      * @param string $id
  458.      * @return mixed
  459.      * @throws ClientExceptionInterface
  460.      * @throws RedirectionExceptionInterface
  461.      * @throws ServerExceptionInterface
  462.      * @throws TransportExceptionInterface
  463.      */
  464.     public function getProgramSurvey(int $id, array $filters = [])
  465.     {
  466.         $entrypoint "/api/surveys/"$id;
  467.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  468.     }
  469.         /**
  470.      * @param int $id
  471.      * @param array $filters
  472.      * @return mixed
  473.      * @throws ClientExceptionInterface
  474.      * @throws RedirectionExceptionInterface
  475.      * @throws ServerExceptionInterface
  476.      * @throws TransportExceptionInterface
  477.      */
  478.     public function getSurveyQuestions(array $filters = [], array $extra = [])
  479.     {
  480.         // $filters = array_merge($filters, $extra);
  481.         $entrypoint "/api/surveys/"$extra['id'] ."/questions";
  482.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  483.     }
  484.     /**
  485.      * @return null
  486.      * @throws ClientExceptionInterface
  487.      * @throws RedirectionExceptionInterface
  488.      * @throws ServerExceptionInterface
  489.      * @throws TransportExceptionInterface
  490.      */
  491.     public function postAnswer(array $data)
  492.     {
  493.         $entrypoint '/api/answers';
  494.         $data json_encode($data);
  495.         return $this->callUrl($entrypoint'POST', [], $data);
  496.     }
  497.     /**
  498.      * @param string $id
  499.      * @return mixed
  500.      * @throws ClientExceptionInterface
  501.      * @throws RedirectionExceptionInterface
  502.      * @throws ServerExceptionInterface
  503.      * @throws TransportExceptionInterface
  504.      */
  505.     public function getAnswer(int $id, array $filters = [])
  506.     {
  507.         $entrypoint "/api/answers/$id";
  508.         return $this->callUrl($entrypoint,'GET', [], [], $filters);
  509.     }
  510.     /**
  511.      * @return null
  512.      * @throws ClientExceptionInterface
  513.      * @throws RedirectionExceptionInterface
  514.      * @throws ServerExceptionInterface
  515.      * @throws TransportExceptionInterface
  516.      */
  517.     public function updateAnswer(int $id$data)
  518.     {
  519.         $entrypoint '/api/answers/'$id;
  520.         $_data $data;
  521.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  522.         $data =  str_replace('\\/''/'$data);
  523.         return $this->callUrl($entrypoint'PATCH', [
  524.             'Content-Type' => self::MERGE_CONTENT_TYPE
  525.         ], $data);
  526.     }
  527.     /**
  528.      * @param array $filters
  529.      * @return mixed
  530.      * @throws ClientExceptionInterface
  531.      * @throws RedirectionExceptionInterface
  532.      * @throws ServerExceptionInterface
  533.      * @throws TransportExceptionInterface
  534.      */
  535.     public function getAnswers(array $filters = [], array $extra = [])
  536.     {
  537.         $filters array_merge($filters$extra);
  538.         $entrypoint "/api/answers";
  539.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  540.     }
  541.     /**
  542.      * @param int $id
  543.      * @param array $filters
  544.      * @return mixed
  545.      * @throws ClientExceptionInterface
  546.      * @throws RedirectionExceptionInterface
  547.      * @throws ServerExceptionInterface
  548.      * @throws TransportExceptionInterface
  549.      */
  550.     public function getQuestionAnswers(array $filters = [], array $extra = [])
  551.     {
  552.         // $filters = array_merge($filters, $extra);
  553.         $entrypoint "/api/answers?question.id="$extra['id'] . "";
  554.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  555.     }
  556.     /**
  557.      * @return null
  558.      * @throws ClientExceptionInterface
  559.      * @throws RedirectionExceptionInterface
  560.      * @throws ServerExceptionInterface
  561.      * @throws TransportExceptionInterface
  562.      */
  563.     public function activateProgramSurvey(int $id$data)
  564.     {
  565.         $entrypoint '/api/surveys/'$id;
  566.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  567.         return $this->callUrl($entrypoint'PATCH', [
  568.             'Content-Type' => self::MERGE_CONTENT_TYPE
  569.         ], $data);
  570.     }
  571.     /**
  572.      * @param array $filters
  573.      * @param array $extra
  574.      * @return mixed
  575.      * @throws ClientExceptionInterface
  576.      * @throws RedirectionExceptionInterface
  577.      * @throws ServerExceptionInterface
  578.      * @throws TransportExceptionInterface
  579.      */
  580.     public function getUsers(array $filters = [], array $extra = [])
  581.     {
  582.         $entrypoint '/api/users';
  583.         $filters array_merge($filters$extra);
  584.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  585.     }
  586.     /**
  587.      * @param array $filters
  588.      * @param array $extra
  589.      * @return mixed
  590.      * @throws ClientExceptionInterface
  591.      * @throws RedirectionExceptionInterface
  592.      * @throws ServerExceptionInterface
  593.      * @throws TransportExceptionInterface
  594.      */
  595.     public function getClients(array $filters = [], array $extra = [])
  596.     {
  597.         $entrypoint '/api/clients';
  598.         $filters array_merge($filters$extra);
  599.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  600.     }
  601.     /**
  602.      * This posts a group of new users linked to a company
  603.      * @param array $data
  604.      * @return null
  605.      * @throws ClientExceptionInterface
  606.      * @throws RedirectionExceptionInterface
  607.      * @throws ServerExceptionInterface
  608.      * @throws TransportExceptionInterface
  609.      */
  610.     public function postUsersBulk(array $data)
  611.     {
  612.         $entrypoint '/api/users/create';
  613.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  614.         $data =  str_replace('\\'''$data);
  615.         return $this->callUrl($entrypoint'POST', [
  616.             'Content-Type' => 'application/ld+json'
  617.         ], $data, [], false);
  618.     }
  619.     /**
  620.      * @param string $id
  621.      * @return mixed
  622.      * @throws ClientExceptionInterface
  623.      * @throws RedirectionExceptionInterface
  624.      * @throws ServerExceptionInterface
  625.      * @throws TransportExceptionInterface
  626.      */
  627.     public function getUser(string $id)
  628.     {
  629.         $entrypoint "/api/users/$id";
  630.         return $this->callUrl($entrypoint);
  631.     }
  632.     /**
  633.      * @param stdClass $user
  634.      * @return mixed
  635.      * @throws ClientExceptionInterface
  636.      * @throws RedirectionExceptionInterface
  637.      * @throws ServerExceptionInterface
  638.      * @throws TransportExceptionInterface
  639.      */
  640.     public function updateUser(stdClass $user)
  641.     {
  642.         $entrypoint "/api/users/{$user->id}";
  643.         return $this->callUrl($entrypoint'PATCH', [
  644.             'Content-Type' => self::MERGE_CONTENT_TYPE
  645.         ], json_encode($user));
  646.     }
  647.     /**
  648.      * @param string $userId
  649.      * @return mixed
  650.      * @throws ClientExceptionInterface
  651.      * @throws RedirectionExceptionInterface
  652.      * @throws ServerExceptionInterface
  653.      * @throws TransportExceptionInterface
  654.      */
  655.     public function activateUser(string $userId)
  656.     {
  657.         $entrypoint "api/users/$userId/active";
  658.         return $this->callUrl($entrypoint);
  659.     }
  660.     /**
  661.      * @param array $filters
  662.      * @param bool $session
  663.      * @return mixed
  664.      * @throws ClientExceptionInterface
  665.      * @throws RedirectionExceptionInterface
  666.      * @throws ServerExceptionInterface
  667.      * @throws TransportExceptionInterface
  668.      */
  669.     public function getCategories(array $filters = [], bool $session false)
  670.     {
  671.         $entrypoint '/api/categories';
  672.         if ($session){
  673.             return $this->sessionStorageCall($entrypoint);
  674.         }
  675.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  676.     }
  677.     /**
  678.      * @param array $filters
  679.      * @param bool $session
  680.      * @return mixed
  681.      * @throws ClientExceptionInterface
  682.      * @throws RedirectionExceptionInterface
  683.      * @throws ServerExceptionInterface
  684.      * @throws TransportExceptionInterface
  685.      */
  686.     public function getCategoriesBis(array $filters = [], array $extra =[])
  687.     {
  688.         $entrypoint '/api/categories';
  689.         $filters array_merge($filters$extra);
  690.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  691.     }
  692.     /**
  693.      * @param mixed $video
  694.      * @return null
  695.      * @throws ClientExceptionInterface
  696.      * @throws RedirectionExceptionInterface
  697.      * @throws ServerExceptionInterface
  698.      * @throws TransportExceptionInterface
  699.      */
  700.     public function getChannelsFromCategory(array $filters = [], array $extra = [])
  701.     {
  702.         $filters array_merge($filters$extra);
  703.         $entrypoint '/api/categories/{id}/channels';
  704.         $entrypoint strtr($entrypoint, ['{id}' => $filters['id']]);
  705.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  706.     }
  707.     /**
  708.      * @param array $filters
  709.      * @param array $extra
  710.      * @return mixed
  711.      * @throws ClientExceptionInterface
  712.      * @throws RedirectionExceptionInterface
  713.      * @throws ServerExceptionInterface
  714.      * @throws TransportExceptionInterface
  715.      */
  716.     public function getVideosManager(array $filters = [], array $extra = [])
  717.     {
  718.         $company $extra['company'];
  719.         unset($extra['company']);
  720.         $videos $this->getVideos($filters$extra);
  721.         return $videos;
  722.     }
  723.     /**
  724.      * @param array $filters
  725.      * @param array $extra
  726.      * @return mixed
  727.      * @throws ClientExceptionInterface
  728.      * @throws RedirectionExceptionInterface
  729.      * @throws ServerExceptionInterface
  730.      * @throws TransportExceptionInterface
  731.      */
  732.     public function getChannelsManager(array $filters = [], array $extra = [])
  733.     {
  734.         return $this->getChannelsBis($filters$extra);
  735.     }
  736.     /**
  737.      * @param array $filters
  738.      * @param array $extra
  739.      * @return mixed
  740.      * @throws ClientExceptionInterface
  741.      * @throws RedirectionExceptionInterface
  742.      * @throws ServerExceptionInterface
  743.      * @throws TransportExceptionInterface
  744.      */
  745.     public function getCategoriesManager(array $filters = [], array $extra = [])
  746.     {
  747.         // $categories = $this->getCategoriesBis($filters, $extra);
  748.         // return $categories;
  749.         $entrypoint '/api/manager/categories';
  750.         $filters array_merge($filters$extra);
  751.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  752.     }
  753.     /**
  754.      * @param string $class
  755.      * @param string $object
  756.      * @return mixed
  757.      * @throws ClientExceptionInterface
  758.      * @throws RedirectionExceptionInterface
  759.      * @throws ServerExceptionInterface
  760.      * @throws TransportExceptionInterface
  761.      */
  762.     public function exclusionToggleManager(string $classstring $object)
  763.     {
  764.         $entrypoint "/api/exclusionsManager/$class/toggle/$object";
  765.         return $this->callUrl($entrypoint);
  766.     }
  767.     /**
  768.      * @param array $filters
  769.      * @return mixed
  770.      * @throws ClientExceptionInterface
  771.      * @throws RedirectionExceptionInterface
  772.      * @throws ServerExceptionInterface
  773.      * @throws TransportExceptionInterface
  774.      */
  775.     public function getVideos(array $filters = [], array $extra =[])
  776.     {
  777.         $entrypoint '/api/videos';
  778.         $filters array_merge($filters$extra);
  779.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  780.     }
  781.     /**
  782.      * @param array $filters
  783.      * @return mixed
  784.      * @throws ClientExceptionInterface
  785.      * @throws RedirectionExceptionInterface
  786.      * @throws ServerExceptionInterface
  787.      * @throws TransportExceptionInterface
  788.      */
  789.     public function getDailyAdvices(array $filters = [])
  790.     {
  791.         $entrypoint '/api/daily_advices';
  792.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  793.     }
  794.     /**
  795.      * @param int $id
  796.      * @return mixed
  797.      * @throws ClientExceptionInterface
  798.      * @throws RedirectionExceptionInterface
  799.      * @throws ServerExceptionInterface
  800.      * @throws TransportExceptionInterface
  801.      */
  802.     public function getAdvice(int $id)
  803.     {
  804.         $entrypoint "/api/daily_advices/" $id;
  805.         return $this->callUrl($entrypoint);
  806.     }
  807.     /**
  808.      * @param array $filters
  809.      * @return mixed
  810.      * @throws ClientExceptionInterface
  811.      * @throws RedirectionExceptionInterface
  812.      * @throws ServerExceptionInterface
  813.      * @throws TransportExceptionInterface
  814.      */
  815.     public function deleteAdvice(int $id)
  816.     {
  817.         $entrypoint '/api/daily_advices/' $id;
  818.         return $this->callUrl($entrypoint'DELETE');
  819.     }
  820.     /**
  821.      * @param int $id
  822.      * @return null
  823.      * @throws ClientExceptionInterface
  824.      * @throws RedirectionExceptionInterface
  825.      * @throws ServerExceptionInterface
  826.      * @throws TransportExceptionInterface
  827.      */
  828.     public function activateAdvice($id)
  829.     {
  830.         $entrypoint '/api/daily_advices/{id}';
  831.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  832.         return $this->callUrl($entrypoint'PATCH', [
  833.             'Content-Type' => 'application/merge-patch+json'
  834.         ], json_encode(['active' => true]));
  835.     }
  836.     /**
  837.      * @param int $id
  838.      * @return null
  839.      * @throws ClientExceptionInterface
  840.      * @throws RedirectionExceptionInterface
  841.      * @throws ServerExceptionInterface
  842.      * @throws TransportExceptionInterface
  843.      */
  844.     public function deactivateAdvice($id)
  845.     {
  846.         $entrypoint '/api/daily_advices/{id}';
  847.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  848.         return $this->callUrl($entrypoint'PATCH', [
  849.             'Content-Type' => 'application/merge-patch+json'
  850.         ], json_encode(['active' => false]));
  851.     }
  852.     /**
  853.      * @return null
  854.      * @throws ClientExceptionInterface
  855.      * @throws RedirectionExceptionInterface
  856.      * @throws ServerExceptionInterface
  857.      * @throws TransportExceptionInterface
  858.      */
  859.     public function postAdvice(array $data)
  860.     {
  861.         $entrypoint '/api/daily_advices';
  862.         $data json_encode($data);
  863.         return $this->callUrl($entrypoint'POST', [], $data);
  864.     }
  865.     /**
  866.      * @param array $dataExpert
  867.      * @param array $video
  868.      * @return mixed
  869.      * @throws ClientExceptionInterface
  870.      * @throws RedirectionExceptionInterface
  871.      * @throws ServerExceptionInterface
  872.      * @throws TransportExceptionInterface
  873.      */
  874.     public function updateAdvice(int $id, array $data)
  875.     {
  876.         $entrypoint "/api/daily_advices/" $id;
  877.         return $this->callUrl($entrypoint'PATCH', [
  878.             'Content-Type' => self::MERGE_CONTENT_TYPE
  879.         ], json_encode($data));
  880.     }
  881.     /**
  882.      * @return null
  883.      * @throws ClientExceptionInterface
  884.      * @throws RedirectionExceptionInterface
  885.      * @throws ServerExceptionInterface
  886.      * @throws TransportExceptionInterface
  887.      */
  888.     public function postDepartment(string $namestring $iri)
  889.     {
  890.         $entrypoint '/api/segmentations';
  891.         $data['name'] = $name;
  892.         $data['company'] = $iri;
  893.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  894.         return $this->callUrl($entrypoint'POST', [], $data);
  895.     }
  896.     /**
  897.      * @param array $filters
  898.      * @return mixed
  899.      * @throws ClientExceptionInterface
  900.      * @throws RedirectionExceptionInterface
  901.      * @throws ServerExceptionInterface
  902.      * @throws TransportExceptionInterface
  903.      */
  904.     public function deleteDepartment(int $id)
  905.     {
  906.         $entrypoint '/api/segmentations/' $id;
  907.         return $this->callUrl($entrypoint'DELETE');
  908.     }
  909.     /**
  910.      * @param int $id
  911.      * @param array $filters
  912.      * @return mixed
  913.      * @throws ClientExceptionInterface
  914.      * @throws RedirectionExceptionInterface
  915.      * @throws ServerExceptionInterface
  916.      * @throws TransportExceptionInterface
  917.      */
  918.     public function getVideo(int $id, array $filters = [])
  919.     {
  920.         $entrypoint '/api/videos/' $id;
  921.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  922.     }
  923.     /**
  924.      * @param array $data
  925.      * @return mixed
  926.      * @throws ClientExceptionInterface
  927.      * @throws RedirectionExceptionInterface
  928.      * @throws ServerExceptionInterface
  929.      * @throws TransportExceptionInterface
  930.      */
  931.     public function updateVideoInformation(int $id, array $data, ?UploadedFile $preview, ?UploadedFile $picture, ?UploadedFile $pdf, ?array $filters = [])
  932.     {
  933.         $entrypoint "/api/videos/" $id;
  934.         $_data $data;
  935.         if ($preview != null) {
  936.             $_data['preview'] = $this->postMediaObject($preview)->{'@id'};
  937.         }else {
  938.             unset($_data['preview']);
  939.         }
  940.         if ($picture != null) {
  941.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  942.         }else {
  943.             unset($_data['picture']);
  944.         }
  945.         if ($pdf != null) {
  946.             $_data['tip'] = $this->postMediaObject($pdf)->{'@id'};
  947.         }else {
  948.             unset($_data['tip']);
  949.         }
  950.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  951.         $data =  str_replace('\\/''/'$data);
  952.         return $this->callUrl($entrypoint'PATCH', ['Content-Type' => self::MERGE_CONTENT_TYPE], $data$filters);
  953.     }
  954.     /**
  955.      * This updates the PDF(tip) on an existing video, at least the id of the video
  956.      * is required in order for this to work
  957.      *
  958.      * @param $video
  959.      * @param UploadedFile|null $pdf pdf file to be modified if any
  960.      * @return null
  961.      * @throws ClientExceptionInterface
  962.      * @throws RedirectionExceptionInterface
  963.      * @throws ServerExceptionInterface
  964.      * @throws TransportExceptionInterface
  965.      */
  966.     public function updateVideoTip($id, ?UploadedFile $pdf null)
  967.     {
  968.         $entrypoint '/api/videos/' $id;
  969.         $data = [];
  970.         if ($pdf != null) {
  971.             $idPdf $this->postMediaObject($pdf)->{'id'};
  972.             $data '{"tip": "/api/media_objects/'.$idPdf.'"}' ;
  973.         }
  974.         return $this->callUrl($entrypoint'PATCH', [
  975.             'Content-Type' => 'application/merge-patch+json'
  976.         ], $data);
  977.     }
  978.     /**
  979.      * This deletes the PDF(tip) on an existing video, at least the id of the video
  980.      * is required in order for this to work
  981.      *
  982.      * @param $video
  983.      * @param UploadedFile|null $pdf pdf file to be modified if any
  984.      * @return null
  985.      * @throws ClientExceptionInterface
  986.      * @throws RedirectionExceptionInterface
  987.      * @throws ServerExceptionInterface
  988.      * @throws TransportExceptionInterface
  989.      */
  990.     public function deleteVideoTip($id$data)
  991.     {
  992.         $entrypoint '/api/videos/' $id;
  993.         return $this->callUrl($entrypoint'PATCH', [
  994.             'Content-Type' => self::MERGE_CONTENT_TYPE
  995.         ],json_encode($data));
  996.     }
  997.     /**
  998.      * This updates the image on an existing video, at least the id of the video
  999.      * is required in order for this to work
  1000.      *
  1001.      * @param $video
  1002.      * @param UploadedFile|null $image image file to be modified if any
  1003.      * @return null
  1004.      * @throws ClientExceptionInterface
  1005.      * @throws RedirectionExceptionInterface
  1006.      * @throws ServerExceptionInterface
  1007.      * @throws TransportExceptionInterface
  1008.      */
  1009.     public function updateVideoPreview($id, ?UploadedFile $image null)
  1010.     {
  1011.         $entrypoint '/api/videos/' $id;
  1012.         $data = [];
  1013.         if ($image != null) {
  1014.             $idImage $this->postMediaObject($image)->{'id'};
  1015.             $data '{"preview": "/api/media_objects/'.$idImage.'"}' ;
  1016.         }
  1017.         return $this->callUrl($entrypoint'PATCH', [
  1018.             'Content-Type' => 'application/merge-patch+json'
  1019.         ], $data);
  1020.     }
  1021.     /**
  1022.      * This updates the image on an existing video, at least the id of the video
  1023.      * is required in order for this to work
  1024.      *
  1025.      * @param $video
  1026.      * @param UploadedFile|null $image image file to be modified if any
  1027.      * @return null
  1028.      * @throws ClientExceptionInterface
  1029.      * @throws RedirectionExceptionInterface
  1030.      * @throws ServerExceptionInterface
  1031.      * @throws TransportExceptionInterface
  1032.      */
  1033.     public function updateVideoPicture($id, ?UploadedFile $image null)
  1034.     {
  1035.         $entrypoint '/api/videos/' $id;
  1036.         $data = [];
  1037.         if ($image != null) {
  1038.             $idImage $this->postMediaObject($image)->{'id'};
  1039.             $data '{"picture": "/api/media_objects/'.$idImage.'"}' ;
  1040.         }
  1041.         return $this->callUrl($entrypoint'PATCH', [
  1042.             'Content-Type' => 'application/merge-patch+json'
  1043.         ], $data);
  1044.     }
  1045.     /**
  1046.      * @param array $dataExpert
  1047.      * @param array $video
  1048.      * @return mixed
  1049.      * @throws ClientExceptionInterface
  1050.      * @throws RedirectionExceptionInterface
  1051.      * @throws ServerExceptionInterface
  1052.      * @throws TransportExceptionInterface
  1053.      */
  1054.     public function updateVideoExpert(int $id, array $data)
  1055.     {
  1056.         $entrypoint "/api/videos/" $id;
  1057.         return $this->callUrl($entrypoint'PATCH', [
  1058.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1059.         ], json_encode($data));
  1060.     }
  1061.     /**
  1062.      * @param array $data
  1063.      * @param array $video
  1064.      * @return mixed
  1065.      * @throws ClientExceptionInterface
  1066.      * @throws RedirectionExceptionInterface
  1067.      * @throws ServerExceptionInterface
  1068.      * @throws TransportExceptionInterface
  1069.      */
  1070.     public function updateVideoChannel(int $id, array $data)
  1071.     {
  1072.         $entrypoint "/api/videos/" $id;
  1073.         return $this->callUrl($entrypoint'PATCH', [
  1074.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1075.         ], json_encode($data));
  1076.     }
  1077.     /**
  1078.      * @param array $filters
  1079.      * @param array $extra
  1080.      * @return mixed
  1081.      * @throws ClientExceptionInterface
  1082.      * @throws RedirectionExceptionInterface
  1083.      * @throws ServerExceptionInterface
  1084.      * @throws TransportExceptionInterface
  1085.      */
  1086.     public function getPrograms(array $filters = [], array $extra = [])
  1087.     {
  1088.         $filters array_merge($filters$extra);
  1089.         $entrypoint '/api/programs';
  1090.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1091.     }
  1092.     /**
  1093.      * This posts a new Program
  1094.      * @param array $data
  1095.      * @param UploadedFile|null $image image file to be posted
  1096.      * @param UploadedFile|null $pdf pdf file to be posted
  1097.      * @return null
  1098.      * @throws ClientExceptionInterface
  1099.      * @throws RedirectionExceptionInterface
  1100.      * @throws ServerExceptionInterface
  1101.      * @throws TransportExceptionInterface
  1102.      */
  1103.     public function postProgram($data ,?UploadedFile $image null, ?UploadedFile $picture null, ?UploadedFile $pdf null)
  1104.     {
  1105.         $entrypoint '/api/programs';
  1106.         $_data $data;
  1107.         if ($image != null) {
  1108.             $_data['illustration'] = $this->postMediaObject($image)->{'@id'};
  1109.         }
  1110.         if ($picture != null) {
  1111.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  1112.         }
  1113.         if ($pdf != null) {
  1114.             $_data['tip'] = $this->postMediaObject($pdf)->{'@id'};
  1115.         }
  1116.          $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  1117.          $data =  str_replace('\\/','/'$data);
  1118.         return $this->callUrl($entrypoint'POST', [
  1119.             'Content-Type' => 'application/ld+json'
  1120.         ], $data);
  1121.     }
  1122.     /**
  1123.      * This edits a Program
  1124.      * @param array $data
  1125.      * @param UploadedFile|null $image image file to be posted
  1126.      * @param UploadedFile|null $pdf pdf file to be posted
  1127.      * @return null
  1128.      * @throws ClientExceptionInterface
  1129.      * @throws RedirectionExceptionInterface
  1130.      * @throws ServerExceptionInterface
  1131.      * @throws TransportExceptionInterface
  1132.      */
  1133.     public function editProgramint $id$data ,?UploadedFile $image null, ?UploadedFile $picture null, ?UploadedFile $pdf null)
  1134.     {
  1135.         $entrypoint '/api/programs/'$id ;
  1136.         $_data $data;
  1137.         if ($image != null) {
  1138.             $_data['illustration'] = $this->postMediaObject($image)->{'@id'};
  1139.         }
  1140.         if ($picture != null) {
  1141.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  1142.         }
  1143.         if ($pdf != null) {
  1144.             $_data['tip'] = $this->postMediaObject($pdf)->{'@id'};
  1145.         }
  1146.          $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  1147.          $data =  str_replace('\\/''/'$data);
  1148.         return $this->callUrl($entrypoint'PATCH', [
  1149.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1150.         ], $data);
  1151.     }
  1152.     /**
  1153.      * @param array $data
  1154.      * @param array $video
  1155.      * @return mixed
  1156.      * @throws ClientExceptionInterface
  1157.      * @throws RedirectionExceptionInterface
  1158.      * @throws ServerExceptionInterface
  1159.      * @throws TransportExceptionInterface
  1160.      */
  1161.     public function updateProgramVideo(int $id, array $data)
  1162.     {
  1163.         $entrypoint '/api/days/'$id;
  1164.         $data json_encode($data);
  1165.         $data =  str_replace('\\/''/'$data);
  1166.         return $this->callUrl($entrypoint'PATCH', [
  1167.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1168.         ], $data);
  1169.     }
  1170.     /**
  1171.      * @param array $data
  1172.      * @param array $video
  1173.      * @return mixed
  1174.      * @throws ClientExceptionInterface
  1175.      * @throws RedirectionExceptionInterface
  1176.      * @throws ServerExceptionInterface
  1177.      * @throws TransportExceptionInterface
  1178.      */
  1179.     public function updateProgramDayContent(int $id, array $data)
  1180.     {
  1181.         $entrypoint '/api/days/'$id;
  1182.         $data json_encode($data);
  1183.         $data =  str_replace('\\/''/'$data);
  1184.         return $this->callUrl($entrypoint'PATCH', [
  1185.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1186.         ], $data);
  1187.     }
  1188.     /**
  1189.      * @param array $data
  1190.      * @param array $video
  1191.      * @return mixed
  1192.      * @throws ClientExceptionInterface
  1193.      * @throws RedirectionExceptionInterface
  1194.      * @throws ServerExceptionInterface
  1195.      * @throws TransportExceptionInterface
  1196.      */
  1197.     public function deleteProgramVideo(int $id, array $data)
  1198.     {
  1199.         $entrypoint '/api/days/'$id;
  1200.         $data json_encode($data);
  1201.         $data =  str_replace('\\/''/'$data);
  1202.         return $this->callUrl($entrypoint'PATCH', [
  1203.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1204.         ], $data);
  1205.     }
  1206.     /**
  1207.      * This updates the image on an existing video, at least the id of the video
  1208.      * is required in order for this to work
  1209.      *
  1210.      * @param $video
  1211.      * @param UploadedFile|null $image image file to be modified if any
  1212.      * @return null
  1213.      * @throws ClientExceptionInterface
  1214.      * @throws RedirectionExceptionInterface
  1215.      * @throws ServerExceptionInterface
  1216.      * @throws TransportExceptionInterface
  1217.      */
  1218.     public function postProgramPicture(?UploadedFile $image null)
  1219.     {
  1220.         $entrypoint '/api/programs';
  1221.         $data = [];
  1222.         if ($image != null) {
  1223.             $idImage $this->postMediaObject($image)->{'id'};
  1224.             $data '{"picture": "/api/media_objects/'.$idImage.'"}' ;
  1225.         }
  1226.         return $this->callUrl($entrypoint'POST', [
  1227.             'Content-Type' => 'application/ld+json'
  1228.         ], $data);
  1229.     }
  1230.     /**
  1231.      * This updates the image on an existing video, at least the id of the video
  1232.      * is required in order for this to work
  1233.      *
  1234.      * @param $video
  1235.      * @param UploadedFile|null $image image file to be modified if any
  1236.      * @return null
  1237.      * @throws ClientExceptionInterface
  1238.      * @throws RedirectionExceptionInterface
  1239.      * @throws ServerExceptionInterface
  1240.      * @throws TransportExceptionInterface
  1241.      */
  1242.     public function postProgramPdf(?UploadedFile $pdf null)
  1243.     {
  1244.         $entrypoint '/api/programs';
  1245.         $data = [];
  1246.         if ($pdf != null) {
  1247.             $idpdf $this->postMediaObject($pdf)->{'id'};
  1248.             $data '{"picture": "/api/media_objects/'.$idpdf.'"}' ;
  1249.         }
  1250.         return $this->callUrl($entrypoint'POST', [
  1251.             'Content-Type' => 'application/ld+json'
  1252.         ], $data);
  1253.     }
  1254.     /**
  1255.      * @param string $programsId
  1256.      * @return mixed
  1257.      * @throws ClientExceptionInterface
  1258.      * @throws RedirectionExceptionInterface
  1259.      * @throws ServerExceptionInterface
  1260.      * @throws TransportExceptionInterface
  1261.      */
  1262.     public function activateProgram(int $id)
  1263.     {
  1264.         $entrypoint "/api/programs/"$id ."/activate";
  1265.         return $this->callUrl($entrypoint);
  1266.     }
  1267.     /**
  1268.      * @param string $programsId
  1269.      * @return mixed
  1270.      * @throws ClientExceptionInterface
  1271.      * @throws RedirectionExceptionInterface
  1272.      * @throws ServerExceptionInterface
  1273.      * @throws TransportExceptionInterface
  1274.      */
  1275.     public function deactivateProgram(int $id)
  1276.     {
  1277.         $entrypoint "/api/programs/"$id ."/deactivate";
  1278.         return $this->callUrl($entrypoint);
  1279.     }
  1280.     /**
  1281.      * @param int $id
  1282.      * @param array $filters
  1283.      * @return mixed
  1284.      * @throws ClientExceptionInterface
  1285.      * @throws RedirectionExceptionInterface
  1286.      * @throws ServerExceptionInterface
  1287.      * @throws TransportExceptionInterface
  1288.      */
  1289.     public function getProgram(int $id, array $filters = [])
  1290.     {
  1291.         $entrypoint '/api/programs/' $id;
  1292.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1293.     }
  1294.     /**
  1295.      * @param array $filters
  1296.      * @return mixed
  1297.      * @throws ClientExceptionInterface
  1298.      * @throws RedirectionExceptionInterface
  1299.      * @throws ServerExceptionInterface
  1300.      * @throws TransportExceptionInterface
  1301.      */
  1302.     public function deleteProgram(int $id)
  1303.     {
  1304.         $entrypoint '/api/programs/' $id;
  1305.         return $this->callUrl($entrypoint'DELETE');
  1306.     }
  1307.     /**
  1308.      * @param array $filters
  1309.      * @return mixed
  1310.      * @throws ClientExceptionInterface
  1311.      * @throws RedirectionExceptionInterface
  1312.      * @throws ServerExceptionInterface
  1313.      * @throws TransportExceptionInterface
  1314.      */
  1315.     public function cloneProgram(int $id, array $filters = [])
  1316.     {
  1317.         $entrypoint '/api/programs/' $id '/clone';
  1318.         return $this->callUrl($entrypoint'POST', [], ['' => ''], $filters);
  1319.     }
  1320.     /**
  1321.      * @param int $id
  1322.      * @param array $filters
  1323.      * @return mixed
  1324.      * @throws ClientExceptionInterface
  1325.      * @throws RedirectionExceptionInterface
  1326.      * @throws ServerExceptionInterface
  1327.      * @throws TransportExceptionInterface
  1328.      */
  1329.    public function getProgramDay(int $id, array $filters = [])
  1330.    {
  1331.        $entrypoint '/api/programs/' $id '/days';
  1332.        return $this->callUrl($entrypoint'GET', [], [], $filters);
  1333.    }
  1334.     /**
  1335.      * @param array $filters
  1336.      * @return mixed
  1337.      * @throws ClientExceptionInterface
  1338.      * @throws RedirectionExceptionInterface
  1339.      * @throws ServerExceptionInterface
  1340.      * @throws TransportExceptionInterface
  1341.      */
  1342.     public function getDays(array $filters = [])
  1343.     {
  1344.         $entrypoint '/api/days';
  1345.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1346.     }
  1347.     /**
  1348.      * @param array $filters
  1349.      * @param array $extra
  1350.      * @return mixed
  1351.      * @throws ClientExceptionInterface
  1352.      * @throws RedirectionExceptionInterface
  1353.      * @throws ServerExceptionInterface
  1354.      * @throws TransportExceptionInterface
  1355.      */
  1356.     public function getDayVideos( array $filters = [], array $extra = [])
  1357.     {
  1358.         $entrypoint '/api/days/'$extra['id'] .'/playlist/videos';
  1359.         unset($extra['id']);
  1360.         $filters array_merge($filters$extra);
  1361.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1362.     }
  1363.     /**
  1364.      * @param int $id
  1365.      * @param array $filters
  1366.      * @return mixed
  1367.      * @throws ClientExceptionInterface
  1368.      * @throws RedirectionExceptionInterface
  1369.      * @throws ServerExceptionInterface
  1370.      * @throws TransportExceptionInterface
  1371.      */
  1372.     public function getDay(int $id, array $filters = [])
  1373.     {
  1374.         $entrypoint '/api/days/'.$id;
  1375.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1376.     }
  1377.     /**
  1378.      * @param array $filters
  1379.      * @return mixed
  1380.      * @throws ClientExceptionInterface
  1381.      * @throws RedirectionExceptionInterface
  1382.      * @throws ServerExceptionInterface
  1383.      * @throws TransportExceptionInterface
  1384.      */
  1385.     public function getMessages(array $filters = [])
  1386.     {
  1387.         $entrypoint '/api/messages';
  1388.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1389.     }
  1390.     /**
  1391.      * @param int $id
  1392.      * @param array $filters
  1393.      * @return mixed
  1394.      * @throws ClientExceptionInterface
  1395.      * @throws RedirectionExceptionInterface
  1396.      * @throws ServerExceptionInterface
  1397.      * @throws TransportExceptionInterface
  1398.      */
  1399.     public function getCompany(int $id, array $filters = [])
  1400.     {
  1401.         $entrypoint '/api/companies/{id}';
  1402.         $entrypoint strtr($entrypoint, [
  1403.             '{id}' => $id
  1404.         ]);
  1405.         return $this->callGetUrl($entrypoint$filters);
  1406.     }
  1407.     /**
  1408.      * @param int $companyId
  1409.      * @param array $filters
  1410.      * @return mixed
  1411.      * @throws ClientExceptionInterface
  1412.      * @throws RedirectionExceptionInterface
  1413.      * @throws ServerExceptionInterface
  1414.      * @throws TransportExceptionInterface
  1415.      */
  1416.     public function getCompanyDepartments(int $companyId, array $filters = [])
  1417.     {
  1418.         $entrypoint "/api/companies/{$companyId}/departments";
  1419.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1420.     }
  1421.     /**
  1422.      * @param int $id
  1423.      * @param array $filters
  1424.      * @return mixed
  1425.      * @throws ClientExceptionInterface
  1426.      * @throws RedirectionExceptionInterface
  1427.      * @throws ServerExceptionInterface
  1428.      * @throws TransportExceptionInterface
  1429.      */
  1430.     public function getCompanySlides(array $filters = [], array $extra = [])
  1431.     {
  1432.         $filters array_merge($filters$extra);
  1433.         $entrypoint '/api/companies/{id}/slides';
  1434.         $entrypoint strtr($entrypoint, [
  1435.             '{id}' => $filters['id']
  1436.         ]);
  1437.         return $this->callUrl($entrypoint);
  1438.     }
  1439.     /**
  1440.      * @param int $id
  1441.      * @param array $filters
  1442.      * @return mixed
  1443.      * @throws ClientExceptionInterface
  1444.      * @throws RedirectionExceptionInterface
  1445.      * @throws ServerExceptionInterface
  1446.      * @throws TransportExceptionInterface
  1447.      */
  1448.     public function getCompanySlide(int $id, array $filters = [])
  1449.     {
  1450.         $entrypoint '/api/slides/{id}';
  1451.         $entrypoint strtr($entrypoint, [
  1452.             '{id}' => $id
  1453.         ]);
  1454.         return $this->callUrl($entrypoint);
  1455.     }
  1456.     /**
  1457.      * @param int $id
  1458.      * @param array $filters
  1459.      * @return mixed
  1460.      * @throws ClientExceptionInterface
  1461.      * @throws RedirectionExceptionInterface
  1462.      * @throws ServerExceptionInterface
  1463.      * @throws TransportExceptionInterface
  1464.      */
  1465.     public function getCompanyUsers( array $filters = [], int $id)
  1466.     {
  1467.         $entrypoint '/api/companies/'$id .'/users';
  1468.         $entrypoint '/api/companies/'$id .'/clients';
  1469.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1470.     }
  1471.     /**
  1472.      * This posts a new Program
  1473.      * @param array $data
  1474.      * @param UploadedFile|null $image image file to be posted
  1475.      * @return null
  1476.      * @throws ClientExceptionInterface
  1477.      * @throws RedirectionExceptionInterface
  1478.      * @throws ServerExceptionInterface
  1479.      * @throws TransportExceptionInterface
  1480.      */
  1481.     public function postCompany($data ,?UploadedFile $image null)
  1482.     {
  1483.         $entrypoint '/api/companies';
  1484.         $_data $data;
  1485.         if ($image != null) {
  1486.             $_data['logo'] = $this->postMediaObject($image)->{'@id'};
  1487.         }
  1488.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  1489.         $data =  str_replace('\\/''/'$data);
  1490.         return $this->callUrl($entrypoint'POST', [
  1491.             'Content-Type' => 'application/ld+json'
  1492.         ], $data);
  1493.     }
  1494.     /**
  1495.      * @param array $filters
  1496.      * @return mixed
  1497.      * @throws ClientExceptionInterface
  1498.      * @throws RedirectionExceptionInterface
  1499.      * @throws ServerExceptionInterface
  1500.      * @throws TransportExceptionInterface
  1501.      */
  1502.     public function deleteCompany(int $id)
  1503.     {
  1504.         $entrypoint '/api/companies/' $id;
  1505.         return $this->callUrl($entrypoint'DELETE');
  1506.     }
  1507.     /**
  1508.      * @param int $id
  1509.      * @param array $filters
  1510.      * @return mixed
  1511.      * @throws ClientExceptionInterface
  1512.      * @throws RedirectionExceptionInterface
  1513.      * @throws ServerExceptionInterface
  1514.      * @throws TransportExceptionInterface
  1515.      */
  1516.     public function getCategory(int $id, array $filters = [])
  1517.     {
  1518.         $entrypoint '/api/categories/{id}';
  1519.         $entrypoint strtr($entrypoint, [
  1520.             '{id}' => $id
  1521.         ]);
  1522.         return $this->callUrl($entrypoint);
  1523.     }
  1524.     /**
  1525.      * Uploads a media object to the api this function
  1526.      * is not meant to be called without any other
  1527.      * orphan media objects will be removed from the API
  1528.      *
  1529.      * @param $file
  1530.      * @return mixed
  1531.      * @throws ClientExceptionInterface
  1532.      * @throws RedirectionExceptionInterface
  1533.      * @throws ServerExceptionInterface
  1534.      * @throws TransportExceptionInterface
  1535.      */
  1536.     protected function postMediaObject(UploadedFile $file)
  1537.     {
  1538.         $entrypoint '/api/media_objects';
  1539.         $dataFile = new DataPart($file->getContent(), $this->slugger->slug($file->getClientOriginalName(), '.') , $file->getMimeType());
  1540.         $formFields = [
  1541.             'file' => $dataFile,
  1542.         ];
  1543.         $formData = new FormDataPart($formFields);
  1544.         return $this->callUrl($entrypoint'POST'$formData->getPreparedHeaders()->toArray(), $formData->bodyToString(), ['fields' => ["id"]]);
  1545.     }
  1546.     /**
  1547.      * This updates the infos on an existing company, at leas the id of the company
  1548.      * is required in order for this to work
  1549.      *
  1550.      * @param mixed $company infos on the company to be modified
  1551.      * @param UploadedFile|null $logo logo file to be modified if any
  1552.      * @return null
  1553.      * @throws ClientExceptionInterface
  1554.      * @throws RedirectionExceptionInterface
  1555.      * @throws ServerExceptionInterface
  1556.      * @throws TransportExceptionInterface
  1557.      */
  1558.     public function UpdateCompany(int $id, array $dataUploadedFile $logo nullUploadedFile $cmsImage null, array $filters = [])
  1559.     {
  1560.         $entrypoint '/api/companies/'$id;
  1561.         $_data $data;
  1562.         if ($logo != null) {
  1563.             $_data['logo'] = $this->postMediaObject($logo)->{'@id'};
  1564.         }elseif ($cmsImage != null){
  1565.             $_data['cmsImg'] = $this->postMediaObject($cmsImage)->{'@id'};
  1566.         }elseif (!empty($_data['removeImage']) && $_data['removeImage'] == "true") {
  1567.             $_data['cmsImg'] = null;
  1568.         } else {
  1569.             unset($_data['logo']);
  1570.             unset($_data['cmsImg']);
  1571.         }
  1572.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  1573.         $data =  str_replace('\\/''/'$data);
  1574.         return $this->callUrl($entrypoint'PATCH', [
  1575.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1576.         ], $data$filters);
  1577.     }
  1578.     /**
  1579.      * This deletes the image on a company page without having to send a form.
  1580.      *
  1581.      * @param mixed $company infos on the company to be modified
  1582.      * @param UploadedFile|null $logo logo file to be modified if any
  1583.      * @return null
  1584.      * @throws ClientExceptionInterface
  1585.      * @throws RedirectionExceptionInterface
  1586.      * @throws ServerExceptionInterface
  1587.      * @throws TransportExceptionInterface
  1588.      */
  1589.     public function DeleteCmsImage(int $id, array $data)
  1590.     {
  1591.         $entrypoint '/api/companies/'$id;
  1592.         $_data $data;
  1593.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  1594.         $data =  str_replace('\\/''/'$data);
  1595.         return $this->callUrl($entrypoint'PATCH', [
  1596.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1597.         ], $data);
  1598.     }
  1599.     /**
  1600.      * This updates the subscription infos on an existing company, at leas the id of the company
  1601.      * is required in order for this to work
  1602.      *
  1603.      * @param mixed $company infos on the company to be modified
  1604.      * @param UploadedFile|null $logo logo file to be modified if any
  1605.      * @return null
  1606.      * @throws ClientExceptionInterface
  1607.      * @throws RedirectionExceptionInterface
  1608.      * @throws ServerExceptionInterface
  1609.      * @throws TransportExceptionInterface
  1610.      */
  1611.     public function updateCompanySubscription(int $id, array $data)
  1612.     {
  1613.         $entrypoint '/api/companies/'$id;
  1614.         $_data $data;
  1615.         $data json_encode($_data);
  1616.         return $this->callUrl($entrypoint'PATCH', [
  1617.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1618.         ], $data);
  1619.     }
  1620.     /**
  1621.      * This updates the restriction infos on an existing company, at least the id of the company
  1622.      * is required in order for this to work
  1623.      *
  1624.      * @param mixed $company infos on the company to be modified
  1625.      * @param UploadedFile|null $logo logo file to be modified if any
  1626.      * @return null
  1627.      * @throws ClientExceptionInterface
  1628.      * @throws RedirectionExceptionInterface
  1629.      * @throws ServerExceptionInterface
  1630.      * @throws TransportExceptionInterface
  1631.      */
  1632.     public function updateCompanyRestriction(int $id, array $data)
  1633.     {
  1634.         $entrypoint '/api/companies/'$id;
  1635.         $_data $data;
  1636.         $data json_encode($_data);
  1637.         return $this->callUrl($entrypoint'PATCH', [
  1638.             'Content-Type' => self::MERGE_CONTENT_TYPE
  1639.         ], $data);
  1640.     }
  1641.     /**
  1642.      * This updates the image on an existing company, at least the id of the company
  1643.      * is required in order for this to work
  1644.      *
  1645.      * @param $video
  1646.      * @param UploadedFile|null $image image file to be modified if any
  1647.      * @return null
  1648.      * @throws ClientExceptionInterface
  1649.      * @throws RedirectionExceptionInterface
  1650.      * @throws ServerExceptionInterface
  1651.      * @throws TransportExceptionInterface
  1652.      */
  1653.     public function updateCompanyLogo($id, ?UploadedFile $image null)
  1654.     {
  1655.         $entrypoint '/api/videos/' $id;
  1656.         $data = [];
  1657.         if ($image != null) {
  1658.             $idImage $this->postMediaObject($image)->{'id'};
  1659.             $data '{"logo": "/api/media_objects/'.$idImage.'"}' ;
  1660.         }
  1661.         return $this->callUrl($entrypoint'PATCH', [
  1662.             'Content-Type' => 'application/merge-patch+json'
  1663.         ], $data);
  1664.     }
  1665.     /**
  1666.      * @param mixed $category
  1667.      * @return null
  1668.      * @throws ClientExceptionInterface
  1669.      * @throws RedirectionExceptionInterface
  1670.      * @throws ServerExceptionInterface
  1671.      * @throws TransportExceptionInterface
  1672.      */
  1673.     public function activateCategory($id)
  1674.     {
  1675.         $entrypoint '/api/categories/{id}';
  1676.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1677.         return $this->callUrl($entrypoint'PATCH', [
  1678.             'Content-Type' => 'application/merge-patch+json'
  1679.         ], json_encode(['active' => true]));
  1680.     }
  1681.     /**
  1682.      * @param mixed $category
  1683.      * @return null
  1684.      * @throws ClientExceptionInterface
  1685.      * @throws RedirectionExceptionInterface
  1686.      * @throws ServerExceptionInterface
  1687.      * @throws TransportExceptionInterface
  1688.      */
  1689.     public function deactivateCategory($id)
  1690.     {
  1691.         $entrypoint '/api/categories/{id}';
  1692.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1693.         return $this->callUrl($entrypoint'PATCH', [
  1694.             'Content-Type' => 'application/merge-patch+json'
  1695.         ], json_encode(['active' => false]));
  1696.     }
  1697.     /**
  1698.      * @param mixed $channel
  1699.      * @return null
  1700.      * @throws ClientExceptionInterface
  1701.      * @throws RedirectionExceptionInterface
  1702.      * @throws ServerExceptionInterface
  1703.      * @throws TransportExceptionInterface
  1704.      */
  1705.     public function activateChaine($id)
  1706.     {
  1707.         $entrypoint '/api/channels/{id}';
  1708.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1709.         return $this->callUrl($entrypoint'PATCH', [
  1710.             'Content-Type' => 'application/merge-patch+json'
  1711.         ], json_encode(['active' => true]));
  1712.     }
  1713.     /**
  1714.      * @param mixed $channel
  1715.      * @return null
  1716.      * @throws ClientExceptionInterface
  1717.      * @throws RedirectionExceptionInterface
  1718.      * @throws ServerExceptionInterface
  1719.      * @throws TransportExceptionInterface
  1720.      */
  1721.     public function deactivateChaine($id)
  1722.     {
  1723.         $entrypoint '/api/channels/{id}';
  1724.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1725.         return $this->callUrl($entrypoint'PATCH', [
  1726.             'Content-Type' => 'application/merge-patch+json'
  1727.         ], json_encode(['active' => false]));
  1728.     }
  1729.     /**
  1730.      * @param mixed $video
  1731.      * @return null
  1732.      * @throws ClientExceptionInterface
  1733.      * @throws RedirectionExceptionInterface
  1734.      * @throws ServerExceptionInterface
  1735.      * @throws TransportExceptionInterface
  1736.      */
  1737.     public function getVideosFromChannel(array $filters = [], array $extra = [])
  1738.     {
  1739.         $filters array_merge($filters$extra);
  1740.         $entrypoint '/api/channels/{id}/playlist/videos';
  1741.         $entrypoint strtr($entrypoint, ['{id}' => $filters['id']]);
  1742.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1743.     }
  1744.     /**
  1745.      * @param mixed $video
  1746.      * @return null
  1747.      * @throws ClientExceptionInterface
  1748.      * @throws RedirectionExceptionInterface
  1749.      * @throws ServerExceptionInterface
  1750.      * @throws TransportExceptionInterface
  1751.      */
  1752.     public function getVideosFromChannelPlaylist(array $filters = [], array $extra = [])
  1753.     {
  1754.         $filters array_merge($filters$extra);
  1755.         $entrypoint '/api/playlists/{id}/videos';
  1756.         $entrypoint strtr($entrypoint, ['{id}' => $filters['id']]);
  1757.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1758.     }
  1759.     /**
  1760.      * @param mixed $video
  1761.      * @return null
  1762.      * @throws ClientExceptionInterface
  1763.      * @throws RedirectionExceptionInterface
  1764.      * @throws ServerExceptionInterface
  1765.      * @throws TransportExceptionInterface
  1766.      */
  1767.     public function setVideosChannelRank(array $data = [])
  1768.     {
  1769.         $entrypoint "/api/custom/playlist_video_configs/update-rank";
  1770.         return $this->callUrl($entrypoint'POST', [], json_encode($data));
  1771.     }
  1772.     /**
  1773.      * @param array $data
  1774.      * @return null
  1775.      * @throws ClientExceptionInterface
  1776.      * @throws RedirectionExceptionInterface
  1777.      * @throws ServerExceptionInterface
  1778.      * @throws TransportExceptionInterface
  1779.      */
  1780.     public function updateProgramMoods(array $data = [])
  1781.     {
  1782.         $entrypoint "api/moods_after_post_responses/programs/bulk/add_link";
  1783.         return $this->callUrl($entrypoint'POST', [], json_encode($data));
  1784.     }
  1785.     /**
  1786.      * @param mixed $channel
  1787.      * @return null
  1788.      * @throws ClientExceptionInterface
  1789.      * @throws RedirectionExceptionInterface
  1790.      * @throws ServerExceptionInterface
  1791.      * @throws TransportExceptionInterface
  1792.      */
  1793.     public function deleteChannel($id)
  1794.     {
  1795.         $entrypoint '/api/channels/{id}';
  1796.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1797.         return $this->callUrl($entrypoint'DELETE');
  1798.     }
  1799.     /**
  1800.      * @param mixed $category
  1801.      * @return null
  1802.      * @throws ClientExceptionInterface
  1803.      * @throws RedirectionExceptionInterface
  1804.      * @throws ServerExceptionInterface
  1805.      * @throws TransportExceptionInterface
  1806.      */
  1807.     public function deleteCategory($id)
  1808.     {
  1809.         $entrypoint '/api/categories/{id}';
  1810.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1811.         return $this->callUrl($entrypoint'DELETE');
  1812.     }
  1813.     /**
  1814.      * This updates the infos on an existing company, at leas the id of the company
  1815.      * is required in order for this to work
  1816.      *
  1817.      * @param $category
  1818.      * @return null
  1819.      * @throws ClientExceptionInterface
  1820.      * @throws RedirectionExceptionInterface
  1821.      * @throws ServerExceptionInterface
  1822.      * @throws TransportExceptionInterface
  1823.      */
  1824.     public function updateCategory($category, ?UploadedFile $illustration null, ?UploadedFile $picture null, ?UploadedFile $appPicture null)
  1825.     {
  1826.         $entrypoint '/api/categories/{id}';
  1827.         $_category = (array)$category;
  1828.         $id $this->extractProperty($category'id');
  1829.         if($illustration != null){
  1830.             $_category['illustration'] = $this->postMediaObject($illustration)->{'@id'};
  1831.         } else {
  1832.             unset($_category['illustration']);
  1833.         }
  1834.         if($picture != null){
  1835.             $_category['picture'] = $this->postMediaObject($picture)->{'@id'};
  1836.         } else {
  1837.             unset($_category['picture']);
  1838.         }
  1839.         if($appPicture != null){
  1840.             $_category['appPicture'] = $this->postMediaObject($appPicture)->{'@id'};
  1841.         } else {
  1842.             unset($_category['appPicture']);
  1843.         }
  1844.         $data json_encode($_categoryJSON_UNESCAPED_UNICODE);
  1845.         $data str_replace('\\/''/'$data);
  1846.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1847.         return $this->callUrl($entrypoint'PATCH', [
  1848.             'Content-Type' => 'application/merge-patch+json'
  1849.         ], $data);
  1850.     }
  1851.     /**
  1852.      * This updates the infos on an existing company, at leas the id of the company
  1853.      * is required in order for this to work
  1854.      *
  1855.      * @param mixed $company infos on the company to be modified
  1856.      * @param UploadedFile|null $logo logo file to be modified if any
  1857.      * @return null
  1858.      * @throws ClientExceptionInterface
  1859.      * @throws RedirectionExceptionInterface
  1860.      * @throws ServerExceptionInterface
  1861.      * @throws TransportExceptionInterface
  1862.      */
  1863.     public function updateChannel(int $id$channel, ?UploadedFile $image null)
  1864.     {
  1865.         $entrypoint '/api/channels/'$id;
  1866.         $_channel = (array)$channel;
  1867.         if($image != null){
  1868.             $_channel['image'] = $this->postMediaObject($image)->{'@id'};
  1869.         } else {
  1870.             unset($_channel['image']);
  1871.         }
  1872.         $data json_encode($_channelJSON_UNESCAPED_UNICODE);
  1873.         $data str_replace('\\/''/'$data);
  1874.         return $this->callUrl($entrypoint'PATCH', [
  1875.             'Content-Type' => 'application/merge-patch+json'
  1876.         ], $data);
  1877.     }
  1878.     /**
  1879.      * Calls activation toggle on a company
  1880.      *
  1881.      * @param int $id
  1882.      * @return mixed
  1883.      * @throws ClientExceptionInterface
  1884.      * @throws RedirectionExceptionInterface
  1885.      * @throws ServerExceptionInterface
  1886.      * @throws TransportExceptionInterface
  1887.      */
  1888.     public function activateCompany(int $id)
  1889.     {
  1890.         $entrypoint '/api/companies/{id}/activation';
  1891.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  1892.         return $this->callUrl($entrypoint);
  1893.     }
  1894.     /**
  1895.      * Extracts property of generic object or array
  1896.      * @param array|object $element
  1897.      * @param string $property
  1898.      * @return mixed
  1899.      */
  1900.     private function extractProperty($elementstring $property)
  1901.     {
  1902.         $result null;
  1903.         if (is_array($element) && isset($element[$property])) {
  1904.             $result $element[$property];
  1905.         } elseif (is_object($element) && isset($element->$property)) {
  1906.             $result $element->$property;
  1907.         }
  1908.         if ($result === null) {
  1909.             throw new \InvalidArgumentException("Unable to extract '$property'");
  1910.         }
  1911.         return $result;
  1912.     }
  1913.     /**
  1914.      * @return mixed
  1915.      * @throws ClientExceptionInterface
  1916.      * @throws RedirectionExceptionInterface
  1917.      * @throws ServerExceptionInterface
  1918.      * @throws TransportExceptionInterface
  1919.      */
  1920.     public function getLoginImages()
  1921.     {
  1922.         $entrypoint '/api/slides_slug/login_page';
  1923.         return $this->callUrl($entrypoint);
  1924.     }
  1925.     /**
  1926.      * @param string $user
  1927.      * @param DateTime|null $start
  1928.      * @param DateTime|null $end
  1929.      * @return mixed
  1930.      * @throws ClientExceptionInterface
  1931.      * @throws RedirectionExceptionInterface
  1932.      * @throws ServerExceptionInterface
  1933.      * @throws TransportExceptionInterface
  1934.      */
  1935.     public function getStatsUser(string $user, ?DateTime $start, ?DateTime $end)
  1936.     {
  1937.         $entrypoint "/api/stats/user-views/{$user}";
  1938.         return $this->callUrl($entrypoint'GET', [], '', [
  1939.             'start' => $start,
  1940.             'end' => $end,
  1941.         ]);
  1942.     }
  1943.     /**
  1944.      * @param array $filters
  1945.      * @return mixed
  1946.      * @throws ClientExceptionInterface
  1947.      * @throws RedirectionExceptionInterface
  1948.      * @throws ServerExceptionInterface
  1949.      * @throws TransportExceptionInterface
  1950.      */
  1951.     public function getTotalViews(array $filters = [])
  1952.     {
  1953.         $entrypoint '/api/stats/total-views';
  1954.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1955.     }
  1956.     /**
  1957.      * @param array $filters
  1958.      * @return mixed
  1959.      * @throws ClientExceptionInterface
  1960.      * @throws RedirectionExceptionInterface
  1961.      * @throws ServerExceptionInterface
  1962.      * @throws TransportExceptionInterface
  1963.      */
  1964.     public function getTopFiveVideos(array $filters = [])
  1965.     {
  1966.         $entrypoint '/api/stats/top-5';
  1967.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1968.     }
  1969.     /**
  1970.      * @return mixed
  1971.      * @throws ClientExceptionInterface
  1972.      * @throws RedirectionExceptionInterface
  1973.      * @throws ServerExceptionInterface
  1974.      * @throws TransportExceptionInterface
  1975.      */
  1976.     public function getTopFiveVideosCategories()
  1977.     {
  1978.         $entrypoint '/api/stats/top-5';
  1979.         return $this->callUrl($entrypoint);
  1980.     }
  1981.     /**
  1982.      * @param array $filters
  1983.      * @return mixed
  1984.      * @throws ClientExceptionInterface
  1985.      * @throws RedirectionExceptionInterface
  1986.      * @throws ServerExceptionInterface
  1987.      * @throws TransportExceptionInterface
  1988.      */
  1989.     public function getFiveCategories(array $filters = [])
  1990.     {
  1991.         $entrypoint "/api/stats/videos/top-categories";
  1992.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  1993.     }
  1994.     /**
  1995.      * @param array $filters
  1996.      * @return mixed
  1997.      * @throws ClientExceptionInterface
  1998.      * @throws RedirectionExceptionInterface
  1999.      * @throws ServerExceptionInterface
  2000.      * @throws TransportExceptionInterface
  2001.      */
  2002.     public function getUsersStats(array $filters = [])
  2003.     {
  2004.         $entrypoint "/api/stats/users";
  2005.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2006.     }
  2007.     /**
  2008.      * @param array $filters
  2009.      * @return mixed
  2010.      * @throws ClientExceptionInterface
  2011.      * @throws RedirectionExceptionInterface
  2012.      * @throws ServerExceptionInterface
  2013.      * @throws TransportExceptionInterface
  2014.      */
  2015.     public function getFullStats(array $filters = [])
  2016.     {
  2017.         $entrypoint "/api/stats/full";
  2018.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2019.     }
  2020.     /**
  2021.      * @param int $id
  2022.      * @param array $filters
  2023.      * @return mixed
  2024.      * @throws ClientExceptionInterface
  2025.      * @throws RedirectionExceptionInterface
  2026.      * @throws ServerExceptionInterface
  2027.      * @throws TransportExceptionInterface
  2028.      */
  2029.     public function getChannel(int $id, array $filters = [])
  2030.     {
  2031.         $entrypoint '/api/channels/{id}';
  2032.         $entrypoint strtr($entrypoint, [
  2033.             '{id}' => $id
  2034.         ]);
  2035.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2036.     }
  2037.     /**
  2038.      * @param string $channelId
  2039.      * @return mixed
  2040.      * @throws ClientExceptionInterface
  2041.      * @throws RedirectionExceptionInterface
  2042.      * @throws ServerExceptionInterface
  2043.      * @throws TransportExceptionInterface
  2044.      */
  2045.     public function getFiveChannel(string $channelId)
  2046.     {
  2047.         $entrypoint "/api/stats/top-channel/$channelId";
  2048.         return $this->callUrl($entrypoint);
  2049.     }
  2050.     /**
  2051.      * @param array $filters
  2052.      * @return mixed
  2053.      * @throws ClientExceptionInterface
  2054.      * @throws RedirectionExceptionInterface
  2055.      * @throws ServerExceptionInterface
  2056.      * @throws TransportExceptionInterface
  2057.      */
  2058.     public function getTopChannels(array $filters = [])
  2059.     {
  2060.         $entrypoint "/api/stats/top-channels";
  2061.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2062.     }
  2063.     /**
  2064.      * @param array $filters
  2065.      * @return mixed
  2066.      * @throws ClientExceptionInterface
  2067.      * @throws RedirectionExceptionInterface
  2068.      * @throws ServerExceptionInterface
  2069.      * @throws TransportExceptionInterface
  2070.      */
  2071.     public function getTopChannelsCategories(array $filters = [])
  2072.     {
  2073.         $entrypoint "/api/stats/categories/top-channels";
  2074.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2075.     }
  2076.     /**
  2077.      * @param array $filters
  2078.      * @return mixed
  2079.      * @throws ClientExceptionInterface
  2080.      * @throws RedirectionExceptionInterface
  2081.      * @throws ServerExceptionInterface
  2082.      * @throws TransportExceptionInterface
  2083.      */
  2084.     public function getTopCategories(array $filters = [])
  2085.     {
  2086.         $entrypoint "/api/stats/top-categories";
  2087.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2088.     }
  2089.     /**
  2090.      * @return mixed
  2091.      * @throws ClientExceptionInterface
  2092.      * @throws RedirectionExceptionInterface
  2093.      * @throws ServerExceptionInterface
  2094.      * @throws TransportExceptionInterface
  2095.      */
  2096.     public function getWeeklyRestrictions()
  2097.     {
  2098.         $entrypoint "/api/restrictions/manager/week-days";
  2099.         return $this->callUrl($entrypoint);
  2100.     }
  2101.     /**
  2102.      * @return mixed
  2103.      * @throws ClientExceptionInterface
  2104.      * @throws RedirectionExceptionInterface
  2105.      * @throws ServerExceptionInterface
  2106.      * @throws TransportExceptionInterface
  2107.      */
  2108.     public function updateWeeklyRestrictions($data)
  2109.     {
  2110.         $entrypoint "/api/restrictions/manager/week-days";
  2111.         return $this->callUrl($entrypoint'POST', [], json_encode($data));
  2112.     }
  2113.     /**
  2114.      * @param array $filters
  2115.      * @param bool $session
  2116.      * @return mixed
  2117.      * @throws ClientExceptionInterface
  2118.      * @throws RedirectionExceptionInterface
  2119.      * @throws ServerExceptionInterface
  2120.      * @throws TransportExceptionInterface
  2121.      */
  2122.     public function getChannels(array $filters = [], bool $session false)
  2123.     {
  2124.         $entrypoint '/api/channels';
  2125.         if ($session){
  2126.             return $this->sessionStorageCall($entrypoint);
  2127.         }
  2128.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2129.     }
  2130.     /**
  2131.      * @param array $filters
  2132.      * @param bool $playlist
  2133.      * @return mixed
  2134.      * @throws ClientExceptionInterface
  2135.      * @throws RedirectionExceptionInterface
  2136.      * @throws ServerExceptionInterface
  2137.      * @throws TransportExceptionInterface
  2138.      */
  2139.     public function getChannelsForm(array $filters = [], bool $playlist true)
  2140.     {
  2141.         $entrypoint '/api/channels';
  2142.         $result $this->callUrl($entrypoint'GET', [], [], $filters)->{'hydra:member'};
  2143.         $values = [];
  2144.         foreach ($result as $item) {
  2145.             if ($playlist && !empty($item->playlist) && !empty($item->playlist->{'@id'})) {
  2146.                 $values[$item->name] = $item->playlist->{'@id'};
  2147.             } else {
  2148.                 $values[$item->name] = $item->{'@id'};
  2149.             }
  2150.         }
  2151.         return $values;
  2152.     }
  2153.     /**
  2154.      * @param array $filters
  2155.      * @param bool $session
  2156.      * @return mixed
  2157.      * @throws ClientExceptionInterface
  2158.      * @throws RedirectionExceptionInterface
  2159.      * @throws ServerExceptionInterface
  2160.      * @throws TransportExceptionInterface
  2161.      */
  2162.     public function postChannel($data, ?UploadedFile $image null)
  2163.     {
  2164.         $entrypoint '/api/channels';
  2165.         $_data = (array)$data;
  2166.         if($image != null){
  2167.             $_data['image'] = $this->postMediaObject($image)->{'@id'};
  2168.         }
  2169.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2170.         $data str_replace('\\/''/'$data);
  2171.         return $this->callUrl($entrypoint'POST', [], $data);
  2172.     }
  2173.     /**
  2174.      * @param array $filters
  2175.      * @param array $extra
  2176.      * @return mixed
  2177.      * @throws ClientExceptionInterface
  2178.      * @throws RedirectionExceptionInterface
  2179.      * @throws ServerExceptionInterface
  2180.      * @throws TransportExceptionInterface
  2181.      */
  2182.     public function getExperts(array $filters = [], array $extra = [])
  2183.     {
  2184.         $entrypoint '/api/experts';
  2185.         $filters array_merge($filters$extra);
  2186.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2187.     }
  2188.     /**
  2189.      * @param array $filters
  2190.      * @return mixed
  2191.      * @throws ClientExceptionInterface
  2192.      * @throws RedirectionExceptionInterface
  2193.      * @throws ServerExceptionInterface
  2194.      * @throws TransportExceptionInterface
  2195.      */
  2196.     public function deleteExpert(int $id)
  2197.     {
  2198.         $entrypoint '/api/experts/' $id;
  2199.         return $this->callUrl($entrypoint'DELETE');
  2200.     }
  2201.     /**
  2202.      * @param array $filters
  2203.      * @return mixed
  2204.      * @throws ClientExceptionInterface
  2205.      * @throws RedirectionExceptionInterface
  2206.      * @throws ServerExceptionInterface
  2207.      * @throws TransportExceptionInterface
  2208.      */
  2209.     public function getExpert(int $id)
  2210.     {
  2211.         $entrypoint '/api/experts/'.$id;
  2212.         return $this->callUrl($entrypoint'GET');
  2213.     }
  2214.     /**
  2215.      * @param array $filters
  2216.      * @return mixed
  2217.      * @throws ClientExceptionInterface
  2218.      * @throws RedirectionExceptionInterface
  2219.      * @throws ServerExceptionInterface
  2220.      * @throws TransportExceptionInterface
  2221.      */
  2222.     public function getExpertVideos( array $filters = [], int $id)
  2223.     {
  2224.         $entrypoint '/api/experts/'$id .'/videos';
  2225.         $filters['active'] =  true;
  2226.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2227.     }
  2228.     /**
  2229.      * This updates the infos on an existing expert, at leas the id of the expert
  2230.      * is required in order for this to work
  2231.      *
  2232.      * @param mixed $company infos on the company to be modified
  2233.      * @param UploadedFile|null $logo logo file to be modified if any
  2234.      * @return null
  2235.      * @throws ClientExceptionInterface
  2236.      * @throws RedirectionExceptionInterface
  2237.      * @throws ServerExceptionInterface
  2238.      * @throws TransportExceptionInterface
  2239.      */
  2240.     public function updateExpert(int $id, array $data, ?UploadedFile $picture null, ?UploadedFile $avatar null )
  2241.     {
  2242.         $entrypoint '/api/experts/'$id;
  2243.         $_data =(array)$data;
  2244.         if ($picture != null) {
  2245.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  2246.         }else{
  2247.             unset($_data['picture']);
  2248.         }
  2249.         if ($avatar != null) {
  2250.             $_data['avatar'] = $this->postMediaObject($avatar)->{'@id'};
  2251.         }else{
  2252.             unset($_data['avatar']);
  2253.         }
  2254.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2255.         $data =  str_replace('\\/''/'$data);
  2256.         return $this->callUrl($entrypoint'PATCH', [
  2257.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2258.         ], $data);
  2259.     }
  2260.     /**
  2261.      * @param array $filters
  2262.      * @param bool $session
  2263.      * @return mixed
  2264.      * @throws ClientExceptionInterface
  2265.      * @throws RedirectionExceptionInterface
  2266.      * @throws ServerExceptionInterface
  2267.      * @throws TransportExceptionInterface
  2268.      */
  2269.     public function postExpert($data, ?UploadedFile $picture null, ?UploadedFile $avatar null)
  2270.     {
  2271.         $entrypoint '/api/experts';
  2272.         $_data = (array)$data;
  2273.         if ($picture != null) {
  2274.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  2275.         }
  2276.         if ($avatar != null) {
  2277.             $_data['avatar'] = $this->postMediaObject($avatar)->{'@id'};
  2278.         }
  2279.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2280.         $data str_replace('\\/''/'$data);
  2281.         return $this->callUrl($entrypoint'POST', [], $data);
  2282.     }
  2283.     public function postCategory($data, ?UploadedFile $illustration null, ?UploadedFile $picture null, ?UploadedFile $appPicture null )
  2284.     {
  2285.         $entrypoint '/api/categories';
  2286.         $_data = (array)$data;
  2287.         if($illustration != null){
  2288.             $_data['illustration'] = $this->postMediaObject($illustration)->{'@id'};
  2289.         }
  2290.         if($picture != null){
  2291.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  2292.         }
  2293.         if($appPicture != null){
  2294.             $_data['appPicture'] = $this->postMediaObject($appPicture)->{'@id'};
  2295.         }
  2296.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2297.         $data str_replace('\\/''/'$data);
  2298.         return $this->callUrl($entrypoint'POST', [], $data);
  2299.     }
  2300.     /**
  2301.      * @param array $filters
  2302.      * @param bool $session
  2303.      * @return mixed
  2304.      * @throws ClientExceptionInterface
  2305.      * @throws RedirectionExceptionInterface
  2306.      * @throws ServerExceptionInterface
  2307.      * @throws TransportExceptionInterface
  2308.      */
  2309.     public function getChannelsBis(array $filters = [], array $extra = [])
  2310.     {
  2311.         $entrypoint '/api/channels';
  2312.         $filters array_merge($filters$extra);
  2313.         $filters['isThematic'] = false;
  2314.         $filters['exists[user]'] = false;
  2315.         $filters['exists[category]'] = true;
  2316.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2317.     }
  2318.     /**
  2319.      * @param array $filters
  2320.      * @param bool $session
  2321.      * @return mixed
  2322.      * @throws ClientExceptionInterface
  2323.      * @throws RedirectionExceptionInterface
  2324.      * @throws ServerExceptionInterface
  2325.      * @throws TransportExceptionInterface
  2326.      */
  2327.     public function getThematics(array $filters = [], array $extra = [])
  2328.     {
  2329.         $entrypoint '/api/channels';
  2330.         $filters array_merge($filters$extra);
  2331.         $filters['isThematic'] = true;
  2332.         $filters['exists[user]'] = false;
  2333.         $filters['exists[category]'] = true;
  2334.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2335.     }
  2336.     /**
  2337.      * @param array $filters
  2338.      * @param bool $session
  2339.      * @return mixed
  2340.      * @throws ClientExceptionInterface
  2341.      * @throws RedirectionExceptionInterface
  2342.      * @throws ServerExceptionInterface
  2343.      * @throws TransportExceptionInterface
  2344.      */
  2345.     public function getSlidesHome(array $filters = [], array $extra =[])
  2346.     {
  2347.         $entrypoint '/api/slides';
  2348.         $filters['type'] = "homepage_slide";
  2349.         $filters array_merge($filters$extra);
  2350.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2351.     }
  2352.     /**
  2353.      * @param array $filters
  2354.      * @param bool $session
  2355.      * @return mixed
  2356.      * @throws ClientExceptionInterface
  2357.      * @throws RedirectionExceptionInterface
  2358.      * @throws ServerExceptionInterface
  2359.      * @throws TransportExceptionInterface
  2360.      */
  2361.     public function getSlidesFromChannel(array $filters = [], array $extra =[])
  2362.     {
  2363.         $filters array_merge($filters$extra);
  2364.         $entrypoint '/api/channels/{id}/slides';
  2365.         $entrypoint strtr($entrypoint, ['{id}' => $filters['id']]);
  2366.         return $this->callUrl($entrypoint'GET');
  2367.     }
  2368.     /**
  2369.      * @param int $id
  2370.      * @return null
  2371.      * @throws ClientExceptionInterface
  2372.      * @throws RedirectionExceptionInterface
  2373.      * @throws ServerExceptionInterface
  2374.      * @throws TransportExceptionInterface
  2375.      */
  2376.     public function activateSlide($id)
  2377.     {
  2378.         $entrypoint '/api/slides/{id}';
  2379.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2380.         return $this->callUrl($entrypoint'PATCH', [
  2381.             'Content-Type' => 'application/merge-patch+json'
  2382.         ], json_encode(['active' => true]));
  2383.     }
  2384.     /**
  2385.      * @param int $id
  2386.      * @return null
  2387.      * @throws ClientExceptionInterface
  2388.      * @throws RedirectionExceptionInterface
  2389.      * @throws ServerExceptionInterface
  2390.      * @throws TransportExceptionInterface
  2391.      */
  2392.     public function deactivateSlide($id)
  2393.     {
  2394.         $entrypoint '/api/slides/{id}';
  2395.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2396.         return $this->callUrl($entrypoint'PATCH', [
  2397.             'Content-Type' => 'application/merge-patch+json'
  2398.         ], json_encode(['active' => false]));
  2399.     }
  2400.     /**
  2401.      * @param string $iri
  2402.      * @throws ClientExceptionInterface
  2403.      * @throws RedirectionExceptionInterface
  2404.      * @throws ServerExceptionInterface
  2405.      * @throws TransportExceptionInterface
  2406.      */
  2407.     public function getChannelFromIri($iri)
  2408.     {
  2409.         return $this->callUrl($iri'GET');
  2410.     }
  2411.     /**
  2412.      * @param string $iri
  2413.      * @throws ClientExceptionInterface
  2414.      * @throws RedirectionExceptionInterface
  2415.      * @throws ServerExceptionInterface
  2416.      * @throws TransportExceptionInterface
  2417.      */
  2418.     public function getProgramFromIri($iri)
  2419.     {
  2420.         return $this->callUrl($iri'GET');
  2421.     }
  2422.     /**
  2423.      * @param string $iri
  2424.      * @throws ClientExceptionInterface
  2425.      * @throws RedirectionExceptionInterface
  2426.      * @throws ServerExceptionInterface
  2427.      * @throws TransportExceptionInterface
  2428.      */
  2429.     public function getVideoFromIri($iri)
  2430.     {
  2431.         return $this->callUrl($iri'GET');
  2432.     }
  2433.     /**
  2434.      * @throws ClientExceptionInterface
  2435.      * @throws RedirectionExceptionInterface
  2436.      * @throws ServerExceptionInterface
  2437.      * @throws TransportExceptionInterface
  2438.      */
  2439.     public function postSlide($data, ?UploadedFile $image null)
  2440.     {
  2441.         $entrypoint '/api/slides';
  2442.         $_data = (array)$data;
  2443.         if($image != null){
  2444.             $_data['image'] = $this->postMediaObject($image)->{'@id'};
  2445.         }
  2446.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2447.         $data str_replace('\\/''/'$data);
  2448.         return $this->callUrl($entrypoint'POST', [], $data);
  2449.     }
  2450.     /**
  2451.      * @param $data
  2452.      * @param int $id
  2453.      * @return null
  2454.      * @throws ClientExceptionInterface
  2455.      * @throws RedirectionExceptionInterface
  2456.      * @throws ServerExceptionInterface
  2457.      * @throws TransportExceptionInterface
  2458.      */
  2459.     public function updateSlide($data$id, ?UploadedFile $image null$removeImage "")
  2460.     {
  2461.         $entrypoint '/api/slides/{id}';
  2462.         $_data = (array)$data;
  2463.         if($removeImage == "true"){
  2464.             $_data['image'] == null;
  2465.         } elseif($image != null){
  2466.             $_data['image'] = $this->postMediaObject($image)->{'@id'};
  2467.         } else {
  2468.             unset($_data['image']);
  2469.         }
  2470.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2471.         $data str_replace('\\/''/'$data);
  2472.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2473.         return $this->callUrl($entrypoint'PATCH', [
  2474.             'Content-Type' => 'application/merge-patch+json'
  2475.         ], $data);
  2476.     }
  2477.     /**
  2478.      * This deletes the image on a company page without having to send a form.
  2479.      *
  2480.      * @param mixed $company infos on the company to be modified
  2481.      * @param UploadedFile|null $logo logo file to be modified if any
  2482.      * @return null
  2483.      * @throws ClientExceptionInterface
  2484.      * @throws RedirectionExceptionInterface
  2485.      * @throws ServerExceptionInterface
  2486.      * @throws TransportExceptionInterface
  2487.      */
  2488.     public function deleteSlideImage(int $id, array $data)
  2489.     {
  2490.         $entrypoint '/api/slides/'$id;
  2491.         $_data $data;
  2492.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2493.         $data =  str_replace('\\/''/'$data);
  2494.         return $this->callUrl($entrypoint'PATCH', [
  2495.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2496.         ], $data);
  2497.     }
  2498.     /**
  2499.      * @param int $id
  2500.      * @return null
  2501.      * @throws ClientExceptionInterface
  2502.      * @throws RedirectionExceptionInterface
  2503.      * @throws ServerExceptionInterface
  2504.      * @throws TransportExceptionInterface
  2505.      */
  2506.     public function deleteSlide($id)
  2507.     {
  2508.         $entrypoint '/api/slides/{id}';
  2509.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2510.         return $this->callUrl($entrypoint'DELETE');
  2511.     }
  2512.     /**
  2513.      * @param int $id
  2514.      * @return null
  2515.      * @throws ClientExceptionInterface
  2516.      * @throws RedirectionExceptionInterface
  2517.      * @throws ServerExceptionInterface
  2518.      * @throws TransportExceptionInterface
  2519.      */
  2520.     public function getSlide($id)
  2521.     {
  2522.         $entrypoint '/api/slides/{id}';
  2523.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2524.         return $this->callUrl($entrypoint'GET');
  2525.     }
  2526.     // /**
  2527.     //  * @param int $id
  2528.     //  * @return null
  2529.     //  * @throws ClientExceptionInterface
  2530.     //  * @throws RedirectionExceptionInterface
  2531.     //  * @throws ServerExceptionInterface
  2532.     //  * @throws TransportExceptionInterface
  2533.     //  */
  2534.     // public function getCompanySlide($id)
  2535.     // {
  2536.     //     $entrypoint = '/api/slides/{id}';
  2537.     //     $entrypoint = strtr($entrypoint, ['{id}' => $id]);
  2538.     //     return $this->callUrl($entrypoint, 'GET');
  2539.     // }
  2540.     /**
  2541.      * @param $username
  2542.      * @return null
  2543.      * @throws ClientExceptionInterface
  2544.      * @throws RedirectionExceptionInterface
  2545.      * @throws ServerExceptionInterface
  2546.      * @throws TransportExceptionInterface
  2547.      */
  2548.     public function resetPwdRequest($email)
  2549.     {
  2550.         $entrypoint '/security/forgot_password/back/{email}';
  2551.         $entrypoint strtr($entrypoint, ['{email}' => $email]);
  2552.         return $this->callUrl($entrypoint'GET', [
  2553.             'X-url' => $this->router->generate('app_reset_pwd', [], RouterInterface::ABSOLUTE_URL),
  2554.         ]);
  2555.     }
  2556.     /**
  2557.      * @return null
  2558.      * @throws ClientExceptionInterface
  2559.      * @throws RedirectionExceptionInterface
  2560.      * @throws ServerExceptionInterface
  2561.      * @throws TransportExceptionInterface
  2562.      */
  2563.     public function resetPwd(array $data)
  2564.     {
  2565.         $entrypoint '/security/forgot_password';
  2566.         $data json_encode($data);
  2567.         return $this->callUrl($entrypoint'POST', [], $data);
  2568.     }
  2569.     /**
  2570.      * @param array $filters
  2571.      * @return mixed
  2572.      * @throws ClientExceptionInterface
  2573.      * @throws RedirectionExceptionInterface
  2574.      * @throws ServerExceptionInterface
  2575.      * @throws TransportExceptionInterface
  2576.      */
  2577.     public function getFilterCategs(array $filters = [])
  2578.     {
  2579.         $entrypoint '/api/filters_categories';
  2580.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2581.     }
  2582.     /**
  2583.      * @param array $filters
  2584.      * @return mixed
  2585.      * @throws ClientExceptionInterface
  2586.      * @throws RedirectionExceptionInterface
  2587.      * @throws ServerExceptionInterface
  2588.      * @throws TransportExceptionInterface
  2589.      */
  2590.     public function getFilterCateg(int $id)
  2591.     {
  2592.         $entrypoint '/api/filters_categories/'$id;
  2593.         return $this->callUrl($entrypoint'GET');
  2594.     }
  2595.     /**
  2596.      * @return null
  2597.      * @throws ClientExceptionInterface
  2598.      * @throws RedirectionExceptionInterface
  2599.      * @throws ServerExceptionInterface
  2600.      * @throws TransportExceptionInterface
  2601.      */
  2602.     public function postFilterCateg(array $data)
  2603.     {
  2604.         $entrypoint '/api/filters_categories';
  2605.         $data json_encode($data);
  2606.         return $this->callUrl($entrypoint'POST', [], $data);
  2607.     }
  2608.     /**
  2609.      * @return null
  2610.      * @throws ClientExceptionInterface
  2611.      * @throws RedirectionExceptionInterface
  2612.      * @throws ServerExceptionInterface
  2613.      * @throws TransportExceptionInterface
  2614.      */
  2615.     public function activateFilterCateg(int $id, array $data)
  2616.     {
  2617.         $entrypoint '/api/filters_categories/'$id;
  2618.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  2619.         return $this->callUrl($entrypoint'PATCH', [
  2620.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2621.         ], $data);
  2622.     }
  2623.     /**
  2624.      * @return null
  2625.      * @throws ClientExceptionInterface
  2626.      * @throws RedirectionExceptionInterface
  2627.      * @throws ServerExceptionInterface
  2628.      * @throws TransportExceptionInterface
  2629.      */
  2630.     public function editFilterCateg(int $id, array $data)
  2631.     {
  2632.         $entrypoint '/api/filters_categories/'$id;
  2633.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  2634.         return $this->callUrl($entrypoint'PATCH', [
  2635.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2636.         ], $data);
  2637.     }
  2638.     /**
  2639.      * @param array $filters
  2640.      * @return mixed
  2641.      * @throws ClientExceptionInterface
  2642.      * @throws RedirectionExceptionInterface
  2643.      * @throws ServerExceptionInterface
  2644.      * @throws TransportExceptionInterface
  2645.      */
  2646.     public function deleteFilterCateg(int $id)
  2647.     {
  2648.         $entrypoint '/api/filters_categories/' $id;
  2649.         return $this->callUrl($entrypoint'DELETE');
  2650.     }
  2651.     /**
  2652.      * @param array $filters
  2653.      * @return mixed
  2654.      * @throws ClientExceptionInterface
  2655.      * @throws RedirectionExceptionInterface
  2656.      * @throws ServerExceptionInterface
  2657.      * @throws TransportExceptionInterface
  2658.      */
  2659.     public function getFiltersFilters(array $filters = [])
  2660.     {
  2661.         $entrypoint '/api/filters_filters';
  2662.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2663.     }
  2664.     /**
  2665.      * @param array $filters
  2666.      * @return mixed
  2667.      * @throws ClientExceptionInterface
  2668.      * @throws RedirectionExceptionInterface
  2669.      * @throws ServerExceptionInterface
  2670.      * @throws TransportExceptionInterface
  2671.      */
  2672.     public function getFiltersFilter(int $id)
  2673.     {
  2674.         $entrypoint '/api/filters_filters/'$id;
  2675.         return $this->callUrl($entrypoint'GET');
  2676.     }
  2677.     /**
  2678.      * @return null
  2679.      * @throws ClientExceptionInterface
  2680.      * @throws RedirectionExceptionInterface
  2681.      * @throws ServerExceptionInterface
  2682.      * @throws TransportExceptionInterface
  2683.      */
  2684.     public function postFiltersFilter(array $data)
  2685.     {
  2686.         $entrypoint '/api/filters_filters';
  2687.         $data json_encode($data);
  2688.         return $this->callUrl($entrypoint'POST', [], $data);
  2689.     }
  2690.     /**
  2691.      * @return null
  2692.      * @throws ClientExceptionInterface
  2693.      * @throws RedirectionExceptionInterface
  2694.      * @throws ServerExceptionInterface
  2695.      * @throws TransportExceptionInterface
  2696.      */
  2697.     public function editFiltersFilter(int $id, array $data)
  2698.     {
  2699.         $entrypoint '/api/filters_filters/'$id;
  2700.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  2701.         return $this->callUrl($entrypoint'PATCH', [
  2702.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2703.         ], $data);
  2704.     }
  2705.     /**
  2706.      * @return null
  2707.      * @throws ClientExceptionInterface
  2708.      * @throws RedirectionExceptionInterface
  2709.      * @throws ServerExceptionInterface
  2710.      * @throws TransportExceptionInterface
  2711.      */
  2712.     public function activateFiltersFilter(int $id, array $data)
  2713.     {
  2714.         $entrypoint '/api/filters_filters/'$id;
  2715.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  2716.         return $this->callUrl($entrypoint'PATCH', [
  2717.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2718.         ], $data);
  2719.     }
  2720.     /**
  2721.      * @param array $filters
  2722.      * @return mixed
  2723.      * @throws ClientExceptionInterface
  2724.      * @throws RedirectionExceptionInterface
  2725.      * @throws ServerExceptionInterface
  2726.      * @throws TransportExceptionInterface
  2727.      */
  2728.     public function deleteFiltersFilter(int $id)
  2729.     {
  2730.         $entrypoint '/api/filters_filters/' $id;
  2731.         return $this->callUrl($entrypoint'DELETE');
  2732.     }
  2733.     /**
  2734.      * @param array $filters
  2735.      * @return mixed
  2736.      * @throws ClientExceptionInterface
  2737.      * @throws RedirectionExceptionInterface
  2738.      * @throws ServerExceptionInterface
  2739.      * @throws TransportExceptionInterface
  2740.      */
  2741.     public function getMoods(array $filters = [])
  2742.     {
  2743.         $entrypoint '/api/custom/moods';
  2744.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2745.     }
  2746.     /**
  2747.      * @param array $filters
  2748.      * @return mixed
  2749.      * @throws ClientExceptionInterface
  2750.      * @throws RedirectionExceptionInterface
  2751.      * @throws ServerExceptionInterface
  2752.      * @throws TransportExceptionInterface
  2753.      */
  2754.     public function getMoodResponses(array $filters = [])
  2755.     {
  2756.         $entrypoint '/api/mood_after_post_responses';
  2757.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2758.     }
  2759.     /**
  2760.      * @param array $filters
  2761.      * @return mixed
  2762.      * @throws ClientExceptionInterface
  2763.      * @throws RedirectionExceptionInterface
  2764.      * @throws ServerExceptionInterface
  2765.      * @throws TransportExceptionInterface
  2766.      */
  2767.     public function getMoodResponse(int $id)
  2768.     {
  2769.         $entrypoint '/api/mood_after_post_responses/'$id;
  2770.         return $this->callUrl($entrypoint'GET');
  2771.     }
  2772.     /**
  2773.      * @return null
  2774.      * @throws ClientExceptionInterface
  2775.      * @throws RedirectionExceptionInterface
  2776.      * @throws ServerExceptionInterface
  2777.      * @throws TransportExceptionInterface
  2778.      */
  2779.     public function postMoodResponse(array $data)
  2780.     {
  2781.         $entrypoint '/api/mood_after_post_responses';
  2782.         $data json_encode($data);
  2783.         return $this->callUrl($entrypoint'POST', [], $data);
  2784.     }
  2785.     /**
  2786.      * @return null
  2787.      * @throws ClientExceptionInterface
  2788.      * @throws RedirectionExceptionInterface
  2789.      * @throws ServerExceptionInterface
  2790.      * @throws TransportExceptionInterface
  2791.      */
  2792.     public function editMoodResponse(int $id, array $data)
  2793.     {
  2794.         $entrypoint '/api/mood_after_post_responses/'$id;
  2795.         $data json_encode($dataJSON_UNESCAPED_UNICODE);
  2796.         return $this->callUrl($entrypoint'PATCH', [
  2797.             'Content-Type' => self::MERGE_CONTENT_TYPE
  2798.         ], $data);
  2799.     }
  2800.     /**
  2801.      * @param array $filters
  2802.      * @return mixed
  2803.      * @throws ClientExceptionInterface
  2804.      * @throws RedirectionExceptionInterface
  2805.      * @throws ServerExceptionInterface
  2806.      * @throws TransportExceptionInterface
  2807.      */
  2808.     public function deleteMoodResponse(int $id)
  2809.     {
  2810.         $entrypoint '/api/mood_after_post_responses/' $id;
  2811.         return $this->callUrl($entrypoint'DELETE');
  2812.     }
  2813.     /**
  2814.      * @return null
  2815.      * @throws ClientExceptionInterface
  2816.      * @throws RedirectionExceptionInterface
  2817.      * @throws ServerExceptionInterface
  2818.      * @throws TransportExceptionInterface
  2819.      */
  2820.     public function linkMoodResponse(array $data)
  2821.     {
  2822.         $entrypoint '/api/custom/moods_after_post_responses/add_link';
  2823.         $data json_encode($data);
  2824.         return $this->callUrl($entrypoint'POST', [], $data);
  2825.     }
  2826.     /**
  2827.      * @return null
  2828.      * @throws ClientExceptionInterface
  2829.      * @throws RedirectionExceptionInterface
  2830.      * @throws ServerExceptionInterface
  2831.      * @throws TransportExceptionInterface
  2832.      */
  2833.     public function unlinkMoodResponse(array $data)
  2834.     {
  2835.         $entrypoint '/api/custom/moods_after_post_responses/remove_link';
  2836.         $data json_encode($data);
  2837.         return $this->callUrl($entrypoint'POST', [], $data);
  2838.     }
  2839.     /**
  2840.      * @return array
  2841.      * @throws ClientExceptionInterface
  2842.      * @throws RedirectionExceptionInterface
  2843.      * @throws ServerExceptionInterface
  2844.      * @throws TransportExceptionInterface
  2845.      */
  2846.     public function getChannelsTypes()
  2847.     {
  2848.         $entrypoint '/api/custom/channels/types';
  2849.         return $this->callUrl($entrypoint'GET');
  2850.     }
  2851.     /**
  2852.      * @param string $iri
  2853.      * @param array $filters
  2854.      * @return mixed
  2855.      * @throws ClientExceptionInterface
  2856.      * @throws RedirectionExceptionInterface
  2857.      * @throws ServerExceptionInterface
  2858.      * @throws TransportExceptionInterface
  2859.      */
  2860.     public function getIriValue(string $iri, array $filters)
  2861.     {
  2862.         return $this->callUrl($iri'GET', [], [], $filters);
  2863.     }
  2864.     /**
  2865.      * @param array $resources
  2866.      * @param array $filters
  2867.      * @return mixed
  2868.      * @throws ClientExceptionInterface
  2869.      * @throws RedirectionExceptionInterface
  2870.      * @throws ServerExceptionInterface
  2871.      * @throws TransportExceptionInterface
  2872.      */
  2873.     public function getIriValues(array $resources, array $filters)
  2874.     {
  2875.         $filters['resources'] = $resources;
  2876.         return $this->callUrl('/api/resources''GET', [], [], $filters);
  2877.     }
  2878.     /**
  2879.      * @param array $moods
  2880.      * @param int $videoId
  2881.      * @return mixed
  2882.      * @throws ClientExceptionInterface
  2883.      * @throws RedirectionExceptionInterface
  2884.      * @throws ServerExceptionInterface
  2885.      * @throws TransportExceptionInterface
  2886.      */
  2887.     public function bulkMoodsVideoAssociation(array $moodsint $videoId)
  2888.     {
  2889.         $data = [];
  2890.         $entrypoint "/api/moods_after_post_responses/bulk/add_link";
  2891.         foreach ($moods as $mood) {
  2892.             $data[] = [
  2893.                 'id' => explode('/'$mood)[3],
  2894.                 'videos' => [
  2895.                     $videoId
  2896.                 ]
  2897.             ];
  2898.         }
  2899.         return $this->callUrl($entrypoint'POST', [], json_encode($data));
  2900.     }
  2901.     /**
  2902.      * @param array $filters
  2903.      * @param array $extra
  2904.      * @return mixed
  2905.      * @throws ClientExceptionInterface
  2906.      * @throws RedirectionExceptionInterface
  2907.      * @throws ServerExceptionInterface
  2908.      * @throws TransportExceptionInterface
  2909.      */
  2910.     public function getObjectives(array $filters = [], array $extra = [])
  2911.     {
  2912.         $entrypoint '/api/objectives';
  2913.         $filters array_merge($filters$extra);
  2914.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2915.     }
  2916.     /**
  2917.      * @param array $data
  2918.      * @param UploadedFile $illustration
  2919.      * @param UploadedFile $picture
  2920.      * @return mixed
  2921.      * @throws ClientExceptionInterface
  2922.      * @throws RedirectionExceptionInterface
  2923.      * @throws ServerExceptionInterface
  2924.      * @throws TransportExceptionInterface
  2925.      */
  2926.     public function postObjective($data, ?UploadedFile $illustration null, ?UploadedFile $picture null )
  2927.     {
  2928.         $entrypoint '/api/objectives';
  2929.         $_data = (array)$data;
  2930.         if($illustration != null){
  2931.             $_data['illustration'] = $this->postMediaObject($illustration)->{'@id'};
  2932.         }
  2933.         if($picture != null){
  2934.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  2935.         }
  2936.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  2937.         $data str_replace('\\/''/'$data);
  2938.         return $this->callUrl($entrypoint'POST', [], $data);
  2939.     }
  2940.     /**
  2941.      * @param array $filters
  2942.      * @return mixed
  2943.      * @throws ClientExceptionInterface
  2944.      * @throws RedirectionExceptionInterface
  2945.      * @throws ServerExceptionInterface
  2946.      * @throws TransportExceptionInterface
  2947.      */
  2948.     public function getObjective(int $id , array $filters = [])
  2949.     {
  2950.         $entrypoint '/api/objectives/'.$id;
  2951.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  2952.     }
  2953.     /**
  2954.      * @param $objective
  2955.      * @return null
  2956.      * @throws ClientExceptionInterface
  2957.      * @throws RedirectionExceptionInterface
  2958.      * @throws ServerExceptionInterface
  2959.      * @throws TransportExceptionInterface
  2960.      */
  2961.     public function updateObjective($objective, ?UploadedFile $illustration null, ?UploadedFile $picture null)
  2962.     {
  2963.         $entrypoint '/api/objectives/{id}';
  2964.         $_objective = (array)$objective;
  2965.         $id $this->extractProperty($objective'id');
  2966.         if($illustration != null){
  2967.             $_objective['illustration'] = $this->postMediaObject($illustration)->{'@id'};
  2968.         } else {
  2969.             unset($_objective['illustration']);
  2970.         }
  2971.         if($picture != null){
  2972.             $_objective['picture'] = $this->postMediaObject($picture)->{'@id'};
  2973.         } else {
  2974.             unset($_objective['picture']);
  2975.         }
  2976.         $data json_encode($_objectiveJSON_UNESCAPED_UNICODE);
  2977.         $data str_replace('\\/''/'$data);
  2978.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2979.         return $this->callUrl($entrypoint'PATCH', [
  2980.             'Content-Type' => 'application/merge-patch+json'
  2981.         ], $data);
  2982.     }
  2983.     /**
  2984.      * @param mixed $objective
  2985.      * @return null
  2986.      * @throws ClientExceptionInterface
  2987.      * @throws RedirectionExceptionInterface
  2988.      * @throws ServerExceptionInterface
  2989.      * @throws TransportExceptionInterface
  2990.      */
  2991.     public function activateObjective($id)
  2992.     {
  2993.         $entrypoint '/api/objectives/{id}/activate';
  2994.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  2995.         return $this->callUrl($entrypoint);
  2996.     }
  2997.     /**
  2998.      * @param mixed $objective
  2999.      * @return null
  3000.      * @throws ClientExceptionInterface
  3001.      * @throws RedirectionExceptionInterface
  3002.      * @throws ServerExceptionInterface
  3003.      * @throws TransportExceptionInterface
  3004.      */
  3005.     public function deactivateObjective($id)
  3006.     {
  3007.         $entrypoint '/api/objectives/{id}/deactivate';
  3008.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  3009.         return $this->callUrl($entrypoint);
  3010.     }
  3011.     /**
  3012.      * @param array $filters
  3013.      * @return mixed
  3014.      * @throws ClientExceptionInterface
  3015.      * @throws RedirectionExceptionInterface
  3016.      * @throws ServerExceptionInterface
  3017.      * @throws TransportExceptionInterface
  3018.      */
  3019.     public function deleteObjective(int $id)
  3020.     {
  3021.         $entrypoint '/api/objectives/' $id;
  3022.         return $this->callUrl($entrypoint'DELETE');
  3023.     }
  3024.     /**
  3025.      * @param array $filters
  3026.      * @param array $extra
  3027.      * @return mixed
  3028.      * @throws ClientExceptionInterface
  3029.      * @throws RedirectionExceptionInterface
  3030.      * @throws ServerExceptionInterface
  3031.      * @throws TransportExceptionInterface
  3032.      */
  3033.     public function getGames(array $filters = [], array $extra = [])
  3034.     {
  3035.         $entrypoint '/api/awards';
  3036.         $filters array_merge($filters$extra);
  3037.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3038.     }
  3039.     /**
  3040.      * @param array $data
  3041.      * @param UploadedFile $illustration
  3042.      * @param UploadedFile $picture
  3043.      * @return mixed
  3044.      * @throws ClientExceptionInterface
  3045.      * @throws RedirectionExceptionInterface
  3046.      * @throws ServerExceptionInterface
  3047.      * @throws TransportExceptionInterface
  3048.      */
  3049.     public function postGame($data, ?UploadedFile $rulePdf null )
  3050.     {
  3051.         $entrypoint '/api/awards';
  3052.         $_data = (array)$data;
  3053.         if($rulePdf != null){
  3054.             $_data['rules'] = $this->postMediaObject($rulePdf)->{'@id'};
  3055.         }
  3056.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3057.         $data str_replace('\\/''/'$data);
  3058.         return $this->callUrl($entrypoint'POST', [], $data);
  3059.     }
  3060.     /**
  3061.      * @param array $filters
  3062.      * @return mixed
  3063.      * @throws ClientExceptionInterface
  3064.      * @throws RedirectionExceptionInterface
  3065.      * @throws ServerExceptionInterface
  3066.      * @throws TransportExceptionInterface
  3067.      */
  3068.     public function getGame(int $id , array $filters = [])
  3069.     {
  3070.         $entrypoint '/api/awards/'.$id;
  3071.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3072.     }
  3073.     /**
  3074.      * @return null
  3075.      * @throws ClientExceptionInterface
  3076.      * @throws RedirectionExceptionInterface
  3077.      * @throws ServerExceptionInterface
  3078.      * @throws TransportExceptionInterface
  3079.      */
  3080.     public function updateGame(int $id$data)
  3081.     {
  3082.         $entrypoint '/api/awards/'$id;
  3083.         $_data $data;
  3084.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3085.         $data =  str_replace('\\/''/'$data);
  3086.         return $this->callUrl($entrypoint'PATCH', [
  3087.             'Content-Type' => self::MERGE_CONTENT_TYPE
  3088.         ], $data);
  3089.     }
  3090.     /**
  3091.      * @return null
  3092.      * @throws ClientExceptionInterface
  3093.      * @throws RedirectionExceptionInterface
  3094.      * @throws ServerExceptionInterface
  3095.      * @throws TransportExceptionInterface
  3096.      */
  3097.     public function customUpdateGame(int $id$data)
  3098.     {
  3099.         $entrypoint '/api/custom/awards/'$id;
  3100.         $_data $data;
  3101.         if($_data['rules'] != null){
  3102.             $_data['rules'] = $this->postMediaObject($_data['rules'])->{'@id'};
  3103.         }else{
  3104.             unset($_data['rules']);
  3105.         }
  3106.         if($_data['firstAward']['picture'] != null){
  3107.             $_data['firstAward']['picture'] = $this->postMediaObject($_data['firstAward']['picture'])->{'@id'};
  3108.         }else{
  3109.             unset($_data['firstAward']['picture']);
  3110.         }
  3111.         if($_data['secondAward']['picture'] != null){
  3112.             $_data['secondAward']['picture'] = $this->postMediaObject($_data['secondAward']['picture'])->{'@id'};
  3113.         }else{
  3114.             unset($_data['secondAward']['picture']);
  3115.         }
  3116.         if($_data['thirdAward']['picture'] != null){
  3117.             $_data['thirdAward']['picture'] = $this->postMediaObject($_data['thirdAward']['picture'])->{'@id'};
  3118.         }else{
  3119.             unset($_data['thirdAward']['picture']);
  3120.         }
  3121.         if($_data['firstAward']['illustration'] != null){
  3122.             $_data['firstAward']['illustration'] = $this->postMediaObject($_data['firstAward']['illustration'])->{'@id'};
  3123.         }else{
  3124.             unset($_data['firstAward']['illustration']);
  3125.         }
  3126.         if($_data['secondAward']['illustration'] != null){
  3127.             $_data['secondAward']['illustration'] = $this->postMediaObject($_data['secondAward']['illustration'])->{'@id'};
  3128.         }else{
  3129.             unset($_data['secondAward']['illustration']);
  3130.         }
  3131.         if($_data['thirdAward']['illustration'] != null){
  3132.             $_data['thirdAward']['illustration'] = $this->postMediaObject($_data['thirdAward']['illustration'])->{'@id'};
  3133.         }else{
  3134.             unset($_data['thirdAward']['illustration']);
  3135.         }
  3136.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3137.         $data =  str_replace('\\/''/'$data);
  3138.         return $this->callUrl($entrypoint'PATCH', [
  3139.             'Content-Type' => self::MERGE_CONTENT_TYPE
  3140.         ], $data);
  3141.     }
  3142.     /**
  3143.      * @param array $filters
  3144.      * @return mixed
  3145.      * @throws ClientExceptionInterface
  3146.      * @throws RedirectionExceptionInterface
  3147.      * @throws ServerExceptionInterface
  3148.      * @throws TransportExceptionInterface
  3149.      */
  3150.     public function getGameConfigs( array $filters = [])
  3151.     {
  3152.         $entrypoint '/api/award_configs';
  3153.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3154.     }
  3155.     /**
  3156.      * @param array $filters
  3157.      * @return mixed
  3158.      * @throws ClientExceptionInterface
  3159.      * @throws RedirectionExceptionInterface
  3160.      * @throws ServerExceptionInterface
  3161.      * @throws TransportExceptionInterface
  3162.      */
  3163.     public function getGameConfig(int $id,  array $filters = [])
  3164.     {
  3165.         $entrypoint '/api/award_configs/'.$id;
  3166.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3167.     }
  3168.     /**
  3169.      * @return null
  3170.      * @throws ClientExceptionInterface
  3171.      * @throws RedirectionExceptionInterface
  3172.      * @throws ServerExceptionInterface
  3173.      * @throws TransportExceptionInterface
  3174.      */
  3175.     public function updateOperation(int $id$data)
  3176.     {
  3177.         $entrypoint '/api/award_configs/'$id;
  3178.         $_data $data;
  3179.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3180.         $data =  str_replace('\\/''/'$data);
  3181.         return $this->callUrl($entrypoint'PATCH', [
  3182.             'Content-Type' => self::MERGE_CONTENT_TYPE
  3183.         ], $data);
  3184.     }
  3185.     /**
  3186.      * @param array $filters
  3187.      * @return mixed
  3188.      * @throws ClientExceptionInterface
  3189.      * @throws RedirectionExceptionInterface
  3190.      * @throws ServerExceptionInterface
  3191.      * @throws TransportExceptionInterface
  3192.      */
  3193.     public function getAssociations( array $filters = [])
  3194.     {
  3195.         $entrypoint '/api/associations';
  3196.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3197.     }
  3198.     /**
  3199.      * @param array $filters
  3200.      * @return mixed
  3201.      * @throws ClientExceptionInterface
  3202.      * @throws RedirectionExceptionInterface
  3203.      * @throws ServerExceptionInterface
  3204.      * @throws TransportExceptionInterface
  3205.      */
  3206.     public function getCompanyAssociations( array $filters = [], int $id)
  3207.     {
  3208.         $entrypoint '/api/companies/'$id .'/associations';
  3209.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3210.     }
  3211.     /**
  3212.      * @param array $filters
  3213.      * @return mixed
  3214.      * @throws ClientExceptionInterface
  3215.      * @throws RedirectionExceptionInterface
  3216.      * @throws ServerExceptionInterface
  3217.      * @throws TransportExceptionInterface
  3218.      */
  3219.     public function postAssociation($data, ?UploadedFile $illustration null, ?UploadedFile $picture null )
  3220.     {
  3221.         $entrypoint '/api/associations';
  3222.         $_data = (array)$data;
  3223.         if($illustration != null){
  3224.             $_data['illustration'] = $this->postMediaObject($illustration)->{'@id'};
  3225.         }
  3226.         if($picture != null){
  3227.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3228.         }
  3229.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3230.         $data str_replace('\\/''/'$data);
  3231.         return $this->callUrl($entrypoint'POST', [], $data);
  3232.     }
  3233.     /**
  3234.      * @param array $filters
  3235.      * @return mixed
  3236.      * @throws ClientExceptionInterface
  3237.      * @throws RedirectionExceptionInterface
  3238.      * @throws ServerExceptionInterface
  3239.      * @throws TransportExceptionInterface
  3240.      */
  3241.     public function getAssociation(int $id , array $filters = [])
  3242.     {
  3243.         $entrypoint '/api/associations/'.$id;
  3244.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3245.     }
  3246.     /**
  3247.      * @param $objective
  3248.      * @return null
  3249.      * @throws ClientExceptionInterface
  3250.      * @throws RedirectionExceptionInterface
  3251.      * @throws ServerExceptionInterface
  3252.      * @throws TransportExceptionInterface
  3253.      */
  3254.     public function updateAssociation(int $id$data, ?UploadedFile $illustration null, ?UploadedFile $picture null)
  3255.     {
  3256.         $entrypoint '/api/associations/'$id;
  3257.         $_data = (array)$data;
  3258.         if($illustration != null){
  3259.             $_data['illustration'] = $this->postMediaObject($illustration)->{'@id'};
  3260.         } else {
  3261.             unset($_data['illustration']);
  3262.         }
  3263.         if($picture != null){
  3264.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3265.         } else {
  3266.             unset($_data['picture']);
  3267.         }
  3268.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3269.         $data str_replace('\\/''/'$data);
  3270.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  3271.         return $this->callUrl($entrypoint'PATCH', [
  3272.             'Content-Type' => 'application/merge-patch+json'
  3273.         ], $data);
  3274.     }
  3275.     /**
  3276.      * @param array $filters
  3277.      * @return mixed
  3278.      * @throws ClientExceptionInterface
  3279.      * @throws RedirectionExceptionInterface
  3280.      * @throws ServerExceptionInterface
  3281.      * @throws TransportExceptionInterface
  3282.      */
  3283.     public function deleteAssociation(int $id)
  3284.     {
  3285.         $entrypoint '/api/associations/' $id;
  3286.         return $this->callUrl($entrypoint'DELETE');
  3287.     }
  3288.     public function cleanCache()
  3289.     {
  3290.         $entrypoint '/api/cache/clear';
  3291.         return $this->callUrl($entrypoint'GET');
  3292.     }
  3293.     public function cleanAllCache()
  3294.     {
  3295.         $entrypoint '/api/cache/clear-all';
  3296.         return $this->callUrl($entrypoint'GET');
  3297.     }
  3298.     /**
  3299.      * @param array $filters
  3300.      * @return mixed
  3301.      * @throws ClientExceptionInterface
  3302.      * @throws RedirectionExceptionInterface
  3303.      * @throws ServerExceptionInterface
  3304.      * @throws TransportExceptionInterface
  3305.      */
  3306.     public function getRecoSurveys( array $filters = [])
  3307.     {
  3308.         $filters = [
  3309.             'type' => 'vitality_survey'
  3310.         ];
  3311.         $entrypoint '/api/surveys';
  3312.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3313.     }
  3314.     /**
  3315.      * @return null
  3316.      * @throws ClientExceptionInterface
  3317.      * @throws RedirectionExceptionInterface
  3318.      * @throws ServerExceptionInterface
  3319.      * @throws TransportExceptionInterface
  3320.      */
  3321.     public function postRecoSurvey(array $data)
  3322.     {
  3323.         $entrypoint '/api/vitality_surveys';
  3324.         $data json_encode($data);
  3325.         return $this->callUrl($entrypoint'POST', [], $data);
  3326.     }
  3327.     /**
  3328.      * @param string $id
  3329.      * @return mixed
  3330.      * @throws ClientExceptionInterface
  3331.      * @throws RedirectionExceptionInterface
  3332.      * @throws ServerExceptionInterface
  3333.      * @throws TransportExceptionInterface
  3334.      */
  3335.     public function getSurvey(int $id, array $filters = [])
  3336.     {
  3337.         $entrypoint "/api/surveys/"$id;
  3338.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3339.     }
  3340.     /**
  3341.      * @return null
  3342.      * @throws ClientExceptionInterface
  3343.      * @throws RedirectionExceptionInterface
  3344.      * @throws ServerExceptionInterface
  3345.      * @throws TransportExceptionInterface
  3346.      */
  3347.     public function updateAnswerWithReco(int $id, array $data)
  3348.     {
  3349.         $entrypoint '/api/answers/'$id .'/update-with-recommended-objective';
  3350.         $data json_encode($data);
  3351.         return $this->callUrl($entrypoint'POST', [], $data);
  3352.     }
  3353.     /**
  3354.      * @return null
  3355.      * @throws ClientExceptionInterface
  3356.      * @throws RedirectionExceptionInterface
  3357.      * @throws ServerExceptionInterface
  3358.      * @throws TransportExceptionInterface
  3359.      */
  3360.     public function updateRecoSurvey(int $id, array $data)
  3361.     {
  3362.         $entrypoint "/api/surveys/{$id}/update/recommended-objectives";
  3363.         $data json_encode($data);
  3364.         return $this->callUrl($entrypoint'POST', [], $data);
  3365.     }
  3366.     /**
  3367.      * @return null
  3368.      * @throws ClientExceptionInterface
  3369.      * @throws RedirectionExceptionInterface
  3370.      * @throws ServerExceptionInterface
  3371.      * @throws TransportExceptionInterface
  3372.      */
  3373.     public function renderCompanyResa(int $idbool $force false)
  3374.     {
  3375.         $entrypoint "/api/companies/{$id}/resa-activation/{$force}";
  3376.         return $this->callUrl($entrypoint);
  3377.     }
  3378.     /**
  3379.      * @return null
  3380.      * @throws ClientExceptionInterface
  3381.      * @throws RedirectionExceptionInterface
  3382.      * @throws ServerExceptionInterface
  3383.      * @throws TransportExceptionInterface
  3384.      */
  3385.     public function updateHomeSurveyTag(int $id, array $data)
  3386.     {
  3387.         $entrypoint "/api/tv_tags/{$id}/update-with-motivations-phrases";
  3388.         $data json_encode($data);
  3389.         return $this->callUrl($entrypoint'PATCH', [
  3390.             'Content-Type' => 'application/merge-patch+json'
  3391.         ], $data);
  3392.     }
  3393.     /**
  3394.      * @return null
  3395.      * @throws ClientExceptionInterface
  3396.      * @throws RedirectionExceptionInterface
  3397.      * @throws ServerExceptionInterface
  3398.      * @throws TransportExceptionInterface
  3399.      */
  3400.     public function getChallenges(array $filters = [], array $extra = [])
  3401.     {
  3402.         $entrypoint "/api/teamplay_challenges";
  3403.         $filters array_merge($filters$extra);
  3404.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3405.     }
  3406.     /**
  3407.      * @return null
  3408.      * @throws ClientExceptionInterface
  3409.      * @throws RedirectionExceptionInterface
  3410.      * @throws ServerExceptionInterface
  3411.      * @throws TransportExceptionInterface
  3412.      */
  3413.     public function getChallengeTypes(array $filters = [])
  3414.     {
  3415.         $entrypoint "/api/teamplay_challenge_types";
  3416.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3417.     }
  3418.     /**
  3419.      * @return null
  3420.      * @throws ClientExceptionInterface
  3421.      * @throws RedirectionExceptionInterface
  3422.      * @throws ServerExceptionInterface
  3423.      * @throws TransportExceptionInterface
  3424.      */
  3425.     public function postChallenge(array $data, ?UploadedFile $picture null)
  3426.     {
  3427.         $entrypoint '/api/teamplay_challenges';
  3428.         $_data = (array)$data;
  3429.         if($picture != null){
  3430.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3431.         }
  3432.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3433.         $data str_replace('\\/''/'$data);
  3434.         return $this->callUrl($entrypoint'POST', [], $data);
  3435.     }
  3436.     /**
  3437.      * @return null
  3438.      * @throws ClientExceptionInterface
  3439.      * @throws RedirectionExceptionInterface
  3440.      * @throws ServerExceptionInterface
  3441.      * @throws TransportExceptionInterface
  3442.      */
  3443.     public function getChallenge(int $id,  array $filters = [])
  3444.     {
  3445.         $entrypoint "/api/teamplay_challenges/"$id;
  3446.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3447.     }
  3448.     /**
  3449.      * @param $objective
  3450.      * @return null
  3451.      * @throws ClientExceptionInterface
  3452.      * @throws RedirectionExceptionInterface
  3453.      * @throws ServerExceptionInterface
  3454.      * @throws TransportExceptionInterface
  3455.      */
  3456.     public function editChallenge(int $id$data, ?UploadedFile $picture null)
  3457.     {
  3458.         $entrypoint '/api/teamplay_challenges/'$id;
  3459.         $_data = (array)$data;
  3460.         if($picture != null){
  3461.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3462.         } else {
  3463.             unset($_data['picture']);
  3464.         }
  3465.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3466.         $data str_replace('\\/''/'$data);
  3467.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  3468.         return $this->callUrl($entrypoint'PATCH', [
  3469.             'Content-Type' => 'application/merge-patch+json'
  3470.         ], $data);
  3471.     }
  3472.     /**
  3473.      * @param array $filters
  3474.      * @return mixed
  3475.      * @throws ClientExceptionInterface
  3476.      * @throws RedirectionExceptionInterface
  3477.      * @throws ServerExceptionInterface
  3478.      * @throws TransportExceptionInterface
  3479.      */
  3480.     public function deleteChallenge(int $id)
  3481.     {
  3482.         $entrypoint '/api/teamplay_challenges/' $id;
  3483.         return $this->callUrl($entrypoint'DELETE');
  3484.     }
  3485.     /**
  3486.      * @return null
  3487.      * @throws ClientExceptionInterface
  3488.      * @throws RedirectionExceptionInterface
  3489.      * @throws ServerExceptionInterface
  3490.      * @throws TransportExceptionInterface
  3491.      */
  3492.     public function getPlannings(array $filters = [], array $extra = [])
  3493.     {
  3494.         $filters array_merge($filters$extra);
  3495.         $entrypoint "/api/teamplays";
  3496.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3497.     }
  3498.     /**
  3499.      * @return null
  3500.      * @throws ClientExceptionInterface
  3501.      * @throws RedirectionExceptionInterface
  3502.      * @throws ServerExceptionInterface
  3503.      * @throws TransportExceptionInterface
  3504.      */
  3505.     public function getPlanningChallenges(array $filters = [], array $extra = [])
  3506.     {
  3507.         $entrypoint "/api/teamplays/"$extra['id'] ."/challenges";
  3508.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3509.     }
  3510.     /**
  3511.      * @return mixed
  3512.      * @throws ClientExceptionInterface
  3513.      * @throws RedirectionExceptionInterface
  3514.      * @throws ServerExceptionInterface
  3515.      * @throws TransportExceptionInterface
  3516.      */
  3517.     public function postPlanning(array $data, ?UploadedFile $picture null)
  3518.     {
  3519.         $entrypoint '/api/teamplays';
  3520.         $_data = (array)$data;
  3521.         if($picture != null){
  3522.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3523.         }
  3524.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3525.         $data str_replace('\\/''/'$data);
  3526.         return $this->callUrl($entrypoint'POST', [], $data);
  3527.     }
  3528.     /**
  3529.      * @return mixed
  3530.      * @throws ClientExceptionInterface
  3531.      * @throws RedirectionExceptionInterface
  3532.      * @throws ServerExceptionInterface
  3533.      * @throws TransportExceptionInterface
  3534.      */
  3535.     public function getPlanning(int $id, array $filters = [])
  3536.     {
  3537.         $entrypoint "/api/teamplays/"$id;
  3538.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3539.     }
  3540.     /**
  3541.      * @param $objective
  3542.      * @return null
  3543.      * @throws ClientExceptionInterface
  3544.      * @throws RedirectionExceptionInterface
  3545.      * @throws ServerExceptionInterface
  3546.      * @throws TransportExceptionInterface
  3547.      */
  3548.     public function editPlanning(int $id$data, ?UploadedFile $picture null)
  3549.     {
  3550.         $entrypoint '/api/teamplays/'$id;
  3551.         $_data = (array)$data;
  3552.         if($picture != null){
  3553.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3554.         } else {
  3555.             unset($_data['picture']);
  3556.         }
  3557.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3558.         $data str_replace('\\/''/'$data);
  3559.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  3560.         $fields = [
  3561.             'id''name''dateStart''dateEnd''duration''active''inProgress''description''active',
  3562.             'association' => ['id''name'],
  3563.             'company' => ['id''name'],
  3564.             'picture' => ['id''contentUrl']
  3565.         ];
  3566.         return $this->callUrl($entrypoint'PATCH', [
  3567.             'Content-Type' => 'application/merge-patch+json'
  3568.         ], $data, ['groups' => ["teamplay:write"]]);
  3569.     }
  3570.     /**
  3571.      * @param array $filters
  3572.      * @return mixed
  3573.      * @throws ClientExceptionInterface
  3574.      * @throws RedirectionExceptionInterface
  3575.      * @throws ServerExceptionInterface
  3576.      * @throws TransportExceptionInterface
  3577.      */
  3578.     public function deletePlanning(int $id)
  3579.     {
  3580.         $entrypoint '/api/teamplays/' $id;
  3581.         return $this->callUrl($entrypoint'DELETE');
  3582.     }
  3583.     /**
  3584.      * @param array $filters
  3585.      * @return mixed
  3586.      * @throws ClientExceptionInterface
  3587.      * @throws RedirectionExceptionInterface
  3588.      * @throws ServerExceptionInterface
  3589.      * @throws TransportExceptionInterface
  3590.      */
  3591.     public function getDashboardBO(array $filters = [])
  3592.     {
  3593.         $entrypoint "/api/stats/bo/dashboard";
  3594.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3595.     }
  3596.     /**
  3597.      * @param array $filters
  3598.      * @param array $extra
  3599.      * @return mixed
  3600.      * @throws ClientExceptionInterface
  3601.      * @throws RedirectionExceptionInterface
  3602.      * @throws ServerExceptionInterface
  3603.      * @throws TransportExceptionInterface
  3604.      */
  3605.     public function getTeams(array $filters = [], array $extra = [])
  3606.     {
  3607.         $filters array_merge($filters$extra);
  3608.         $entrypoint '/api/teams';
  3609.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3610.     }
  3611.     /**
  3612.      * @param array $data
  3613.      * @param UploadedFile $illustration
  3614.      * @param UploadedFile $picture
  3615.      * @return mixed
  3616.      * @throws ClientExceptionInterface
  3617.      * @throws RedirectionExceptionInterface
  3618.      * @throws ServerExceptionInterface
  3619.      * @throws TransportExceptionInterface
  3620.      */
  3621.     public function postTeam($data, ?UploadedFile $picture null )
  3622.     {
  3623.         $entrypoint '/api/teams';
  3624.         $_data = (array)$data;
  3625.         if($picture != null){
  3626.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3627.         }
  3628.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3629.         $data str_replace('\\/''/'$data);
  3630.         return $this->callUrl($entrypoint'POST', [], $data);
  3631.     }
  3632.     /**
  3633.      * @param string $id
  3634.      * @return mixed
  3635.      * @throws ClientExceptionInterface
  3636.      * @throws RedirectionExceptionInterface
  3637.      * @throws ServerExceptionInterface
  3638.      * @throws TransportExceptionInterface
  3639.      */
  3640.     public function getTeam(int $id, array $filters = [])
  3641.     {
  3642.         $entrypoint "/api/teams/"$id;
  3643.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3644.     }
  3645.     /**
  3646.      * @param string $id
  3647.      * @return mixed
  3648.      * @throws ClientExceptionInterface
  3649.      * @throws RedirectionExceptionInterface
  3650.      * @throws ServerExceptionInterface
  3651.      * @throws TransportExceptionInterface
  3652.      */
  3653.     public function getTeamUsers(array $filters = [], array $extra = [])
  3654.     {
  3655.         $id $extra['id'];
  3656.         unset($extra['id']);
  3657.         $filters array_merge($filters$extra);
  3658.         $entrypoint "/api/teams/"$id ."/team_users";
  3659.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3660.     }
  3661.     /**
  3662.      * @param array $data
  3663.      * @return null
  3664.      * @throws ClientExceptionInterface
  3665.      * @throws RedirectionExceptionInterface
  3666.      * @throws ServerExceptionInterface
  3667.      * @throws TransportExceptionInterface
  3668.      */
  3669.     public function editTeam(int $id, array $data, ?UploadedFile $picture null)
  3670.     {
  3671.         $entrypoint '/api/teams/'$id;
  3672.         $_data = (array)$data;
  3673.         if($picture != null){
  3674.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3675.         } else {
  3676.             unset($_data['picture']);
  3677.         }
  3678.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3679.         $data str_replace('\\/''/'$data);
  3680.         return $this->callUrl($entrypoint'PATCH', [
  3681.             'Content-Type' => 'application/merge-patch+json'
  3682.         ], $data);
  3683.     }
  3684.     /**
  3685.      * @param array $filters
  3686.      * @return mixed
  3687.      * @throws ClientExceptionInterface
  3688.      * @throws RedirectionExceptionInterface
  3689.      * @throws ServerExceptionInterface
  3690.      * @throws TransportExceptionInterface
  3691.      */
  3692.     public function deleteTeam(int $id)
  3693.     {
  3694.         $entrypoint '/api/teams/' $id;
  3695.         return $this->callUrl($entrypoint'DELETE');
  3696.     }
  3697.     /**
  3698.      * @param string $id
  3699.      * @return mixed
  3700.      * @throws ClientExceptionInterface
  3701.      * @throws RedirectionExceptionInterface
  3702.      * @throws ServerExceptionInterface
  3703.      * @throws TransportExceptionInterface
  3704.      */
  3705.     public function getManagerAwards(array $filters = [])
  3706.     {
  3707.         $entrypoint "api/bo/manager/games/award/dashboard";
  3708.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3709.     }
  3710.     /**
  3711.      * @param string $id
  3712.      * @return mixed
  3713.      * @throws ClientExceptionInterface
  3714.      * @throws RedirectionExceptionInterface
  3715.      * @throws ServerExceptionInterface
  3716.      * @throws TransportExceptionInterface
  3717.      */
  3718.     public function getManagerTeamplays(array $filters = [])
  3719.     {
  3720.         $entrypoint "/api/bo/manager/games/teamplay/dashboard";
  3721.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3722.     }
  3723.     /****** NOTIFICATION ********/
  3724.     /**
  3725.      * @return null
  3726.      * @throws ClientExceptionInterface
  3727.      * @throws RedirectionExceptionInterface
  3728.      * @throws ServerExceptionInterface
  3729.      * @throws TransportExceptionInterface
  3730.      */
  3731.     public function getNotificationTypes(array $filters = [])
  3732.     {
  3733.         $entrypoint "/api/notification_types";
  3734.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3735.     }
  3736.     /**
  3737.      * @return null
  3738.      * @throws ClientExceptionInterface
  3739.      * @throws RedirectionExceptionInterface
  3740.      * @throws ServerExceptionInterface
  3741.      * @throws TransportExceptionInterface
  3742.      */
  3743.     public function getNotification(int $id,  array $filters = [])
  3744.     {
  3745.         $entrypoint "/api/notifications/"$id;
  3746.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3747.     }
  3748.     /**
  3749.      * @return null
  3750.      * @throws ClientExceptionInterface
  3751.      * @throws RedirectionExceptionInterface
  3752.      * @throws ServerExceptionInterface
  3753.      * @throws TransportExceptionInterface
  3754.      */
  3755.     public function getNotifications(array $filters = [], array $extra = [])
  3756.     {
  3757.         $entrypoint "/api/notifications";
  3758.         $filters array_merge($filters$extra);
  3759.         return $this->callUrl($entrypoint'GET', [], [], $filters);
  3760.     }
  3761.     /**
  3762.      * @return null
  3763.      * @throws ClientExceptionInterface
  3764.      * @throws RedirectionExceptionInterface
  3765.      * @throws ServerExceptionInterface
  3766.      * @throws TransportExceptionInterface
  3767.      */
  3768.     public function postNotification(array $data, ?UploadedFile $picture null)
  3769.     {
  3770.         $entrypoint '/api/notifications';
  3771.         $_data = (array)$data;
  3772.         if($picture != null){
  3773.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3774.         }
  3775.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3776.         $data str_replace('\\/''/'$data);
  3777.         return $this->callUrl($entrypoint'POST', [], $data);
  3778.     }
  3779.     /**
  3780.      * @param $objective
  3781.      * @return null
  3782.      * @throws ClientExceptionInterface
  3783.      * @throws RedirectionExceptionInterface
  3784.      * @throws ServerExceptionInterface
  3785.      * @throws TransportExceptionInterface
  3786.      */
  3787.     public function editNotification(int $id$data, ?UploadedFile $picture null)
  3788.     {
  3789.         $entrypoint '/api/notifications/'$id;
  3790.         $_data = (array)$data;
  3791.         if($picture != null){
  3792.             $_data['picture'] = $this->postMediaObject($picture)->{'@id'};
  3793.         } else {
  3794.             unset($_data['picture']);
  3795.         }
  3796.         $data json_encode($_dataJSON_UNESCAPED_UNICODE);
  3797.         $data str_replace('\\/''/'$data);
  3798.         $entrypoint strtr($entrypoint, ['{id}' => $id]);
  3799.         return $this->callUrl($entrypoint'PATCH', [
  3800.             'Content-Type' => 'application/merge-patch+json'
  3801.         ], $data);
  3802.     }
  3803.     /**
  3804.      * @param array $filters
  3805.      * @return mixed
  3806.      * @throws ClientExceptionInterface
  3807.      * @throws RedirectionExceptionInterface
  3808.      * @throws ServerExceptionInterface
  3809.      * @throws TransportExceptionInterface
  3810.      */
  3811.     public function deleteNotification(int $id)
  3812.     {
  3813.         $entrypoint '/api/notifications/' $id;
  3814.         return $this->callUrl($entrypoint'DELETE');
  3815.     }
  3816.     /**
  3817.      * Envoie la notification dans OneSignal
  3818.      */
  3819.     public function sendNotification(int $id)
  3820.     {
  3821.         $entrypoint "/api/notifications/{$id}/send";
  3822.         return $this->callUrl($entrypoint'GET');
  3823.     }
  3824.     /**
  3825.      * Annule la notification via OneSignal
  3826.      */
  3827.     public function canceledNotification(int $id)
  3828.     {
  3829.         $entrypoint "/api/notifications/{$id}/canceled";
  3830.         return $this->callUrl($entrypoint'GET');
  3831.     }
  3832.     /**
  3833.      * MAJ de toutes les notifications via OneSignal
  3834.      */
  3835.     public function importNotificationFromOneSignal()
  3836.     {
  3837.         $entrypoint "/api/onesignal/notifications/import";
  3838.         return $this->callUrl($entrypoint'GET');
  3839.     }
  3840.     /**
  3841.      * MAJ d'une notification via OneSignal
  3842.      */
  3843.     public function importNotificationByIdFromOneSignal(int $id)
  3844.     {
  3845.         $entrypoint "/api/notifications/{$id}/import";
  3846.         return $this->callUrl($entrypoint'GET');
  3847.     }
  3848. }