diff options
Diffstat (limited to 'src')
5 files changed, 131 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 3cb86881..edbcec4b 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php | |||
@@ -12,6 +12,8 @@ class DeveloperController extends Controller | |||
12 | * @param Request $request | 12 | * @param Request $request |
13 | * | 13 | * |
14 | * @Route("/developer", name="developer") | 14 | * @Route("/developer", name="developer") |
15 | * | ||
16 | * @return \Symfony\Component\HttpFoundation\Response | ||
15 | */ | 17 | */ |
16 | public function indexAction(Request $request) | 18 | public function indexAction(Request $request) |
17 | { | 19 | { |
@@ -22,6 +24,8 @@ class DeveloperController extends Controller | |||
22 | * @param Request $request | 24 | * @param Request $request |
23 | * | 25 | * |
24 | * @Route("/developer/client/create", name="create_client") | 26 | * @Route("/developer/client/create", name="create_client") |
27 | * | ||
28 | * @return \Symfony\Component\HttpFoundation\Response | ||
25 | */ | 29 | */ |
26 | public function createClientAction(Request $request) | 30 | public function createClientAction(Request $request) |
27 | { | 31 | { |
@@ -33,6 +37,19 @@ class DeveloperController extends Controller | |||
33 | 37 | ||
34 | return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( | 38 | return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( |
35 | 'client_id' => $client->getPublicId(), | 39 | 'client_id' => $client->getPublicId(), |
40 | 'client_secret' => $client->getSecret(), | ||
36 | )); | 41 | )); |
37 | } | 42 | } |
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 | } | ||
38 | } | 55 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig index edebc7ee..5ab35700 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/client.html.twig | |||
@@ -1,9 +1,24 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block title %}{% trans %}New client{% endtrans %}{% endblock %} | 3 | {% block title %}{% trans %}New application{% endtrans %}{% endblock %} |
4 | 4 | ||
5 | {% block content %} | 5 | {% block content %} |
6 | <div class="row"> | ||
7 | <div class="col s12"> | ||
8 | <div class="card-panel settings"> | ||
6 | 9 | ||
7 | Client ID: {{ client_id }} | 10 | <div class="row"> |
11 | <h3>My application parameters</h3> | ||
12 | <p>Here are your application parameters.</p> | ||
13 | <ul> | ||
14 | <li>Client ID: {{ client_id }}</li> | ||
15 | <li>Client Secret: {{ client_secret }}</li> | ||
16 | </ul> | ||
17 | <a class="waves-effect waves-light btn" href="{{ path('developer') }}">Back to Developer main page</a> | ||
18 | </div> | ||
19 | |||
20 | </div> | ||
21 | </div> | ||
22 | </div> | ||
8 | 23 | ||
9 | {% endblock %} | 24 | {% endblock %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig new file mode 100644 index 00000000..2db15b16 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/howto_app.html.twig | |||
@@ -0,0 +1,68 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title %}{% trans %}How to create my first application{% endtrans %}{% endblock %} | ||
4 | |||
5 | {% block content %} | ||
6 | <div class="row"> | ||
7 | <div class="col s12"> | ||
8 | <div class="card-panel settings"> | ||
9 | |||
10 | <div class="row"> | ||
11 | <p>The following commands make use of the <a href="https://github.com/jkbrzt/httpie">HTTPie library</a>. Make sure it is installed on your system before using it.</p> | ||
12 | <p>You need a token to communicate between your 3rd application and wallabag API.</p> | ||
13 | <p>To create this token, you need <a href="{{ path('create_client') }}">to create a new client</a>.</p> | ||
14 | <p>Now, create your token (replace client_id, client_secret, username and password with the good values):</p> | ||
15 | <p> | ||
16 | <code> | ||
17 | <pre> | ||
18 | http POST http://v2.wallabag.org/oauth/v2/token \ | ||
19 | grant_type=password \ | ||
20 | client_id=12_5um6nz50ceg4088c0840wwc0kgg44g00kk84og044ggkscso0k \ | ||
21 | client_secret=3qd12zpeaxes8cwg8c0404g888co4wo8kc4gcw0occww8cgw4k \ | ||
22 | username=yourUsername \ | ||
23 | password=yourPassw0rd | ||
24 | </pre> | ||
25 | </code> | ||
26 | </p> | ||
27 | <p>The API will return a response like this:</p> | ||
28 | <p> | ||
29 | <code> | ||
30 | <pre> | ||
31 | HTTP/1.1 200 OK | ||
32 | Cache-Control: no-store, private | ||
33 | Connection: close | ||
34 | Content-Type: application/json | ||
35 | Date: Tue, 06 Oct 2015 18:24:03 GMT | ||
36 | Host: localhost:8000 | ||
37 | Pragma: no-cache | ||
38 | X-Debug-Token: be00a1 | ||
39 | X-Debug-Token-Link: /profiler/be00a1 | ||
40 | X-Powered-By: PHP/5.5.9-1ubuntu4.13 | ||
41 | { | ||
42 | "access_token": "ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw", | ||
43 | "expires_in": 3600, | ||
44 | "refresh_token": "ODBjODU1NWUwNmUzZTBkNDQ5YWVlZTVlMjQ2Y2I0OWM2NTM1ZGM2M2Y3MDhjMTViM2U2MzYxYzRkMDk5ODRlZg", | ||
45 | "scope": null, | ||
46 | "token_type": "bearer" | ||
47 | } | ||
48 | </pre> | ||
49 | </code> | ||
50 | </p> | ||
51 | <p>The access_token is useful to do a call to the API endpoint. For example:</p> | ||
52 | <p> | ||
53 | <code> | ||
54 | <pre> | ||
55 | http GET http://v2.wallabag.org/api/entries.json \ | ||
56 | "Authorization:Bearer ZWFjNjA3ZWMwYWVmYzRkYTBlMmQ3NTllYmVhOGJiZDE0ZTg1NjE4MjczOTVlNzM0ZTRlMWQ0MmRlMmYwNTk5Mw" | ||
57 | </pre> | ||
58 | </code> | ||
59 | </p> | ||
60 | <p>This call will return all the entries for your user.</p> | ||
61 | <p>If you want to see all the API endpoints, you can have a look <a href="{{ path('nelmio_api_doc_index') }}">to our API documentation</a>.</p> | ||
62 | <p><a class="waves-effect waves-light btn" href="{{ path('developer') }}">Back to Developer main page</a></p> | ||
63 | </div> | ||
64 | |||
65 | </div> | ||
66 | </div> | ||
67 | </div> | ||
68 | {% endblock %} | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig index 9e06005f..36d5c2bd 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig | |||
@@ -3,7 +3,31 @@ | |||
3 | {% block title %}{% trans %}Developer{% endtrans %}{% endblock %} | 3 | {% block title %}{% trans %}Developer{% endtrans %}{% endblock %} |
4 | 4 | ||
5 | {% block content %} | 5 | {% block content %} |
6 | <div class="row"> | ||
7 | <div class="col s12"> | ||
8 | <div class="card-panel settings"> | ||
9 | |||
10 | <div class="row"> | ||
11 | <h3>Welcome to the wallabag API</h3> | ||
12 | |||
13 | <h4>Documentation</h4> | ||
14 | |||
15 | <ul> | ||
16 | <li><a href="{{ path('howto-firstapp') }}">How to create my first application</a></li> | ||
17 | <li><a href="{{ path('nelmio_api_doc_index') }}">View full API documentation</a></li> | ||
18 | </ul> | ||
19 | |||
20 | <h4>My applications</h4> | ||
21 | <ul> | ||
22 | <li><a href="{{ path('create_client') }}">Create a new application</a></li> | ||
23 | <li><a href="#">See my applications</a></li> | ||
24 | </ul> | ||
25 | |||
26 | </div> | ||
27 | |||
28 | </div> | ||
29 | </div> | ||
30 | </div> | ||
6 | 31 | ||
7 | <a href="{{ path('create_client') }}">Create a new client</a> | ||
8 | 32 | ||
9 | {% endblock %} | 33 | {% endblock %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig index aff8dd2b..6c786951 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig | |||
@@ -28,6 +28,10 @@ | |||
28 | <li><a href="{{ path('import_pocket') }}">{% trans %}Migrate from Pocket{% endtrans %}</a></li> | 28 | <li><a href="{{ path('import_pocket') }}">{% trans %}Migrate from Pocket{% endtrans %}</a></li> |
29 | <li><a href="{{ path('import_wallabag_v1') }}">{% trans %}Migrate from wallabag v1{% endtrans %}</a></li> | 29 | <li><a href="{{ path('import_wallabag_v1') }}">{% trans %}Migrate from wallabag v1{% endtrans %}</a></li> |
30 | </ul> | 30 | </ul> |
31 | <h4>{% trans %}Developers{% endtrans %}</h4> | ||
32 | <ul> | ||
33 | <li><a href="{{ path('developer') }}">{% trans %}Create your third application{% endtrans %}</a></li> | ||
34 | </ul> | ||
31 | <h4>{% trans %}Full documentation{% endtrans %}</h4> | 35 | <h4>{% trans %}Full documentation{% endtrans %}</h4> |
32 | <ul> | 36 | <ul> |
33 | <li><a href="http://wallabag.readthedocs.org">{% trans %}Convert your articles into ePUB or PDF{% endtrans %}</a></li> | 37 | <li><a href="http://wallabag.readthedocs.org">{% trans %}Convert your articles into ePUB or PDF{% endtrans %}</a></li> |