]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #1141 from ArthurHoaro/api/tags
authorArthurHoaro <arthur@hoa.ro>
Tue, 10 Jul 2018 16:06:26 +0000 (18:06 +0200)
committerGitHub <noreply@github.com>
Tue, 10 Jul 2018 16:06:26 +0000 (18:06 +0200)
Implements Tags endpoints for Shaarli's REST API

1  2 
index.php

diff --combined index.php
index ddd5dbf56a1cb450ebdff9dff3dadcb84903842b,6dcec9b2b5ab1427bf21fa3e5d6115d0afc51eb1..29d67f62cf396de9b45ce278c2db5a0c196d64ee
+++ b/index.php
@@@ -48,7 -48,7 +48,7 @@@ if (! file_exists(__DIR__ . '/vendor/au
          ."If you installed Shaarli through Git or using the development branch,\n"
          ."please refer to the installation documentation to install PHP"
          ." dependencies using Composer:\n"
 -        ."- https://shaarli.readthedocs.io/en/master/Server-requirements/\n"
 +        ."- https://shaarli.readthedocs.io/en/master/Server-configuration/\n"
          ."- https://shaarli.readthedocs.io/en/master/Download-and-Installation/";
      exit;
  }
@@@ -174,7 -174,7 +174,7 @@@ if (! is_file($conf->getConfigFileExt()
      }
  
      // Display the installation form if no existing config is found
 -    install($conf, $sessionManager);
 +    install($conf, $sessionManager, $loginManager);
  }
  
  $loginManager->checkLoginState($_COOKIE, $clientIpId);
@@@ -1823,9 -1823,8 +1823,9 @@@ function lazyThumbnail($conf, $url,$hre
   *
   * @param ConfigManager  $conf           Configuration Manager instance.
   * @param SessionManager $sessionManager SessionManager instance
 + * @param LoginManager   $loginManager   LoginManager instance
   */
 -function install($conf, $sessionManager) {
 +function install($conf, $sessionManager, $loginManager) {
      // On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
      if (endsWith($_SERVER['HTTP_HOST'],'.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'].'/sessions')) mkdir($_SERVER['DOCUMENT_ROOT'].'/sessions',0705);
  
@@@ -2176,6 -2175,12 +2176,12 @@@ $app->group('/api/v1', function() 
      $this->post('/links', '\Shaarli\Api\Controllers\Links:postLink')->setName('postLink');
      $this->put('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:putLink')->setName('putLink');
      $this->delete('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:deleteLink')->setName('deleteLink');
+     $this->get('/tags', '\Shaarli\Api\Controllers\Tags:getTags')->setName('getTags');
+     $this->get('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:getTag')->setName('getTag');
+     $this->put('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:putTag')->setName('putTag');
+     $this->delete('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:deleteTag')->setName('deleteTag');
      $this->get('/history', '\Shaarli\Api\Controllers\History:getHistory')->setName('getHistory');
  })->add('\Shaarli\Api\ApiMiddleware');