Skip to content

Commit 5deccee

Browse files
authored
Merge pull request sigmavirus24#915 from CJ-Wright/subscribe
Match `Repo.subscribe` docstrings
2 parents acb9e7d + b996227 commit 5deccee

File tree

4 files changed

+45
-11
lines changed

4 files changed

+45
-11
lines changed

src/github3/repos/repo.py

+42-8
Original file line numberDiff line numberDiff line change
@@ -2423,21 +2423,14 @@ def subscribe(self):
24232423
24242424
This replaces ``Repository#set_subscription``
24252425
2426-
:param bool subscribed:
2427-
(required), determines if notifications should
2428-
be received from this repository.
2429-
:param bool ignored:
2430-
(required), determines if notifications should be
2431-
ignored from this repository.
24322426
:returns:
24332427
the new repository subscription
24342428
:rtype:
24352429
:class:`~github3.notifications.RepositorySubscription`
24362430
"""
24372431
url = self._build_url("subscription", base_url=self._api)
24382432
json = self._json(
2439-
self._put(url, data=jsonlib.dumps({"subcribed": True})), 200
2440-
)
2433+
self._put(url, data=jsonlib.dumps({"subscribed": True})), 200)
24412434
return self._instance_or_null(
24422435
notifications.RepositorySubscription, json
24432436
)
@@ -2557,6 +2550,47 @@ def tree(self, sha, recursive=False):
25572550
json = self._json(self._get(url, params=params), 200)
25582551
return self._instance_or_null(git.Tree, json)
25592552

2553+
@requires_auth
2554+
def unignore(self):
2555+
"""Unignore notifications from this repository for the user.
2556+
2557+
.. versionadded:: 1.3
2558+
2559+
This replaces ``Repository#set_subscription``.
2560+
2561+
:returns:
2562+
the new repository subscription
2563+
:rtype:
2564+
:class:~github3.notifications.RepositorySubscription`
2565+
"""
2566+
url = self._build_url("subscription", base_url=self._api)
2567+
json = self._json(
2568+
self._put(url, data=jsonlib.dumps({"ignored": False})), 200
2569+
)
2570+
return self._instance_or_null(
2571+
notifications.RepositorySubscription, json
2572+
)
2573+
2574+
@requires_auth
2575+
def unsubscribe(self):
2576+
"""Unsubscribe the user to this repository's notifications.
2577+
2578+
.. versionadded:: 1.3
2579+
2580+
This replaces ``Repository#set_subscription``
2581+
2582+
:returns:
2583+
the new repository subscription
2584+
:rtype:
2585+
:class:`~github3.notifications.RepositorySubscription`
2586+
"""
2587+
url = self._build_url("subscription", base_url=self._api)
2588+
json = self._json(
2589+
self._put(url, data=jsonlib.dumps({"subscribed": False})), 200)
2590+
return self._instance_or_null(
2591+
notifications.RepositorySubscription, json
2592+
)
2593+
25602594
def weekly_commit_count(self):
25612595
"""Retrieve the total commit counts.
25622596

0 commit comments

Comments
 (0)