Merge branch 'stable'
[mediagoblin.git] / mediagoblin / api / routing.py
CommitLineData
d7b3805f
JT
1# GNU MediaGoblin -- federated, autonomous media hosting
2# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from mediagoblin.tools.routing import add_route
18
19# Add user profile
20add_route(
4fd52036 21 "media.api.user",
d7b3805f 22 "/api/user/<string:username>/",
4fd52036 23 "mediagoblin.api.views:user_endpoint",
c7c26b17 24 match_slash=False
0679545f 25)
d7b3805f
JT
26
27add_route(
4fd52036 28 "mediagoblin.api.user.profile",
c7c26b17 29 "/api/user/<string:username>/profile/",
4fd52036 30 "mediagoblin.api.views:profile_endpoint",
c7c26b17 31 match_slash=False
0679545f 32)
d7b3805f
JT
33
34# Inbox and Outbox (feed)
35add_route(
4fd52036 36 "mediagoblin.api.feed",
c7c26b17 37 "/api/user/<string:username>/feed/",
4fd52036 38 "mediagoblin.api.views:feed_endpoint",
c7c26b17 39 match_slash=False
0679545f 40)
d7b3805f 41
9a51bf1e 42add_route(
4fd52036 43 "mediagoblin.api.feed_major",
9a51bf1e 44 "/api/user/<string:username>/feed/major/",
4fd52036 45 "mediagoblin.api.views:feed_major_endpoint",
9a51bf1e
JT
46 match_slash=False
47)
48
49add_route(
4fd52036 50 "mediagoblin.api.feed_minor",
9a51bf1e 51 "/api/user/<string:username>/feed/minor/",
4fd52036 52 "mediagoblin.api.views:feed_minor_endpoint",
9a51bf1e
JT
53 match_slash=False
54)
55
d4a21d7e 56add_route(
4fd52036 57 "mediagoblin.api.user.uploads",
c7c26b17 58 "/api/user/<string:username>/uploads/",
4fd52036 59 "mediagoblin.api.views:uploads_endpoint",
c7c26b17 60 match_slash=False
0679545f 61)
d4a21d7e 62
d7b3805f 63add_route(
4fd52036 64 "mediagoblin.api.inbox",
c7c26b17 65 "/api/user/<string:username>/inbox/",
4fd52036 66 "mediagoblin.api.views:inbox_endpoint",
c7c26b17 67 match_slash=False
f2698759
JT
68)
69
70add_route(
4fd52036 71 "mediagoblin.api.inbox_minor",
c7c26b17 72 "/api/user/<string:username>/inbox/minor/",
4fd52036 73 "mediagoblin.api.views:inbox_minor_endpoint",
c7c26b17 74 match_slash=False
f2698759
JT
75)
76
77add_route(
4fd52036 78 "mediagoblin.api.inbox_major",
c7c26b17 79 "/api/user/<string:username>/inbox/major/",
4fd52036 80 "mediagoblin.api.views:inbox_major_endpoint",
c7c26b17 81 match_slash=False
f2698759
JT
82)
83
84add_route(
4fd52036 85 "mediagoblin.api.inbox_direct",
c7c26b17 86 "/api/user/<string:username>/inbox/direct/",
4fd52036 87 "mediagoblin.api.views:inbox_endpoint",
c7c26b17 88 match_slash=False
f2698759
JT
89)
90
91add_route(
4fd52036 92 "mediagoblin.api.inbox_direct_minor",
9a51bf1e 93 "/api/user/<string:username>/inbox/direct/minor/",
4fd52036 94 "mediagoblin.api.views:inbox_minor_endpoint",
c7c26b17 95 match_slash=False
f2698759
JT
96)
97
98add_route(
4fd52036 99 "mediagoblin.api.inbox_direct_major",
9a51bf1e 100 "/api/user/<string:username>/inbox/direct/major/",
4fd52036 101 "mediagoblin.api.views:inbox_major_endpoint",
c7c26b17 102 match_slash=False
0679545f 103)
5a2056f7
JT
104
105# object endpoints
106add_route(
4fd52036 107 "mediagoblin.api.object",
c7c26b17 108 "/api/<string:object_type>/<string:id>/",
4fd52036 109 "mediagoblin.api.views:object_endpoint",
c7c26b17
JT
110 match_slash=False
111)
112
98596dd0 113add_route(
4fd52036 114 "mediagoblin.api.object.comments",
c7c26b17 115 "/api/<string:object_type>/<string:id>/comments/",
4fd52036 116 "mediagoblin.api.views:object_comments",
c7c26b17 117 match_slash=False
0679545f 118)
a5682e89 119
120add_route(
121 "mediagoblin.webfinger.well-known.host-meta",
122 "/.well-known/host-meta",
4fd52036 123 "mediagoblin.api.views:host_meta"
0679545f 124)
a5682e89 125
18297655 126add_route(
127 "mediagoblin.webfinger.well-known.host-meta.json",
128 "/.well-known/host-meta.json",
4fd52036 129 "mediagoblin.api.views:host_meta"
0679545f 130)
18297655 131
1bce9961
JT
132add_route(
133 "mediagoblin.webfinger.well-known.webfinger",
c7c26b17 134 "/.well-known/webfinger/",
4fd52036 135 "mediagoblin.api.views:lrdd_lookup",
c7c26b17 136 match_slash=False
1bce9961
JT
137)
138
a5682e89 139add_route(
140 "mediagoblin.webfinger.whoami",
c7c26b17 141 "/api/whoami/",
4fd52036 142 "mediagoblin.api.views:whoami",
c7c26b17 143 match_slash=False
f2698759 144)