Skip to content

Commit caa25dc

Browse files
committed
Update events docs
1 parent 0e4dd05 commit caa25dc

File tree

7 files changed

+93
-20
lines changed

7 files changed

+93
-20
lines changed

docs/events.rst

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
Events service
44
==============
55

6-
This service exposes the `Events API`. Much of this API is read-only, and while
6+
This service exposes the `Events API`_. Much of this API is read-only, and while
77
pagination is supported, there is a fixed page size of 30 with a limit of 10
8-
page requests.
8+
page requests.
99

10-
Many events have an `actor` which denotes the user that performed an event.
11-
Additionally, there may be `org` or `repo` attributes for events related to
12-
Organizations and Repos. Finally, each event object contains a `payload`
10+
Many events have an `actor` which denotes the user that performed an event.
11+
Additionally, there may be `org` or `repo` attributes for events related to
12+
Organizations and Repos. Finally, each event object contains a `payload`
1313
attribute containing more detailed information about the event.
14+
1415
.. _public events:
1516

1617
Public Events
@@ -26,14 +27,39 @@ Yields the most recent public events from Github.
2627
events = gh.events.list().all()
2728
print events[0].payload
2829

30+
Event
31+
.......
32+
33+
.. autoclass:: pygithub3.services.events.Event
34+
:members:
35+
36+
.. attribute:: issues
37+
38+
:ref:`Issues events <Issues events service>`
39+
40+
.. attribute:: networks
41+
42+
:ref:`Events network service`
43+
44+
.. attribute:: orgs
45+
46+
:ref:`Events org service`
47+
48+
.. attribute:: repos
49+
50+
:ref:`Events repo service`
51+
52+
.. attribute:: users
53+
54+
:ref:`Events user service`
2955

3056
.. _repository events:
3157

3258
Repo Events
3359
-----------
3460

35-
These are events for a specific repo, including issue and network events. The
36-
Issues events are proxied to the `Issues Service`_.
61+
These are events for a specific repo, including issue and network events. The
62+
Issues events are proxied to the :ref:`Issues service`.
3763

3864
::
3965

@@ -42,12 +68,30 @@ Issues events are proxied to the `Issues Service`_.
4268
print("{t}".format(t=e.type))
4369

4470
# Get the issue Events
45-
events = gh.events.issues.list_by_repo(user="copitux",
71+
events = gh.events.issues.list_by_repo(user="copitux",
4672
repo="python-github3")
4773

4874
# Get the Public Events for a Repo's Network
4975
events = gh.events.networks.list(user="copitux", repo="python-github3")
50-
76+
77+
.. _Events network service:
78+
79+
Network
80+
.......
81+
82+
.. autoclass:: pygithub3.services.events.networks.Network
83+
:members:
84+
85+
86+
.. _Events repo service:
87+
88+
Repo
89+
........
90+
91+
.. autoclass:: pygithub3.services.events.repos.Repo
92+
:members:
93+
94+
5195
.. _organziation events:
5296

5397
Organization Events
@@ -60,19 +104,27 @@ These are the public events for an Organization
60104
events = gh.events.orgs.list(org="Acme")
61105

62106
You may also get a user's feed of events for an Organization, but you *must* be
63-
authenticated as the provided user, and you must be a member of the given
107+
authenticated as the provided user, and you must be a member of the given
64108
organization.
65109

66110
::
67-
111+
68112
events = gh.events.users.orgs(user="copitux", org="acme")
69113

114+
.. _Events org service:
115+
116+
Org
117+
........
118+
119+
.. autoclass:: pygithub3.services.events.orgs.Org
120+
:members:
121+
70122
.. _user events:
71123

72124
User Events
73125
-----------
74126

75-
You can retrieve the public events performed by a user and the public events
127+
You can retrieve the public events performed by a user and the public events
76128
that a user receives. If you're authenticated, you may also receive private
77129
events.
78130

@@ -84,10 +136,15 @@ events.
84136
If authenticated as `copitux`, you could get private events with the
85137
following, otherwise you'll just get the public events as above:
86138

87-
::
139+
::
88140

89141
received_events = gh.events.users.list_received(user="copitux")
90142
performed_events = gh.events.users.list_performed(user="copitux")
91143

144+
.. _Events user service:
145+
146+
User
147+
........
92148

93-
.. _Events API: http://developer.github.com/v3/events/
149+
.. autoclass:: pygithub3.services.events.users.User
150+
:members:

docs/issues.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Issues
2525

2626
.. attribute:: events
2727

28-
:ref:`Events service`
28+
:ref:`Issues events service`
2929

3030
.. attribute:: labels
3131

@@ -43,7 +43,7 @@ Comments
4343
.. autoclass:: pygithub3.services.issues.Comments
4444
:members:
4545

46-
.. _Events service:
46+
.. _Issues events service:
4747

4848
Events
4949
------

pygithub3/services/events/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ def list(self):
2626
:returns: A :doc:`result`
2727
2828
.. note::
29+
Hits the API fetching maximum number of events (300 = 30/page * 10)
30+
"""
31+
32+
""" TODO
2933
This method uses ``_get_normal_result`` which hits the API fetching
3034
maximum number of events (300 = 30/page * 10).
3135
3236
If there's a good way to tell ``smart.Method`` about the last page
3337
ahead of time, that may be a better way to proceed. Otherwise it
3438
tries to set that via ``_set_last_page_from`` which fails because
3539
that data is not in the returned header.
36-
37-
3840
"""
3941
request = self.request_builder('events.list')
4042
return self._get_normal_result(request, per_page=None)

pygithub3/services/events/networks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def list(self, user=None, repo=None):
1616
:param str repo: Repository
1717
:returns: A :doc:`result`
1818
19+
.. note::
20+
Remember :ref:`config precedence`
1921
"""
2022
request = self.make_request('events.networks.list',
2123
user=user, repo=repo)

pygithub3/services/events/repos.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ def list(self, user=None, repo=None):
1616
:param str repo: Repository
1717
:returns: A :doc:`result`
1818
19+
.. note::
20+
Remember :ref:`config precedence`
21+
1922
.. note::
2023
Remember that the Events API give 10 pages with 30 entries, up to
2124
300 events, so you'll only get the last 300 Repo events
22-
2325
"""
2426
request = self.make_request('events.repos.list', user=user, repo=repo)
2527
return self._get_normal_result(request)

pygithub3/services/events/users.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def list_received(self, user=None):
1616
:param str user: Username
1717
:returns: A :doc:`result`
1818
19+
.. note::
20+
Remember :ref:`config precedence`
1921
"""
2022
request = self.make_request('events.users.list_received', user=user)
2123
return self._get_normal_result(request)
@@ -26,6 +28,8 @@ def list_received_public(self, user=None):
2628
:param str user: Username
2729
:returns: A :doc:`result`
2830
31+
.. note::
32+
Remember :ref:`config precedence`
2933
"""
3034
request = self.make_request('events.users.list_received_public',
3135
user=user)
@@ -38,6 +42,8 @@ def list_performed(self, user=None):
3842
:param str user: Username
3943
:returns: A :doc:`result`
4044
45+
.. note::
46+
Remember :ref:`config precedence`
4147
"""
4248
request = self.make_request('events.users.list_performed', user=user)
4349
return self._get_normal_result(request)
@@ -48,6 +54,8 @@ def list_performed_public(self, user=None):
4854
:param str user: Username
4955
:returns: A :doc:`result`
5056
57+
.. note::
58+
Remember :ref:`config precedence`
5159
"""
5260
request = self.make_request('events.users.list_performed_public',
5361
user=user)
@@ -62,6 +70,8 @@ def orgs(self, user=None, org=None):
6270
.. warning::
6371
You must be authenticated as the given user.
6472
73+
.. note::
74+
Remember :ref:`config precedence`
6575
"""
6676
request = self.make_request('events.users.list_org_events',
6777
user=user, org=org)

pygithub3/services/issues/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class Events(Service):
7-
""" Consume `Events API
7+
""" Consume `Issues Events API
88
<http://developer.github.com/v3/issues/events>`_ """
99

1010
def list_by_issue(self, number, user=None, repo=None):

0 commit comments

Comments
 (0)