Bring Piwik for API back.
[wolnelektury.git] / src / api / urls.py
1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from django.conf.urls import url, include
6 from django.views.decorators.csrf import csrf_exempt
7 from django.views.generic import TemplateView
8 import catalogue.views
9 from stats.utils import piwik_track_view
10 from api.piston_patch import oauth_user_auth
11 from . import views
12
13
14 urlpatterns = [
15     url(r'^oauth/request_token/$', views.OAuth1RequestTokenView.as_view()),
16     url(r'^oauth/authorize/$', oauth_user_auth, name='oauth_user_auth'),
17     url(r'^oauth/access_token/$', csrf_exempt(views.OAuth1AccessTokenView.as_view())),
18
19     url(r'^$', TemplateView.as_view(template_name='api/main.html'), name='api'),
20
21     # info boxes (used by mobile app)
22     url(r'book/(?P<book_id>\d*?)/info\.html$', catalogue.views.book_info),
23     url(r'tag/(?P<tag_id>\d*?)/info\.html$', catalogue.views.tag_info),
24
25     # reading data
26     url(r'^reading/(?P<slug>[a-z0-9-]+)/$',
27         piwik_track_view(views.BookUserDataView.as_view()),
28         name='api_reading'),
29     url(r'^reading/(?P<slug>[a-z0-9-]+)/(?P<state>[a-z]+)/$',
30         piwik_track_view(views.BookUserDataView.as_view()),
31         name='api_reading'),
32     url(r'^username/$',
33         piwik_track_view(views.UserView.as_view()),
34         name='api_username'),
35
36     url(r'^blog/$',
37         piwik_track_view(views.BlogView.as_view())),
38
39     url(r'^pictures/$', include('picture.api.urls')),
40     url(r'^', include('social.api.urls')),
41     url(r'^', include('catalogue.api.urls')),
42 ]