1 | <?php |
||
13 | class Watching extends AbstractActivity |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * List watchers |
||
18 | * |
||
19 | * @link https://developer.github.com/v3/activity/watching/#list-watchers |
||
20 | * @return array |
||
21 | */ |
||
22 | public function listWatchers(): array |
||
27 | |||
28 | /** |
||
29 | * List repositories being watched |
||
30 | * |
||
31 | * @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched |
||
32 | * |
||
33 | * @param string $username |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | public function listSubscriptions(string $username = null): array |
||
48 | |||
49 | /** |
||
50 | * Get a Repository Subscription |
||
51 | * |
||
52 | * @link https://developer.github.com/v3/activity/watching/#get-a-repository-subscription |
||
53 | * @return array |
||
54 | */ |
||
55 | public function getRepositorySubscription(): array |
||
60 | |||
61 | /** |
||
62 | * Set a Repository Subscription |
||
63 | * |
||
64 | * @link https://developer.github.com/v3/activity/watching/#set-a-repository-subscription |
||
65 | * |
||
66 | * @param bool $subscribed |
||
67 | * @param bool $ignored |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function setRepositorySubscription(bool $subscribed = false, bool $ignored = false): array |
||
72 | { |
||
73 | return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/subscription?:args', |
||
74 | $this->getActivity()->getOwner(), $this->getActivity()->getRepo(), http_build_query([ |
||
75 | 'subscribed' => $subscribed, |
||
76 | 'ignored' => $ignored |
||
77 | ])), Request::METHOD_PUT); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Delete a Repository Subscription |
||
82 | * |
||
83 | * @link https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription |
||
84 | * @return bool |
||
85 | */ |
||
86 | public function deleteRepositorySubscription(): bool |
||
98 | |||
99 | /** |
||
100 | * Check if you are watching a repository (LEGACY) |
||
101 | * |
||
102 | * @link https://developer.github.com/v3/activity/watching/#check-if-you-are-watching-a-repository-legacy |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function userSubscriptions(): bool |
||
117 | |||
118 | /** |
||
119 | * Watch a repository (LEGACY) |
||
120 | * |
||
121 | * @link https://developer.github.com/v3/activity/watching/#watch-a-repository-legacy |
||
122 | * @return bool |
||
123 | */ |
||
124 | public function watchRepository(): bool |
||
136 | |||
137 | /** |
||
138 | * Stop watching a repository (LEGACY) |
||
139 | * |
||
140 | * @link https://developer.github.com/v3/activity/watching/#stop-watching-a-repository-legacy |
||
141 | * @return bool |
||
142 | */ |
||
143 | public function stopWatchingRepository(): bool |
||
155 | } |