You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-6Lines changed: 43 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -184,9 +184,24 @@ The client automatically handles authentication and token refresh when an instal
184
184
185
185
### Models
186
186
187
+
django-github-app provides models that handle the persistence and retrieval of GitHub App data. These models abstract away common patterns when working with GitHub Apps: storing webhook events, managing installation authentication, and tracking repository access.
188
+
189
+
All models and their managers provide async methods for database operations and GitHub API interactions, with sync wrappers where appropriate.
190
+
187
191
#### `EventLog`
188
192
189
-
Stores incoming webhook events with their payload and timestamp. Includes automatic cleanup of old events based on the `DAYS_TO_KEEP_EVENTS` setting via a `EventLog.objects.acleanup_events` manager method.
193
+
Maintains a history of incoming webhook events, storing both the event type and its full payload. Automatically cleans up old events based on your configuration, via the `acleanup_events` manager method and the `GITHUB_APP["DAYS_TO_KEEP_EVENTS"]` setting.
194
+
195
+
Manager methods:
196
+
197
+
- `acreate_from_event`/`create_from_event`: Store incoming webhook events _(primarily for internal use)_
198
+
- `acleanup_events`/`cleanup_events`: Remove events older than specified days
199
+
200
+
Properties:
201
+
202
+
- `action`: Extract action from event payload, if present
203
+
204
+
The model primarily serves the webhook handling system, but you can also use it to query past events if needed.
190
205
191
206
#### `Installation`
192
207
@@ -198,22 +213,44 @@ from django_github_app.models import Installation
0 commit comments