aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/urls.py
blob: ae3172c7580a6c56dc8a49b32171ea5db6e50615 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
from django.urls import include, path
from rest_framework.routers import DefaultRouter

from .views import (
    GitHubArtifactsView,
    GitHubWebhookFilterView,
    HealthcheckView,
    RulesView,
)
from .viewsets import (
    AocAccountLinkViewSet,
    AocCompletionistBlockViewSet,
    BotSettingViewSet,
    BumpedThreadViewSet,
    DeletedMessageViewSet,
    DocumentationLinkViewSet,
    FilterListViewSet,
    FilterViewSet,
    InfractionViewSet,
    MailingListViewSet,
    NominationViewSet,
    OffTopicChannelNameViewSet,
    OffensiveMessageViewSet,
    ReminderViewSet,
    RoleViewSet,
    UserViewSet
)

# https://www.django-rest-framework.org/api-guide/routers/#defaultrouter
bot_router = DefaultRouter(trailing_slash=False)
# XXX: We should probably figure out why we have this registered twice.
bot_router.register(
    'filter/filter_lists',
    FilterListViewSet,
    basename="filter-filterlists-list",
)
bot_router.register(
    "aoc-account-links",
    AocAccountLinkViewSet
)
bot_router.register(
    "aoc-completionist-blocks",
    AocCompletionistBlockViewSet
)
bot_router.register(
    'filter/filters',
    FilterViewSet
)
bot_router.register(
    'bot-settings',
    BotSettingViewSet
)
bot_router.register(
    'bumped-threads',
    BumpedThreadViewSet
)
bot_router.register(
    'deleted-messages',
    DeletedMessageViewSet
)
bot_router.register(
    'documentation-links',
    DocumentationLinkViewSet
)
bot_router.register(
    'filter-lists',
    FilterListViewSet,
)
bot_router.register(
    'infractions',
    InfractionViewSet
)
bot_router.register(
    'mailing-lists',
    MailingListViewSet
)
bot_router.register(
    'nominations',
    NominationViewSet
)
bot_router.register(
    'offensive-messages',
    OffensiveMessageViewSet
)
bot_router.register(
    'off-topic-channel-names',
    OffTopicChannelNameViewSet,
    basename='offtopicchannelname'
)
bot_router.register(
    'reminders',
    ReminderViewSet
)
bot_router.register(
    'roles',
    RoleViewSet
)
bot_router.register(
    'users',
    UserViewSet
)

app_name = 'api'
urlpatterns = (
    # Build URLs using something like...
    #
    # from django_hosts.resolvers import reverse
    path('bot/', include((bot_router.urls, 'api'), namespace='bot')),
    path('healthcheck', HealthcheckView.as_view(), name='healthcheck'),
    path('rules', RulesView.as_view(), name='rules'),
    path(
        'github/artifact/<str:owner>/<str:repo>/<str:sha>/<str:action_name>/<str:artifact_name>',
        GitHubArtifactsView.as_view(),
        name="github-artifacts"
    ),
    path(
        'github/webhook-filter/<str:webhook_id>/<str:webhook_token>',
        GitHubWebhookFilterView.as_view(),
        name='github-webhook-filter'
    ),
)