pieforhead.topic
¶
Topic
¶
Class to hold Topic endpoints.
Source code in pieforhead/topic.py
list_topics(include_communities=None)
¶
Get a list of topics on the instance.
API endpoint: GET topic/list
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_communities
|
bool | None
|
Include the communities of the topics in the response. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict | None
|
dict | None: dict containing the deserialized json returned by the server. None is returned if an exception was raised and then subsequently ignored. |
Source code in pieforhead/topic.py
subscribe(topic_id, subscribe)
¶
Get notified of new posts in a topic.
API endpoint: PUT topic/subscribe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
topic_id
|
int
|
Topic id to get notifications for. |
required |
subscribe
|
bool
|
True to create activity alert. False to remove it. |
required |
Returns:
| Type | Description |
|---|---|
dict | None
|
dict | None: dict containing the deserialized json returned by the server. None is returned if an exception was raised and then subsequently ignored. |
Source code in pieforhead/topic.py
TopicAsync
¶
Class to hold async Topic endpoints.
Source code in pieforhead/topic.py
list_topics(include_communities=None)
async
¶
Get a list of topics on the instance.
API endpoint: GET topic/list
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_communities
|
bool | None
|
Include the communities of the topics in the response. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict | None
|
dict | None: dict containing the deserialized json returned by the server. None is returned if an exception was raised and then subsequently ignored. |
Source code in pieforhead/topic.py
subscribe(topic_id, subscribe)
async
¶
Get notified of new posts in a topic.
API endpoint: PUT topic/subscribe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
topic_id
|
int
|
Topic id to get notifications for. |
required |
subscribe
|
bool
|
True to create activity alert. False to remove it. |
required |
Returns:
| Type | Description |
|---|---|
dict | None
|
dict | None: dict containing the deserialized json returned by the server. None is returned if an exception was raised and then subsequently ignored. |