]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Controller/DeveloperController.php
API: rename application to client
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / DeveloperController.php
CommitLineData
24152cdb
NL
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Component\HttpFoundation\Request;
7use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
9class DeveloperController extends Controller
10{
11 /**
12 * @param Request $request
13 *
14 * @Route("/developer", name="developer")
b6321bed
NL
15 *
16 * @return \Symfony\Component\HttpFoundation\Response
24152cdb
NL
17 */
18 public function indexAction(Request $request)
19 {
20 return $this->render('WallabagCoreBundle:Developer:index.html.twig');
21 }
22
23 /**
24 * @param Request $request
25 *
26 * @Route("/developer/client/create", name="create_client")
b6321bed
NL
27 *
28 * @return \Symfony\Component\HttpFoundation\Response
24152cdb
NL
29 */
30 public function createClientAction(Request $request)
31 {
32 $clientManager = $this->container->get('fos_oauth_server.client_manager.default');
33 $client = $clientManager->createClient();
34 $client->setRedirectUris(array('http://www.example.com'));
35 $client->setAllowedGrantTypes(array('token', 'authorization_code'));
36 $clientManager->updateClient($client);
37
38 return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
39 'client_id' => $client->getPublicId(),
b6321bed 40 'client_secret' => $client->getSecret(),
24152cdb
NL
41 ));
42 }
b6321bed
NL
43
44 /**
45 * @param Request $request
46 *
47 * @Route("/developer/howto/first-app", name="howto-firstapp")
48 *
49 * @return \Symfony\Component\HttpFoundation\Response
50 */
51 public function howtoFirstAppAction(Request $request)
52 {
53 return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig');
54 }
24152cdb 55}