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
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,3 +98,54 @@ Similarly for takeovers, you just need to pass `page_type="takeovers"`.
98
98
-`get_index` provides two additional arguments `limit` and `offset`, to provide pagination functionality. They default to 50 and 0 respectively.
99
99
- If you want to get all engage pages, which in the case of some sites like jp.ubuntu.com there are not that many, you can pass `limit=-1`
100
100
- Use `MaxLimitError` in the `exceptions.py` to handle excessive limit. By default, it will raise an error when it surpasses 500
101
+
102
+
103
+
## Instructions for Category class usage
104
+
105
+
This works similar to the other class but exposes some specific functions that can be run on the index topic and the category as a whole.
106
+
107
+
It exposes a some APIs that can then be called from within a view func for processing.
108
+
109
+
Here is an example of the implementation:
110
+
111
+
```
112
+
security_vulnerabilities = Category(
113
+
parser=CategoryParser(
114
+
api=discourse_api,
115
+
index_topic_id=53193,
116
+
url_prefix="/security/vulnerabilities",
117
+
),
118
+
category_id=308,
119
+
)
120
+
```
121
+
122
+
The `security_vulnerabilities` object exposes the following APIs:
123
+
124
+
- get_topic(path): Fetches a single topic using its URL (path).
125
+
- get_category_index_metadata(data_name): Retrieves metadata for the category index. You can optionally specify a data_name to get data for just one table.
126
+
- get_topics_in_category(): Retrieves all topics within the currently active category.
127
+
- get_category_events(limit=100, offset=0): Retrieves all future events in a category. Requires the Discourse Events plugin to be installed on the instance.
128
+
129
+
## Instructions for Events class usage
130
+
131
+
This class provides functionality for managing and parsing events from Discourse topics, particularly useful for event-driven websites that need to display upcoming events, featured events, and event categories. It relies on the plugin, [Discourse Calendar](https://meta.discourse.org/t/discourse-calendar-and-event/97376).
132
+
133
+
It exposes APIs that can be called from within a view function for processing event data.
134
+
135
+
Here is an example of the implementation:
136
+
137
+
```python
138
+
events = Events(
139
+
parser=EventsParser(
140
+
api=discourse_api,
141
+
index_topic_id=12345,
142
+
url_prefix="/events",
143
+
),
144
+
category_id=25,
145
+
)
146
+
```
147
+
148
+
The `events` object exposes the following APIs:
149
+
150
+
- get_events(): Fetches all future events from the target Discourse instance.
151
+
- get_featured_events(target_tag="featured-event"): Retrieves all events with a given tagrte tag, defaults to "featured-event"
0 commit comments