Events::listPublicNetworkEvents()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace FlexyProject\GitHub\Receiver\Activity;
3
4
/**
5
 * The Events API class provide a read-only interface to all the event types that power the various activity streams on
6
 * GitHub.
7
 *
8
 * @link    https://developer.github.com/v3/activity/events/
9
 * @package GitHub\Receiver\Activity
10
 */
11
class Events extends AbstractActivity
12
{
13
14
    /**
15
     * List public events
16
     *
17
     * @link https://developer.github.com/v3/activity/events/#list-public-events
18
     * @return array
19
     */
20
    public function listPublicEvents(): array
21
    {
22
        return $this->getApi()->request('/events');
23
    }
24
25
    /**
26
     * List repository events
27
     *
28
     * @link https://developer.github.com/v3/activity/events/#list-repository-events
29
     * @return array
30
     */
31
    public function listRepositoryEvents(): array
32
    {
33
        return $this->getApi()->request($this->getApi()
34
                                             ->sprintf('/repos/:owner/:repo/events', $this->getActivity()->getOwner(),
35
                                                 $this->getActivity()->getRepo()));
36
    }
37
38
    /**
39
     * List issue events for a repository
40
     *
41
     * @link https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
42
     * @return array
43
     */
44
    public function listIssueEvents(): array
45
    {
46
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events',
47
            $this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
48
    }
49
50
    /**
51
     * List public events for a network of repositories
52
     *
53
     * @link https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
54
     * @return array
55
     */
56
    public function listPublicNetworkEvents(): array
57
    {
58
        return $this->getApi()->request($this->getApi()->sprintf('/networks/:owner/:repo/events',
59
            $this->getActivity()->getOwner(), $this->getActivity()->getRepo()));
60
    }
61
62
    /**
63
     * List public events for an organization
64
     *
65
     * @link https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
66
     *
67
     * @param string $organization
68
     *
69
     * @return array
70
     */
71
    public function listPublicOrganizationEvents(string $organization): array
72
    {
73
        return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/events', $organization));
74
    }
75
76
    /**
77
     * List events that a user has received
78
     *
79
     * @link https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
80
     *
81
     * @param string $username
82
     *
83
     * @return array
84
     */
85
    public function listUserReceiveEvents(string $username): array
86
    {
87
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username));
88
    }
89
90
    /**
91
     * List public events that a user has received
92
     *
93
     * @link https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
94
     *
95
     * @param string $username
96
     *
97
     * @return array
98
     */
99
    public function listPublicUserReceiveEvents(string $username): array
100
    {
101
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events/public', $username));
102
    }
103
104
    /**
105
     * List events performed by a user
106
     *
107
     * @link https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
108
     *
109
     * @param string $username
110
     *
111
     * @return array
112
     */
113
    public function listUserPerformedEvents(string $username): array
114
    {
115
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username));
116
    }
117
118
    /**
119
     * List public events performed by a user
120
     *
121
     * @link https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
122
     *
123
     * @param string $username
124
     *
125
     * @return array
126
     */
127
    public function listPublicUserPerformedEvents(string $username): array
128
    {
129
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events/public', $username));
130
    }
131
132
    /**
133
     * List events for an organization
134
     *
135
     * @link https://developer.github.com/v3/activity/events/#list-events-for-an-organization
136
     *
137
     * @param string $username
138
     * @param string $organization
139
     *
140
     * @return array
141
     */
142
    public function listOrganizationEvents(string $username, string $organization): array
143
    {
144
        return $this->getApi()->request($this->getApi()
145
                                             ->sprintf('/users/:username/events/orgs/:org', $username, $organization));
146
    }
147
}