Skip to content

Commit 112d9cd

Browse files
authored
APIv3: add _links.notifications to Project resource (#11155)
* APIv3: add `_links.notifications` to `Project` resource Closes #11055 * Update tests * Update more JSON responses with the link * Update more JSON files
1 parent 23bf20c commit 112d9cd

10 files changed

+19
-0
lines changed

readthedocs/api/v3/serializers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ class ProjectLinksSerializer(BaseLinksSerializer):
462462
subprojects = serializers.SerializerMethodField()
463463
superproject = serializers.SerializerMethodField()
464464
translations = serializers.SerializerMethodField()
465+
notifications = serializers.SerializerMethodField()
465466

466467
def get__self(self, obj):
467468
path = reverse("projects-detail", kwargs={"project_slug": obj.slug})
@@ -530,6 +531,15 @@ def get_translations(self, obj):
530531
)
531532
return self._absolute_url(path)
532533

534+
def get_notifications(self, obj):
535+
path = reverse(
536+
"projects-notifications-list",
537+
kwargs={
538+
"parent_lookup_project__slug": obj.slug,
539+
},
540+
)
541+
return self._absolute_url(path)
542+
533543

534544
class ProjectCreateSerializerBase(TaggitSerializer, FlexFieldsModelSerializer):
535545

readthedocs/api/v3/tests/responses/projects-detail.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"_self": "https://readthedocs.org/api/v3/projects/project/",
7272
"builds": "https://readthedocs.org/api/v3/projects/project/builds/",
7373
"environmentvariables": "https://readthedocs.org/api/v3/projects/project/environmentvariables/",
74+
"notifications": "https://readthedocs.org/api/v3/projects/project/notifications/",
7475
"redirects": "https://readthedocs.org/api/v3/projects/project/redirects/",
7576
"subprojects": "https://readthedocs.org/api/v3/projects/project/subprojects/",
7677
"superproject": "https://readthedocs.org/api/v3/projects/project/superproject/",

readthedocs/api/v3/tests/responses/projects-list.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"versions": "https://readthedocs.org/api/v3/projects/project/versions/",
4848
"builds": "https://readthedocs.org/api/v3/projects/project/builds/",
4949
"environmentvariables": "https://readthedocs.org/api/v3/projects/project/environmentvariables/",
50+
"notifications": "https://readthedocs.org/api/v3/projects/project/notifications/",
5051
"redirects": "https://readthedocs.org/api/v3/projects/project/redirects/",
5152
"subprojects": "https://readthedocs.org/api/v3/projects/project/subprojects/",
5253
"superproject": "https://readthedocs.org/api/v3/projects/project/superproject/",

readthedocs/api/v3/tests/responses/projects-list_POST.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"_self": "https://readthedocs.org/api/v3/projects/test-project/",
44
"builds": "https://readthedocs.org/api/v3/projects/test-project/builds/",
55
"environmentvariables": "https://readthedocs.org/api/v3/projects/test-project/environmentvariables/",
6+
"notifications": "https://readthedocs.org/api/v3/projects/test-project/notifications/",
67
"redirects": "https://readthedocs.org/api/v3/projects/test-project/redirects/",
78
"subprojects": "https://readthedocs.org/api/v3/projects/test-project/subprojects/",
89
"superproject": "https://readthedocs.org/api/v3/projects/test-project/superproject/",

readthedocs/api/v3/tests/responses/projects-subprojects-detail.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"_self": "https://readthedocs.org/api/v3/projects/subproject/",
1010
"builds": "https://readthedocs.org/api/v3/projects/subproject/builds/",
1111
"environmentvariables": "https://readthedocs.org/api/v3/projects/subproject/environmentvariables/",
12+
"notifications": "https://readthedocs.org/api/v3/projects/subproject/notifications/",
1213
"redirects": "https://readthedocs.org/api/v3/projects/subproject/redirects/",
1314
"subprojects": "https://readthedocs.org/api/v3/projects/subproject/subprojects/",
1415
"superproject": "https://readthedocs.org/api/v3/projects/subproject/superproject/",

readthedocs/api/v3/tests/responses/projects-subprojects-list.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"_self": "https://readthedocs.org/api/v3/projects/subproject/",
1515
"builds": "https://readthedocs.org/api/v3/projects/subproject/builds/",
1616
"environmentvariables": "https://readthedocs.org/api/v3/projects/subproject/environmentvariables/",
17+
"notifications": "https://readthedocs.org/api/v3/projects/subproject/notifications/",
1718
"redirects": "https://readthedocs.org/api/v3/projects/subproject/redirects/",
1819
"subprojects": "https://readthedocs.org/api/v3/projects/subproject/subprojects/",
1920
"superproject": "https://readthedocs.org/api/v3/projects/subproject/superproject/",

readthedocs/api/v3/tests/responses/projects-subprojects-list_POST.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"_self": "https://readthedocs.org/api/v3/projects/new-project/",
1010
"builds": "https://readthedocs.org/api/v3/projects/new-project/builds/",
1111
"environmentvariables": "https://readthedocs.org/api/v3/projects/new-project/environmentvariables/",
12+
"notifications": "https://readthedocs.org/api/v3/projects/new-project/notifications/",
1213
"redirects": "https://readthedocs.org/api/v3/projects/new-project/redirects/",
1314
"subprojects": "https://readthedocs.org/api/v3/projects/new-project/subprojects/",
1415
"superproject": "https://readthedocs.org/api/v3/projects/new-project/superproject/",

readthedocs/api/v3/tests/responses/projects-superproject.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"_self": "https://readthedocs.org/api/v3/projects/project/",
1212
"builds": "https://readthedocs.org/api/v3/projects/project/builds/",
1313
"environmentvariables": "https://readthedocs.org/api/v3/projects/project/environmentvariables/",
14+
"notifications": "https://readthedocs.org/api/v3/projects/project/notifications/",
1415
"redirects": "https://readthedocs.org/api/v3/projects/project/redirects/",
1516
"subprojects": "https://readthedocs.org/api/v3/projects/project/subprojects/",
1617
"superproject": "https://readthedocs.org/api/v3/projects/project/superproject/",

readthedocs/api/v3/tests/responses/projects-versions-builds-list_POST.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"builds": "https://readthedocs.org/api/v3/projects/project/builds/",
4040
"environmentvariables": "https://readthedocs.org/api/v3/projects/project/environmentvariables/",
4141
"redirects": "https://readthedocs.org/api/v3/projects/project/redirects/",
42+
"notifications": "https://readthedocs.org/api/v3/projects/project/notifications/",
4243
"subprojects": "https://readthedocs.org/api/v3/projects/project/subprojects/",
4344
"superproject": "https://readthedocs.org/api/v3/projects/project/superproject/",
4445
"translations": "https://readthedocs.org/api/v3/projects/project/translations/",

readthedocs/api/v3/tests/responses/remoterepositories-list.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"_self": "https://readthedocs.org/api/v3/projects/project/",
2222
"builds": "https://readthedocs.org/api/v3/projects/project/builds/",
2323
"environmentvariables": "https://readthedocs.org/api/v3/projects/project/environmentvariables/",
24+
"notifications": "https://readthedocs.org/api/v3/projects/project/notifications/",
2425
"redirects": "https://readthedocs.org/api/v3/projects/project/redirects/",
2526
"subprojects": "https://readthedocs.org/api/v3/projects/project/subprojects/",
2627
"superproject": "https://readthedocs.org/api/v3/projects/project/superproject/",

0 commit comments

Comments
 (0)