universal-mcp-applications 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. universal_mcp/applications/ahrefs/README.md +51 -0
  2. universal_mcp/applications/ahrefs/__init__.py +1 -0
  3. universal_mcp/applications/ahrefs/app.py +2291 -0
  4. universal_mcp/applications/airtable/README.md +22 -0
  5. universal_mcp/applications/airtable/__init__.py +1 -0
  6. universal_mcp/applications/airtable/app.py +479 -0
  7. universal_mcp/applications/apollo/README.md +44 -0
  8. universal_mcp/applications/apollo/__init__.py +1 -0
  9. universal_mcp/applications/apollo/app.py +1847 -0
  10. universal_mcp/applications/asana/README.md +199 -0
  11. universal_mcp/applications/asana/__init__.py +1 -0
  12. universal_mcp/applications/asana/app.py +9509 -0
  13. universal_mcp/applications/aws-s3/README.md +0 -0
  14. universal_mcp/applications/aws-s3/__init__.py +1 -0
  15. universal_mcp/applications/aws-s3/app.py +552 -0
  16. universal_mcp/applications/bill/README.md +0 -0
  17. universal_mcp/applications/bill/__init__.py +1 -0
  18. universal_mcp/applications/bill/app.py +8705 -0
  19. universal_mcp/applications/box/README.md +307 -0
  20. universal_mcp/applications/box/__init__.py +1 -0
  21. universal_mcp/applications/box/app.py +15987 -0
  22. universal_mcp/applications/braze/README.md +106 -0
  23. universal_mcp/applications/braze/__init__.py +1 -0
  24. universal_mcp/applications/braze/app.py +4754 -0
  25. universal_mcp/applications/cal-com-v2/README.md +150 -0
  26. universal_mcp/applications/cal-com-v2/__init__.py +1 -0
  27. universal_mcp/applications/cal-com-v2/app.py +5541 -0
  28. universal_mcp/applications/calendly/README.md +53 -0
  29. universal_mcp/applications/calendly/__init__.py +1 -0
  30. universal_mcp/applications/calendly/app.py +1436 -0
  31. universal_mcp/applications/canva/README.md +43 -0
  32. universal_mcp/applications/canva/__init__.py +1 -0
  33. universal_mcp/applications/canva/app.py +941 -0
  34. universal_mcp/applications/clickup/README.md +135 -0
  35. universal_mcp/applications/clickup/__init__.py +1 -0
  36. universal_mcp/applications/clickup/app.py +5009 -0
  37. universal_mcp/applications/coda/README.md +108 -0
  38. universal_mcp/applications/coda/__init__.py +1 -0
  39. universal_mcp/applications/coda/app.py +3671 -0
  40. universal_mcp/applications/confluence/README.md +198 -0
  41. universal_mcp/applications/confluence/__init__.py +1 -0
  42. universal_mcp/applications/confluence/app.py +6273 -0
  43. universal_mcp/applications/contentful/README.md +17 -0
  44. universal_mcp/applications/contentful/__init__.py +1 -0
  45. universal_mcp/applications/contentful/app.py +364 -0
  46. universal_mcp/applications/crustdata/README.md +25 -0
  47. universal_mcp/applications/crustdata/__init__.py +1 -0
  48. universal_mcp/applications/crustdata/app.py +586 -0
  49. universal_mcp/applications/dialpad/README.md +202 -0
  50. universal_mcp/applications/dialpad/__init__.py +1 -0
  51. universal_mcp/applications/dialpad/app.py +5949 -0
  52. universal_mcp/applications/digitalocean/README.md +463 -0
  53. universal_mcp/applications/digitalocean/__init__.py +1 -0
  54. universal_mcp/applications/digitalocean/app.py +20835 -0
  55. universal_mcp/applications/domain-checker/README.md +13 -0
  56. universal_mcp/applications/domain-checker/__init__.py +1 -0
  57. universal_mcp/applications/domain-checker/app.py +265 -0
  58. universal_mcp/applications/e2b/README.md +12 -0
  59. universal_mcp/applications/e2b/__init__.py +1 -0
  60. universal_mcp/applications/e2b/app.py +187 -0
  61. universal_mcp/applications/elevenlabs/README.md +88 -0
  62. universal_mcp/applications/elevenlabs/__init__.py +1 -0
  63. universal_mcp/applications/elevenlabs/app.py +3235 -0
  64. universal_mcp/applications/exa/README.md +15 -0
  65. universal_mcp/applications/exa/__init__.py +1 -0
  66. universal_mcp/applications/exa/app.py +221 -0
  67. universal_mcp/applications/falai/README.md +17 -0
  68. universal_mcp/applications/falai/__init__.py +1 -0
  69. universal_mcp/applications/falai/app.py +331 -0
  70. universal_mcp/applications/figma/README.md +49 -0
  71. universal_mcp/applications/figma/__init__.py +1 -0
  72. universal_mcp/applications/figma/app.py +1090 -0
  73. universal_mcp/applications/firecrawl/README.md +20 -0
  74. universal_mcp/applications/firecrawl/__init__.py +1 -0
  75. universal_mcp/applications/firecrawl/app.py +514 -0
  76. universal_mcp/applications/fireflies/README.md +25 -0
  77. universal_mcp/applications/fireflies/__init__.py +1 -0
  78. universal_mcp/applications/fireflies/app.py +506 -0
  79. universal_mcp/applications/fpl/README.md +23 -0
  80. universal_mcp/applications/fpl/__init__.py +1 -0
  81. universal_mcp/applications/fpl/app.py +1327 -0
  82. universal_mcp/applications/fpl/utils/api.py +142 -0
  83. universal_mcp/applications/fpl/utils/fixtures.py +629 -0
  84. universal_mcp/applications/fpl/utils/helper.py +982 -0
  85. universal_mcp/applications/fpl/utils/league_utils.py +546 -0
  86. universal_mcp/applications/fpl/utils/position_utils.py +68 -0
  87. universal_mcp/applications/ghost-content/README.md +25 -0
  88. universal_mcp/applications/ghost-content/__init__.py +1 -0
  89. universal_mcp/applications/ghost-content/app.py +654 -0
  90. universal_mcp/applications/github/README.md +1049 -0
  91. universal_mcp/applications/github/__init__.py +1 -0
  92. universal_mcp/applications/github/app.py +50600 -0
  93. universal_mcp/applications/gong/README.md +63 -0
  94. universal_mcp/applications/gong/__init__.py +1 -0
  95. universal_mcp/applications/gong/app.py +2297 -0
  96. universal_mcp/applications/google-ads/README.md +0 -0
  97. universal_mcp/applications/google-ads/__init__.py +1 -0
  98. universal_mcp/applications/google-ads/app.py +23 -0
  99. universal_mcp/applications/google-calendar/README.md +21 -0
  100. universal_mcp/applications/google-calendar/__init__.py +1 -0
  101. universal_mcp/applications/google-calendar/app.py +574 -0
  102. universal_mcp/applications/google-docs/README.md +25 -0
  103. universal_mcp/applications/google-docs/__init__.py +1 -0
  104. universal_mcp/applications/google-docs/app.py +760 -0
  105. universal_mcp/applications/google-drive/README.md +68 -0
  106. universal_mcp/applications/google-drive/__init__.py +1 -0
  107. universal_mcp/applications/google-drive/app.py +4936 -0
  108. universal_mcp/applications/google-gemini/README.md +25 -0
  109. universal_mcp/applications/google-gemini/__init__.py +1 -0
  110. universal_mcp/applications/google-gemini/app.py +663 -0
  111. universal_mcp/applications/google-mail/README.md +31 -0
  112. universal_mcp/applications/google-mail/__init__.py +1 -0
  113. universal_mcp/applications/google-mail/app.py +1354 -0
  114. universal_mcp/applications/google-searchconsole/README.md +21 -0
  115. universal_mcp/applications/google-searchconsole/__init__.py +1 -0
  116. universal_mcp/applications/google-searchconsole/app.py +320 -0
  117. universal_mcp/applications/google-sheet/README.md +36 -0
  118. universal_mcp/applications/google-sheet/__init__.py +1 -0
  119. universal_mcp/applications/google-sheet/app.py +1941 -0
  120. universal_mcp/applications/hashnode/README.md +20 -0
  121. universal_mcp/applications/hashnode/__init__.py +1 -0
  122. universal_mcp/applications/hashnode/app.py +455 -0
  123. universal_mcp/applications/heygen/README.md +44 -0
  124. universal_mcp/applications/heygen/__init__.py +1 -0
  125. universal_mcp/applications/heygen/app.py +961 -0
  126. universal_mcp/applications/http-tools/README.md +16 -0
  127. universal_mcp/applications/http-tools/__init__.py +1 -0
  128. universal_mcp/applications/http-tools/app.py +153 -0
  129. universal_mcp/applications/hubspot/README.md +239 -0
  130. universal_mcp/applications/hubspot/__init__.py +1 -0
  131. universal_mcp/applications/hubspot/app.py +416 -0
  132. universal_mcp/applications/jira/README.md +600 -0
  133. universal_mcp/applications/jira/__init__.py +1 -0
  134. universal_mcp/applications/jira/app.py +28804 -0
  135. universal_mcp/applications/klaviyo/README.md +313 -0
  136. universal_mcp/applications/klaviyo/__init__.py +1 -0
  137. universal_mcp/applications/klaviyo/app.py +11236 -0
  138. universal_mcp/applications/linkedin/README.md +15 -0
  139. universal_mcp/applications/linkedin/__init__.py +1 -0
  140. universal_mcp/applications/linkedin/app.py +243 -0
  141. universal_mcp/applications/mailchimp/README.md +281 -0
  142. universal_mcp/applications/mailchimp/__init__.py +1 -0
  143. universal_mcp/applications/mailchimp/app.py +10937 -0
  144. universal_mcp/applications/markitdown/README.md +12 -0
  145. universal_mcp/applications/markitdown/__init__.py +1 -0
  146. universal_mcp/applications/markitdown/app.py +63 -0
  147. universal_mcp/applications/miro/README.md +151 -0
  148. universal_mcp/applications/miro/__init__.py +1 -0
  149. universal_mcp/applications/miro/app.py +5429 -0
  150. universal_mcp/applications/ms-teams/README.md +42 -0
  151. universal_mcp/applications/ms-teams/__init__.py +1 -0
  152. universal_mcp/applications/ms-teams/app.py +1823 -0
  153. universal_mcp/applications/neon/README.md +74 -0
  154. universal_mcp/applications/neon/__init__.py +1 -0
  155. universal_mcp/applications/neon/app.py +2018 -0
  156. universal_mcp/applications/notion/README.md +30 -0
  157. universal_mcp/applications/notion/__init__.py +1 -0
  158. universal_mcp/applications/notion/app.py +527 -0
  159. universal_mcp/applications/openai/README.md +22 -0
  160. universal_mcp/applications/openai/__init__.py +1 -0
  161. universal_mcp/applications/openai/app.py +759 -0
  162. universal_mcp/applications/outlook/README.md +20 -0
  163. universal_mcp/applications/outlook/__init__.py +1 -0
  164. universal_mcp/applications/outlook/app.py +444 -0
  165. universal_mcp/applications/perplexity/README.md +12 -0
  166. universal_mcp/applications/perplexity/__init__.py +1 -0
  167. universal_mcp/applications/perplexity/app.py +65 -0
  168. universal_mcp/applications/pipedrive/README.md +284 -0
  169. universal_mcp/applications/pipedrive/__init__.py +1 -0
  170. universal_mcp/applications/pipedrive/app.py +12924 -0
  171. universal_mcp/applications/posthog/README.md +132 -0
  172. universal_mcp/applications/posthog/__init__.py +1 -0
  173. universal_mcp/applications/posthog/app.py +7125 -0
  174. universal_mcp/applications/reddit/README.md +135 -0
  175. universal_mcp/applications/reddit/__init__.py +1 -0
  176. universal_mcp/applications/reddit/app.py +4652 -0
  177. universal_mcp/applications/replicate/README.md +18 -0
  178. universal_mcp/applications/replicate/__init__.py +1 -0
  179. universal_mcp/applications/replicate/app.py +495 -0
  180. universal_mcp/applications/resend/README.md +40 -0
  181. universal_mcp/applications/resend/__init__.py +1 -0
  182. universal_mcp/applications/resend/app.py +881 -0
  183. universal_mcp/applications/retell/README.md +21 -0
  184. universal_mcp/applications/retell/__init__.py +1 -0
  185. universal_mcp/applications/retell/app.py +333 -0
  186. universal_mcp/applications/rocketlane/README.md +70 -0
  187. universal_mcp/applications/rocketlane/__init__.py +1 -0
  188. universal_mcp/applications/rocketlane/app.py +4346 -0
  189. universal_mcp/applications/semanticscholar/README.md +25 -0
  190. universal_mcp/applications/semanticscholar/__init__.py +1 -0
  191. universal_mcp/applications/semanticscholar/app.py +482 -0
  192. universal_mcp/applications/semrush/README.md +44 -0
  193. universal_mcp/applications/semrush/__init__.py +1 -0
  194. universal_mcp/applications/semrush/app.py +2081 -0
  195. universal_mcp/applications/sendgrid/README.md +362 -0
  196. universal_mcp/applications/sendgrid/__init__.py +1 -0
  197. universal_mcp/applications/sendgrid/app.py +9752 -0
  198. universal_mcp/applications/sentry/README.md +186 -0
  199. universal_mcp/applications/sentry/__init__.py +1 -0
  200. universal_mcp/applications/sentry/app.py +7471 -0
  201. universal_mcp/applications/serpapi/README.md +14 -0
  202. universal_mcp/applications/serpapi/__init__.py +1 -0
  203. universal_mcp/applications/serpapi/app.py +293 -0
  204. universal_mcp/applications/sharepoint/README.md +0 -0
  205. universal_mcp/applications/sharepoint/__init__.py +1 -0
  206. universal_mcp/applications/sharepoint/app.py +215 -0
  207. universal_mcp/applications/shopify/README.md +321 -0
  208. universal_mcp/applications/shopify/__init__.py +1 -0
  209. universal_mcp/applications/shopify/app.py +15392 -0
  210. universal_mcp/applications/shortcut/README.md +128 -0
  211. universal_mcp/applications/shortcut/__init__.py +1 -0
  212. universal_mcp/applications/shortcut/app.py +4478 -0
  213. universal_mcp/applications/slack/README.md +0 -0
  214. universal_mcp/applications/slack/__init__.py +1 -0
  215. universal_mcp/applications/slack/app.py +570 -0
  216. universal_mcp/applications/spotify/README.md +91 -0
  217. universal_mcp/applications/spotify/__init__.py +1 -0
  218. universal_mcp/applications/spotify/app.py +2526 -0
  219. universal_mcp/applications/supabase/README.md +87 -0
  220. universal_mcp/applications/supabase/__init__.py +1 -0
  221. universal_mcp/applications/supabase/app.py +2970 -0
  222. universal_mcp/applications/tavily/README.md +12 -0
  223. universal_mcp/applications/tavily/__init__.py +1 -0
  224. universal_mcp/applications/tavily/app.py +51 -0
  225. universal_mcp/applications/trello/README.md +266 -0
  226. universal_mcp/applications/trello/__init__.py +1 -0
  227. universal_mcp/applications/trello/app.py +10875 -0
  228. universal_mcp/applications/twillo/README.md +0 -0
  229. universal_mcp/applications/twillo/__init__.py +1 -0
  230. universal_mcp/applications/twillo/app.py +269 -0
  231. universal_mcp/applications/twitter/README.md +100 -0
  232. universal_mcp/applications/twitter/__init__.py +1 -0
  233. universal_mcp/applications/twitter/api_segments/__init__.py +0 -0
  234. universal_mcp/applications/twitter/api_segments/api_segment_base.py +51 -0
  235. universal_mcp/applications/twitter/api_segments/compliance_api.py +122 -0
  236. universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +255 -0
  237. universal_mcp/applications/twitter/api_segments/dm_events_api.py +140 -0
  238. universal_mcp/applications/twitter/api_segments/likes_api.py +159 -0
  239. universal_mcp/applications/twitter/api_segments/lists_api.py +395 -0
  240. universal_mcp/applications/twitter/api_segments/openapi_json_api.py +34 -0
  241. universal_mcp/applications/twitter/api_segments/spaces_api.py +309 -0
  242. universal_mcp/applications/twitter/api_segments/trends_api.py +40 -0
  243. universal_mcp/applications/twitter/api_segments/tweets_api.py +1403 -0
  244. universal_mcp/applications/twitter/api_segments/usage_api.py +40 -0
  245. universal_mcp/applications/twitter/api_segments/users_api.py +1498 -0
  246. universal_mcp/applications/twitter/app.py +46 -0
  247. universal_mcp/applications/unipile/README.md +28 -0
  248. universal_mcp/applications/unipile/__init__.py +1 -0
  249. universal_mcp/applications/unipile/app.py +829 -0
  250. universal_mcp/applications/whatsapp/README.md +23 -0
  251. universal_mcp/applications/whatsapp/__init__.py +1 -0
  252. universal_mcp/applications/whatsapp/app.py +595 -0
  253. universal_mcp/applications/whatsapp-business/README.md +34 -0
  254. universal_mcp/applications/whatsapp-business/__init__.py +1 -0
  255. universal_mcp/applications/whatsapp-business/app.py +1065 -0
  256. universal_mcp/applications/wrike/README.md +46 -0
  257. universal_mcp/applications/wrike/__init__.py +1 -0
  258. universal_mcp/applications/wrike/app.py +1583 -0
  259. universal_mcp/applications/youtube/README.md +57 -0
  260. universal_mcp/applications/youtube/__init__.py +1 -0
  261. universal_mcp/applications/youtube/app.py +1696 -0
  262. universal_mcp/applications/zenquotes/README.md +12 -0
  263. universal_mcp/applications/zenquotes/__init__.py +1 -0
  264. universal_mcp/applications/zenquotes/app.py +31 -0
  265. universal_mcp_applications-0.1.1.dist-info/METADATA +172 -0
  266. universal_mcp_applications-0.1.1.dist-info/RECORD +268 -0
  267. universal_mcp_applications-0.1.1.dist-info/WHEEL +4 -0
  268. universal_mcp_applications-0.1.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,4652 @@
1
+ from typing import Any
2
+
3
+ import httpx
4
+ from loguru import logger
5
+ from universal_mcp.applications.application import APIApplication
6
+ from universal_mcp.exceptions import NotAuthorizedError
7
+ from universal_mcp.integrations import Integration
8
+
9
+
10
+ class RedditApp(APIApplication):
11
+ def __init__(self, integration: Integration) -> None:
12
+ super().__init__(name="reddit", integration=integration)
13
+ self.base_api_url = "https://oauth.reddit.com"
14
+ self.base_url = "https://oauth.reddit.com"
15
+
16
+ def _post(self, url, data):
17
+ try:
18
+ headers = self._get_headers()
19
+ response = httpx.post(url, headers=headers, data=data)
20
+ response.raise_for_status()
21
+ return response
22
+ except NotAuthorizedError as e:
23
+ logger.warning(f"Authorization needed: {e.message}")
24
+ raise e
25
+ except httpx.HTTPStatusError as e:
26
+ if e.response.status_code == 429:
27
+ return e.response.text or "Rate limit exceeded. Please try again later."
28
+ else:
29
+ raise e
30
+ except Exception as e:
31
+ logger.error(f"Error posting {url}: {e}")
32
+ raise e
33
+
34
+ def _get_headers(self):
35
+ if not self.integration:
36
+ raise ValueError("Integration not configured for RedditApp")
37
+ credentials = self.integration.get_credentials()
38
+ if "access_token" not in credentials:
39
+ logger.error("Reddit credentials found but missing 'access_token'.")
40
+ raise ValueError("Invalid Reddit credentials format.")
41
+
42
+ return {
43
+ "Authorization": f"Bearer {credentials['access_token']}",
44
+ "User-Agent": "agentr-reddit-app/0.1 by AgentR",
45
+ }
46
+
47
+ def get_subreddit_posts(
48
+ self, subreddit: str, limit: int = 5, timeframe: str = "day"
49
+ ) -> dict[str, Any]:
50
+ """
51
+ Retrieves and formats top posts from a specified subreddit within a given timeframe using the Reddit API
52
+
53
+ Args:
54
+ subreddit: The name of the subreddit (e.g., 'python', 'worldnews') without the 'r/' prefix
55
+ limit: The maximum number of posts to return (default: 5, max: 100)
56
+ timeframe: The time period for top posts. Valid options: 'hour', 'day', 'week', 'month', 'year', 'all' (default: 'day')
57
+
58
+ Returns:
59
+ A formatted string containing a numbered list of top posts, including titles, authors, scores, and URLs, or an error message if the request fails
60
+
61
+ Raises:
62
+ RequestException: When the HTTP request to the Reddit API fails
63
+ JSONDecodeError: When the API response contains invalid JSON
64
+
65
+ Tags:
66
+ fetch, reddit, api, list, social-media, important, read-only
67
+ """
68
+ valid_timeframes = ["hour", "day", "week", "month", "year", "all"]
69
+ if timeframe not in valid_timeframes:
70
+ return f"Error: Invalid timeframe '{timeframe}'. Please use one of: {', '.join(valid_timeframes)}"
71
+ if not 1 <= limit <= 100:
72
+ return (
73
+ f"Error: Invalid limit '{limit}'. Please use a value between 1 and 100."
74
+ )
75
+ url = f"{self.base_api_url}/r/{subreddit}/top"
76
+ params = {"limit": limit, "t": timeframe}
77
+ logger.info(
78
+ f"Requesting top {limit} posts from r/{subreddit} for timeframe '{timeframe}'"
79
+ )
80
+ response = self._get(url, params=params)
81
+ return self._handle_response(response)
82
+
83
+ def search_subreddits(
84
+ self, query: str, limit: int = 5, sort: str = "relevance"
85
+ ) -> str:
86
+ """
87
+ Searches Reddit for subreddits matching a given query string and returns a formatted list of results including subreddit names, subscriber counts, and descriptions.
88
+
89
+ Args:
90
+ query: The text to search for in subreddit names and descriptions
91
+ limit: The maximum number of subreddits to return, between 1 and 100 (default: 5)
92
+ sort: The order of results, either 'relevance' or 'activity' (default: 'relevance')
93
+
94
+ Returns:
95
+ A formatted string containing a list of matching subreddits with their names, subscriber counts, and descriptions, or an error message if the search fails or parameters are invalid
96
+
97
+ Raises:
98
+ RequestException: When the HTTP request to Reddit's API fails
99
+ JSONDecodeError: When the API response contains invalid JSON
100
+
101
+ Tags:
102
+ search, important, reddit, api, query, format, list, validation
103
+ """
104
+ valid_sorts = ["relevance", "activity"]
105
+ if sort not in valid_sorts:
106
+ return f"Error: Invalid sort option '{sort}'. Please use one of: {', '.join(valid_sorts)}"
107
+ if not 1 <= limit <= 100:
108
+ return (
109
+ f"Error: Invalid limit '{limit}'. Please use a value between 1 and 100."
110
+ )
111
+ url = f"{self.base_api_url}/subreddits/search"
112
+ params = {
113
+ "q": query,
114
+ "limit": limit,
115
+ "sort": sort,
116
+ # Optionally include NSFW results? Defaulting to false for safety.
117
+ # "include_over_18": "false"
118
+ }
119
+ logger.info(
120
+ f"Searching for subreddits matching '{query}' (limit: {limit}, sort: {sort})"
121
+ )
122
+ response = self._get(url, params=params)
123
+ return self._handle_response(response)
124
+
125
+ def get_post_flairs(self, subreddit: str):
126
+ """
127
+ Retrieves a list of available post flairs for a specified subreddit using the Reddit API.
128
+
129
+ Args:
130
+ subreddit: The name of the subreddit (e.g., 'python', 'worldnews') without the 'r/' prefix
131
+
132
+ Returns:
133
+ A list of dictionaries containing flair details if flairs exist, or a string message indicating no flairs are available
134
+
135
+ Raises:
136
+ RequestException: When the API request fails or network connectivity issues occur
137
+ JSONDecodeError: When the API response contains invalid JSON data
138
+
139
+ Tags:
140
+ fetch, get, reddit, flair, api, read-only
141
+ """
142
+ url = f"{self.base_api_url}/r/{subreddit}/api/link_flair_v2"
143
+ logger.info(f"Fetching post flairs for subreddit: r/{subreddit}")
144
+ response = self._get(url)
145
+ flairs = response.json()
146
+ if not flairs:
147
+ return f"No post flairs available for r/{subreddit}."
148
+ return flairs
149
+
150
+ def create_post(
151
+ self,
152
+ subreddit: str,
153
+ title: str,
154
+ kind: str = "self",
155
+ text: str = None,
156
+ url: str = None,
157
+ flair_id: str = None,
158
+ ):
159
+ """
160
+ Creates a new Reddit post in a specified subreddit with support for text posts, link posts, and image posts
161
+
162
+ Args:
163
+ subreddit: The name of the subreddit (e.g., 'python', 'worldnews') without the 'r/'
164
+ title: The title of the post
165
+ kind: The type of post; either 'self' (text post) or 'link' (link or image post)
166
+ text: The text content of the post; required if kind is 'self'
167
+ url: The URL of the link or image; required if kind is 'link'. Must end with valid image extension for image posts
168
+ flair_id: The ID of the flair to assign to the post
169
+
170
+ Returns:
171
+ The JSON response from the Reddit API, or an error message as a string if the API returns an error
172
+
173
+ Raises:
174
+ ValueError: Raised when kind is invalid or when required parameters (text for self posts, url for link posts) are missing
175
+
176
+ Tags:
177
+ create, post, social-media, reddit, api, important
178
+ """
179
+ if kind not in ["self", "link"]:
180
+ raise ValueError("Invalid post kind. Must be one of 'self' or 'link'.")
181
+ if kind == "self" and not text:
182
+ raise ValueError("Text content is required for text posts.")
183
+ if kind == "link" and not url:
184
+ raise ValueError("URL is required for link posts (including images).")
185
+ data = {
186
+ "sr": subreddit,
187
+ "title": title,
188
+ "kind": kind,
189
+ "text": text,
190
+ "url": url,
191
+ "flair_id": flair_id,
192
+ }
193
+ data = {k: v for k, v in data.items() if v is not None}
194
+ url_api = f"{self.base_api_url}/api/submit"
195
+ logger.info(f"Submitting a new post to r/{subreddit}")
196
+ response = self._post(url_api, data=data)
197
+ response_json = response.json()
198
+ if (
199
+ response_json
200
+ and "json" in response_json
201
+ and "errors" in response_json["json"]
202
+ ):
203
+ errors = response_json["json"]["errors"]
204
+ if errors:
205
+ error_message = ", ".join(
206
+ [f"{code}: {message}" for code, message in errors]
207
+ )
208
+ return f"Reddit API error: {error_message}"
209
+ return response_json
210
+
211
+ def get_comment_by_id(self, comment_id: str) -> dict:
212
+ """
213
+ Retrieves a specific Reddit comment using its unique identifier.
214
+
215
+ Args:
216
+ comment_id: The full unique identifier of the comment (prefixed with 't1_', e.g., 't1_abcdef')
217
+
218
+ Returns:
219
+ A dictionary containing the comment data including attributes like author, body, score, etc. If the comment is not found, returns a dictionary with an error message.
220
+
221
+ Raises:
222
+ HTTPError: When the Reddit API request fails due to network issues or invalid authentication
223
+ JSONDecodeError: When the API response cannot be parsed as valid JSON
224
+
225
+ Tags:
226
+ retrieve, get, reddit, comment, api, fetch, single-item, important
227
+ """
228
+ url = f"https://oauth.reddit.com/api/info.json?id={comment_id}"
229
+ response = self._get(url)
230
+ data = response.json()
231
+ comments = data.get("data", {}).get("children", [])
232
+ if comments:
233
+ return comments[0]["data"]
234
+ else:
235
+ return {"error": "Comment not found."}
236
+
237
+ def post_comment(self, parent_id: str, text: str) -> dict:
238
+ """
239
+ Posts a comment to a Reddit post or comment using the Reddit API
240
+
241
+ Args:
242
+ parent_id: The full ID of the parent comment or post (e.g., 't3_abc123' for a post, 't1_def456' for a comment)
243
+ text: The text content of the comment to be posted
244
+
245
+ Returns:
246
+ A dictionary containing the Reddit API response with details about the posted comment
247
+
248
+ Raises:
249
+ RequestException: If the API request fails or returns an error status code
250
+ JSONDecodeError: If the API response cannot be parsed as JSON
251
+
252
+ Tags:
253
+ post, comment, social, reddit, api, important
254
+ """
255
+ url = f"{self.base_api_url}/api/comment"
256
+ data = {
257
+ "parent": parent_id,
258
+ "text": text,
259
+ }
260
+ logger.info(f"Posting comment to {parent_id}")
261
+ response = self._post(url, data=data)
262
+ return response.json()
263
+
264
+ def edit_content(self, content_id: str, text: str) -> dict:
265
+ """
266
+ Edits the text content of an existing Reddit post or comment using the Reddit API
267
+
268
+ Args:
269
+ content_id: The full ID of the content to edit (e.g., 't3_abc123' for a post, 't1_def456' for a comment)
270
+ text: The new text content to replace the existing content
271
+
272
+ Returns:
273
+ A dictionary containing the API response with details about the edited content
274
+
275
+ Raises:
276
+ RequestException: When the API request fails or network connectivity issues occur
277
+ ValueError: When invalid content_id format or empty text is provided
278
+
279
+ Tags:
280
+ edit, update, content, reddit, api, important
281
+ """
282
+ url = f"{self.base_api_url}/api/editusertext"
283
+ data = {
284
+ "thing_id": content_id,
285
+ "text": text,
286
+ }
287
+ logger.info(f"Editing content {content_id}")
288
+ response = self._post(url, data=data)
289
+ return response.json()
290
+
291
+ def delete_content(self, content_id: str) -> dict:
292
+ """
293
+ Deletes a specified Reddit post or comment using the Reddit API.
294
+
295
+ Args:
296
+ content_id: The full ID of the content to delete (e.g., 't3_abc123' for a post, 't1_def456' for a comment)
297
+
298
+ Returns:
299
+ A dictionary containing a success message with the deleted content ID
300
+
301
+ Raises:
302
+ HTTPError: When the API request fails or returns an error status code
303
+ RequestException: When there are network connectivity issues or API communication problems
304
+
305
+ Tags:
306
+ delete, content-management, api, reddit, important
307
+ """
308
+ url = f"{self.base_api_url}/api/del"
309
+ data = {
310
+ "id": content_id,
311
+ }
312
+ logger.info(f"Deleting content {content_id}")
313
+ response = self._post(url, data=data)
314
+ response.raise_for_status()
315
+ return {"message": f"Content {content_id} deleted successfully."}
316
+
317
+ def api_v1_me(self) -> Any:
318
+ """
319
+ Get the current user's information.
320
+ Returns:
321
+ Any: API response data.
322
+
323
+ Tags:
324
+ users
325
+ """
326
+ url = f"{self.base_url}/api/v1/me"
327
+ query_params = {}
328
+ response = self._get(url, params=query_params)
329
+ response.raise_for_status()
330
+ return response.json()
331
+
332
+ def api_v1_me_karma(self) -> Any:
333
+ """
334
+ Get the current user's karma.
335
+
336
+ Returns:
337
+ Any: API response data.
338
+
339
+ Tags:
340
+ account
341
+ """
342
+ url = f"{self.base_url}/api/v1/me/karma"
343
+ query_params = {}
344
+ response = self._get(url, params=query_params)
345
+ response.raise_for_status()
346
+ return response.json()
347
+
348
+ def api_v1_me_prefs(self) -> Any:
349
+ """
350
+ Get the current user's preferences.
351
+
352
+ Returns:
353
+ Any: API response data.
354
+
355
+ Tags:
356
+ account
357
+ """
358
+ url = f"{self.base_url}/api/v1/me/prefs"
359
+ query_params = {}
360
+ response = self._get(url, params=query_params)
361
+ response.raise_for_status()
362
+ return response.json()
363
+
364
+ def api_v1_me_prefs1(
365
+ self,
366
+ accept_pms=None,
367
+ activity_relevant_ads=None,
368
+ allow_clicktracking=None,
369
+ bad_comment_autocollapse=None,
370
+ beta=None,
371
+ clickgadget=None,
372
+ collapse_read_messages=None,
373
+ compress=None,
374
+ country_code=None,
375
+ creddit_autorenew=None,
376
+ default_comment_sort=None,
377
+ domain_details=None,
378
+ email_chat_request=None,
379
+ email_comment_reply=None,
380
+ email_community_discovery=None,
381
+ email_digests=None,
382
+ email_messages=None,
383
+ email_new_user_welcome=None,
384
+ email_post_reply=None,
385
+ email_private_message=None,
386
+ email_unsubscribe_all=None,
387
+ email_upvote_comment=None,
388
+ email_upvote_post=None,
389
+ email_user_new_follower=None,
390
+ email_username_mention=None,
391
+ enable_default_themes=None,
392
+ enable_followers=None,
393
+ feed_recommendations_enabled=None,
394
+ g=None,
395
+ hide_ads=None,
396
+ hide_downs=None,
397
+ hide_from_robots=None,
398
+ hide_ups=None,
399
+ highlight_controversial=None,
400
+ highlight_new_comments=None,
401
+ ignore_suggested_sort=None,
402
+ in_redesign_beta=None,
403
+ label_nsfw=None,
404
+ lang=None,
405
+ legacy_search=None,
406
+ live_bar_recommendations_enabled=None,
407
+ live_orangereds=None,
408
+ mark_messages_read=None,
409
+ media=None,
410
+ media_preview=None,
411
+ min_comment_score=None,
412
+ min_link_score=None,
413
+ monitor_mentions=None,
414
+ newwindow=None,
415
+ nightmode=None,
416
+ no_profanity=None,
417
+ num_comments=None,
418
+ numsites=None,
419
+ organic=None,
420
+ other_theme=None,
421
+ over_18=None,
422
+ private_feeds=None,
423
+ profile_opt_out=None,
424
+ public_votes=None,
425
+ research=None,
426
+ search_include_over_18=None,
427
+ send_crosspost_messages=None,
428
+ send_welcome_messages=None,
429
+ show_flair=None,
430
+ show_gold_expiration=None,
431
+ show_link_flair=None,
432
+ show_location_based_recommendations=None,
433
+ show_presence=None,
434
+ show_promote=None,
435
+ show_stylesheets=None,
436
+ show_trending=None,
437
+ show_twitter=None,
438
+ sms_notifications_enabled=None,
439
+ store_visits=None,
440
+ survey_last_seen_time=None,
441
+ theme_selector=None,
442
+ third_party_data_personalized_ads=None,
443
+ third_party_personalized_ads=None,
444
+ third_party_site_data_personalized_ads=None,
445
+ third_party_site_data_personalized_content=None,
446
+ threaded_messages=None,
447
+ threaded_modmail=None,
448
+ top_karma_subreddits=None,
449
+ use_global_defaults=None,
450
+ video_autoplay=None,
451
+ whatsapp_comment_reply=None,
452
+ whatsapp_enabled=None,
453
+ ) -> Any:
454
+ """
455
+ Update the current user's preferences.
456
+
457
+ Args:
458
+ accept_pms (string): accept_pms Example: 'whitelisted'.
459
+ activity_relevant_ads (boolean): activity_relevant_ads Example: 'False'.
460
+ allow_clicktracking (boolean): allow_clicktracking Example: 'False'.
461
+ bad_comment_autocollapse (string): bad_comment_autocollapse Example: 'off'.
462
+ beta (boolean): beta Example: 'False'.
463
+ clickgadget (boolean): clickgadget Example: 'True'.
464
+ collapse_read_messages (boolean): collapse_read_messages Example: 'False'.
465
+ compress (boolean): compress Example: 'False'.
466
+ country_code (string): country_code Example: 'ZZ'.
467
+ creddit_autorenew (boolean): creddit_autorenew Example: 'False'.
468
+ default_comment_sort (string): default_comment_sort Example: 'new'.
469
+ domain_details (boolean): domain_details Example: 'False'.
470
+ email_chat_request (boolean): email_chat_request Example: 'False'.
471
+ email_comment_reply (boolean): email_comment_reply Example: 'False'.
472
+ email_community_discovery (boolean): email_community_discovery Example: 'False'.
473
+ email_digests (boolean): email_digests Example: 'False'.
474
+ email_messages (boolean): email_messages Example: 'False'.
475
+ email_new_user_welcome (boolean): email_new_user_welcome Example: 'False'.
476
+ email_post_reply (boolean): email_post_reply Example: 'False'.
477
+ email_private_message (boolean): email_private_message Example: 'False'.
478
+ email_unsubscribe_all (boolean): email_unsubscribe_all Example: 'True'.
479
+ email_upvote_comment (boolean): email_upvote_comment Example: 'False'.
480
+ email_upvote_post (boolean): email_upvote_post Example: 'False'.
481
+ email_user_new_follower (boolean): email_user_new_follower Example: 'False'.
482
+ email_username_mention (boolean): email_username_mention Example: 'False'.
483
+ enable_default_themes (boolean): enable_default_themes Example: 'False'.
484
+ enable_followers (boolean): enable_followers Example: 'False'.
485
+ feed_recommendations_enabled (boolean): feed_recommendations_enabled Example: 'False'.
486
+ g (string): g
487
+ hide_ads (boolean): hide_ads Example: 'True'.
488
+ hide_downs (boolean): hide_downs Example: 'False'.
489
+ hide_from_robots (boolean): hide_from_robots Example: 'True'.
490
+ hide_ups (boolean): hide_ups Example: 'False'.
491
+ highlight_controversial (boolean): highlight_controversial Example: 'False'.
492
+ highlight_new_comments (boolean): highlight_new_comments Example: 'True'.
493
+ ignore_suggested_sort (boolean): ignore_suggested_sort Example: 'True'.
494
+ in_redesign_beta (boolean): in_redesign_beta Example: 'True'.
495
+ label_nsfw (boolean): label_nsfw Example: 'True'.
496
+ lang (string): lang Example: 'en'.
497
+ legacy_search (boolean): legacy_search Example: 'False'.
498
+ live_bar_recommendations_enabled (boolean): live_bar_recommendations_enabled Example: 'False'.
499
+ live_orangereds (boolean): live_orangereds Example: 'False'.
500
+ mark_messages_read (boolean): mark_messages_read Example: 'True'.
501
+ media (string): media Example: 'subreddit'.
502
+ media_preview (string): media_preview Example: 'subreddit'.
503
+ min_comment_score (number): min_comment_score Example: '-100'.
504
+ min_link_score (number): min_link_score Example: '-100'.
505
+ monitor_mentions (boolean): monitor_mentions Example: 'True'.
506
+ newwindow (boolean): newwindow Example: 'False'.
507
+ nightmode (boolean): nightmode Example: 'True'.
508
+ no_profanity (boolean): no_profanity Example: 'False'.
509
+ num_comments (number): num_comments Example: '500'.
510
+ numsites (number): numsites Example: '100'.
511
+ organic (string): organic
512
+ other_theme (string): other_theme
513
+ over_18 (boolean): over_18 Example: 'True'.
514
+ private_feeds (boolean): private_feeds Example: 'True'.
515
+ profile_opt_out (boolean): profile_opt_out Example: 'False'.
516
+ public_votes (boolean): public_votes Example: 'False'.
517
+ research (boolean): research Example: 'False'.
518
+ search_include_over_18 (boolean): search_include_over_18 Example: 'True'.
519
+ send_crosspost_messages (boolean): send_crosspost_messages Example: 'True'.
520
+ send_welcome_messages (boolean): send_welcome_messages Example: 'True'.
521
+ show_flair (boolean): show_flair Example: 'True'.
522
+ show_gold_expiration (boolean): show_gold_expiration Example: 'True'.
523
+ show_link_flair (boolean): show_link_flair Example: 'True'.
524
+ show_location_based_recommendations (boolean): show_location_based_recommendations Example: 'False'.
525
+ show_presence (boolean): show_presence Example: 'False'.
526
+ show_promote (boolean): show_promote Example: 'False'.
527
+ show_stylesheets (boolean): show_stylesheets Example: 'True'.
528
+ show_trending (boolean): show_trending Example: 'False'.
529
+ show_twitter (boolean): show_twitter Example: 'False'.
530
+ sms_notifications_enabled (boolean): sms_notifications_enabled Example: 'False'.
531
+ store_visits (boolean): store_visits Example: 'False'.
532
+ survey_last_seen_time (string): survey_last_seen_time
533
+ theme_selector (string): theme_selector
534
+ third_party_data_personalized_ads (boolean): third_party_data_personalized_ads Example: 'False'.
535
+ third_party_personalized_ads (boolean): third_party_personalized_ads Example: 'False'.
536
+ third_party_site_data_personalized_ads (boolean): third_party_site_data_personalized_ads Example: 'False'.
537
+ third_party_site_data_personalized_content (boolean): third_party_site_data_personalized_content Example: 'False'.
538
+ threaded_messages (boolean): threaded_messages Example: 'True'.
539
+ threaded_modmail (boolean): threaded_modmail Example: 'True'.
540
+ top_karma_subreddits (boolean): top_karma_subreddits Example: 'False'.
541
+ use_global_defaults (boolean): use_global_defaults Example: 'False'.
542
+ video_autoplay (boolean): video_autoplay Example: 'False'.
543
+ whatsapp_comment_reply (boolean): whatsapp_comment_reply Example: 'False'.
544
+ whatsapp_enabled (boolean): whatsapp_enabled
545
+ Example:
546
+ ```json
547
+ {
548
+ "accept_pms": "whitelisted",
549
+ "activity_relevant_ads": false,
550
+ "allow_clicktracking": false,
551
+ "bad_comment_autocollapse": "off",
552
+ "beta": false,
553
+ "clickgadget": true,
554
+ "collapse_read_messages": false,
555
+ "compress": false,
556
+ "country_code": "ZZ",
557
+ "creddit_autorenew": false,
558
+ "default_comment_sort": "new",
559
+ "domain_details": false,
560
+ "email_chat_request": false,
561
+ "email_comment_reply": false,
562
+ "email_community_discovery": false,
563
+ "email_digests": false,
564
+ "email_messages": false,
565
+ "email_new_user_welcome": false,
566
+ "email_post_reply": false,
567
+ "email_private_message": false,
568
+ "email_unsubscribe_all": true,
569
+ "email_upvote_comment": false,
570
+ "email_upvote_post": false,
571
+ "email_user_new_follower": false,
572
+ "email_username_mention": false,
573
+ "enable_default_themes": false,
574
+ "enable_followers": false,
575
+ "feed_recommendations_enabled": false,
576
+ "g": "",
577
+ "hide_ads": true,
578
+ "hide_downs": false,
579
+ "hide_from_robots": true,
580
+ "hide_ups": false,
581
+ "highlight_controversial": false,
582
+ "highlight_new_comments": true,
583
+ "ignore_suggested_sort": true,
584
+ "in_redesign_beta": true,
585
+ "label_nsfw": true,
586
+ "lang": "en",
587
+ "legacy_search": false,
588
+ "live_bar_recommendations_enabled": false,
589
+ "live_orangereds": false,
590
+ "mark_messages_read": true,
591
+ "media": "subreddit",
592
+ "media_preview": "subreddit",
593
+ "min_comment_score": -100,
594
+ "min_link_score": -100,
595
+ "monitor_mentions": true,
596
+ "newwindow": false,
597
+ "nightmode": true,
598
+ "no_profanity": false,
599
+ "num_comments": 500,
600
+ "numsites": 100,
601
+ "organic": null,
602
+ "other_theme": "",
603
+ "over_18": true,
604
+ "private_feeds": true,
605
+ "profile_opt_out": false,
606
+ "public_votes": false,
607
+ "research": false,
608
+ "search_include_over_18": true,
609
+ "send_crosspost_messages": true,
610
+ "send_welcome_messages": true,
611
+ "show_flair": true,
612
+ "show_gold_expiration": true,
613
+ "show_link_flair": true,
614
+ "show_location_based_recommendations": false,
615
+ "show_presence": false,
616
+ "show_promote": false,
617
+ "show_stylesheets": true,
618
+ "show_trending": false,
619
+ "show_twitter": false,
620
+ "sms_notifications_enabled": false,
621
+ "store_visits": false,
622
+ "survey_last_seen_time": null,
623
+ "theme_selector": "",
624
+ "third_party_data_personalized_ads": false,
625
+ "third_party_personalized_ads": false,
626
+ "third_party_site_data_personalized_ads": false,
627
+ "third_party_site_data_personalized_content": false,
628
+ "threaded_messages": true,
629
+ "threaded_modmail": true,
630
+ "top_karma_subreddits": false,
631
+ "use_global_defaults": false,
632
+ "video_autoplay": false,
633
+ "whatsapp_comment_reply": false,
634
+ "whatsapp_enabled": false
635
+ }
636
+ ```
637
+
638
+ Returns:
639
+ Any: API response data.
640
+
641
+ Tags:
642
+ account
643
+ """
644
+ request_body = {
645
+ "accept_pms": accept_pms,
646
+ "activity_relevant_ads": activity_relevant_ads,
647
+ "allow_clicktracking": allow_clicktracking,
648
+ "bad_comment_autocollapse": bad_comment_autocollapse,
649
+ "beta": beta,
650
+ "clickgadget": clickgadget,
651
+ "collapse_read_messages": collapse_read_messages,
652
+ "compress": compress,
653
+ "country_code": country_code,
654
+ "creddit_autorenew": creddit_autorenew,
655
+ "default_comment_sort": default_comment_sort,
656
+ "domain_details": domain_details,
657
+ "email_chat_request": email_chat_request,
658
+ "email_comment_reply": email_comment_reply,
659
+ "email_community_discovery": email_community_discovery,
660
+ "email_digests": email_digests,
661
+ "email_messages": email_messages,
662
+ "email_new_user_welcome": email_new_user_welcome,
663
+ "email_post_reply": email_post_reply,
664
+ "email_private_message": email_private_message,
665
+ "email_unsubscribe_all": email_unsubscribe_all,
666
+ "email_upvote_comment": email_upvote_comment,
667
+ "email_upvote_post": email_upvote_post,
668
+ "email_user_new_follower": email_user_new_follower,
669
+ "email_username_mention": email_username_mention,
670
+ "enable_default_themes": enable_default_themes,
671
+ "enable_followers": enable_followers,
672
+ "feed_recommendations_enabled": feed_recommendations_enabled,
673
+ "g": g,
674
+ "hide_ads": hide_ads,
675
+ "hide_downs": hide_downs,
676
+ "hide_from_robots": hide_from_robots,
677
+ "hide_ups": hide_ups,
678
+ "highlight_controversial": highlight_controversial,
679
+ "highlight_new_comments": highlight_new_comments,
680
+ "ignore_suggested_sort": ignore_suggested_sort,
681
+ "in_redesign_beta": in_redesign_beta,
682
+ "label_nsfw": label_nsfw,
683
+ "lang": lang,
684
+ "legacy_search": legacy_search,
685
+ "live_bar_recommendations_enabled": live_bar_recommendations_enabled,
686
+ "live_orangereds": live_orangereds,
687
+ "mark_messages_read": mark_messages_read,
688
+ "media": media,
689
+ "media_preview": media_preview,
690
+ "min_comment_score": min_comment_score,
691
+ "min_link_score": min_link_score,
692
+ "monitor_mentions": monitor_mentions,
693
+ "newwindow": newwindow,
694
+ "nightmode": nightmode,
695
+ "no_profanity": no_profanity,
696
+ "num_comments": num_comments,
697
+ "numsites": numsites,
698
+ "organic": organic,
699
+ "other_theme": other_theme,
700
+ "over_18": over_18,
701
+ "private_feeds": private_feeds,
702
+ "profile_opt_out": profile_opt_out,
703
+ "public_votes": public_votes,
704
+ "research": research,
705
+ "search_include_over_18": search_include_over_18,
706
+ "send_crosspost_messages": send_crosspost_messages,
707
+ "send_welcome_messages": send_welcome_messages,
708
+ "show_flair": show_flair,
709
+ "show_gold_expiration": show_gold_expiration,
710
+ "show_link_flair": show_link_flair,
711
+ "show_location_based_recommendations": show_location_based_recommendations,
712
+ "show_presence": show_presence,
713
+ "show_promote": show_promote,
714
+ "show_stylesheets": show_stylesheets,
715
+ "show_trending": show_trending,
716
+ "show_twitter": show_twitter,
717
+ "sms_notifications_enabled": sms_notifications_enabled,
718
+ "store_visits": store_visits,
719
+ "survey_last_seen_time": survey_last_seen_time,
720
+ "theme_selector": theme_selector,
721
+ "third_party_data_personalized_ads": third_party_data_personalized_ads,
722
+ "third_party_personalized_ads": third_party_personalized_ads,
723
+ "third_party_site_data_personalized_ads": third_party_site_data_personalized_ads,
724
+ "third_party_site_data_personalized_content": third_party_site_data_personalized_content,
725
+ "threaded_messages": threaded_messages,
726
+ "threaded_modmail": threaded_modmail,
727
+ "top_karma_subreddits": top_karma_subreddits,
728
+ "use_global_defaults": use_global_defaults,
729
+ "video_autoplay": video_autoplay,
730
+ "whatsapp_comment_reply": whatsapp_comment_reply,
731
+ "whatsapp_enabled": whatsapp_enabled,
732
+ }
733
+ request_body = {k: v for k, v in request_body.items() if v is not None}
734
+ url = f"{self.base_url}/api/v1/me/prefs"
735
+ query_params = {}
736
+ response = self._patch(url, data=request_body, params=query_params)
737
+ response.raise_for_status()
738
+ return response.json()
739
+
740
+ def api_v1_me_trophies(self) -> Any:
741
+ """
742
+ Get the current user's trophies.
743
+
744
+ Returns:
745
+ Any: API response data.
746
+
747
+ Tags:
748
+ account
749
+ """
750
+ url = f"{self.base_url}/api/v1/me/trophies"
751
+ query_params = {}
752
+ response = self._get(url, params=query_params)
753
+ response.raise_for_status()
754
+ return response.json()
755
+
756
+ def prefs_friends(
757
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
758
+ ) -> Any:
759
+ """
760
+ Get the current user's friends.
761
+
762
+ Args:
763
+ after (string): fullname of a thing
764
+ before (string): fullname of a thing
765
+ count (string): a positive integer (default: 0)
766
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
767
+ show (string): (optional) the string "all"
768
+ sr_detail (string): (optional) expand subreddits
769
+
770
+ Returns:
771
+ Any: API response data.
772
+
773
+ Tags:
774
+ account
775
+ """
776
+ url = f"{self.base_url}/prefs/friends"
777
+ query_params = {
778
+ k: v
779
+ for k, v in [
780
+ ("after", after),
781
+ ("before", before),
782
+ ("count", count),
783
+ ("limit", limit),
784
+ ("show", show),
785
+ ("sr_detail", sr_detail),
786
+ ]
787
+ if v is not None
788
+ }
789
+ response = self._get(url, params=query_params)
790
+ response.raise_for_status()
791
+ return response.json()
792
+
793
+ def prefs_blocked(
794
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
795
+ ) -> Any:
796
+ """
797
+ Get the current user's blocked users.
798
+
799
+ Args:
800
+ after (string): fullname of a thing
801
+ before (string): fullname of a thing
802
+ count (string): a positive integer (default: 0)
803
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
804
+ show (string): (optional) the string "all"
805
+ sr_detail (string): (optional) expand subreddits
806
+
807
+ Returns:
808
+ Any: API response data.
809
+
810
+ Tags:
811
+ account
812
+ """
813
+ url = f"{self.base_url}/prefs/blocked"
814
+ query_params = {
815
+ k: v
816
+ for k, v in [
817
+ ("after", after),
818
+ ("before", before),
819
+ ("count", count),
820
+ ("limit", limit),
821
+ ("show", show),
822
+ ("sr_detail", sr_detail),
823
+ ]
824
+ if v is not None
825
+ }
826
+ response = self._get(url, params=query_params)
827
+ response.raise_for_status()
828
+ return response.json()
829
+
830
+ def prefs_messaging(
831
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
832
+ ) -> Any:
833
+ """
834
+ Get the current user's messaging preferences.
835
+
836
+ Args:
837
+ after (string): fullname of a thing
838
+ before (string): fullname of a thing
839
+ count (string): a positive integer (default: 0)
840
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
841
+ show (string): (optional) the string "all"
842
+ sr_detail (string): (optional) expand subreddits
843
+
844
+ Returns:
845
+ Any: API response data.
846
+
847
+ Tags:
848
+ account
849
+ """
850
+ url = f"{self.base_url}/prefs/messaging"
851
+ query_params = {
852
+ k: v
853
+ for k, v in [
854
+ ("after", after),
855
+ ("before", before),
856
+ ("count", count),
857
+ ("limit", limit),
858
+ ("show", show),
859
+ ("sr_detail", sr_detail),
860
+ ]
861
+ if v is not None
862
+ }
863
+ response = self._get(url, params=query_params)
864
+ response.raise_for_status()
865
+ return response.json()
866
+
867
+ def prefs_trusted(
868
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
869
+ ) -> Any:
870
+ """
871
+ Get the current user's trusted users.
872
+
873
+ Args:
874
+ after (string): fullname of a thing
875
+ before (string): fullname of a thing
876
+ count (string): a positive integer (default: 0)
877
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
878
+ show (string): (optional) the string "all"
879
+ sr_detail (string): (optional) expand subreddits
880
+
881
+ Returns:
882
+ Any: API response data.
883
+
884
+ Tags:
885
+ account
886
+ """
887
+ url = f"{self.base_url}/prefs/trusted"
888
+ query_params = {
889
+ k: v
890
+ for k, v in [
891
+ ("after", after),
892
+ ("before", before),
893
+ ("count", count),
894
+ ("limit", limit),
895
+ ("show", show),
896
+ ("sr_detail", sr_detail),
897
+ ]
898
+ if v is not None
899
+ }
900
+ response = self._get(url, params=query_params)
901
+ response.raise_for_status()
902
+ return response.json()
903
+
904
+ def api_needs_captcha(self) -> Any:
905
+ """
906
+ Check if the current user needs a captcha.
907
+
908
+ Returns:
909
+ Any: API response data.
910
+
911
+ Tags:
912
+ captcha
913
+ """
914
+ url = f"{self.base_url}/api/needs_captcha"
915
+ query_params = {}
916
+ response = self._get(url, params=query_params)
917
+ response.raise_for_status()
918
+ return response.json()
919
+
920
+ def api_v1_collections_collection(
921
+ self, collection_id=None, include_links=None
922
+ ) -> Any:
923
+ """
924
+ Get a collection by ID.
925
+
926
+ Args:
927
+ collection_id (string): the UUID of a collection
928
+ include_links (string): boolean value(true, false)
929
+
930
+ Returns:
931
+ Any: API response data.
932
+
933
+ Tags:
934
+ collections
935
+ """
936
+ url = f"{self.base_url}/api/v1/collections/collection"
937
+ query_params = {
938
+ k: v
939
+ for k, v in [
940
+ ("collection_id", collection_id),
941
+ ("include_links", include_links),
942
+ ]
943
+ if v is not None
944
+ }
945
+ response = self._get(url, params=query_params)
946
+ response.raise_for_status()
947
+ return response.json()
948
+
949
+ def api_v1_collections_subreddit_collections(self) -> Any:
950
+ """
951
+ Get the current user's subreddit collections.
952
+
953
+ Returns:
954
+ Any: API response data.
955
+
956
+ Tags:
957
+ collections
958
+ """
959
+ url = f"{self.base_url}/api/v1/collections/subreddit_collections"
960
+ query_params = {}
961
+ response = self._get(url, params=query_params)
962
+ response.raise_for_status()
963
+ return response.json()
964
+
965
+ def api_v1_subreddit_emoji_emoji_name(self, subreddit, emoji_name) -> Any:
966
+ """
967
+ Get an emoji by name.
968
+
969
+ Args:
970
+ subreddit (string): subreddit
971
+ emoji_name (string): emoji_name
972
+
973
+ Returns:
974
+ Any: API response data.
975
+
976
+ Tags:
977
+ emoji
978
+ """
979
+ if subreddit is None:
980
+ raise ValueError("Missing required parameter 'subreddit'")
981
+ if emoji_name is None:
982
+ raise ValueError("Missing required parameter 'emoji_name'")
983
+ url = f"{self.base_url}/api/v1/{subreddit}/emoji/{emoji_name}"
984
+ query_params = {}
985
+ response = self._delete(url, params=query_params)
986
+ response.raise_for_status()
987
+ return response.json()
988
+
989
+ def api_v1_subreddit_emojis_all(self, subreddit) -> Any:
990
+ """
991
+ Get all emojis for a subreddit.
992
+
993
+ Args:
994
+ subreddit (string): subreddit
995
+
996
+ Returns:
997
+ Any: API response data.
998
+
999
+ Tags:
1000
+ emoji
1001
+ """
1002
+ if subreddit is None:
1003
+ raise ValueError("Missing required parameter 'subreddit'")
1004
+ url = f"{self.base_url}/api/v1/{subreddit}/emojis/all"
1005
+ query_params = {}
1006
+ response = self._get(url, params=query_params)
1007
+ response.raise_for_status()
1008
+ return response.json()
1009
+
1010
+ def r_subreddit_api_flair(self, subreddit) -> Any:
1011
+ """
1012
+ Get the current user's flair for a subreddit.
1013
+
1014
+ Args:
1015
+ subreddit (string): subreddit
1016
+
1017
+ Returns:
1018
+ Any: API response data.
1019
+
1020
+ Tags:
1021
+ flair
1022
+ """
1023
+ if subreddit is None:
1024
+ raise ValueError("Missing required parameter 'subreddit'")
1025
+ url = f"{self.base_url}/r/{subreddit}/api/flair"
1026
+ query_params = {}
1027
+ response = self._get(url, params=query_params)
1028
+ response.raise_for_status()
1029
+ return response.json()
1030
+
1031
+ def r_subreddit_api_flairlist(
1032
+ self,
1033
+ subreddit,
1034
+ after=None,
1035
+ before=None,
1036
+ count=None,
1037
+ limit=None,
1038
+ name=None,
1039
+ show=None,
1040
+ sr_detail=None,
1041
+ ) -> Any:
1042
+ """
1043
+ Get the current user's flair list for a subreddit.
1044
+
1045
+ Args:
1046
+ subreddit (string): subreddit
1047
+ after (string): fullname of a thing
1048
+ before (string): fullname of a thing
1049
+ count (string): a positive integer (default: 0)
1050
+ limit (string): the maximum number of items desired (default: 25, maximum: 1000)
1051
+ name (string): a user by name
1052
+ show (string): (optional) the string "all" Example: 'all'.
1053
+ sr_detail (string): (optional) expand subreddits
1054
+
1055
+ Returns:
1056
+ Any: API response data.
1057
+
1058
+ Tags:
1059
+ flair
1060
+ """
1061
+ if subreddit is None:
1062
+ raise ValueError("Missing required parameter 'subreddit'")
1063
+ url = f"{self.base_url}/r/{subreddit}/api/flairlist"
1064
+ query_params = {
1065
+ k: v
1066
+ for k, v in [
1067
+ ("after", after),
1068
+ ("before", before),
1069
+ ("count", count),
1070
+ ("limit", limit),
1071
+ ("name", name),
1072
+ ("show", show),
1073
+ ("sr_detail", sr_detail),
1074
+ ]
1075
+ if v is not None
1076
+ }
1077
+ response = self._get(url, params=query_params)
1078
+ response.raise_for_status()
1079
+ return response.json()
1080
+
1081
+ def r_subreddit_api_link_flair(self, subreddit) -> Any:
1082
+ """
1083
+ Get the current user's link flair for a subreddit.
1084
+
1085
+ Args:
1086
+ subreddit (string): subreddit
1087
+
1088
+ Returns:
1089
+ Any: API response data.
1090
+
1091
+ Tags:
1092
+ flair
1093
+ """
1094
+ if subreddit is None:
1095
+ raise ValueError("Missing required parameter 'subreddit'")
1096
+ url = f"{self.base_url}/r/{subreddit}/api/link_flair"
1097
+ query_params = {}
1098
+ response = self._get(url, params=query_params)
1099
+ response.raise_for_status()
1100
+ return response.json()
1101
+
1102
+ def r_subreddit_api_link_flair_v2(self, subreddit) -> Any:
1103
+ """
1104
+ Get the current user's link flair for a subreddit.
1105
+
1106
+ Args:
1107
+ subreddit (string): subreddit
1108
+
1109
+ Returns:
1110
+ Any: API response data.
1111
+
1112
+ Tags:
1113
+ flair
1114
+ """
1115
+ if subreddit is None:
1116
+ raise ValueError("Missing required parameter 'subreddit'")
1117
+ url = f"{self.base_url}/r/{subreddit}/api/link_flair_v2"
1118
+ query_params = {}
1119
+ response = self._get(url, params=query_params)
1120
+ response.raise_for_status()
1121
+ return response.json()
1122
+
1123
+ def r_subreddit_api_user_flair(self, subreddit) -> Any:
1124
+ """
1125
+ Get the current user's user flair for a subreddit.
1126
+
1127
+ Args:
1128
+ subreddit (string): subreddit
1129
+
1130
+ Returns:
1131
+ Any: API response data.
1132
+
1133
+ Tags:
1134
+ flair
1135
+ """
1136
+ if subreddit is None:
1137
+ raise ValueError("Missing required parameter 'subreddit'")
1138
+ url = f"{self.base_url}/r/{subreddit}/api/user_flair"
1139
+ query_params = {}
1140
+ response = self._get(url, params=query_params)
1141
+ response.raise_for_status()
1142
+ return response.json()
1143
+
1144
+ def r_subreddit_api_user_flair_v2(self, subreddit) -> Any:
1145
+ """
1146
+ Get the current user's user flair for a subreddit.
1147
+
1148
+ Args:
1149
+ subreddit (string): subreddit
1150
+
1151
+ Returns:
1152
+ Any: API response data.
1153
+
1154
+ Tags:
1155
+ flair
1156
+ """
1157
+ if subreddit is None:
1158
+ raise ValueError("Missing required parameter 'subreddit'")
1159
+ url = f"{self.base_url}/r/{subreddit}/api/user_flair_v2"
1160
+ query_params = {}
1161
+ response = self._get(url, params=query_params)
1162
+ response.raise_for_status()
1163
+ return response.json()
1164
+
1165
+ def api_info(self, id=None, sr_name=None, url=None) -> Any:
1166
+ """
1167
+ Get information about a link or comment.
1168
+
1169
+ Args:
1170
+ id (string): A comma-separated list of thing fullnames
1171
+ sr_name (string): A comma-separated list of subreddit names
1172
+ url (string): a valid URL
1173
+
1174
+ Returns:
1175
+ Any: API response data.
1176
+
1177
+ Tags:
1178
+ links & comments
1179
+ """
1180
+ url = f"{self.base_url}/api/info"
1181
+ query_params = {
1182
+ k: v
1183
+ for k, v in [("id", id), ("sr_name", sr_name), ("url", url)]
1184
+ if v is not None
1185
+ }
1186
+ response = self._get(url, params=query_params)
1187
+ response.raise_for_status()
1188
+ return response.json()
1189
+
1190
+ def r_subreddit_api_info(self, subreddit, id=None, sr_name=None, url=None) -> Any:
1191
+ """
1192
+ Get information about a link or comment in a subreddit.
1193
+
1194
+ Args:
1195
+ subreddit (string): subreddit
1196
+ id (string): A comma-separated list of thing fullnames
1197
+ sr_name (string): A comma-separated list of subreddit names
1198
+ url (string): a valid URL
1199
+
1200
+ Returns:
1201
+ Any: API response data.
1202
+
1203
+ Tags:
1204
+ links & comments
1205
+ """
1206
+ if subreddit is None:
1207
+ raise ValueError("Missing required parameter 'subreddit'")
1208
+ url = f"{self.base_url}/{subreddit}/api/info"
1209
+ query_params = {
1210
+ k: v
1211
+ for k, v in [("id", id), ("sr_name", sr_name), ("url", url)]
1212
+ if v is not None
1213
+ }
1214
+ response = self._get(url, params=query_params)
1215
+ response.raise_for_status()
1216
+ return response.json()
1217
+
1218
+ def api_morechildren(
1219
+ self,
1220
+ api_type=None,
1221
+ children=None,
1222
+ depth=None,
1223
+ id=None,
1224
+ limit_children=None,
1225
+ link_id=None,
1226
+ sort=None,
1227
+ ) -> Any:
1228
+ """
1229
+ Get more children for a link or comment.
1230
+
1231
+ Args:
1232
+ api_type (string): the string "json" Example: 'json'.
1233
+ children (string): No description provided.
1234
+ depth (string): (optional) an integer
1235
+ id (string): (optional) id of the associated MoreChildren object
1236
+ limit_children (string): boolean value (true, false)
1237
+ link_id (string): fullname of a link
1238
+ sort (string): one of (confidence, top, new, controversial, old, random, qa, live)
1239
+
1240
+ Returns:
1241
+ Any: API response data.
1242
+
1243
+ Tags:
1244
+ links & comments
1245
+ """
1246
+ url = f"{self.base_url}/api/morechildren"
1247
+ query_params = {
1248
+ k: v
1249
+ for k, v in [
1250
+ ("api_type", api_type),
1251
+ ("children", children),
1252
+ ("depth", depth),
1253
+ ("id", id),
1254
+ ("limit_children", limit_children),
1255
+ ("link_id", link_id),
1256
+ ("sort", sort),
1257
+ ]
1258
+ if v is not None
1259
+ }
1260
+ response = self._get(url, params=query_params)
1261
+ response.raise_for_status()
1262
+ return response.json()
1263
+
1264
+ def api_saved_categories(self) -> Any:
1265
+ """
1266
+ Get the current user's saved categories.
1267
+
1268
+ Returns:
1269
+ Any: API response data.
1270
+
1271
+ Tags:
1272
+ links & comments
1273
+ """
1274
+ url = f"{self.base_url}/api/saved_categories"
1275
+ query_params = {}
1276
+ response = self._get(url, params=query_params)
1277
+ response.raise_for_status()
1278
+ return response.json()
1279
+
1280
+ def req(self) -> Any:
1281
+ """
1282
+ Get the current user's requests.
1283
+
1284
+ Returns:
1285
+ Any: API response data.
1286
+
1287
+ Tags:
1288
+ listings
1289
+ """
1290
+ url = f"{self.base_url}/req"
1291
+ query_params = {}
1292
+ response = self._get(url, params=query_params)
1293
+ response.raise_for_status()
1294
+ return response.json()
1295
+
1296
+ def best(
1297
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
1298
+ ) -> Any:
1299
+ """
1300
+ Get the best posts.
1301
+
1302
+ Args:
1303
+ after (string): fullname of a thing
1304
+ before (string): fullname of a thing
1305
+ count (string): a positive integer (default: 0)
1306
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1307
+ show (string): (optional) the string all
1308
+ sr_detail (string): (optional) expand subreddits
1309
+
1310
+ Returns:
1311
+ Any: API response data.
1312
+
1313
+ Tags:
1314
+ listings
1315
+ """
1316
+ url = f"{self.base_url}/best"
1317
+ query_params = {
1318
+ k: v
1319
+ for k, v in [
1320
+ ("after", after),
1321
+ ("before", before),
1322
+ ("count", count),
1323
+ ("limit", limit),
1324
+ ("show", show),
1325
+ ("sr_detail", sr_detail),
1326
+ ]
1327
+ if v is not None
1328
+ }
1329
+ response = self._get(url, params=query_params)
1330
+ response.raise_for_status()
1331
+ return response.json()
1332
+
1333
+ def by_id_names(self, names) -> Any:
1334
+ """
1335
+ Get posts by ID.
1336
+
1337
+ Args:
1338
+ names (string): names
1339
+
1340
+ Returns:
1341
+ Any: API response data.
1342
+
1343
+ Tags:
1344
+ listings
1345
+ """
1346
+ if names is None:
1347
+ raise ValueError("Missing required parameter 'names'")
1348
+ url = f"{self.base_url}/by_id/{names}"
1349
+ query_params = {}
1350
+ response = self._get(url, params=query_params)
1351
+ response.raise_for_status()
1352
+ return response.json()
1353
+
1354
+ def comments_article(
1355
+ self,
1356
+ article,
1357
+ comment=None,
1358
+ context=None,
1359
+ depth=None,
1360
+ limit=None,
1361
+ showedits=None,
1362
+ showmedia=None,
1363
+ showmore=None,
1364
+ showtitle=None,
1365
+ sort=None,
1366
+ sr_detail=None,
1367
+ theme=None,
1368
+ threaded=None,
1369
+ truncate=None,
1370
+ ) -> Any:
1371
+ """
1372
+ Get comments for a post.
1373
+
1374
+ Args:
1375
+ article (string): article
1376
+ comment (string): (optional) ID36 of a comment
1377
+ context (string): an integer between 0 and 8
1378
+ depth (string): (optional) an integer
1379
+ limit (string): (optional) an integer
1380
+ showedits (string): boolean value (true, false)
1381
+ showmedia (string): boolean value (true, false)
1382
+ showmore (string): boolean value (true, false)
1383
+ showtitle (string): boolean value (true, false)
1384
+ sort (string): one of (confidence, top, new, controversial, old, random, qa, live)
1385
+ sr_detail (string): (optional) expand subreddits
1386
+ theme (string): one of (default, dark)
1387
+ threaded (string): boolean value (true, false)
1388
+ truncate (string): an integer between 0 and 50
1389
+
1390
+ Returns:
1391
+ Any: API response data.
1392
+
1393
+ Tags:
1394
+ listings
1395
+ """
1396
+ if article is None:
1397
+ raise ValueError("Missing required parameter 'article'")
1398
+ url = f"{self.base_url}/comments/{article}"
1399
+ query_params = {
1400
+ k: v
1401
+ for k, v in [
1402
+ ("comment", comment),
1403
+ ("context", context),
1404
+ ("depth", depth),
1405
+ ("limit", limit),
1406
+ ("showedits", showedits),
1407
+ ("showmedia", showmedia),
1408
+ ("showmore", showmore),
1409
+ ("showtitle", showtitle),
1410
+ ("sort", sort),
1411
+ ("sr_detail", sr_detail),
1412
+ ("theme", theme),
1413
+ ("threaded", threaded),
1414
+ ("truncate", truncate),
1415
+ ]
1416
+ if v is not None
1417
+ }
1418
+ response = self._get(url, params=query_params)
1419
+ response.raise_for_status()
1420
+ return response.json()
1421
+
1422
+ def get_post_comments_details(self, post_id: str) -> Any:
1423
+ """
1424
+ Get post details and comments like title, author, score, etc.
1425
+
1426
+ Args:
1427
+ post_id (string): The Reddit post ID ( e.g. '1m734tx' for https://www.reddit.com/r/mcp/comments/1m734tx/comment/n4occ77/)
1428
+
1429
+ Returns:
1430
+ Any: API response data containing post details and comments.
1431
+
1432
+ Tags:
1433
+ listings, comments, posts, important
1434
+ """
1435
+
1436
+ url = f"{self.base_url}/comments/{post_id}.json"
1437
+ query_params = {}
1438
+ response = self._get(url, params=query_params)
1439
+ return self._handle_response(response)
1440
+
1441
+ def controversial(
1442
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
1443
+ ) -> Any:
1444
+ """
1445
+ Get the most controversial posts.
1446
+
1447
+ Args:
1448
+ after (string): fullname of a thing
1449
+ before (string): fullname of a thing
1450
+ count (string): a positive integer (default: 0)
1451
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1452
+ show (string): (optional) the string "all"
1453
+ sr_detail (string): (optional) expand subreddits
1454
+
1455
+ Returns:
1456
+ Any: API response data.
1457
+
1458
+ Tags:
1459
+ listings
1460
+ """
1461
+ url = f"{self.base_url}/controversial"
1462
+ query_params = {
1463
+ k: v
1464
+ for k, v in [
1465
+ ("after", after),
1466
+ ("before", before),
1467
+ ("count", count),
1468
+ ("limit", limit),
1469
+ ("show", show),
1470
+ ("sr_detail", sr_detail),
1471
+ ]
1472
+ if v is not None
1473
+ }
1474
+ response = self._get(url, params=query_params)
1475
+ response.raise_for_status()
1476
+ return response.json()
1477
+
1478
+ def duplicates_article(
1479
+ self,
1480
+ article,
1481
+ after=None,
1482
+ before=None,
1483
+ count=None,
1484
+ crossposts_only=None,
1485
+ limit=None,
1486
+ show=None,
1487
+ sort=None,
1488
+ sr=None,
1489
+ sr_detail=None,
1490
+ ) -> Any:
1491
+ """
1492
+ Get duplicate posts.
1493
+
1494
+ Args:
1495
+ article (string): article
1496
+ after (string): fullname of a thing
1497
+ before (string): fullname of a thing
1498
+ count (string): a positive integer (default: 0)
1499
+ crossposts_only (string): boolean value (true, false)
1500
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1501
+ show (string): (optional) the string "all"
1502
+ sort (string): one of (num_comments, new)
1503
+ sr (string): subreddit name
1504
+ sr_detail (string): (optional) expand subreddits
1505
+
1506
+ Returns:
1507
+ Any: API response data.
1508
+
1509
+ Tags:
1510
+ listings
1511
+ """
1512
+ if article is None:
1513
+ raise ValueError("Missing required parameter 'article'")
1514
+ url = f"{self.base_url}/duplicates/{article}"
1515
+ query_params = {
1516
+ k: v
1517
+ for k, v in [
1518
+ ("after", after),
1519
+ ("before", before),
1520
+ ("count", count),
1521
+ ("crossposts_only", crossposts_only),
1522
+ ("limit", limit),
1523
+ ("show", show),
1524
+ ("sort", sort),
1525
+ ("sr", sr),
1526
+ ("sr_detail", sr_detail),
1527
+ ]
1528
+ if v is not None
1529
+ }
1530
+ response = self._get(url, params=query_params)
1531
+ response.raise_for_status()
1532
+ return response.json()
1533
+
1534
+ def hot(
1535
+ self,
1536
+ g=None,
1537
+ after=None,
1538
+ before=None,
1539
+ count=None,
1540
+ limit=None,
1541
+ show=None,
1542
+ sr_detail=None,
1543
+ ) -> Any:
1544
+ """
1545
+ Get the hottest posts.
1546
+
1547
+ Args:
1548
+ g (string): one of (GLOBAL, US, AR, AU, BG, CA, CL, CO, HR, CZ, FI, FR, DE, GR, HU, IS, IN, IE, IT, JP, MY, MX, NZ, PH, PL, PT, PR, RO, RS, SG, ES, SE, TW, TH, TR, GB, US_WA, US_DE, US_DC, US_WI, US_WV, US_HI, US_FL, US_WY, US_NH, US_NJ, US_NM, US_TX, US_LA, US_NC, US_ND, US_NE, US_TN, US_NY, US_PA, US_CA, US_NV, US_VA, US_CO, US_AK, US_AL, US_AR, US_VT, US_IL, US_GA, US_IN, US_IA, US_OK, US_AZ, US_ID, US_CT, US_ME, US_MD, US_MA, US_OH, US_UT, US_MO, US_MN, US_MI, US_RI, US_KS, US_MT, US_MS, US_SC, US_KY, US_OR, US_SD)
1549
+ after (string): fullname of a thing
1550
+ before (string): fullname of a thing
1551
+ count (string): a positive integer (default: 0)
1552
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1553
+ show (string): (optional) the string "all"
1554
+ sr_detail (string): (optional) expand subreddits
1555
+
1556
+ Returns:
1557
+ Any: API response data.
1558
+
1559
+ Tags:
1560
+ listings
1561
+ """
1562
+ url = f"{self.base_url}/hot"
1563
+ query_params = {
1564
+ k: v
1565
+ for k, v in [
1566
+ ("g", g),
1567
+ ("after", after),
1568
+ ("before", before),
1569
+ ("count", count),
1570
+ ("limit", limit),
1571
+ ("show", show),
1572
+ ("sr_detail", sr_detail),
1573
+ ]
1574
+ if v is not None
1575
+ }
1576
+ response = self._get(url, params=query_params)
1577
+ response.raise_for_status()
1578
+ return response.json()
1579
+
1580
+ def new(
1581
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
1582
+ ) -> Any:
1583
+ """
1584
+ Get the newest posts.
1585
+
1586
+ Args:
1587
+ after (string): fullname of a thing
1588
+ before (string): fullname of a thing
1589
+ count (string): a positive integer (default: 0)
1590
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1591
+ show (string): (optional) the string "all"
1592
+ sr_detail (string): (optional) expand subreddits
1593
+
1594
+ Returns:
1595
+ Any: API response data.
1596
+
1597
+ Tags:
1598
+ listings
1599
+ """
1600
+ url = f"{self.base_url}/new"
1601
+ query_params = {
1602
+ k: v
1603
+ for k, v in [
1604
+ ("after", after),
1605
+ ("before", before),
1606
+ ("count", count),
1607
+ ("limit", limit),
1608
+ ("show", show),
1609
+ ("sr_detail", sr_detail),
1610
+ ]
1611
+ if v is not None
1612
+ }
1613
+ response = self._get(url, params=query_params)
1614
+ response.raise_for_status()
1615
+ return response.json()
1616
+
1617
+ def r_subreddit_comments_article(
1618
+ self,
1619
+ subreddit,
1620
+ article,
1621
+ comment=None,
1622
+ context=None,
1623
+ depth=None,
1624
+ limit=None,
1625
+ showedits=None,
1626
+ showmedia=None,
1627
+ showmore=None,
1628
+ showtitle=None,
1629
+ sort=None,
1630
+ sr_detail=None,
1631
+ theme=None,
1632
+ threaded=None,
1633
+ truncate=None,
1634
+ ) -> Any:
1635
+ """
1636
+ Get comments for a post in a subreddit.
1637
+
1638
+ Args:
1639
+ subreddit (string): subreddit
1640
+ article (string): article
1641
+ comment (string): (optional) ID36 of a comment
1642
+ context (string): an integer between 0 and 8
1643
+ depth (string): (optional) an integer
1644
+ limit (string): (optional) an integer
1645
+ showedits (string): boolean value (true, false)
1646
+ showmedia (string): boolean value (true, false)
1647
+ showmore (string): boolean value (true, false)
1648
+ showtitle (string): boolean value (true, false)
1649
+ sort (string): one of (confidence, top, new, controversial, old, random, qa, live)
1650
+ sr_detail (string): (optional) expand subreddits
1651
+ theme (string): one of (default, dark)
1652
+ threaded (string): boolean value (true, false)
1653
+ truncate (string): an integer between 0 and 50
1654
+
1655
+ Returns:
1656
+ Any: API response data.
1657
+
1658
+ Tags:
1659
+ listings
1660
+ """
1661
+ if subreddit is None:
1662
+ raise ValueError("Missing required parameter 'subreddit'")
1663
+ if article is None:
1664
+ raise ValueError("Missing required parameter 'article'")
1665
+ url = f"{self.base_url}/r/{subreddit}/comments/{article}"
1666
+ query_params = {
1667
+ k: v
1668
+ for k, v in [
1669
+ ("comment", comment),
1670
+ ("context", context),
1671
+ ("depth", depth),
1672
+ ("limit", limit),
1673
+ ("showedits", showedits),
1674
+ ("showmedia", showmedia),
1675
+ ("showmore", showmore),
1676
+ ("showtitle", showtitle),
1677
+ ("sort", sort),
1678
+ ("sr_detail", sr_detail),
1679
+ ("theme", theme),
1680
+ ("threaded", threaded),
1681
+ ("truncate", truncate),
1682
+ ]
1683
+ if v is not None
1684
+ }
1685
+ response = self._get(url, params=query_params)
1686
+ response.raise_for_status()
1687
+ return response.json()
1688
+
1689
+ def r_subreddit_controversial(
1690
+ self,
1691
+ subreddit,
1692
+ after=None,
1693
+ before=None,
1694
+ count=None,
1695
+ limit=None,
1696
+ show=None,
1697
+ sr_detail=None,
1698
+ ) -> Any:
1699
+ """
1700
+ Get the most controversial posts in a subreddit.
1701
+
1702
+ Args:
1703
+ subreddit (string): subreddit
1704
+ after (string): fullname of a thing
1705
+ before (string): fullname of a thing
1706
+ count (string): a positive integer (default: 0)
1707
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1708
+ show (string): (optional) the string "all"
1709
+ sr_detail (string): (optional) expand subreddits
1710
+
1711
+ Returns:
1712
+ Any: API response data.
1713
+
1714
+ Tags:
1715
+ listings
1716
+ """
1717
+ if subreddit is None:
1718
+ raise ValueError("Missing required parameter 'subreddit'")
1719
+ url = f"{self.base_url}/r/{subreddit}/controversial"
1720
+ query_params = {
1721
+ k: v
1722
+ for k, v in [
1723
+ ("after", after),
1724
+ ("before", before),
1725
+ ("count", count),
1726
+ ("limit", limit),
1727
+ ("show", show),
1728
+ ("sr_detail", sr_detail),
1729
+ ]
1730
+ if v is not None
1731
+ }
1732
+ response = self._get(url, params=query_params)
1733
+ response.raise_for_status()
1734
+ return response.json()
1735
+
1736
+ def r_subreddit_hot(
1737
+ self,
1738
+ subreddit,
1739
+ g=None,
1740
+ after=None,
1741
+ before=None,
1742
+ count=None,
1743
+ limit=None,
1744
+ show=None,
1745
+ sr_detail=None,
1746
+ ) -> Any:
1747
+ """
1748
+ Get the hottest posts in a subreddit.
1749
+
1750
+ Args:
1751
+ subreddit (string): subreddit
1752
+ g (string): one of (GLOBAL, US, AR, AU, BG, CA, CL, CO, HR, CZ, FI, FR, DE, GR, HU, IS, IN, IE, IT, JP, MY, MX, NZ, PH, PL, PT, PR, RO, RS, SG, ES, SE, TW, TH, TR, GB, US_WA, US_DE, US_DC, US_WI, US_WV, US_HI, US_FL, US_WY, US_NH, US_NJ, US_NM, US_TX, US_LA, US_NC, US_ND, US_NE, US_TN, US_NY, US_PA, US_CA, US_NV, US_VA, US_CO, US_AK, US_AL, US_AR, US_VT, US_IL, US_GA, US_IN, US_IA, US_OK, US_AZ, US_ID, US_CT, US_ME, US_MD, US_MA, US_OH, US_UT, US_MO, US_MN, US_MI, US_RI, US_KS, US_MT, US_MS, US_SC, US_KY, US_OR, US_SD)
1753
+ after (string): fullname of a thing
1754
+ before (string): fullname of a thing
1755
+ count (string): a positive integer (default: 0)
1756
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1757
+ show (string): (optional) the string "all"
1758
+ sr_detail (string): (optional) expand subreddits
1759
+
1760
+ Returns:
1761
+ Any: API response data.
1762
+
1763
+ Tags:
1764
+ listings
1765
+ """
1766
+ if subreddit is None:
1767
+ raise ValueError("Missing required parameter 'subreddit'")
1768
+ url = f"{self.base_url}/r/{subreddit}/hot"
1769
+ query_params = {
1770
+ k: v
1771
+ for k, v in [
1772
+ ("g", g),
1773
+ ("after", after),
1774
+ ("before", before),
1775
+ ("count", count),
1776
+ ("limit", limit),
1777
+ ("show", show),
1778
+ ("sr_detail", sr_detail),
1779
+ ]
1780
+ if v is not None
1781
+ }
1782
+ response = self._get(url, params=query_params)
1783
+ response.raise_for_status()
1784
+ return response.json()
1785
+
1786
+ def r_subreddit_new(
1787
+ self,
1788
+ subreddit,
1789
+ after=None,
1790
+ before=None,
1791
+ count=None,
1792
+ limit=None,
1793
+ show=None,
1794
+ sr_detail=None,
1795
+ ) -> Any:
1796
+ """
1797
+ Get the newest posts in a subreddit.
1798
+
1799
+ Args:
1800
+ subreddit (string): subreddit
1801
+ after (string): fullname of a thing
1802
+ before (string): fullname of a thing
1803
+ count (string): a positive integer (default: 0)
1804
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1805
+ show (string): (optional) the string "all"
1806
+ sr_detail (string): (optional) expand subreddits
1807
+
1808
+ Returns:
1809
+ Any: API response data.
1810
+
1811
+ Tags:
1812
+ listings
1813
+ """
1814
+ if subreddit is None:
1815
+ raise ValueError("Missing required parameter 'subreddit'")
1816
+ url = f"{self.base_url}/r/{subreddit}/new"
1817
+ query_params = {
1818
+ k: v
1819
+ for k, v in [
1820
+ ("after", after),
1821
+ ("before", before),
1822
+ ("count", count),
1823
+ ("limit", limit),
1824
+ ("show", show),
1825
+ ("sr_detail", sr_detail),
1826
+ ]
1827
+ if v is not None
1828
+ }
1829
+ response = self._get(url, params=query_params)
1830
+ response.raise_for_status()
1831
+ return response.json()
1832
+
1833
+ def r_subreddit_random(
1834
+ self,
1835
+ subreddit,
1836
+ after=None,
1837
+ before=None,
1838
+ count=None,
1839
+ limit=None,
1840
+ show=None,
1841
+ sr_detail=None,
1842
+ ) -> Any:
1843
+ """
1844
+ Get a random post in a subreddit.
1845
+
1846
+ Args:
1847
+ subreddit (string): subreddit
1848
+ after (string): fullname of a thing
1849
+ before (string): fullname of a thing
1850
+ count (string): a positive integer (default: 0)
1851
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1852
+ show (string): (optional) the string "all"
1853
+ sr_detail (string): (optional) expand subreddits
1854
+
1855
+ Returns:
1856
+ Any: API response data.
1857
+
1858
+ Tags:
1859
+ listings
1860
+ """
1861
+ if subreddit is None:
1862
+ raise ValueError("Missing required parameter 'subreddit'")
1863
+ url = f"{self.base_url}/r/{subreddit}/random"
1864
+ query_params = {
1865
+ k: v
1866
+ for k, v in [
1867
+ ("after", after),
1868
+ ("before", before),
1869
+ ("count", count),
1870
+ ("limit", limit),
1871
+ ("show", show),
1872
+ ("sr_detail", sr_detail),
1873
+ ]
1874
+ if v is not None
1875
+ }
1876
+ response = self._get(url, params=query_params)
1877
+ response.raise_for_status()
1878
+ return response.json()
1879
+
1880
+ def r_subreddit_rising(
1881
+ self,
1882
+ subreddit,
1883
+ after=None,
1884
+ before=None,
1885
+ count=None,
1886
+ limit=None,
1887
+ show=None,
1888
+ sr_detail=None,
1889
+ ) -> Any:
1890
+ """
1891
+ Get the rising posts in a subreddit.
1892
+
1893
+ Args:
1894
+ subreddit (string): subreddit
1895
+ after (string): fullname of a thing
1896
+ before (string): fullname of a thing
1897
+ count (string): a positive integer (default: 0)
1898
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1899
+ show (string): (optional) the string "all"
1900
+ sr_detail (string): (optional) expand subreddits
1901
+
1902
+ Returns:
1903
+ Any: API response data.
1904
+
1905
+ Tags:
1906
+ listings
1907
+ """
1908
+ if subreddit is None:
1909
+ raise ValueError("Missing required parameter 'subreddit'")
1910
+ url = f"{self.base_url}/r/{subreddit}/rising"
1911
+ query_params = {
1912
+ k: v
1913
+ for k, v in [
1914
+ ("after", after),
1915
+ ("before", before),
1916
+ ("count", count),
1917
+ ("limit", limit),
1918
+ ("show", show),
1919
+ ("sr_detail", sr_detail),
1920
+ ]
1921
+ if v is not None
1922
+ }
1923
+ response = self._get(url, params=query_params)
1924
+ response.raise_for_status()
1925
+ return response.json()
1926
+
1927
+ def r_subreddit_top(
1928
+ self,
1929
+ subreddit,
1930
+ after=None,
1931
+ before=None,
1932
+ count=None,
1933
+ limit=None,
1934
+ show=None,
1935
+ sr_detail=None,
1936
+ ) -> Any:
1937
+ """
1938
+ Get the top posts in a subreddit.
1939
+
1940
+ Args:
1941
+ subreddit (string): subreddit
1942
+ after (string): fullname of a thing
1943
+ before (string): fullname of a thing
1944
+ count (string): a positive integer (default: 0)
1945
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1946
+ show (string): (optional) the string "all"
1947
+ sr_detail (string): (optional) expand subreddits
1948
+
1949
+ Returns:
1950
+ Any: API response data.
1951
+
1952
+ Tags:
1953
+ listings
1954
+ """
1955
+ if subreddit is None:
1956
+ raise ValueError("Missing required parameter 'subreddit'")
1957
+ url = f"{self.base_url}/r/{subreddit}/top"
1958
+ query_params = {
1959
+ k: v
1960
+ for k, v in [
1961
+ ("after", after),
1962
+ ("before", before),
1963
+ ("count", count),
1964
+ ("limit", limit),
1965
+ ("show", show),
1966
+ ("sr_detail", sr_detail),
1967
+ ]
1968
+ if v is not None
1969
+ }
1970
+ response = self._get(url, params=query_params)
1971
+ response.raise_for_status()
1972
+ return response.json()
1973
+
1974
+ def random(
1975
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
1976
+ ) -> Any:
1977
+ """
1978
+ Get a random post.
1979
+
1980
+ Args:
1981
+ after (string): fullname of a thing
1982
+ before (string): fullname of a thing
1983
+ count (string): a positive integer (default: 0)
1984
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
1985
+ show (string): (optional) the string "all"
1986
+ sr_detail (string): (optional) expand subreddits
1987
+
1988
+ Returns:
1989
+ Any: API response data.
1990
+
1991
+ Tags:
1992
+ listings
1993
+ """
1994
+ url = f"{self.base_url}/random"
1995
+ query_params = {
1996
+ k: v
1997
+ for k, v in [
1998
+ ("after", after),
1999
+ ("before", before),
2000
+ ("count", count),
2001
+ ("limit", limit),
2002
+ ("show", show),
2003
+ ("sr_detail", sr_detail),
2004
+ ]
2005
+ if v is not None
2006
+ }
2007
+ response = self._get(url, params=query_params)
2008
+ response.raise_for_status()
2009
+ return response.json()
2010
+
2011
+ def rising(
2012
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
2013
+ ) -> Any:
2014
+ """
2015
+ Get the rising posts.
2016
+
2017
+ Args:
2018
+ after (string): fullname of a thing
2019
+ before (string): fullname of a thing
2020
+ count (string): a positive integer (default: 0)
2021
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2022
+ show (string): (optional) the string "all"
2023
+ sr_detail (string): (optional) expand subreddits
2024
+
2025
+ Returns:
2026
+ Any: API response data.
2027
+
2028
+ Tags:
2029
+ listings
2030
+ """
2031
+ url = f"{self.base_url}/rising"
2032
+ query_params = {
2033
+ k: v
2034
+ for k, v in [
2035
+ ("after", after),
2036
+ ("before", before),
2037
+ ("count", count),
2038
+ ("limit", limit),
2039
+ ("show", show),
2040
+ ("sr_detail", sr_detail),
2041
+ ]
2042
+ if v is not None
2043
+ }
2044
+ response = self._get(url, params=query_params)
2045
+ response.raise_for_status()
2046
+ return response.json()
2047
+
2048
+ def top(
2049
+ self, after=None, before=None, count=None, limit=None, show=None, sr_detail=None
2050
+ ) -> Any:
2051
+ """
2052
+ Get the top posts.
2053
+
2054
+ Args:
2055
+ after (string): fullname of a thing
2056
+ before (string): fullname of a thing
2057
+ count (string): a positive integer (default: 0)
2058
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2059
+ show (string): (optional) the string "all"
2060
+ sr_detail (string): (optional) expand subreddits
2061
+
2062
+ Returns:
2063
+ Any: API response data.
2064
+
2065
+ Tags:
2066
+ listings
2067
+ """
2068
+ url = f"{self.base_url}/top"
2069
+ query_params = {
2070
+ k: v
2071
+ for k, v in [
2072
+ ("after", after),
2073
+ ("before", before),
2074
+ ("count", count),
2075
+ ("limit", limit),
2076
+ ("show", show),
2077
+ ("sr_detail", sr_detail),
2078
+ ]
2079
+ if v is not None
2080
+ }
2081
+ response = self._get(url, params=query_params)
2082
+ response.raise_for_status()
2083
+ return response.json()
2084
+
2085
+ def api_saved_media_text(self, url=None) -> Any:
2086
+ """
2087
+ Get the text of a saved media.
2088
+
2089
+ Args:
2090
+ url (string): a valid URL
2091
+
2092
+ Returns:
2093
+ Any: API response data.
2094
+
2095
+ Tags:
2096
+ misc
2097
+ """
2098
+ url = f"{self.base_url}/api/saved_media_text"
2099
+ query_params = {k: v for k, v in [("url", url)] if v is not None}
2100
+ response = self._get(url, params=query_params)
2101
+ response.raise_for_status()
2102
+ return response.json()
2103
+
2104
+ def api_v1_scopes(self, scopes=None) -> Any:
2105
+ """
2106
+ Get the current user's scopes.
2107
+
2108
+ Args:
2109
+ scopes (string): (optional) An OAuth2 scope string
2110
+
2111
+ Returns:
2112
+ Any: API response data.
2113
+
2114
+ Tags:
2115
+ misc
2116
+ """
2117
+ url = f"{self.base_url}/api/v1/scopes"
2118
+ query_params = {k: v for k, v in [("scopes", scopes)] if v is not None}
2119
+ response = self._get(url, params=query_params)
2120
+ response.raise_for_status()
2121
+ return response.json()
2122
+
2123
+ def r_subreddit_api_saved_media_text(self, subreddit, url=None) -> Any:
2124
+ """
2125
+ Get the text of a saved media in a subreddit.
2126
+
2127
+ Args:
2128
+ subreddit (string): subreddit
2129
+ url (string): a valid URL
2130
+
2131
+ Returns:
2132
+ Any: API response data.
2133
+
2134
+ Tags:
2135
+ misc
2136
+ """
2137
+ if subreddit is None:
2138
+ raise ValueError("Missing required parameter 'subreddit'")
2139
+ url = f"{self.base_url}/r/{subreddit}/api/saved_media_text"
2140
+ query_params = {k: v for k, v in [("url", url)] if v is not None}
2141
+ response = self._get(url, params=query_params)
2142
+ response.raise_for_status()
2143
+ return response.json()
2144
+
2145
+ def r_subreddit_about_log(
2146
+ self,
2147
+ subreddit,
2148
+ after=None,
2149
+ before=None,
2150
+ count=None,
2151
+ limit=None,
2152
+ mod=None,
2153
+ show=None,
2154
+ sr_detail=None,
2155
+ type=None,
2156
+ ) -> Any:
2157
+ """
2158
+ Get the log of a subreddit.
2159
+
2160
+ Args:
2161
+ subreddit (string): subreddit
2162
+ after (string): a ModAction ID
2163
+ before (string): a ModAction ID
2164
+ count (string): a positive integer (default: 0)
2165
+ limit (string): the maximum number of items desired (default: 25, maximum: 500)
2166
+ mod (string): (optional) a moderator filter
2167
+ show (string): (optional) the string "all"
2168
+ sr_detail (string): (optional) expand subreddits
2169
+ type (string): one of (banuser, unbanuser, spamlink, removelink, approvelink, spamcomment, removecomment, approvecomment, addmoderator, showcomment, invitemoderator, uninvitemoderator, acceptmoderatorinvite, removemoderator, addcontributor, removecontributor, editsettings, editflair, distinguish, marknsfw, wikibanned, wikicontributor, wikiunbanned, wikipagelisted, removewikicontributor, wikirevise, wikipermlevel, ignorereports, unignorereports, setpermissions, setsuggestedsort, sticky, unsticky, setcontestmode, unsetcontestmode, lock, unlock, muteuser, unmuteuser, createrule, editrule, reorderrules, deleterule, spoiler, unspoiler, modmail_enrollment, community_styling, community_widgets, markoriginalcontent, collections, events, hidden_award, add_community_topics, remove_community_topics, create_scheduled_post, edit_scheduled_post, delete_scheduled_post, submit_scheduled_post, edit_post_requirements, invitesubscriber, submit_content_rating_survey, adjust_post_crowd_control_level, enable_post_crowd_control_filter, disable_post_crowd_control_filter, deleteoverriddenclassification, overrideclassification, reordermoderators, snoozereports, unsnoozereports, addnote, deletenote, addremovalreason, createremovalreason, updateremovalreason, deleteremovalreason, reorderremovalreason, dev_platform_app_changed, dev_platform_app_disabled, dev_platform_app_enabled, dev_platform_app_installed, dev_platform_app_uninstalled)
2170
+
2171
+ Returns:
2172
+ Any: API response data.
2173
+
2174
+ Tags:
2175
+ moderation
2176
+ """
2177
+ if subreddit is None:
2178
+ raise ValueError("Missing required parameter 'subreddit'")
2179
+ url = f"{self.base_url}/r/{subreddit}/about/log"
2180
+ query_params = {
2181
+ k: v
2182
+ for k, v in [
2183
+ ("after", after),
2184
+ ("before", before),
2185
+ ("count", count),
2186
+ ("limit", limit),
2187
+ ("mod", mod),
2188
+ ("show", show),
2189
+ ("sr_detail", sr_detail),
2190
+ ("type", type),
2191
+ ]
2192
+ if v is not None
2193
+ }
2194
+ response = self._get(url, params=query_params)
2195
+ response.raise_for_status()
2196
+ return response.json()
2197
+
2198
+ def r_subreddit_about_edited(
2199
+ self,
2200
+ subreddit,
2201
+ after=None,
2202
+ before=None,
2203
+ count=None,
2204
+ limit=None,
2205
+ location=None,
2206
+ only=None,
2207
+ show=None,
2208
+ sr_detail=None,
2209
+ ) -> Any:
2210
+ """
2211
+ Get the edited posts in a subreddit.
2212
+
2213
+ Args:
2214
+ subreddit (string): subreddit
2215
+ after (string): fullname of a thing
2216
+ before (string): fullname of a thing
2217
+ count (string): a positive integer (default: 0)
2218
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2219
+ location (string): No description provided.
2220
+ only (string): one of (links, comments, chat_comments)
2221
+ show (string): (optional) the string "all"
2222
+ sr_detail (string): (optional) expand subreddits
2223
+
2224
+ Returns:
2225
+ Any: API response data.
2226
+
2227
+ Tags:
2228
+ moderation
2229
+ """
2230
+ if subreddit is None:
2231
+ raise ValueError("Missing required parameter 'subreddit'")
2232
+ url = f"{self.base_url}/r/{subreddit}/about/edited"
2233
+ query_params = {
2234
+ k: v
2235
+ for k, v in [
2236
+ ("after", after),
2237
+ ("before", before),
2238
+ ("count", count),
2239
+ ("limit", limit),
2240
+ ("location", location),
2241
+ ("only", only),
2242
+ ("show", show),
2243
+ ("sr_detail", sr_detail),
2244
+ ]
2245
+ if v is not None
2246
+ }
2247
+ response = self._get(url, params=query_params)
2248
+ response.raise_for_status()
2249
+ return response.json()
2250
+
2251
+ def r_subreddit_about_modqueue(
2252
+ self,
2253
+ subreddit,
2254
+ after=None,
2255
+ before=None,
2256
+ count=None,
2257
+ limit=None,
2258
+ location=None,
2259
+ only=None,
2260
+ show=None,
2261
+ sr_detail=None,
2262
+ ) -> Any:
2263
+ """
2264
+ Get the modqueue in a subreddit.
2265
+
2266
+ Args:
2267
+ subreddit (string): subreddit
2268
+ after (string): fullname of a thing
2269
+ before (string): fullname of a thing
2270
+ count (string): a positive integer (default: 0)
2271
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2272
+ location (string): No description provided.
2273
+ only (string): one of (links, comments, chat_comments)
2274
+ show (string): (optional) the string "all"
2275
+ sr_detail (string): (optional) expand subreddits
2276
+
2277
+ Returns:
2278
+ Any: API response data.
2279
+
2280
+ Tags:
2281
+ moderation
2282
+ """
2283
+ if subreddit is None:
2284
+ raise ValueError("Missing required parameter 'subreddit'")
2285
+ url = f"{self.base_url}/r/{subreddit}/about/modqueue"
2286
+ query_params = {
2287
+ k: v
2288
+ for k, v in [
2289
+ ("after", after),
2290
+ ("before", before),
2291
+ ("count", count),
2292
+ ("limit", limit),
2293
+ ("location", location),
2294
+ ("only", only),
2295
+ ("show", show),
2296
+ ("sr_detail", sr_detail),
2297
+ ]
2298
+ if v is not None
2299
+ }
2300
+ response = self._get(url, params=query_params)
2301
+ response.raise_for_status()
2302
+ return response.json()
2303
+
2304
+ def r_subreddit_about_reports(
2305
+ self,
2306
+ subreddit,
2307
+ after=None,
2308
+ before=None,
2309
+ count=None,
2310
+ limit=None,
2311
+ location=None,
2312
+ only=None,
2313
+ show=None,
2314
+ sr_detail=None,
2315
+ ) -> Any:
2316
+ """
2317
+ Get the reports in a subreddit.
2318
+
2319
+ Args:
2320
+ subreddit (string): subreddit
2321
+ after (string): fullname of a thing
2322
+ before (string): fullname of a thing
2323
+ count (string): a positive integer (default: 0)
2324
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2325
+ location (string): No description provided.
2326
+ only (string): one of (links, comments, chat_comments)
2327
+ show (string): (optional) the string "all"
2328
+ sr_detail (string): (optional) expand subreddits
2329
+
2330
+ Returns:
2331
+ Any: API response data.
2332
+
2333
+ Tags:
2334
+ moderation
2335
+ """
2336
+ if subreddit is None:
2337
+ raise ValueError("Missing required parameter 'subreddit'")
2338
+ url = f"{self.base_url}/r/{subreddit}/about/reports"
2339
+ query_params = {
2340
+ k: v
2341
+ for k, v in [
2342
+ ("after", after),
2343
+ ("before", before),
2344
+ ("count", count),
2345
+ ("limit", limit),
2346
+ ("location", location),
2347
+ ("only", only),
2348
+ ("show", show),
2349
+ ("sr_detail", sr_detail),
2350
+ ]
2351
+ if v is not None
2352
+ }
2353
+ response = self._get(url, params=query_params)
2354
+ response.raise_for_status()
2355
+ return response.json()
2356
+
2357
+ def r_subreddit_about_spam(
2358
+ self,
2359
+ subreddit,
2360
+ after=None,
2361
+ before=None,
2362
+ count=None,
2363
+ limit=None,
2364
+ location=None,
2365
+ only=None,
2366
+ show=None,
2367
+ sr_detail=None,
2368
+ ) -> Any:
2369
+ """
2370
+ Get the spam posts in a subreddit.
2371
+
2372
+ Args:
2373
+ subreddit (string): subreddit
2374
+ after (string): fullname of a thing
2375
+ before (string): fullname of a thing
2376
+ count (string): a positive integer (default: 0)
2377
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2378
+ location (string): No description provided.
2379
+ only (string): one of (links, comments, chat_comments)
2380
+ show (string): (optional) the string "all"
2381
+ sr_detail (string): (optional) expand subreddits
2382
+
2383
+ Returns:
2384
+ Any: API response data.
2385
+
2386
+ Tags:
2387
+ moderation
2388
+ """
2389
+ if subreddit is None:
2390
+ raise ValueError("Missing required parameter 'subreddit'")
2391
+ url = f"{self.base_url}/r/{subreddit}/about/spam"
2392
+ query_params = {
2393
+ k: v
2394
+ for k, v in [
2395
+ ("after", after),
2396
+ ("before", before),
2397
+ ("count", count),
2398
+ ("limit", limit),
2399
+ ("location", location),
2400
+ ("only", only),
2401
+ ("show", show),
2402
+ ("sr_detail", sr_detail),
2403
+ ]
2404
+ if v is not None
2405
+ }
2406
+ response = self._get(url, params=query_params)
2407
+ response.raise_for_status()
2408
+ return response.json()
2409
+
2410
+ def r_subreddit_about_unmoderated(
2411
+ self,
2412
+ subreddit,
2413
+ after=None,
2414
+ before=None,
2415
+ count=None,
2416
+ limit=None,
2417
+ location=None,
2418
+ only=None,
2419
+ show=None,
2420
+ sr_detail=None,
2421
+ ) -> Any:
2422
+ """
2423
+ Get the unmoderated posts in a subreddit.
2424
+
2425
+ Args:
2426
+ subreddit (string): subreddit
2427
+ after (string): fullname of a thing
2428
+ before (string): fullname of a thing
2429
+ count (string): a positive integer (default: 0)
2430
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2431
+ location (string): No description provided.
2432
+ only (string): one of (links, comments, chat_comments)
2433
+ show (string): (optional) the string "all"
2434
+ sr_detail (string): (optional) expand subreddits
2435
+
2436
+ Returns:
2437
+ Any: API response data.
2438
+
2439
+ Tags:
2440
+ moderation
2441
+ """
2442
+ if subreddit is None:
2443
+ raise ValueError("Missing required parameter 'subreddit'")
2444
+ url = f"{self.base_url}/r/{subreddit}/about/unmoderated"
2445
+ query_params = {
2446
+ k: v
2447
+ for k, v in [
2448
+ ("after", after),
2449
+ ("before", before),
2450
+ ("count", count),
2451
+ ("limit", limit),
2452
+ ("location", location),
2453
+ ("only", only),
2454
+ ("show", show),
2455
+ ("sr_detail", sr_detail),
2456
+ ]
2457
+ if v is not None
2458
+ }
2459
+ response = self._get(url, params=query_params)
2460
+ response.raise_for_status()
2461
+ return response.json()
2462
+
2463
+ def r_subreddit_stylesheet(self, subreddit) -> Any:
2464
+ """
2465
+ Get the stylesheet of a subreddit.
2466
+
2467
+ Args:
2468
+ subreddit (string): subreddit
2469
+
2470
+ Returns:
2471
+ Any: API response data.
2472
+
2473
+ Tags:
2474
+ moderation
2475
+ """
2476
+ if subreddit is None:
2477
+ raise ValueError("Missing required parameter 'subreddit'")
2478
+ url = f"{self.base_url}/r/{subreddit}/stylesheet"
2479
+ query_params = {}
2480
+ response = self._get(url, params=query_params)
2481
+ response.raise_for_status()
2482
+ return response.json()
2483
+
2484
+ def stylesheet(self) -> Any:
2485
+ """
2486
+ Get the stylesheet of the current user.
2487
+
2488
+ Returns:
2489
+ Any: API response data.
2490
+
2491
+ Tags:
2492
+ moderation
2493
+ """
2494
+ url = f"{self.base_url}/stylesheet"
2495
+ query_params = {}
2496
+ response = self._get(url, params=query_params)
2497
+ response.raise_for_status()
2498
+ return response.json()
2499
+
2500
+ def api_mod_notes1(
2501
+ self, before=None, filter=None, limit=None, subreddit=None, user=None
2502
+ ) -> Any:
2503
+ """
2504
+ Get the mod notes of a subreddit.
2505
+
2506
+ Args:
2507
+ before (string): (optional) an encoded string used for pagination with mod notes
2508
+ filter (string): (optional) one of (NOTE, APPROVAL, REMOVAL, BAN, MUTE, INVITE, SPAM, CONTENT_CHANGE, MOD_ACTION, ALL), to be used for querying specific types of mod notes (default: all)
2509
+ limit (string): (optional) the number of mod notes to return in the response payload (default: 25, max: 100)
2510
+ subreddit (string): subreddit name
2511
+ user (string): account username
2512
+
2513
+ Returns:
2514
+ Any: API response data.
2515
+
2516
+ Tags:
2517
+ modnote
2518
+ """
2519
+ url = f"{self.base_url}/api/mod/notes"
2520
+ query_params = {
2521
+ k: v
2522
+ for k, v in [
2523
+ ("before", before),
2524
+ ("filter", filter),
2525
+ ("limit", limit),
2526
+ ("subreddit", subreddit),
2527
+ ("user", user),
2528
+ ]
2529
+ if v is not None
2530
+ }
2531
+ response = self._get(url, params=query_params)
2532
+ response.raise_for_status()
2533
+ return response.json()
2534
+
2535
+ def api_mod_notes(self, note_id=None, subreddit=None, user=None) -> Any:
2536
+ """
2537
+ Delete a mod note.
2538
+
2539
+ Args:
2540
+ note_id (string): a unique ID for the note to be deleted (should have a ModNote_ prefix)
2541
+ subreddit (string): subreddit name
2542
+ user (string): account username
2543
+
2544
+ Returns:
2545
+ Any: API response data.
2546
+
2547
+ Tags:
2548
+ modnote
2549
+ """
2550
+ url = f"{self.base_url}/api/mod/notes"
2551
+ query_params = {
2552
+ k: v
2553
+ for k, v in [("note_id", note_id), ("subreddit", subreddit), ("user", user)]
2554
+ if v is not None
2555
+ }
2556
+ response = self._delete(url, params=query_params)
2557
+ response.raise_for_status()
2558
+ return response.json()
2559
+
2560
+ def api_mod_notes_recent(
2561
+ self, before=None, filter=None, limit=None, subreddits=None, user=None
2562
+ ) -> Any:
2563
+ """
2564
+ Get the recent mod notes.
2565
+
2566
+ Args:
2567
+ before (string): (optional) an encoded string used for pagination with mod notes
2568
+ filter (string): (optional) one of (NOTE, APPROVAL, REMOVAL, BAN, MUTE, INVITE, SPAM, CONTENT_CHANGE, MOD_ACTION, ALL), to be used for querying specific types of mod notes (default: all)
2569
+ limit (string): (optional) the number of mod notes to return in the response payload (default: 25, max: 100)
2570
+ subreddits (string): a comma-separated list of subreddits by name
2571
+ user (string): a comma-separated list of usernames
2572
+
2573
+ Returns:
2574
+ Any: API response data.
2575
+
2576
+ Tags:
2577
+ modnote
2578
+ """
2579
+ url = f"{self.base_url}/api/mod/notes/recent"
2580
+ query_params = {
2581
+ k: v
2582
+ for k, v in [
2583
+ ("before", before),
2584
+ ("filter", filter),
2585
+ ("limit", limit),
2586
+ ("subreddits", subreddits),
2587
+ ("user", user),
2588
+ ]
2589
+ if v is not None
2590
+ }
2591
+ response = self._get(url, params=query_params)
2592
+ response.raise_for_status()
2593
+ return response.json()
2594
+
2595
+ def api_multi_mine(self, expand_srs=None) -> Any:
2596
+ """
2597
+ Get the current user's multi.
2598
+
2599
+ Args:
2600
+ expand_srs (string): boolean value (true, false)
2601
+
2602
+ Returns:
2603
+ Any: API response data.
2604
+
2605
+ Tags:
2606
+ multis
2607
+ """
2608
+ url = f"{self.base_url}/api/multi/mine"
2609
+ query_params = {k: v for k, v in [("expand_srs", expand_srs)] if v is not None}
2610
+ response = self._get(url, params=query_params)
2611
+ response.raise_for_status()
2612
+ return response.json()
2613
+
2614
+ def api_multi_user_username(self, username, expand_srs=None) -> Any:
2615
+ """
2616
+ Get a user's multi.
2617
+
2618
+ Args:
2619
+ username (string): username
2620
+ expand_srs (string): boolean value (true, false)
2621
+
2622
+ Returns:
2623
+ Any: API response data.
2624
+
2625
+ Tags:
2626
+ multis
2627
+ """
2628
+ if username is None:
2629
+ raise ValueError("Missing required parameter 'username'")
2630
+ url = f"{self.base_url}/api/multi/user/{username}"
2631
+ query_params = {k: v for k, v in [("expand_srs", expand_srs)] if v is not None}
2632
+ response = self._get(url, params=query_params)
2633
+ response.raise_for_status()
2634
+ return response.json()
2635
+
2636
+ def api_multi_multipath1(self, multipath, expand_srs=None) -> Any:
2637
+ """
2638
+ Get a multi.
2639
+
2640
+ Args:
2641
+ multipath (string): multipath
2642
+ expand_srs (string): boolean value (true, false)
2643
+
2644
+ Returns:
2645
+ Any: API response data.
2646
+
2647
+ Tags:
2648
+ multis
2649
+ """
2650
+ if multipath is None:
2651
+ raise ValueError("Missing required parameter 'multipath'")
2652
+ url = f"{self.base_url}/api/multi/{multipath}"
2653
+ query_params = {k: v for k, v in [("expand_srs", expand_srs)] if v is not None}
2654
+ response = self._get(url, params=query_params)
2655
+ response.raise_for_status()
2656
+ return response.json()
2657
+
2658
+ def api_multi_multipath(self, multipath, expand_srs=None) -> Any:
2659
+ """
2660
+ Delete a multi.
2661
+
2662
+ Args:
2663
+ multipath (string): multipath
2664
+ expand_srs (string): boolean value (true, false)
2665
+
2666
+ Returns:
2667
+ Any: API response data.
2668
+
2669
+ Tags:
2670
+ multis
2671
+ """
2672
+ if multipath is None:
2673
+ raise ValueError("Missing required parameter 'multipath'")
2674
+ url = f"{self.base_url}/api/multi/{multipath}"
2675
+ query_params = {k: v for k, v in [("expand_srs", expand_srs)] if v is not None}
2676
+ response = self._delete(url, params=query_params)
2677
+ response.raise_for_status()
2678
+ return response.json()
2679
+
2680
+ def api_multi_multipath_description(self, multipath) -> Any:
2681
+ """
2682
+ Get a multi's description.
2683
+
2684
+ Args:
2685
+ multipath (string): multipath
2686
+
2687
+ Returns:
2688
+ Any: API response data.
2689
+
2690
+ Tags:
2691
+ multis
2692
+ """
2693
+ if multipath is None:
2694
+ raise ValueError("Missing required parameter 'multipath'")
2695
+ url = f"{self.base_url}/api/multi/{multipath}/description"
2696
+ query_params = {}
2697
+ response = self._get(url, params=query_params)
2698
+ response.raise_for_status()
2699
+ return response.json()
2700
+
2701
+ def api_multi_multipath_rsubreddit1(self, multipath, subreddit) -> Any:
2702
+ """
2703
+ Get a multi's subreddit.
2704
+
2705
+ Args:
2706
+ multipath (string): multipath
2707
+ subreddit (string): subreddit
2708
+
2709
+ Returns:
2710
+ Any: API response data.
2711
+
2712
+ Tags:
2713
+ multis
2714
+ """
2715
+ if multipath is None:
2716
+ raise ValueError("Missing required parameter 'multipath'")
2717
+ if subreddit is None:
2718
+ raise ValueError("Missing required parameter 'subreddit'")
2719
+ url = f"{self.base_url}/api/multi/{multipath}/r/{subreddit}"
2720
+ query_params = {}
2721
+ response = self._get(url, params=query_params)
2722
+ response.raise_for_status()
2723
+ return response.json()
2724
+
2725
+ def api_multi_multipath_rsubreddit(self, multipath, subreddit) -> Any:
2726
+ """
2727
+ Delete a multi's subreddit.
2728
+
2729
+ Args:
2730
+ multipath (string): multipath
2731
+ subreddit (string): subreddit
2732
+
2733
+ Returns:
2734
+ Any: API response data.
2735
+
2736
+ Tags:
2737
+ multis
2738
+ """
2739
+ if multipath is None:
2740
+ raise ValueError("Missing required parameter 'multipath'")
2741
+ if subreddit is None:
2742
+ raise ValueError("Missing required parameter 'subreddit'")
2743
+ url = f"{self.base_url}/api/multi/{multipath}/r/{subreddit}"
2744
+ query_params = {}
2745
+ response = self._delete(url, params=query_params)
2746
+ response.raise_for_status()
2747
+ return response.json()
2748
+
2749
+ def api_mod_conversations(
2750
+ self, after=None, entity=None, limit=None, sort=None, state=None
2751
+ ) -> Any:
2752
+ """
2753
+ Get the mod conversations.
2754
+
2755
+ Args:
2756
+ after (string): A ModMail Converstion ID, in the form ModmailConversation_<id>
2757
+ entity (string): A comma-separated list of subreddit names
2758
+ limit (string): an integer between 1 and 100 (default: 25)
2759
+ sort (string): one of (recent, mod, user, unread)
2760
+ state (string): one of (all, appeals, notifications, inbox, filtered, inprogress, mod, archived, default, highlighted, join_requests, new)
2761
+
2762
+ Returns:
2763
+ Any: API response data.
2764
+
2765
+ Tags:
2766
+ new modmail
2767
+ """
2768
+ url = f"{self.base_url}/api/mod/conversations"
2769
+ query_params = {
2770
+ k: v
2771
+ for k, v in [
2772
+ ("after", after),
2773
+ ("entity", entity),
2774
+ ("limit", limit),
2775
+ ("sort", sort),
2776
+ ("state", state),
2777
+ ]
2778
+ if v is not None
2779
+ }
2780
+ response = self._get(url, params=query_params)
2781
+ response.raise_for_status()
2782
+ return response.json()
2783
+
2784
+ def api_mod_conversations_conversation_id(
2785
+ self, conversation_id, markRead=None
2786
+ ) -> Any:
2787
+ """
2788
+ Get a mod conversation.
2789
+
2790
+ Args:
2791
+ conversation_id (string): conversation_id
2792
+ markRead (string): boolean value (true, false)
2793
+
2794
+ Returns:
2795
+ Any: API response data.
2796
+
2797
+ Tags:
2798
+ new modmail
2799
+ """
2800
+ if conversation_id is None:
2801
+ raise ValueError("Missing required parameter 'conversation_id'")
2802
+ url = f"{self.base_url}/api/mod/conversations/{conversation_id}"
2803
+ query_params = {k: v for k, v in [("markRead", markRead)] if v is not None}
2804
+ response = self._get(url, params=query_params)
2805
+ response.raise_for_status()
2806
+ return response.json()
2807
+
2808
+ def api_mod_conversations_conversation_id_highlight(self, conversation_id) -> Any:
2809
+ """
2810
+ Highlight a mod conversation.
2811
+
2812
+ Args:
2813
+ conversation_id (string): conversation_id
2814
+
2815
+ Returns:
2816
+ Any: API response data.
2817
+
2818
+ Tags:
2819
+ new modmail
2820
+ """
2821
+ if conversation_id is None:
2822
+ raise ValueError("Missing required parameter 'conversation_id'")
2823
+ url = f"{self.base_url}/api/mod/conversations/{conversation_id}/highlight"
2824
+ query_params = {}
2825
+ response = self._delete(url, params=query_params)
2826
+ response.raise_for_status()
2827
+ return response.json()
2828
+
2829
+ def api_mod_conversations_conversation_id_unarchive(self, conversation_id) -> Any:
2830
+ """
2831
+ Unarchive a mod conversation.
2832
+
2833
+ Args:
2834
+ conversation_id (string): conversation_id
2835
+
2836
+ Returns:
2837
+ Any: API response data.
2838
+
2839
+ Tags:
2840
+ new modmail
2841
+ """
2842
+ if conversation_id is None:
2843
+ raise ValueError("Missing required parameter 'conversation_id'")
2844
+ url = f"{self.base_url}/api/mod/conversations/{conversation_id}/unarchive"
2845
+ query_params = {}
2846
+ response = self._post(url, data={}, params=query_params)
2847
+ response.raise_for_status()
2848
+ return response.json()
2849
+
2850
+ def api_mod_conversations_conversation_id_unban(self, conversation_id) -> Any:
2851
+ """
2852
+ Unban a mod conversation.
2853
+
2854
+ Args:
2855
+ conversation_id (string): conversation_id
2856
+
2857
+ Returns:
2858
+ Any: API response data.
2859
+
2860
+ Tags:
2861
+ new modmail
2862
+ """
2863
+ if conversation_id is None:
2864
+ raise ValueError("Missing required parameter 'conversation_id'")
2865
+ url = f"{self.base_url}/api/mod/conversations/{conversation_id}/unban"
2866
+ query_params = {}
2867
+ response = self._post(url, data={}, params=query_params)
2868
+ response.raise_for_status()
2869
+ return response.json()
2870
+
2871
+ def api_mod_conversations_conversation_id_unmute(self, conversation_id) -> Any:
2872
+ """
2873
+ Unmute a mod conversation.
2874
+
2875
+ Args:
2876
+ conversation_id (string): conversation_id
2877
+
2878
+ Returns:
2879
+ Any: API response data.
2880
+
2881
+ Tags:
2882
+ new modmail
2883
+ """
2884
+ if conversation_id is None:
2885
+ raise ValueError("Missing required parameter 'conversation_id'")
2886
+ url = f"{self.base_url}/api/mod/conversations/{conversation_id}/unmute"
2887
+ query_params = {}
2888
+ response = self._post(url, data={}, params=query_params)
2889
+ response.raise_for_status()
2890
+ return response.json()
2891
+
2892
+ def api_mod_conversations_conversation_id_user(self, conversation_id) -> Any:
2893
+ """
2894
+ Get a mod conversation's user.
2895
+
2896
+ Args:
2897
+ conversation_id (string): conversation_id
2898
+
2899
+ Returns:
2900
+ Any: API response data.
2901
+
2902
+ Tags:
2903
+ new modmail
2904
+ """
2905
+ if conversation_id is None:
2906
+ raise ValueError("Missing required parameter 'conversation_id'")
2907
+ url = f"{self.base_url}/api/mod/conversations/{conversation_id}/user"
2908
+ query_params = {}
2909
+ response = self._get(url, params=query_params)
2910
+ response.raise_for_status()
2911
+ return response.json()
2912
+
2913
+ def api_mod_conversations_subreddits(self) -> Any:
2914
+ """
2915
+ Get the mod conversations' subreddits.
2916
+
2917
+ Returns:
2918
+ Any: API response data.
2919
+
2920
+ Tags:
2921
+ new modmail
2922
+ """
2923
+ url = f"{self.base_url}/api/mod/conversations/subreddits"
2924
+ query_params = {}
2925
+ response = self._get(url, params=query_params)
2926
+ response.raise_for_status()
2927
+ return response.json()
2928
+
2929
+ def api_mod_conversations_unread_count(self) -> Any:
2930
+ """
2931
+ Get the unread count of the mod conversations.
2932
+
2933
+ Returns:
2934
+ Any: API response data.
2935
+
2936
+ Tags:
2937
+ new modmail
2938
+ """
2939
+ url = f"{self.base_url}/api/mod/conversations/unread/count"
2940
+ query_params = {}
2941
+ response = self._get(url, params=query_params)
2942
+ response.raise_for_status()
2943
+ return response.json()
2944
+
2945
+ def message_inbox(
2946
+ self,
2947
+ mark=None,
2948
+ mid=None,
2949
+ after=None,
2950
+ before=None,
2951
+ count=None,
2952
+ limit=None,
2953
+ show=None,
2954
+ sr_detail=None,
2955
+ ) -> Any:
2956
+ """
2957
+ Get the current user's inbox.
2958
+
2959
+ Args:
2960
+ mark (string): one of (true, false)
2961
+ mid (string): No description provided.
2962
+ after (string): fullname of a thing
2963
+ before (string): fullname of a thing
2964
+ count (string): a positive integer (default: 0)
2965
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
2966
+ show (string): (optional) the string "all"
2967
+ sr_detail (string): (optional) expand subreddits
2968
+
2969
+ Returns:
2970
+ Any: API response data.
2971
+
2972
+ Tags:
2973
+ private messages
2974
+ """
2975
+ url = f"{self.base_url}/message/inbox"
2976
+ query_params = {
2977
+ k: v
2978
+ for k, v in [
2979
+ ("mark", mark),
2980
+ ("mid", mid),
2981
+ ("after", after),
2982
+ ("before", before),
2983
+ ("count", count),
2984
+ ("limit", limit),
2985
+ ("show", show),
2986
+ ("sr_detail", sr_detail),
2987
+ ]
2988
+ if v is not None
2989
+ }
2990
+ response = self._get(url, params=query_params)
2991
+ response.raise_for_status()
2992
+ return response.json()
2993
+
2994
+ def message_sent(
2995
+ self,
2996
+ mark=None,
2997
+ mid=None,
2998
+ after=None,
2999
+ before=None,
3000
+ count=None,
3001
+ limit=None,
3002
+ show=None,
3003
+ sr_detail=None,
3004
+ ) -> Any:
3005
+ """
3006
+ Get the current user's sent messages.
3007
+
3008
+ Args:
3009
+ mark (string): one of (true, false)
3010
+ mid (string): No description provided.
3011
+ after (string): fullname of a thing
3012
+ before (string): fullname of a thing
3013
+ count (string): a positive integer (default: 0)
3014
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3015
+ show (string): (optional) the string "all"
3016
+ sr_detail (string): (optional) expand subreddits
3017
+
3018
+ Returns:
3019
+ Any: API response data.
3020
+
3021
+ Tags:
3022
+ private messages
3023
+ """
3024
+ url = f"{self.base_url}/message/sent"
3025
+ query_params = {
3026
+ k: v
3027
+ for k, v in [
3028
+ ("mark", mark),
3029
+ ("mid", mid),
3030
+ ("after", after),
3031
+ ("before", before),
3032
+ ("count", count),
3033
+ ("limit", limit),
3034
+ ("show", show),
3035
+ ("sr_detail", sr_detail),
3036
+ ]
3037
+ if v is not None
3038
+ }
3039
+ response = self._get(url, params=query_params)
3040
+ response.raise_for_status()
3041
+ return response.json()
3042
+
3043
+ def message_unread(
3044
+ self,
3045
+ mark=None,
3046
+ mid=None,
3047
+ after=None,
3048
+ before=None,
3049
+ count=None,
3050
+ limit=None,
3051
+ show=None,
3052
+ sr_detail=None,
3053
+ ) -> Any:
3054
+ """
3055
+ Get the current user's unread messages.
3056
+
3057
+ Args:
3058
+ mark (string): one of (true, false)
3059
+ mid (string): No description provided.
3060
+ after (string): fullname of a thing
3061
+ before (string): fullname of a thing
3062
+ count (string): a positive integer (default: 0)
3063
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3064
+ show (string): (optional) the string "all"
3065
+ sr_detail (string): (optional) expand subreddits
3066
+
3067
+ Returns:
3068
+ Any: API response data.
3069
+
3070
+ Tags:
3071
+ private messages
3072
+ """
3073
+ url = f"{self.base_url}/message/unread"
3074
+ query_params = {
3075
+ k: v
3076
+ for k, v in [
3077
+ ("mark", mark),
3078
+ ("mid", mid),
3079
+ ("after", after),
3080
+ ("before", before),
3081
+ ("count", count),
3082
+ ("limit", limit),
3083
+ ("show", show),
3084
+ ("sr_detail", sr_detail),
3085
+ ]
3086
+ if v is not None
3087
+ }
3088
+ response = self._get(url, params=query_params)
3089
+ response.raise_for_status()
3090
+ return response.json()
3091
+
3092
+ def search(
3093
+ self,
3094
+ after=None,
3095
+ before=None,
3096
+ category=None,
3097
+ count=None,
3098
+ include_facets=None,
3099
+ limit=None,
3100
+ q=None,
3101
+ restrict_sr=None,
3102
+ show=None,
3103
+ sort=None,
3104
+ sr_detail=None,
3105
+ t=None,
3106
+ type=None,
3107
+ ) -> Any:
3108
+ """
3109
+ Search for posts, comments, and users.
3110
+
3111
+ Args:
3112
+ after (string): fullname of a thing
3113
+ before (string): fullname of a thing
3114
+ category (string): a string no longer than 5 characters
3115
+ count (string): a positive integer (default: 0)
3116
+ include_facets (string): boolean value (true, false)
3117
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3118
+ q (string): a string no longer than 512 characters
3119
+ restrict_sr (string): boolean value (true, false)
3120
+ show (string): (optional) the string "all" Example: 'all'.
3121
+ sort (string): one of (relevance, hot, top, new, comments)
3122
+ sr_detail (string): (optional) expand subreddits
3123
+ t (string): one of (hour, day, week, month, year, all)
3124
+ type (string): (optional) A comma-separated list of result types (sr, link, user)
3125
+
3126
+ Returns:
3127
+ Any: API response data.
3128
+
3129
+ Tags:
3130
+ search
3131
+ """
3132
+ url = f"{self.base_url}/search"
3133
+ query_params = {
3134
+ k: v
3135
+ for k, v in [
3136
+ ("after", after),
3137
+ ("before", before),
3138
+ ("category", category),
3139
+ ("count", count),
3140
+ ("include_facets", include_facets),
3141
+ ("limit", limit),
3142
+ ("q", q),
3143
+ ("restrict_sr", restrict_sr),
3144
+ ("show", show),
3145
+ ("sort", sort),
3146
+ ("sr_detail", sr_detail),
3147
+ ("t", t),
3148
+ ("type", type),
3149
+ ]
3150
+ if v is not None
3151
+ }
3152
+ response = self._get(url, params=query_params)
3153
+ response.raise_for_status()
3154
+ return response.json()
3155
+
3156
+ def r_subreddit_search(
3157
+ self,
3158
+ subreddit,
3159
+ after=None,
3160
+ before=None,
3161
+ category=None,
3162
+ count=None,
3163
+ include_facets=None,
3164
+ limit=None,
3165
+ q=None,
3166
+ restrict_sr=None,
3167
+ show=None,
3168
+ sort=None,
3169
+ sr_detail=None,
3170
+ t=None,
3171
+ type=None,
3172
+ ) -> Any:
3173
+ """
3174
+ Search for posts, comments, and users in a subreddit.
3175
+
3176
+ Args:
3177
+ subreddit (string): subreddit
3178
+ after (string): fullname of a thing
3179
+ before (string): fullname of a thing
3180
+ category (string): a string no longer than 5 characters
3181
+ count (string): a positive integer (default: 0)
3182
+ include_facets (string): boolean value (true, false)
3183
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3184
+ q (string): a string no longer than 512 characters
3185
+ restrict_sr (string): boolean value (true, false)
3186
+ show (string): (optional) the string "all" Example: 'all'.
3187
+ sort (string): one of (relevance, hot, top, new, comments)
3188
+ sr_detail (string): (optional) expand subreddits
3189
+ t (string): one of (hour, day, week, month, year, all)
3190
+ type (string): (optional) A comma-separated list of result types (sr, link, user)
3191
+
3192
+ Returns:
3193
+ Any: API response data.
3194
+
3195
+ Tags:
3196
+ search
3197
+ """
3198
+ if subreddit is None:
3199
+ raise ValueError("Missing required parameter 'subreddit'")
3200
+ url = f"{self.base_url}/r/{subreddit}/search"
3201
+ query_params = {
3202
+ k: v
3203
+ for k, v in [
3204
+ ("after", after),
3205
+ ("before", before),
3206
+ ("category", category),
3207
+ ("count", count),
3208
+ ("include_facets", include_facets),
3209
+ ("limit", limit),
3210
+ ("q", q),
3211
+ ("restrict_sr", restrict_sr),
3212
+ ("show", show),
3213
+ ("sort", sort),
3214
+ ("sr_detail", sr_detail),
3215
+ ("t", t),
3216
+ ("type", type),
3217
+ ]
3218
+ if v is not None
3219
+ }
3220
+ response = self._get(url, params=query_params)
3221
+ response.raise_for_status()
3222
+ return response.json()
3223
+
3224
+ def api_search_reddit_names(
3225
+ self,
3226
+ exact=None,
3227
+ include_over_18=None,
3228
+ include_unadvertisable=None,
3229
+ query=None,
3230
+ search_query_id=None,
3231
+ typeahead_active=None,
3232
+ ) -> Any:
3233
+ """
3234
+ Search for subreddits.
3235
+
3236
+ Args:
3237
+ exact (string): boolean value (true, false) Example: 'false'.
3238
+ include_over_18 (string): boolean value (true, false) Example: 'true'.
3239
+ include_unadvertisable (string): boolean value (true, false) Example: 'true'.
3240
+ query (string): a string up to 50 characters long, consisting of printable characters
3241
+ search_query_id (string): a UUID
3242
+ typeahead_active (string): boolean value or None Example: 'None'.
3243
+
3244
+ Returns:
3245
+ Any: API response data.
3246
+
3247
+ Tags:
3248
+ subreddits
3249
+ """
3250
+ url = f"{self.base_url}/api/search_reddit_names"
3251
+ query_params = {
3252
+ k: v
3253
+ for k, v in [
3254
+ ("exact", exact),
3255
+ ("include_over_18", include_over_18),
3256
+ ("include_unadvertisable", include_unadvertisable),
3257
+ ("query", query),
3258
+ ("search_query_id", search_query_id),
3259
+ ("typeahead_active", typeahead_active),
3260
+ ]
3261
+ if v is not None
3262
+ }
3263
+ response = self._get(url, params=query_params)
3264
+ response.raise_for_status()
3265
+ return response.json()
3266
+
3267
+ def api_subreddit_autocomplete(
3268
+ self, include_over_18=None, include_profiles=None, query=None
3269
+ ) -> Any:
3270
+ """
3271
+ Search for subreddits.
3272
+
3273
+ Args:
3274
+ include_over_18 (string): boolean value (true, false)
3275
+ include_profiles (string): boolean value (true, false)
3276
+ query (string): a string up to 25 characters long, consisting of printable characters.
3277
+
3278
+ Returns:
3279
+ Any: API response data.
3280
+
3281
+ Tags:
3282
+ subreddits
3283
+ """
3284
+ url = f"{self.base_url}/api/subreddit_autocomplete"
3285
+ query_params = {
3286
+ k: v
3287
+ for k, v in [
3288
+ ("include_over_18", include_over_18),
3289
+ ("include_profiles", include_profiles),
3290
+ ("query", query),
3291
+ ]
3292
+ if v is not None
3293
+ }
3294
+ response = self._get(url, params=query_params)
3295
+ response.raise_for_status()
3296
+ return response.json()
3297
+
3298
+ def api_subreddit_autocomplete_v2(
3299
+ self,
3300
+ include_over_18=None,
3301
+ include_profiles=None,
3302
+ limit=None,
3303
+ query=None,
3304
+ search_query_id=None,
3305
+ typeahead_active=None,
3306
+ ) -> Any:
3307
+ """
3308
+ Search for subreddits.
3309
+
3310
+ Args:
3311
+ include_over_18 (string): boolean value (true, false)
3312
+ include_profiles (string): boolean value (true, false)
3313
+ limit (string): an integer between 1 and 10 (default: 5)
3314
+ query (string): a string up to 25 characters long, consisting of printable characters.
3315
+ search_query_id (string): a UUID
3316
+ typeahead_active (string): boolean value (true, false) or None
3317
+
3318
+ Returns:
3319
+ Any: API response data.
3320
+
3321
+ Tags:
3322
+ subreddits
3323
+ """
3324
+ url = f"{self.base_url}/api/subreddit_autocomplete_v2"
3325
+ query_params = {
3326
+ k: v
3327
+ for k, v in [
3328
+ ("include_over_18", include_over_18),
3329
+ ("include_profiles", include_profiles),
3330
+ ("limit", limit),
3331
+ ("query", query),
3332
+ ("search_query_id", search_query_id),
3333
+ ("typeahead_active", typeahead_active),
3334
+ ]
3335
+ if v is not None
3336
+ }
3337
+ response = self._get(url, params=query_params)
3338
+ response.raise_for_status()
3339
+ return response.json()
3340
+
3341
+ def api_v1_subreddit_post_requirements(self, subreddit) -> Any:
3342
+ """
3343
+ Get the post requirements for a subreddit.
3344
+
3345
+ Args:
3346
+ subreddit (string): subreddit
3347
+
3348
+ Returns:
3349
+ Any: API response data.
3350
+
3351
+ Tags:
3352
+ subreddits
3353
+ """
3354
+ if subreddit is None:
3355
+ raise ValueError("Missing required parameter 'subreddit'")
3356
+ url = f"{self.base_url}/api/v1/{subreddit}/post_requirements"
3357
+ query_params = {}
3358
+ response = self._get(url, params=query_params)
3359
+ response.raise_for_status()
3360
+ return response.json()
3361
+
3362
+ def r_subreddit_about_banned(
3363
+ self,
3364
+ subreddit,
3365
+ after=None,
3366
+ before=None,
3367
+ count=None,
3368
+ limit=None,
3369
+ show=None,
3370
+ sr_detail=None,
3371
+ user=None,
3372
+ ) -> Any:
3373
+ """
3374
+ Get the banned users in a subreddit.
3375
+
3376
+ Args:
3377
+ subreddit (string): subreddit
3378
+ after (string): fullname of a thing
3379
+ before (string): fullname of a thing
3380
+ count (string): a positive integer (default: 0)
3381
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3382
+ show (string): (optional) the string "all" Example: 'all'.
3383
+ sr_detail (string): (optional) expand subreddits
3384
+ user (string): A valid, existing reddit username
3385
+
3386
+ Returns:
3387
+ Any: API response data.
3388
+
3389
+ Tags:
3390
+ subreddits
3391
+ """
3392
+ if subreddit is None:
3393
+ raise ValueError("Missing required parameter 'subreddit'")
3394
+ url = f"{self.base_url}/r/{subreddit}/about/banned"
3395
+ query_params = {
3396
+ k: v
3397
+ for k, v in [
3398
+ ("after", after),
3399
+ ("before", before),
3400
+ ("count", count),
3401
+ ("limit", limit),
3402
+ ("show", show),
3403
+ ("sr_detail", sr_detail),
3404
+ ("user", user),
3405
+ ]
3406
+ if v is not None
3407
+ }
3408
+ response = self._get(url, params=query_params)
3409
+ response.raise_for_status()
3410
+ return response.json()
3411
+
3412
+ def r_subreddit_about(self, subreddit) -> Any:
3413
+ """
3414
+ Get the about information for a subreddit.
3415
+
3416
+ Args:
3417
+ subreddit (string): subreddit
3418
+
3419
+ Returns:
3420
+ Any: API response data.
3421
+
3422
+ Tags:
3423
+ subreddits
3424
+ """
3425
+ if subreddit is None:
3426
+ raise ValueError("Missing required parameter 'subreddit'")
3427
+ url = f"{self.base_url}/r/{subreddit}/about"
3428
+ query_params = {}
3429
+ response = self._get(url, params=query_params)
3430
+ response.raise_for_status()
3431
+ return response.json()
3432
+
3433
+ def r_subreddit_about_edit(self, subreddit) -> Any:
3434
+ """
3435
+ Get the edit information for a subreddit.
3436
+
3437
+ Args:
3438
+ subreddit (string): subreddit
3439
+
3440
+ Returns:
3441
+ Any: API response data.
3442
+
3443
+ Tags:
3444
+ subreddits
3445
+ """
3446
+ if subreddit is None:
3447
+ raise ValueError("Missing required parameter 'subreddit'")
3448
+ url = f"{self.base_url}/r/{subreddit}/about/edit"
3449
+ query_params = {}
3450
+ response = self._get(url, params=query_params)
3451
+ response.raise_for_status()
3452
+ return response.json()
3453
+
3454
+ def r_subreddit_about_contributors(
3455
+ self,
3456
+ subreddit,
3457
+ after=None,
3458
+ before=None,
3459
+ count=None,
3460
+ limit=None,
3461
+ show=None,
3462
+ sr_detail=None,
3463
+ user=None,
3464
+ ) -> Any:
3465
+ """
3466
+ Get the contributors for a subreddit.
3467
+
3468
+ Args:
3469
+ subreddit (string): subreddit
3470
+ after (string): fullname of a thing
3471
+ before (string): fullname of a thing
3472
+ count (string): a positive integer (default: 0)
3473
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3474
+ show (string): (optional) the string "all" Example: 'all'.
3475
+ sr_detail (string): (optional) expand subreddits
3476
+ user (string): A valid, existing reddit username
3477
+
3478
+ Returns:
3479
+ Any: API response data.
3480
+
3481
+ Tags:
3482
+ subreddits
3483
+ """
3484
+ if subreddit is None:
3485
+ raise ValueError("Missing required parameter 'subreddit'")
3486
+ url = f"{self.base_url}/r/{subreddit}/about/contributors"
3487
+ query_params = {
3488
+ k: v
3489
+ for k, v in [
3490
+ ("after", after),
3491
+ ("before", before),
3492
+ ("count", count),
3493
+ ("limit", limit),
3494
+ ("show", show),
3495
+ ("sr_detail", sr_detail),
3496
+ ("user", user),
3497
+ ]
3498
+ if v is not None
3499
+ }
3500
+ response = self._get(url, params=query_params)
3501
+ response.raise_for_status()
3502
+ return response.json()
3503
+
3504
+ def r_subreddit_about_moderators(
3505
+ self,
3506
+ subreddit,
3507
+ after=None,
3508
+ before=None,
3509
+ count=None,
3510
+ limit=None,
3511
+ show=None,
3512
+ sr_detail=None,
3513
+ user=None,
3514
+ ) -> Any:
3515
+ """
3516
+ Get the moderators for a subreddit.
3517
+
3518
+ Args:
3519
+ subreddit (string): subreddit
3520
+ after (string): fullname of a thing
3521
+ before (string): fullname of a thing
3522
+ count (string): a positive integer (default: 0)
3523
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3524
+ show (string): (optional) the string "all" Example: 'all'.
3525
+ sr_detail (string): (optional) expand subreddits
3526
+ user (string): A valid, existing reddit username
3527
+
3528
+ Returns:
3529
+ Any: API response data.
3530
+
3531
+ Tags:
3532
+ subreddits
3533
+ """
3534
+ if subreddit is None:
3535
+ raise ValueError("Missing required parameter 'subreddit'")
3536
+ url = f"{self.base_url}/r/{subreddit}/about/moderators"
3537
+ query_params = {
3538
+ k: v
3539
+ for k, v in [
3540
+ ("after", after),
3541
+ ("before", before),
3542
+ ("count", count),
3543
+ ("limit", limit),
3544
+ ("show", show),
3545
+ ("sr_detail", sr_detail),
3546
+ ("user", user),
3547
+ ]
3548
+ if v is not None
3549
+ }
3550
+ response = self._get(url, params=query_params)
3551
+ response.raise_for_status()
3552
+ return response.json()
3553
+
3554
+ def r_subreddit_about_muted(
3555
+ self,
3556
+ subreddit,
3557
+ after=None,
3558
+ before=None,
3559
+ count=None,
3560
+ limit=None,
3561
+ show=None,
3562
+ sr_detail=None,
3563
+ user=None,
3564
+ ) -> Any:
3565
+ """
3566
+ Get the muted users for a subreddit.
3567
+
3568
+ Args:
3569
+ subreddit (string): subreddit
3570
+ after (string): fullname of a thing
3571
+ before (string): fullname of a thing
3572
+ count (string): a positive integer (default: 0)
3573
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3574
+ show (string): (optional) the string "all" Example: 'all'.
3575
+ sr_detail (string): (optional) expand subreddits
3576
+ user (string): A valid, existing reddit username
3577
+
3578
+ Returns:
3579
+ Any: API response data.
3580
+
3581
+ Tags:
3582
+ subreddits
3583
+ """
3584
+ if subreddit is None:
3585
+ raise ValueError("Missing required parameter 'subreddit'")
3586
+ url = f"{self.base_url}/r/{subreddit}/about/muted"
3587
+ query_params = {
3588
+ k: v
3589
+ for k, v in [
3590
+ ("after", after),
3591
+ ("before", before),
3592
+ ("count", count),
3593
+ ("limit", limit),
3594
+ ("show", show),
3595
+ ("sr_detail", sr_detail),
3596
+ ("user", user),
3597
+ ]
3598
+ if v is not None
3599
+ }
3600
+ response = self._get(url, params=query_params)
3601
+ response.raise_for_status()
3602
+ return response.json()
3603
+
3604
+ def r_subreddit_about_rules(self, subreddit) -> Any:
3605
+ """
3606
+ Get the rules for a subreddit.
3607
+
3608
+ Args:
3609
+ subreddit (string): subreddit
3610
+
3611
+ Returns:
3612
+ Any: API response data.
3613
+
3614
+ Tags:
3615
+ subreddits
3616
+ """
3617
+ if subreddit is None:
3618
+ raise ValueError("Missing required parameter 'subreddit'")
3619
+ url = f"{self.base_url}/r/{subreddit}/about/rules"
3620
+ query_params = {}
3621
+ response = self._get(url, params=query_params)
3622
+ response.raise_for_status()
3623
+ return response.json()
3624
+
3625
+ def r_subreddit_about_sticky(self, subreddit, num=None) -> Any:
3626
+ """
3627
+ Get the sticky posts for a subreddit.
3628
+
3629
+ Args:
3630
+ subreddit (string): subreddit
3631
+ num (string): an integer between 1 and 2 (default: 1)
3632
+
3633
+ Returns:
3634
+ Any: API response data.
3635
+
3636
+ Tags:
3637
+ subreddits
3638
+ """
3639
+ if subreddit is None:
3640
+ raise ValueError("Missing required parameter 'subreddit'")
3641
+ url = f"{self.base_url}/r/{subreddit}/sticky"
3642
+ query_params = {k: v for k, v in [("num", num)] if v is not None}
3643
+ response = self._get(url, params=query_params)
3644
+ response.raise_for_status()
3645
+ return response.json()
3646
+
3647
+ def r_subreddit_about_traffic(self, subreddit) -> Any:
3648
+ """
3649
+ Get the traffic for a subreddit.
3650
+
3651
+ Args:
3652
+ subreddit (string): subreddit
3653
+
3654
+ Returns:
3655
+ Any: API response data.
3656
+
3657
+ Tags:
3658
+ subreddits
3659
+ """
3660
+ if subreddit is None:
3661
+ raise ValueError("Missing required parameter 'subreddit'")
3662
+ url = f"{self.base_url}/r/{subreddit}/about/traffic"
3663
+ query_params = {}
3664
+ response = self._get(url, params=query_params)
3665
+ response.raise_for_status()
3666
+ return response.json()
3667
+
3668
+ def r_subreddit_about_wikibanned(
3669
+ self,
3670
+ subreddit,
3671
+ after=None,
3672
+ before=None,
3673
+ count=None,
3674
+ limit=None,
3675
+ show=None,
3676
+ sr_detail=None,
3677
+ user=None,
3678
+ ) -> Any:
3679
+ """
3680
+ Get the wikibanned users for a subreddit.
3681
+
3682
+ Args:
3683
+ subreddit (string): subreddit
3684
+ after (string): fullname of a thing
3685
+ before (string): fullname of a thing
3686
+ count (string): a positive integer (default: 0)
3687
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3688
+ show (string): (optional) the string "all" Example: 'all'.
3689
+ sr_detail (string): (optional) expand subreddits
3690
+ user (string): A valid, existing reddit username
3691
+
3692
+ Returns:
3693
+ Any: API response data.
3694
+
3695
+ Tags:
3696
+ subreddits
3697
+ """
3698
+ if subreddit is None:
3699
+ raise ValueError("Missing required parameter 'subreddit'")
3700
+ url = f"{self.base_url}/r/{subreddit}/about/wikibanned"
3701
+ query_params = {
3702
+ k: v
3703
+ for k, v in [
3704
+ ("after", after),
3705
+ ("before", before),
3706
+ ("count", count),
3707
+ ("limit", limit),
3708
+ ("show", show),
3709
+ ("sr_detail", sr_detail),
3710
+ ("user", user),
3711
+ ]
3712
+ if v is not None
3713
+ }
3714
+ response = self._get(url, params=query_params)
3715
+ response.raise_for_status()
3716
+ return response.json()
3717
+
3718
+ def r_subreddit_about_wikicontributors(
3719
+ self,
3720
+ subreddit,
3721
+ after=None,
3722
+ before=None,
3723
+ count=None,
3724
+ limit=None,
3725
+ show=None,
3726
+ sr_detail=None,
3727
+ user=None,
3728
+ ) -> Any:
3729
+ """
3730
+ Get the wikicontributors for a subreddit.
3731
+
3732
+ Args:
3733
+ subreddit (string): subreddit
3734
+ after (string): fullname of a thing
3735
+ before (string): fullname of a thing
3736
+ count (string): a positive integer (default: 0)
3737
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3738
+ show (string): (optional) the string "all" Example: 'all'.
3739
+ sr_detail (string): (optional) expand subreddits
3740
+ user (string): A valid, existing reddit username
3741
+
3742
+ Returns:
3743
+ Any: API response data.
3744
+
3745
+ Tags:
3746
+ subreddits
3747
+ """
3748
+ if subreddit is None:
3749
+ raise ValueError("Missing required parameter 'subreddit'")
3750
+ url = f"{self.base_url}/r/{subreddit}/about/wikicontributors"
3751
+ query_params = {
3752
+ k: v
3753
+ for k, v in [
3754
+ ("after", after),
3755
+ ("before", before),
3756
+ ("count", count),
3757
+ ("limit", limit),
3758
+ ("show", show),
3759
+ ("sr_detail", sr_detail),
3760
+ ("user", user),
3761
+ ]
3762
+ if v is not None
3763
+ }
3764
+ response = self._get(url, params=query_params)
3765
+ response.raise_for_status()
3766
+ return response.json()
3767
+
3768
+ def r_subreddit_api_submit_text(self, subreddit) -> Any:
3769
+ """
3770
+ Get the submit text for a subreddit.
3771
+
3772
+ Args:
3773
+ subreddit (string): subreddit
3774
+
3775
+ Returns:
3776
+ Any: API response data.
3777
+
3778
+ Tags:
3779
+ subreddits
3780
+ """
3781
+ if subreddit is None:
3782
+ raise ValueError("Missing required parameter 'subreddit'")
3783
+ url = f"{self.base_url}/r/{subreddit}/api/submit_text"
3784
+ query_params = {}
3785
+ response = self._get(url, params=query_params)
3786
+ response.raise_for_status()
3787
+ return response.json()
3788
+
3789
+ def subreddits_mine_where(
3790
+ self,
3791
+ where,
3792
+ after=None,
3793
+ before=None,
3794
+ count=None,
3795
+ limit=None,
3796
+ show=None,
3797
+ sr_detail=None,
3798
+ ) -> Any:
3799
+ """
3800
+ Get the subreddits the current user has access to.
3801
+
3802
+ Args:
3803
+ where (string): where
3804
+ after (string): fullname of a thing
3805
+ before (string): fullname of a thing
3806
+ count (string): a positive integer (default: 0)
3807
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3808
+ show (string): (optional) the string "all"
3809
+ sr_detail (string): (optional) expand subreddits
3810
+
3811
+ Returns:
3812
+ Any: API response data.
3813
+
3814
+ Tags:
3815
+ subreddits
3816
+ """
3817
+ if where is None:
3818
+ raise ValueError("Missing required parameter 'where'")
3819
+ url = f"{self.base_url}/subreddits/mine/{where}"
3820
+ query_params = {
3821
+ k: v
3822
+ for k, v in [
3823
+ ("after", after),
3824
+ ("before", before),
3825
+ ("count", count),
3826
+ ("limit", limit),
3827
+ ("show", show),
3828
+ ("sr_detail", sr_detail),
3829
+ ]
3830
+ if v is not None
3831
+ }
3832
+ response = self._get(url, params=query_params)
3833
+ response.raise_for_status()
3834
+ return response.json()
3835
+
3836
+ def subreddits_search(
3837
+ self,
3838
+ after=None,
3839
+ before=None,
3840
+ count=None,
3841
+ limit=None,
3842
+ q=None,
3843
+ search_query_id=None,
3844
+ show=None,
3845
+ show_users=None,
3846
+ sort=None,
3847
+ sr_detail=None,
3848
+ typeahead_active=None,
3849
+ ) -> Any:
3850
+ """
3851
+ Search for subreddits.
3852
+
3853
+ Args:
3854
+ after (string): fullname of a thing
3855
+ before (string): fullname of a thing
3856
+ count (string): a positive integer (default: 0)
3857
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3858
+ q (string): a search query
3859
+ search_query_id (string): a UUID
3860
+ show (string): (optional) the string "all"
3861
+ show_users (string): boolean value (true, false)
3862
+ sort (string): one of (relevance, activity)
3863
+ sr_detail (string): (optional) expand subreddits
3864
+ typeahead_active (string): boolean value (true, false) or None
3865
+
3866
+ Returns:
3867
+ Any: API response data.
3868
+
3869
+ Tags:
3870
+ subreddits
3871
+ """
3872
+ url = f"{self.base_url}/subreddits/search"
3873
+ query_params = {
3874
+ k: v
3875
+ for k, v in [
3876
+ ("after", after),
3877
+ ("before", before),
3878
+ ("count", count),
3879
+ ("limit", limit),
3880
+ ("q", q),
3881
+ ("search_query_id", search_query_id),
3882
+ ("show", show),
3883
+ ("show_users", show_users),
3884
+ ("sort", sort),
3885
+ ("sr_detail", sr_detail),
3886
+ ("typeahead_active", typeahead_active),
3887
+ ]
3888
+ if v is not None
3889
+ }
3890
+ response = self._get(url, params=query_params)
3891
+ response.raise_for_status()
3892
+ return response.json()
3893
+
3894
+ def subreddits_where(
3895
+ self,
3896
+ where,
3897
+ after=None,
3898
+ before=None,
3899
+ count=None,
3900
+ limit=None,
3901
+ show=None,
3902
+ sr_detail=None,
3903
+ ) -> Any:
3904
+ """
3905
+ Get the subreddits the current user has access to.
3906
+
3907
+ Args:
3908
+ where (string): where
3909
+ after (string): fullname of a thing
3910
+ before (string): fullname of a thing
3911
+ count (string): a positive integer (default: 0)
3912
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
3913
+ show (string): (optional) the string "all"
3914
+ sr_detail (string): (optional) expand subreddits
3915
+
3916
+ Returns:
3917
+ Any: API response data.
3918
+
3919
+ Tags:
3920
+ subreddits
3921
+ """
3922
+ if where is None:
3923
+ raise ValueError("Missing required parameter 'where'")
3924
+ url = f"{self.base_url}/subreddits/{where}"
3925
+ query_params = {
3926
+ k: v
3927
+ for k, v in [
3928
+ ("after", after),
3929
+ ("before", before),
3930
+ ("count", count),
3931
+ ("limit", limit),
3932
+ ("show", show),
3933
+ ("sr_detail", sr_detail),
3934
+ ]
3935
+ if v is not None
3936
+ }
3937
+ response = self._get(url, params=query_params)
3938
+ response.raise_for_status()
3939
+ return response.json()
3940
+
3941
+ def api_user_data_by_account_ids(self, ids=None) -> Any:
3942
+ """
3943
+ Get the user data by account IDs.
3944
+
3945
+ Args:
3946
+ ids (string): A comma-separated list of account fullnames
3947
+
3948
+ Returns:
3949
+ Any: API response data.
3950
+
3951
+ Tags:
3952
+ users
3953
+ """
3954
+ url = f"{self.base_url}/api/user_data_by_account_ids"
3955
+ query_params = {k: v for k, v in [("ids", ids)] if v is not None}
3956
+ response = self._get(url, params=query_params)
3957
+ response.raise_for_status()
3958
+ return response.json()
3959
+
3960
+ def api_username_available(self, user=None) -> Any:
3961
+ """
3962
+ Check if a username is available.
3963
+
3964
+ Args:
3965
+ user (string): a valid, unused, username
3966
+
3967
+ Returns:
3968
+ Any: API response data.
3969
+
3970
+ Tags:
3971
+ users
3972
+ """
3973
+ url = f"{self.base_url}/api/username_available"
3974
+ query_params = {k: v for k, v in [("user", user)] if v is not None}
3975
+ response = self._get(url, params=query_params)
3976
+ response.raise_for_status()
3977
+ return response.json()
3978
+
3979
+ def api_v1_me_friends_username1(self, username, id=None) -> Any:
3980
+ """
3981
+ Get a user's friends.
3982
+
3983
+ Args:
3984
+ username (string): username
3985
+ id (string): A valid, existing reddit username
3986
+
3987
+ Returns:
3988
+ Any: API response data.
3989
+
3990
+ Tags:
3991
+ users
3992
+ """
3993
+ if username is None:
3994
+ raise ValueError("Missing required parameter 'username'")
3995
+ url = f"{self.base_url}/api/v1/me/friends/{username}"
3996
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
3997
+ response = self._get(url, params=query_params)
3998
+ response.raise_for_status()
3999
+ return response.json()
4000
+
4001
+ def api_v1_me_friends_username(self, username, id=None) -> Any:
4002
+ """
4003
+ Delete a user's friend.
4004
+
4005
+ Args:
4006
+ username (string): username
4007
+ id (string): A valid, existing reddit username
4008
+
4009
+ Returns:
4010
+ Any: API response data.
4011
+
4012
+ Tags:
4013
+ users
4014
+ """
4015
+ if username is None:
4016
+ raise ValueError("Missing required parameter 'username'")
4017
+ url = f"{self.base_url}/api/v1/me/friends/{username}"
4018
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
4019
+ response = self._delete(url, params=query_params)
4020
+ response.raise_for_status()
4021
+ return response.json()
4022
+
4023
+ def api_v1_user_username_trophies(self, username, id=None) -> Any:
4024
+ """
4025
+ Get a user's trophies.
4026
+
4027
+ Args:
4028
+ username (string): username
4029
+ id (string): A valid, existing reddit username
4030
+
4031
+ Returns:
4032
+ Any: API response data.
4033
+
4034
+ Tags:
4035
+ users
4036
+ """
4037
+ if username is None:
4038
+ raise ValueError("Missing required parameter 'username'")
4039
+ url = f"{self.base_url}/api/v1/user/{username}/trophies"
4040
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
4041
+ response = self._get(url, params=query_params)
4042
+ response.raise_for_status()
4043
+ return response.json()
4044
+
4045
+ def user_username_about(self, username) -> Any:
4046
+ """
4047
+ Get the about information for a user.
4048
+
4049
+ Args:
4050
+ username (string): username
4051
+
4052
+ Returns:
4053
+ Any: API response data.
4054
+
4055
+ Tags:
4056
+ users
4057
+ """
4058
+ if username is None:
4059
+ raise ValueError("Missing required parameter 'username'")
4060
+ url = f"{self.base_url}/user/{username}/about"
4061
+ query_params = {k: v for k, v in [("username", username)] if v is not None}
4062
+ response = self._get(url, params=query_params)
4063
+ response.raise_for_status()
4064
+ return response.json()
4065
+
4066
+ def user_username_where(
4067
+ self,
4068
+ username,
4069
+ where,
4070
+ after=None,
4071
+ before=None,
4072
+ context=None,
4073
+ count=None,
4074
+ limit=None,
4075
+ show=None,
4076
+ sort=None,
4077
+ sr_detail=None,
4078
+ t=None,
4079
+ type=None,
4080
+ ) -> Any:
4081
+ """
4082
+ Get the user's posts or comments.
4083
+
4084
+ Args:
4085
+ username (string): username
4086
+ where (string): where
4087
+ after (string): fullname of a thing
4088
+ before (string): fullname of a thing
4089
+ context (string): an integer between 2 and 10
4090
+ count (string): a positive integer (default: 0)
4091
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
4092
+ show (string): one of (given)
4093
+ sort (string): one of (hot, new, top, controversial)
4094
+ sr_detail (string): (optional) expand subreddits
4095
+ t (string): one of (hour, day, week, month, year, all)
4096
+ type (string): one of (links, comments)
4097
+
4098
+ Returns:
4099
+ Any: API response data.
4100
+
4101
+ Tags:
4102
+ users
4103
+ """
4104
+ if username is None:
4105
+ raise ValueError("Missing required parameter 'username'")
4106
+ if where is None:
4107
+ raise ValueError("Missing required parameter 'where'")
4108
+ url = f"{self.base_url}/user/{username}/{where}"
4109
+ query_params = {
4110
+ k: v
4111
+ for k, v in [
4112
+ ("after", after),
4113
+ ("before", before),
4114
+ ("context", context),
4115
+ ("count", count),
4116
+ ("limit", limit),
4117
+ ("show", show),
4118
+ ("sort", sort),
4119
+ ("sr_detail", sr_detail),
4120
+ ("t", t),
4121
+ ("type", type),
4122
+ ("username", username),
4123
+ ]
4124
+ if v is not None
4125
+ }
4126
+ response = self._get(url, params=query_params)
4127
+ response.raise_for_status()
4128
+ return response.json()
4129
+
4130
+ def users_search(
4131
+ self,
4132
+ after=None,
4133
+ before=None,
4134
+ count=None,
4135
+ limit=None,
4136
+ q=None,
4137
+ search_query_id=None,
4138
+ show=None,
4139
+ sort=None,
4140
+ sr_detail=None,
4141
+ typeahead_active=None,
4142
+ ) -> Any:
4143
+ """
4144
+ Search for users.
4145
+
4146
+ Args:
4147
+ after (string): fullname of a thing
4148
+ before (string): fullname of a thing
4149
+ count (string): a positive integer (default: 0)
4150
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
4151
+ q (string): a search query
4152
+ search_query_id (string): a UUID
4153
+ show (string): (optional) the string "all"
4154
+ sort (string): one of (relevance, activity)
4155
+ sr_detail (string): (optional) expand subreddits
4156
+ typeahead_active (string): boolean value (true, false) or None
4157
+
4158
+ Returns:
4159
+ Any: API response data.
4160
+
4161
+ Tags:
4162
+ users
4163
+ """
4164
+ url = f"{self.base_url}/users/search"
4165
+ query_params = {
4166
+ k: v
4167
+ for k, v in [
4168
+ ("after", after),
4169
+ ("before", before),
4170
+ ("count", count),
4171
+ ("limit", limit),
4172
+ ("q", q),
4173
+ ("search_query_id", search_query_id),
4174
+ ("show", show),
4175
+ ("sort", sort),
4176
+ ("sr_detail", sr_detail),
4177
+ ("typeahead_active", typeahead_active),
4178
+ ]
4179
+ if v is not None
4180
+ }
4181
+ response = self._get(url, params=query_params)
4182
+ response.raise_for_status()
4183
+ return response.json()
4184
+
4185
+ def users_where(
4186
+ self,
4187
+ where,
4188
+ after=None,
4189
+ before=None,
4190
+ count=None,
4191
+ limit=None,
4192
+ show=None,
4193
+ sr_detail=None,
4194
+ ) -> Any:
4195
+ """
4196
+ Get the user's posts or comments.
4197
+
4198
+ Args:
4199
+ where (string): where
4200
+ after (string): fullname of a thing
4201
+ before (string): fullname of a thing
4202
+ count (string): a positive integer (default: 0)
4203
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
4204
+ show (string): (optional) the string "all"
4205
+ sr_detail (string): (optional) expand subreddits
4206
+
4207
+ Returns:
4208
+ Any: API response data.
4209
+
4210
+ Tags:
4211
+ users
4212
+ """
4213
+ if where is None:
4214
+ raise ValueError("Missing required parameter 'where'")
4215
+ url = f"{self.base_url}/users/{where}"
4216
+ query_params = {
4217
+ k: v
4218
+ for k, v in [
4219
+ ("after", after),
4220
+ ("before", before),
4221
+ ("count", count),
4222
+ ("limit", limit),
4223
+ ("show", show),
4224
+ ("sr_detail", sr_detail),
4225
+ ]
4226
+ if v is not None
4227
+ }
4228
+ response = self._get(url, params=query_params)
4229
+ response.raise_for_status()
4230
+ return response.json()
4231
+
4232
+ def r_subreddit_api_widgets(self, subreddit) -> Any:
4233
+ """
4234
+ Get the widgets for a subreddit.
4235
+
4236
+ Args:
4237
+ subreddit (string): subreddit
4238
+
4239
+ Returns:
4240
+ Any: API response data.
4241
+
4242
+ Tags:
4243
+ widgets
4244
+ """
4245
+ if subreddit is None:
4246
+ raise ValueError("Missing required parameter 'subreddit'")
4247
+ url = f"{self.base_url}/r/{subreddit}/api/widgets"
4248
+ query_params = {}
4249
+ response = self._get(url, params=query_params)
4250
+ response.raise_for_status()
4251
+ return response.json()
4252
+
4253
+ def r_subreddit_api_widget_order_section(
4254
+ self, subreddit, section, items=None
4255
+ ) -> Any:
4256
+ """
4257
+ Get the widget order for a subreddit.
4258
+
4259
+ Args:
4260
+ subreddit (string): subreddit
4261
+ section (string): section
4262
+
4263
+ Returns:
4264
+ Any: API response data.
4265
+
4266
+ Tags:
4267
+ widgets
4268
+ """
4269
+ if subreddit is None:
4270
+ raise ValueError("Missing required parameter 'subreddit'")
4271
+ if section is None:
4272
+ raise ValueError("Missing required parameter 'section'")
4273
+ # Use items array directly as request body
4274
+ url = f"{self.base_url}/r/{subreddit}/api/widget_order/{section}"
4275
+ query_params = {}
4276
+ response = self._get(url, params=query_params)
4277
+ response.raise_for_status()
4278
+ return response.json()
4279
+
4280
+ def r_subreddit_api_widget_widget_id(self, subreddit, widget_id) -> Any:
4281
+ """
4282
+ Delete a widget.
4283
+
4284
+ Args:
4285
+ subreddit (string): subreddit
4286
+ widget_id (string): widget_id
4287
+
4288
+ Returns:
4289
+ Any: API response data.
4290
+
4291
+ Tags:
4292
+ widgets
4293
+ """
4294
+ if subreddit is None:
4295
+ raise ValueError("Missing required parameter 'subreddit'")
4296
+ if widget_id is None:
4297
+ raise ValueError("Missing required parameter 'widget_id'")
4298
+ url = f"{self.base_url}/r/{subreddit}/api/widget/{widget_id}"
4299
+ query_params = {}
4300
+ response = self._delete(url, params=query_params)
4301
+ response.raise_for_status()
4302
+ return response.json()
4303
+
4304
+ def r_subreddit_wiki_discussions_page(
4305
+ self,
4306
+ subreddit,
4307
+ page,
4308
+ after=None,
4309
+ before=None,
4310
+ count=None,
4311
+ limit=None,
4312
+ show=None,
4313
+ sr_detail=None,
4314
+ ) -> Any:
4315
+ """
4316
+ Get the discussions for a wiki page.
4317
+
4318
+ Args:
4319
+ subreddit (string): subreddit
4320
+ page (string): page
4321
+ after (string): fullname of a thing
4322
+ before (string): fullname of a thing
4323
+ count (string): a positive integer (default: 0)
4324
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
4325
+ show (string): (optional) the string "all" Example: 'all'.
4326
+ sr_detail (string): (optional) expand subreddits
4327
+
4328
+ Returns:
4329
+ Any: API response data.
4330
+
4331
+ Tags:
4332
+ wiki
4333
+ """
4334
+ if subreddit is None:
4335
+ raise ValueError("Missing required parameter 'subreddit'")
4336
+ if page is None:
4337
+ raise ValueError("Missing required parameter 'page'")
4338
+ url = f"{self.base_url}/r/{subreddit}/wiki/discussions/{page}"
4339
+ query_params = {
4340
+ k: v
4341
+ for k, v in [
4342
+ ("after", after),
4343
+ ("before", before),
4344
+ ("count", count),
4345
+ ("limit", limit),
4346
+ ("page", page),
4347
+ ("show", show),
4348
+ ("sr_detail", sr_detail),
4349
+ ]
4350
+ if v is not None
4351
+ }
4352
+ response = self._get(url, params=query_params)
4353
+ response.raise_for_status()
4354
+ return response.json()
4355
+
4356
+ def r_subreddit_wiki_page(self, subreddit, page, v=None, v2=None) -> Any:
4357
+ """
4358
+ Get a wiki page.
4359
+
4360
+ Args:
4361
+ subreddit (string): subreddit
4362
+ page (string): page
4363
+ v (string): a wiki revision ID
4364
+ v2 (string): a wiki revision ID
4365
+
4366
+ Returns:
4367
+ Any: API response data.
4368
+
4369
+ Tags:
4370
+ wiki
4371
+ """
4372
+ if subreddit is None:
4373
+ raise ValueError("Missing required parameter 'subreddit'")
4374
+ if page is None:
4375
+ raise ValueError("Missing required parameter 'page'")
4376
+ url = f"{self.base_url}/r/{subreddit}/wiki/{page}"
4377
+ query_params = {k: v for k, v in [("v", v), ("v2", v2)] if v is not None}
4378
+ response = self._get(url, params=query_params)
4379
+ response.raise_for_status()
4380
+ return response.json()
4381
+
4382
+ def r_subreddit_wiki_pages(self, subreddit) -> Any:
4383
+ """
4384
+ Get the pages for a wiki.
4385
+
4386
+ Args:
4387
+ subreddit (string): subreddit
4388
+
4389
+ Returns:
4390
+ Any: API response data.
4391
+
4392
+ Tags:
4393
+ wiki
4394
+ """
4395
+ if subreddit is None:
4396
+ raise ValueError("Missing required parameter 'subreddit'")
4397
+ url = f"{self.base_url}/r/{subreddit}/wiki/pages"
4398
+ query_params = {}
4399
+ response = self._get(url, params=query_params)
4400
+ response.raise_for_status()
4401
+ return response.json()
4402
+
4403
+ def r_subreddit_wiki_revisions(
4404
+ self,
4405
+ subreddit,
4406
+ after=None,
4407
+ before=None,
4408
+ count=None,
4409
+ limit=None,
4410
+ show=None,
4411
+ sr_detail=None,
4412
+ ) -> Any:
4413
+ """
4414
+ Get the revisions for a wiki.
4415
+
4416
+ Args:
4417
+ subreddit (string): subreddit
4418
+ after (string): fullname of a thing
4419
+ before (string): fullname of a thing
4420
+ count (string): a positive integer (default: 0)
4421
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
4422
+ show (string): (optional) the string "all" Example: 'all'.
4423
+ sr_detail (string): (optional) expand subreddits
4424
+
4425
+ Returns:
4426
+ Any: API response data.
4427
+
4428
+ Tags:
4429
+ wiki
4430
+ """
4431
+ if subreddit is None:
4432
+ raise ValueError("Missing required parameter 'subreddit'")
4433
+ url = f"{self.base_url}/r/{subreddit}/wiki/revisions"
4434
+ query_params = {
4435
+ k: v
4436
+ for k, v in [
4437
+ ("after", after),
4438
+ ("before", before),
4439
+ ("count", count),
4440
+ ("limit", limit),
4441
+ ("show", show),
4442
+ ("sr_detail", sr_detail),
4443
+ ]
4444
+ if v is not None
4445
+ }
4446
+ response = self._get(url, params=query_params)
4447
+ response.raise_for_status()
4448
+ return response.json()
4449
+
4450
+ def r_subreddit_wiki_revisions_page(
4451
+ self,
4452
+ subreddit,
4453
+ page,
4454
+ after=None,
4455
+ before=None,
4456
+ count=None,
4457
+ limit=None,
4458
+ show=None,
4459
+ sr_detail=None,
4460
+ ) -> Any:
4461
+ """
4462
+ Get the revisions for a wiki page.
4463
+
4464
+ Args:
4465
+ subreddit (string): subreddit
4466
+ page (string): page
4467
+ after (string): fullname of a thing
4468
+ before (string): fullname of a thing
4469
+ count (string): a positive integer (default: 0)
4470
+ limit (string): the maximum number of items desired (default: 25, maximum: 100)
4471
+ show (string): (optional) the string "all" Example: 'all'.
4472
+ sr_detail (string): (optional) expand subreddits
4473
+
4474
+ Returns:
4475
+ Any: API response data.
4476
+
4477
+ Tags:
4478
+ wiki
4479
+ """
4480
+ if subreddit is None:
4481
+ raise ValueError("Missing required parameter 'subreddit'")
4482
+ if page is None:
4483
+ raise ValueError("Missing required parameter 'page'")
4484
+ url = f"{self.base_url}/r/{subreddit}/wiki/revisions/{page}"
4485
+ query_params = {
4486
+ k: v
4487
+ for k, v in [
4488
+ ("after", after),
4489
+ ("before", before),
4490
+ ("count", count),
4491
+ ("limit", limit),
4492
+ ("page", page),
4493
+ ("show", show),
4494
+ ("sr_detail", sr_detail),
4495
+ ]
4496
+ if v is not None
4497
+ }
4498
+ response = self._get(url, params=query_params)
4499
+ response.raise_for_status()
4500
+ return response.json()
4501
+
4502
+ def r_subreddit_wiki_settings_page(self, subreddit, page) -> Any:
4503
+ """
4504
+ Get the settings for a wiki page.
4505
+
4506
+ Args:
4507
+ subreddit (string): subreddit
4508
+ page (string): page
4509
+
4510
+ Returns:
4511
+ Any: API response data.
4512
+
4513
+ Tags:
4514
+ wiki
4515
+ """
4516
+ if subreddit is None:
4517
+ raise ValueError("Missing required parameter 'subreddit'")
4518
+ if page is None:
4519
+ raise ValueError("Missing required parameter 'page'")
4520
+ url = f"{self.base_url}/r/{subreddit}/wiki/settings/{page}"
4521
+ query_params = {k: v for k, v in [("page", page)] if v is not None}
4522
+ response = self._get(url, params=query_params)
4523
+ response.raise_for_status()
4524
+ return response.json()
4525
+
4526
+ def list_tools(self):
4527
+ return [
4528
+ self.get_subreddit_posts,
4529
+ self.search_subreddits,
4530
+ self.get_post_flairs,
4531
+ self.create_post,
4532
+ self.get_comment_by_id,
4533
+ self.post_comment,
4534
+ self.edit_content,
4535
+ self.delete_content,
4536
+ # Auto Generated from openapi spec
4537
+ self.api_v1_me,
4538
+ self.api_v1_me_karma,
4539
+ self.api_v1_me_prefs,
4540
+ self.api_v1_me_prefs1,
4541
+ self.api_v1_me_trophies,
4542
+ self.prefs_friends,
4543
+ self.prefs_blocked,
4544
+ self.prefs_messaging,
4545
+ self.prefs_trusted,
4546
+ self.api_needs_captcha,
4547
+ self.api_v1_collections_collection,
4548
+ self.api_v1_collections_subreddit_collections,
4549
+ self.api_v1_subreddit_emoji_emoji_name,
4550
+ self.api_v1_subreddit_emojis_all,
4551
+ self.r_subreddit_api_flair,
4552
+ self.r_subreddit_api_flairlist,
4553
+ self.r_subreddit_api_link_flair,
4554
+ self.r_subreddit_api_link_flair_v2,
4555
+ self.r_subreddit_api_user_flair,
4556
+ self.r_subreddit_api_user_flair_v2,
4557
+ self.api_info,
4558
+ self.r_subreddit_api_info,
4559
+ self.api_morechildren,
4560
+ self.api_saved_categories,
4561
+ self.req,
4562
+ self.best,
4563
+ self.by_id_names,
4564
+ self.comments_article,
4565
+ self.controversial,
4566
+ self.duplicates_article,
4567
+ self.hot,
4568
+ self.new,
4569
+ self.r_subreddit_comments_article,
4570
+ self.r_subreddit_controversial,
4571
+ self.r_subreddit_hot,
4572
+ self.r_subreddit_new,
4573
+ self.r_subreddit_random,
4574
+ self.r_subreddit_rising,
4575
+ self.r_subreddit_top,
4576
+ self.random,
4577
+ self.rising,
4578
+ self.top,
4579
+ self.api_saved_media_text,
4580
+ self.api_v1_scopes,
4581
+ self.r_subreddit_api_saved_media_text,
4582
+ self.r_subreddit_about_log,
4583
+ self.r_subreddit_about_edited,
4584
+ self.r_subreddit_about_modqueue,
4585
+ self.r_subreddit_about_reports,
4586
+ self.r_subreddit_about_spam,
4587
+ self.r_subreddit_about_unmoderated,
4588
+ self.r_subreddit_stylesheet,
4589
+ self.stylesheet,
4590
+ self.api_mod_notes1,
4591
+ self.api_mod_notes,
4592
+ self.api_mod_notes_recent,
4593
+ self.api_multi_mine,
4594
+ self.api_multi_user_username,
4595
+ self.api_multi_multipath1,
4596
+ self.api_multi_multipath,
4597
+ self.api_multi_multipath_description,
4598
+ self.api_multi_multipath_rsubreddit1,
4599
+ self.api_multi_multipath_rsubreddit,
4600
+ self.api_mod_conversations,
4601
+ self.api_mod_conversations_conversation_id,
4602
+ self.api_mod_conversations_conversation_id_highlight,
4603
+ self.api_mod_conversations_conversation_id_unarchive,
4604
+ self.api_mod_conversations_conversation_id_unban,
4605
+ self.api_mod_conversations_conversation_id_unmute,
4606
+ self.api_mod_conversations_conversation_id_user,
4607
+ self.api_mod_conversations_subreddits,
4608
+ self.api_mod_conversations_unread_count,
4609
+ self.message_inbox,
4610
+ self.message_sent,
4611
+ self.message_unread,
4612
+ self.search,
4613
+ self.r_subreddit_search,
4614
+ self.api_search_reddit_names,
4615
+ self.api_subreddit_autocomplete,
4616
+ self.api_subreddit_autocomplete_v2,
4617
+ self.api_v1_subreddit_post_requirements,
4618
+ self.r_subreddit_about_banned,
4619
+ self.r_subreddit_about,
4620
+ self.r_subreddit_about_edit,
4621
+ self.r_subreddit_about_contributors,
4622
+ self.r_subreddit_about_moderators,
4623
+ self.r_subreddit_about_muted,
4624
+ self.r_subreddit_about_rules,
4625
+ self.r_subreddit_about_sticky,
4626
+ self.r_subreddit_about_traffic,
4627
+ self.r_subreddit_about_wikibanned,
4628
+ self.r_subreddit_about_wikicontributors,
4629
+ self.r_subreddit_api_submit_text,
4630
+ self.subreddits_mine_where,
4631
+ self.subreddits_search,
4632
+ self.subreddits_where,
4633
+ self.api_user_data_by_account_ids,
4634
+ self.api_username_available,
4635
+ self.api_v1_me_friends_username1,
4636
+ self.api_v1_me_friends_username,
4637
+ self.api_v1_user_username_trophies,
4638
+ self.user_username_about,
4639
+ self.user_username_where,
4640
+ self.users_search,
4641
+ self.users_where,
4642
+ self.r_subreddit_api_widgets,
4643
+ self.r_subreddit_api_widget_order_section,
4644
+ self.r_subreddit_api_widget_widget_id,
4645
+ self.r_subreddit_wiki_discussions_page,
4646
+ self.r_subreddit_wiki_page,
4647
+ self.r_subreddit_wiki_pages,
4648
+ self.r_subreddit_wiki_revisions,
4649
+ self.r_subreddit_wiki_revisions_page,
4650
+ self.r_subreddit_wiki_settings_page,
4651
+ self.get_post_comments_details,
4652
+ ]