[UserSettings] refactor, add tests
[mygpo.git] / mygpo / api / urls.py
blobe62aa410cb77cc09cc29511c8817e71987d4ffe2
1 from django.conf.urls import *
3 urlpatterns = patterns('',
4 (r'^upload$', 'mygpo.api.legacy.upload'),
5 (r'^getlist$', 'mygpo.api.legacy.getlist'),
6 (r'^toplist.opml$', 'mygpo.api.simple.toplist', {'count': 50, 'format': 'opml'}),
9 urlpatterns += patterns('mygpo.api.simple',
10 (r'^subscriptions/(?P<username>[\w.+-]+)/(?P<device_uid>[\w.-]+)\.(?P<format>\w+)', 'subscriptions'),
11 (r'^subscriptions/(?P<username>[\w.+-]+)\.(?P<format>\w+)', 'all_subscriptions'),
12 url(r'^toplist/(?P<count>\d+)\.(?P<format>\w+)', 'toplist', name='toplist-opml'),
13 (r'^search\.(?P<format>\w+)', 'search'),
14 url(r'^suggestions/(?P<count>\d+)\.(?P<format>\w+)', 'suggestions', name='suggestions-opml'),
15 (r'^toplist\.(?P<format>\w+)$', 'toplist', {'count': 50}),
16 url(r'^gpodder-examples\.(?P<format>\w+)$', 'example_podcasts', name='example-opml'),
19 from mygpo.api.subscriptions import SubscriptionsAPI
20 from mygpo.api.advanced.updates import DeviceUpdates
21 from mygpo.api.advanced.episode import ChaptersAPI
22 from mygpo.api.advanced.settings import SettingsAPI
24 urlpatterns += patterns('mygpo.api.advanced',
25 url(r'^api/(?P<version>[12])/subscriptions/(?P<username>[\w.+-]+)/(?P<device_uid>[\w.-]+)\.json',
26 SubscriptionsAPI.as_view(), name='subscriptions-api'),
28 url(r'^api/(?P<version>[12])/episodes/(?P<username>[\w.+-]+)\.json', 'episodes'),
29 (r'^api/[12]/devices/(?P<username>[\w.+-]+)/(?P<device_uid>[\w.-]+)\.json', 'device'),
30 (r'^api/[12]/devices/(?P<username>[\w.+-]+)\.json', 'devices'),
32 (r'^api/2/auth/(?P<username>[\w.+-]+)/login\.json', 'auth.login'),
33 (r'^api/2/auth/(?P<username>[\w.+-]+)/logout\.json', 'auth.logout'),
34 (r'^api/2/tags/(?P<count>\d+)\.json', 'directory.top_tags'),
35 (r'^api/2/tag/(?P<tag>[^/]+)/(?P<count>\d+)\.json', 'directory.tag_podcasts'),
36 (r'^api/2/data/podcast\.json', 'directory.podcast_info'),
37 url(r'^api/2/data/episode\.json', 'directory.episode_info', name='api-episode-info'),
39 (r'^api/2/chapters/(?P<username>[\w.+-]+)\.json', ChaptersAPI.as_view()),
40 (r'^api/2/updates/(?P<username>[\w.+-]+)/(?P<device_uid>[\w.-]+)\.json',
41 DeviceUpdates.as_view()),
43 url(r'^api/2/settings/(?P<username>[\w.+-]+)/(?P<scope>account|device|podcast|episode)\.json',
44 SettingsAPI.as_view(),
45 name='settings-api'),
47 (r'^api/2/favorites/(?P<username>[\w.+-]+).json', 'favorites'),
49 (r'^api/2/lists/(?P<username>[\w.+-]+)/create\.(?P<format>\w+)', 'lists.create'),
50 (r'^api/2/lists/(?P<username>[\w.+-]+)\.json', 'lists.get_lists'),
51 url(r'^api/2/lists/(?P<username>[\w.+-]+)/list/(?P<slug>[\w-]+)\.(?P<format>\w+)', 'lists.podcast_list', name='api-get-list'),
53 (r'^api/2/sync-devices/(?P<username>[\w.+-]+)\.json', 'sync.main'),