]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/ImportBundle/Controller/PocketController.php
service call
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Controller / PocketController.php
CommitLineData
1f4408de
NL
1<?php
2
3namespace Wallabag\ImportBundle\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
ff7b031d 7use Wallabag\ImportBundle\Import\PocketImport;
1f4408de
NL
8
9class PocketController extends Controller
10{
11 /**
12 * @Route("/import", name="import")
13 */
14 public function importAction()
15 {
16 return $this->render('WallabagImportBundle:Pocket:index.html.twig', array());
17 }
18
1f4408de
NL
19 /**
20 * @Route("/auth-pocket", name="authpocket")
21 */
22 public function authAction()
23 {
557e549d 24 $pocket = $this->get('wallabag_import.import.pocket_import');
ff7b031d 25 $authUrl = $pocket->oAuthRequest($this->generateUrl('import', array(), true), $this->generateUrl('callbackpocket', array(), true));
1f4408de 26
ff7b031d 27 return $this->redirect($authUrl, 301);
1f4408de
NL
28 }
29
30 /**
31 * @Route("/callback-pocket", name="callbackpocket")
32 */
33 public function callbackAction()
34 {
557e549d 35 $pocket = $this->get('wallabag_import.import.pocket_import');
ff7b031d
NL
36 $accessToken = $pocket->oAuthAuthorize();
37 $pocket->import($accessToken);
1f4408de
NL
38
39 return $this->redirect($this->generateUrl('homepage'));
40 }
1f4408de 41}