@devvit/public-api 0.12.0-next-2025-04-30-2e2a14dbe.0 → 0.12.0-next-2025-08-12-20-06-14-50f19bb3e.0
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.
- package/apis/AssetsClient/AssetsClient.d.ts +2 -2
- package/apis/AssetsClient/AssetsClient.d.ts.map +1 -1
- package/apis/AssetsClient/AssetsClient.js +5 -7
- package/apis/key-value-storage/KeyValueStorage.d.ts +1 -1
- package/apis/key-value-storage/KeyValueStorage.d.ts.map +1 -1
- package/apis/makeAPIClients.d.ts.map +1 -1
- package/apis/makeAPIClients.js +3 -0
- package/apis/media/MediaClient.js +1 -1
- package/apis/realtime/RealtimeClient.d.ts +1 -1
- package/apis/realtime/RealtimeClient.d.ts.map +1 -1
- package/apis/reddit/RedditAPIClient.d.ts +41 -41
- package/apis/reddit/RedditAPIClient.d.ts.map +1 -1
- package/apis/reddit/RedditAPIClient.js +150 -151
- package/apis/reddit/models/Comment.d.ts +4 -1
- package/apis/reddit/models/Comment.d.ts.map +1 -1
- package/apis/reddit/models/Comment.js +4 -1
- package/apis/reddit/models/Flair.d.ts +1 -1
- package/apis/reddit/models/Flair.d.ts.map +1 -1
- package/apis/reddit/models/Flair.js +2 -2
- package/apis/reddit/models/Listing.d.ts +1 -1
- package/apis/reddit/models/Listing.d.ts.map +1 -1
- package/apis/reddit/models/ModAction.d.ts +3 -0
- package/apis/reddit/models/ModAction.d.ts.map +1 -1
- package/apis/reddit/models/ModAction.js +1 -2
- package/apis/reddit/models/ModMail.d.ts +23 -23
- package/apis/reddit/models/ModMail.js +24 -24
- package/apis/reddit/models/ModNote.d.ts +1 -1
- package/apis/reddit/models/ModNote.d.ts.map +1 -1
- package/apis/reddit/models/ModNote.js +1 -1
- package/apis/reddit/models/Post.d.ts +32 -5
- package/apis/reddit/models/Post.d.ts.map +1 -1
- package/apis/reddit/models/Post.js +74 -7
- package/apis/reddit/models/PrivateMessage.d.ts +1 -1
- package/apis/reddit/models/PrivateMessage.d.ts.map +1 -1
- package/apis/reddit/models/PrivateMessage.js +1 -1
- package/apis/reddit/models/Subreddit.d.ts +27 -9
- package/apis/reddit/models/Subreddit.d.ts.map +1 -1
- package/apis/reddit/models/Subreddit.js +12 -18
- package/apis/reddit/models/User.d.ts +23 -2
- package/apis/reddit/models/User.d.ts.map +1 -1
- package/apis/reddit/models/User.js +2 -15
- package/apis/reddit/models/Vault.d.ts +4 -1
- package/apis/reddit/models/Vault.d.ts.map +1 -1
- package/apis/reddit/models/Vault.js +3 -8
- package/apis/reddit/models/index.d.ts +1 -1
- package/apis/reddit/models/index.d.ts.map +1 -1
- package/apis/reddit/models/index.js +1 -0
- package/apis/reddit/tests/utils/createTestRedditApiClient.d.ts +8 -0
- package/apis/reddit/tests/utils/createTestRedditApiClient.d.ts.map +1 -0
- package/apis/reddit/tests/utils/createTestRedditApiClient.js +16 -0
- package/apis/redis/RedisClient.d.ts +0 -1
- package/apis/redis/RedisClient.d.ts.map +1 -1
- package/apis/redis/RedisClient.js +6 -0
- package/apis/redis/RedisClient.tests.js +3 -0
- package/apis/scheduler/SchedulerClient.js +1 -1
- package/apis/ui/UIClient.d.ts +3 -1
- package/apis/ui/UIClient.d.ts.map +1 -1
- package/apis/ui/UIClient.js +13 -12
- package/devvit/Devvit.d.ts +2 -2
- package/devvit/Devvit.d.ts.map +1 -1
- package/devvit/Devvit.js +65 -18
- package/devvit/internals/app-settings.d.ts.map +1 -1
- package/devvit/internals/app-settings.js +1 -4
- package/devvit/internals/blocks/BlocksReconciler.d.ts +105 -0
- package/devvit/internals/blocks/BlocksReconciler.d.ts.map +1 -1
- package/devvit/internals/blocks/BlocksReconciler.js +15 -13
- package/devvit/internals/blocks/handler/BlocksHandler.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/BlocksHandler.js +2 -1
- package/devvit/internals/blocks/handler/ContextBuilder.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/ContextBuilder.js +3 -0
- package/devvit/internals/blocks/handler/UIClient.d.ts +7 -5
- package/devvit/internals/blocks/handler/UIClient.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/UIClient.js +14 -13
- package/devvit/internals/blocks/handler/cache.d.ts +1 -1
- package/devvit/internals/blocks/handler/cache.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/test-helpers.d.ts +1 -1
- package/devvit/internals/blocks/handler/test-helpers.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/types.d.ts +1 -1
- package/devvit/internals/blocks/handler/types.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useAsync.d.ts +1 -1
- package/devvit/internals/blocks/handler/useAsync.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useChannel.d.ts +1 -1
- package/devvit/internals/blocks/handler/useChannel.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useForm.d.ts +1 -1
- package/devvit/internals/blocks/handler/useForm.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useState.d.ts +1 -1
- package/devvit/internals/blocks/handler/useState.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useWebView.d.ts +1 -1
- package/devvit/internals/blocks/handler/useWebView.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useWebView.js +23 -4
- package/devvit/internals/blocks/useChannel.d.ts.map +1 -1
- package/devvit/internals/cache.d.ts +1 -1
- package/devvit/internals/cache.d.ts.map +1 -1
- package/devvit/internals/context.d.ts +1 -1
- package/devvit/internals/context.d.ts.map +1 -1
- package/devvit/internals/context.js +10 -1
- package/devvit/internals/csrf.d.ts.map +1 -1
- package/devvit/internals/csrf.js +4 -5
- package/devvit/internals/helpers/color.d.ts +1 -1
- package/devvit/internals/helpers/color.d.ts.map +1 -1
- package/devvit/internals/helpers/devvitInternalMessage.d.ts.map +1 -1
- package/devvit/internals/helpers/devvitInternalMessage.js +1 -1
- package/devvit/internals/helpers/extendDevvitPrototype.d.ts +1 -6
- package/devvit/internals/helpers/extendDevvitPrototype.d.ts.map +1 -1
- package/devvit/internals/helpers/extendDevvitPrototype.js +1 -9
- package/devvit/internals/installation-settings.d.ts.map +1 -1
- package/devvit/internals/installation-settings.js +1 -4
- package/devvit/internals/menu-items.d.ts +1 -0
- package/devvit/internals/menu-items.d.ts.map +1 -1
- package/devvit/internals/menu-items.js +9 -3
- package/devvit/internals/semanticColors.d.ts +4 -0
- package/devvit/internals/semanticColors.d.ts.map +1 -1
- package/devvit/internals/semanticColors.js +4 -0
- package/devvit/internals/ui-event-handler.js +3 -3
- package/devvit/internals/upgrade-app-shim.d.ts +1 -5
- package/devvit/internals/upgrade-app-shim.d.ts.map +1 -1
- package/devvit/internals/upgrade-app-shim.js +0 -8
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +1 -2
- package/meta.min.json +401 -342
- package/package.json +23 -20
- package/public-api.min.js +6 -6
- package/public-api.min.js.map +4 -4
- package/types/configuration.d.ts +12 -3
- package/types/configuration.d.ts.map +1 -1
- package/types/context.d.ts +10 -2
- package/types/context.d.ts.map +1 -1
- package/types/data.d.ts +1 -1
- package/types/data.d.ts.map +1 -1
- package/types/form.d.ts +6 -89
- package/types/form.d.ts.map +1 -1
- package/types/form.js +2 -5
- package/types/hooks.d.ts +1 -1
- package/types/hooks.d.ts.map +1 -1
- package/types/icons.d.ts +1 -1
- package/types/icons.d.ts.map +1 -1
- package/types/icons.js +1 -1
- package/types/json.d.ts +43 -0
- package/types/json.d.ts.map +1 -0
- package/types/json.js +1 -0
- package/types/kvStore.d.ts +1 -1
- package/types/kvStore.d.ts.map +1 -1
- package/types/media.d.ts +1 -1
- package/types/menu-item.d.ts +3 -14
- package/types/menu-item.d.ts.map +1 -1
- package/types/realtime.d.ts +1 -1
- package/types/realtime.d.ts.map +1 -1
- package/types/redis.d.ts +0 -1
- package/types/redis.d.ts.map +1 -1
- package/types/scheduler.d.ts +2 -2
- package/types/scheduler.d.ts.map +1 -1
- package/types/tid.d.ts +47 -0
- package/types/tid.d.ts.map +1 -0
- package/types/tid.js +114 -0
- package/types/ui-client.d.ts +12 -6
- package/types/ui-client.d.ts.map +1 -1
- package/types/web-view-ui-client.d.ts +1 -1
- package/types/web-view-ui-client.d.ts.map +1 -1
- package/version.json +6 -8
- package/apis/reddit/index.d.ts +0 -1104
- package/apis/reddit/index.d.ts.map +0 -1
- package/apis/reddit/index.js +0 -1442
- package/apis/reddit/tests/utils/createTestRedditApiContext.d.ts +0 -7
- package/apis/reddit/tests/utils/createTestRedditApiContext.d.ts.map +0 -1
- package/apis/reddit/tests/utils/createTestRedditApiContext.js +0 -23
- package/devvit/internals/async-metadata.d.ts +0 -2
- package/devvit/internals/async-metadata.d.ts.map +0 -1
- package/devvit/internals/async-metadata.js +0 -65
- package/meta.json +0 -10428
- package/public-api.d.ts +0 -60472
- package/public-api.iife.js +0 -102332
- package/tsdoc-metadata.json +0 -11
|
@@ -9,13 +9,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var
|
|
12
|
+
var _RedditAPIClient_metadata, _RedditAPIClient_modMailService, _RedditAPIClient_currentUser, _RedditAPIClient_currentUsername;
|
|
13
13
|
import {} from '@devvit/protos';
|
|
14
14
|
import { Header } from '@devvit/shared-types/Header.js';
|
|
15
|
-
import { asT3ID, asT5ID, asTID, isT1ID, isT3ID } from '@devvit/shared-types/tid.js';
|
|
16
15
|
import { Devvit } from '../../devvit/Devvit.js';
|
|
17
|
-
import {
|
|
18
|
-
import { getVaultByAddress, getVaultByUserId } from './models/
|
|
16
|
+
import { asT3ID, asT5ID, asTID, isT1ID, isT3ID } from '../../types/tid.js';
|
|
17
|
+
import { AboutLocations, Comment, Flair, FlairTemplate, getCurrentUsernameFromMetadata, getModerationLog, getSubredditInfoById, getSubredditInfoByName, getSubredditLeaderboard, getSubredditNameById, getSubredditStyles, getVaultByAddress, getVaultByUserId, ModMailService, ModNote, Post, PrivateMessage, Subreddit, User, Widget, WikiPage, } from './models/index.js';
|
|
19
18
|
/**
|
|
20
19
|
* The Reddit API Client
|
|
21
20
|
*
|
|
@@ -31,8 +30,8 @@ import { getVaultByAddress, getVaultByUserId } from './models/Vault.js';
|
|
|
31
30
|
|
|
32
31
|
* // use within one of our capability handlers e.g. Menu Actions, Triggers, Scheduled Job Type, etc
|
|
33
32
|
* async (event, context) => {
|
|
34
|
-
* const subreddit = await getSubredditById(context.subredditId);
|
|
35
|
-
* submitPost({
|
|
33
|
+
* const subreddit = await context.reddit.getSubredditById(context.subredditId);
|
|
34
|
+
* context.reddit.submitPost({
|
|
36
35
|
* subredditName: subreddit.name,
|
|
37
36
|
* title: 'test post',
|
|
38
37
|
* text: 'test body',
|
|
@@ -41,28 +40,28 @@ import { getVaultByAddress, getVaultByUserId } from './models/Vault.js';
|
|
|
41
40
|
* }
|
|
42
41
|
* ```
|
|
43
42
|
*/
|
|
44
|
-
export class
|
|
43
|
+
export class RedditAPIClient {
|
|
45
44
|
constructor(metadata) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
__classPrivateFieldSet(this,
|
|
51
|
-
__classPrivateFieldSet(this,
|
|
45
|
+
_RedditAPIClient_metadata.set(this, void 0);
|
|
46
|
+
_RedditAPIClient_modMailService.set(this, void 0);
|
|
47
|
+
_RedditAPIClient_currentUser.set(this, void 0);
|
|
48
|
+
_RedditAPIClient_currentUsername.set(this, void 0);
|
|
49
|
+
__classPrivateFieldSet(this, _RedditAPIClient_metadata, metadata, "f");
|
|
50
|
+
__classPrivateFieldSet(this, _RedditAPIClient_modMailService, new ModMailService(metadata), "f");
|
|
52
51
|
}
|
|
53
52
|
/**
|
|
54
53
|
* Get ModMail API object
|
|
55
54
|
*
|
|
56
55
|
* @example
|
|
57
56
|
* ```ts
|
|
58
|
-
* await modMail
|
|
57
|
+
* await reddit.modMail.reply({
|
|
59
58
|
* body: "Here is my message",
|
|
60
59
|
* conversationId: "abcd42";
|
|
61
60
|
* })
|
|
62
61
|
* ```
|
|
63
62
|
*/
|
|
64
63
|
get modMail() {
|
|
65
|
-
return __classPrivateFieldGet(this,
|
|
64
|
+
return __classPrivateFieldGet(this, _RedditAPIClient_modMailService, "f");
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
68
67
|
* Gets a {@link Subreddit} object by ID
|
|
@@ -72,11 +71,11 @@ export class _RedditAPIClient {
|
|
|
72
71
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
73
72
|
* @example
|
|
74
73
|
* ```ts
|
|
75
|
-
* const memes = await getSubredditById('t5_2qjpg');
|
|
74
|
+
* const memes = await reddit.getSubredditById('t5_2qjpg');
|
|
76
75
|
* ```
|
|
77
76
|
*/
|
|
78
77
|
getSubredditById(id) {
|
|
79
|
-
return Subreddit.getById(asTID(id), __classPrivateFieldGet(this,
|
|
78
|
+
return Subreddit.getById(asTID(id), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
80
79
|
}
|
|
81
80
|
/**
|
|
82
81
|
* Gets a {@link SubredditInfo} object by ID
|
|
@@ -85,11 +84,11 @@ export class _RedditAPIClient {
|
|
|
85
84
|
* @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
|
|
86
85
|
* @example
|
|
87
86
|
* ```ts
|
|
88
|
-
* const memes = await getSubredditInfoById('t5_2qjpg');
|
|
87
|
+
* const memes = await reddit.getSubredditInfoById('t5_2qjpg');
|
|
89
88
|
* ```
|
|
90
89
|
*/
|
|
91
90
|
getSubredditInfoById(id) {
|
|
92
|
-
return
|
|
91
|
+
return getSubredditInfoById(id, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
93
92
|
}
|
|
94
93
|
/**
|
|
95
94
|
* Gets a {@link Subreddit} object by name
|
|
@@ -99,11 +98,11 @@ export class _RedditAPIClient {
|
|
|
99
98
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
100
99
|
* @example
|
|
101
100
|
* ```ts
|
|
102
|
-
* const askReddit = await getSubredditByName('askReddit');
|
|
101
|
+
* const askReddit = await reddit.getSubredditByName('askReddit');
|
|
103
102
|
* ```
|
|
104
103
|
*/
|
|
105
104
|
getSubredditByName(name) {
|
|
106
|
-
return Subreddit.getByName(name, __classPrivateFieldGet(this,
|
|
105
|
+
return Subreddit.getByName(name, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
107
106
|
}
|
|
108
107
|
/**
|
|
109
108
|
* Gets a {@link SubredditInfo} object by name
|
|
@@ -112,11 +111,11 @@ export class _RedditAPIClient {
|
|
|
112
111
|
* @returns {Promise<SubredditInfo>} A Promise that resolves a SubredditInfo object.
|
|
113
112
|
* @example
|
|
114
113
|
* ```ts
|
|
115
|
-
* const askReddit = await getSubredditInfoByName('askReddit');
|
|
114
|
+
* const askReddit = await reddit.getSubredditInfoByName('askReddit');
|
|
116
115
|
* ```
|
|
117
116
|
*/
|
|
118
117
|
getSubredditInfoByName(name) {
|
|
119
|
-
return
|
|
118
|
+
return getSubredditInfoByName(name, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
122
121
|
* Add a removal reason to a subreddit
|
|
@@ -127,7 +126,7 @@ export class _RedditAPIClient {
|
|
|
127
126
|
* @param options.message The message associated with the removal reason.
|
|
128
127
|
* @example
|
|
129
128
|
* ```ts
|
|
130
|
-
* const newReason = await addSubredditRemovalReasons(
|
|
129
|
+
* const newReason = await reddit.addSubredditRemovalReasons(
|
|
131
130
|
* 'askReddit',
|
|
132
131
|
* {
|
|
133
132
|
* title: 'Spam',
|
|
@@ -140,7 +139,7 @@ export class _RedditAPIClient {
|
|
|
140
139
|
* @returns {string} Removal Reason ID
|
|
141
140
|
*/
|
|
142
141
|
addSubredditRemovalReason(subredditName, options) {
|
|
143
|
-
return Subreddit.addRemovalReason(subredditName, options.title, options.message, __classPrivateFieldGet(this,
|
|
142
|
+
return Subreddit.addRemovalReason(subredditName, options.title, options.message, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
144
143
|
}
|
|
145
144
|
/**
|
|
146
145
|
* Get the list of subreddit's removal reasons (ordered)
|
|
@@ -148,7 +147,7 @@ export class _RedditAPIClient {
|
|
|
148
147
|
* @param subredditName
|
|
149
148
|
* @example
|
|
150
149
|
* ```ts
|
|
151
|
-
* const reasons = await getSubredditRemovalReasons('askReddit');
|
|
150
|
+
* const reasons = await reddit.getSubredditRemovalReasons('askReddit');
|
|
152
151
|
*
|
|
153
152
|
* for (let reason of reasons) {
|
|
154
153
|
* console.log(reason.id, reason.message, reason.title)
|
|
@@ -158,7 +157,7 @@ export class _RedditAPIClient {
|
|
|
158
157
|
* @returns Ordered array of Removal Reasons
|
|
159
158
|
*/
|
|
160
159
|
getSubredditRemovalReasons(subredditName) {
|
|
161
|
-
return Subreddit.getRemovalReasons(subredditName, __classPrivateFieldGet(this,
|
|
160
|
+
return Subreddit.getRemovalReasons(subredditName, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
162
161
|
}
|
|
163
162
|
/**
|
|
164
163
|
* Retrieves the name of the current subreddit.
|
|
@@ -166,16 +165,16 @@ export class _RedditAPIClient {
|
|
|
166
165
|
* @returns {Promise<string>} A Promise that resolves a string representing the current subreddit's name.
|
|
167
166
|
* @example
|
|
168
167
|
* ```ts
|
|
169
|
-
* const currentSubredditName = await getCurrentSubredditName();
|
|
168
|
+
* const currentSubredditName = await reddit.getCurrentSubredditName();
|
|
170
169
|
* ```
|
|
171
170
|
*/
|
|
172
171
|
async getCurrentSubredditName() {
|
|
173
|
-
const nameFromMetadata = __classPrivateFieldGet(this,
|
|
172
|
+
const nameFromMetadata = __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f")?.[Header.SubredditName]?.values[0];
|
|
174
173
|
if (nameFromMetadata) {
|
|
175
174
|
return nameFromMetadata;
|
|
176
175
|
}
|
|
177
|
-
const subredditId = __classPrivateFieldGet(this,
|
|
178
|
-
const nameFromId = await
|
|
176
|
+
const subredditId = __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f")?.[Header.Subreddit]?.values[0];
|
|
177
|
+
const nameFromId = await getSubredditNameById(asT5ID(subredditId), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
179
178
|
if (!nameFromId) {
|
|
180
179
|
throw new Error("Couldn't get current subreddit's name");
|
|
181
180
|
}
|
|
@@ -187,11 +186,11 @@ export class _RedditAPIClient {
|
|
|
187
186
|
* @returns {Promise<Subreddit>} A Promise that resolves a Subreddit object.
|
|
188
187
|
* @example
|
|
189
188
|
* ```ts
|
|
190
|
-
* const currentSubreddit = await getCurrentSubreddit();
|
|
189
|
+
* const currentSubreddit = await reddit.getCurrentSubreddit();
|
|
191
190
|
* ```
|
|
192
191
|
*/
|
|
193
192
|
async getCurrentSubreddit() {
|
|
194
|
-
const currentSubreddit = await Subreddit.getFromMetadata(__classPrivateFieldGet(this,
|
|
193
|
+
const currentSubreddit = await Subreddit.getFromMetadata(__classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
195
194
|
if (!currentSubreddit) {
|
|
196
195
|
throw new Error("Couldn't get current subreddit");
|
|
197
196
|
}
|
|
@@ -204,7 +203,7 @@ export class _RedditAPIClient {
|
|
|
204
203
|
* @returns A Promise that resolves to a Post object.
|
|
205
204
|
*/
|
|
206
205
|
getPostById(id) {
|
|
207
|
-
return Post.getById(asTID(id), __classPrivateFieldGet(this,
|
|
206
|
+
return Post.getById(asTID(id), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
208
207
|
}
|
|
209
208
|
/**
|
|
210
209
|
* Submits a new post to a subreddit.
|
|
@@ -213,7 +212,7 @@ export class _RedditAPIClient {
|
|
|
213
212
|
* @returns A Promise that resolves to a Post object.
|
|
214
213
|
* @example
|
|
215
214
|
* ```ts
|
|
216
|
-
* const post = await submitPost({
|
|
215
|
+
* const post = await reddit.submitPost({
|
|
217
216
|
* subredditName: 'devvit',
|
|
218
217
|
* title: 'Hello World',
|
|
219
218
|
* richtext: new RichTextBuilder()
|
|
@@ -231,14 +230,14 @@ export class _RedditAPIClient {
|
|
|
231
230
|
* ```ts
|
|
232
231
|
* import { RunAs } from '@devvit/public-api';
|
|
233
232
|
*
|
|
234
|
-
* const post = await submitPost({
|
|
233
|
+
* const post = await reddit.submitPost({
|
|
235
234
|
* title: 'My Devvit Post',
|
|
236
235
|
* runAs: RunAs.USER,
|
|
237
236
|
* userGeneratedContent: {
|
|
238
237
|
* text: "hello there",
|
|
239
238
|
* imageUrls: ["https://styles.redditmedia.com/t5_5wa5ww/styles/communityIcon_wyopomb2xb0a1.png", "https://styles.redditmedia.com/t5_49fkib/styles/bannerBackgroundImage_5a4axis7cku61.png"]
|
|
240
239
|
},
|
|
241
|
-
* subredditName: await getCurrentSubredditName(),
|
|
240
|
+
* subredditName: await reddit.getCurrentSubredditName(),
|
|
242
241
|
* textFallback: {
|
|
243
242
|
* text: 'This is a Devvit post!',
|
|
244
243
|
* },
|
|
@@ -251,7 +250,7 @@ export class _RedditAPIClient {
|
|
|
251
250
|
* ```
|
|
252
251
|
*/
|
|
253
252
|
submitPost(options) {
|
|
254
|
-
return Post.submit(options, __classPrivateFieldGet(this,
|
|
253
|
+
return Post.submit(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
255
254
|
}
|
|
256
255
|
/**
|
|
257
256
|
* Crossposts a post to a subreddit.
|
|
@@ -263,7 +262,7 @@ export class _RedditAPIClient {
|
|
|
263
262
|
* @returns - A Promise that resolves to a Post object.
|
|
264
263
|
*/
|
|
265
264
|
crosspost(options) {
|
|
266
|
-
return Post.crosspost(options, __classPrivateFieldGet(this,
|
|
265
|
+
return Post.crosspost(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
267
266
|
}
|
|
268
267
|
/**
|
|
269
268
|
* Gets a {@link User} object by ID
|
|
@@ -272,11 +271,11 @@ export class _RedditAPIClient {
|
|
|
272
271
|
* @returns A Promise that resolves to a User object.
|
|
273
272
|
* @example
|
|
274
273
|
* ```ts
|
|
275
|
-
* const user = await getUserById('t2_1qjpg');
|
|
274
|
+
* const user = await reddit.getUserById('t2_1qjpg');
|
|
276
275
|
* ```
|
|
277
276
|
*/
|
|
278
277
|
getUserById(id) {
|
|
279
|
-
return User.getById(asTID(id), __classPrivateFieldGet(this,
|
|
278
|
+
return User.getById(asTID(id), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
280
279
|
}
|
|
281
280
|
/**
|
|
282
281
|
* Gets a {@link User} object by username
|
|
@@ -286,14 +285,14 @@ export class _RedditAPIClient {
|
|
|
286
285
|
* not found (user doesn't exist, account suspended, etc).
|
|
287
286
|
* @example
|
|
288
287
|
* ```ts
|
|
289
|
-
* const user = await getUserByUsername('devvit');
|
|
288
|
+
* const user = await reddit.getUserByUsername('devvit');
|
|
290
289
|
* if (user) {
|
|
291
290
|
* console.log(user)
|
|
292
291
|
* }
|
|
293
292
|
* ```
|
|
294
293
|
*/
|
|
295
294
|
getUserByUsername(username) {
|
|
296
|
-
return User.getByUsername(username, __classPrivateFieldGet(this,
|
|
295
|
+
return User.getByUsername(username, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
297
296
|
}
|
|
298
297
|
/**
|
|
299
298
|
* Get the current calling user's username.
|
|
@@ -302,12 +301,12 @@ export class _RedditAPIClient {
|
|
|
302
301
|
* @returns A Promise that resolves to a string representing the username or undefined
|
|
303
302
|
* @example
|
|
304
303
|
* ```ts
|
|
305
|
-
* const username = await getCurrentUsername();
|
|
304
|
+
* const username = await reddit.getCurrentUsername();
|
|
306
305
|
* ```
|
|
307
306
|
*/
|
|
308
307
|
async getCurrentUsername() {
|
|
309
|
-
__classPrivateFieldSet(this,
|
|
310
|
-
return __classPrivateFieldGet(this,
|
|
308
|
+
__classPrivateFieldSet(this, _RedditAPIClient_currentUsername, __classPrivateFieldGet(this, _RedditAPIClient_currentUsername, "f") ?? getCurrentUsernameFromMetadata(__classPrivateFieldGet(this, _RedditAPIClient_metadata, "f")), "f");
|
|
309
|
+
return __classPrivateFieldGet(this, _RedditAPIClient_currentUsername, "f");
|
|
311
310
|
}
|
|
312
311
|
/**
|
|
313
312
|
* Get the current calling user.
|
|
@@ -316,12 +315,12 @@ export class _RedditAPIClient {
|
|
|
316
315
|
* @returns A Promise that resolves to a User object or undefined
|
|
317
316
|
* @example
|
|
318
317
|
* ```ts
|
|
319
|
-
* const user = await getCurrentUser();
|
|
318
|
+
* const user = await reddit.getCurrentUser();
|
|
320
319
|
* ```
|
|
321
320
|
*/
|
|
322
321
|
async getCurrentUser() {
|
|
323
|
-
__classPrivateFieldSet(this,
|
|
324
|
-
return __classPrivateFieldGet(this,
|
|
322
|
+
__classPrivateFieldSet(this, _RedditAPIClient_currentUser, __classPrivateFieldGet(this, _RedditAPIClient_currentUser, "f") ?? this.getCurrentUsername().then((username) => username ? User.getByUsername(username, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f")) : undefined), "f");
|
|
323
|
+
return __classPrivateFieldGet(this, _RedditAPIClient_currentUser, "f");
|
|
325
324
|
}
|
|
326
325
|
/**
|
|
327
326
|
* Get the user that the app runs as on the provided metadata.
|
|
@@ -329,11 +328,11 @@ export class _RedditAPIClient {
|
|
|
329
328
|
* @returns A Promise that resolves to a User object.
|
|
330
329
|
* @example
|
|
331
330
|
* ```ts
|
|
332
|
-
* const user = await getAppUser(metadata);
|
|
331
|
+
* const user = await reddit.getAppUser(metadata);
|
|
333
332
|
* ```
|
|
334
333
|
*/
|
|
335
334
|
getAppUser() {
|
|
336
|
-
return User.getFromMetadata(Header.AppUser, __classPrivateFieldGet(this,
|
|
335
|
+
return User.getFromMetadata(Header.AppUser, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
337
336
|
}
|
|
338
337
|
/**
|
|
339
338
|
* Get the snoovatar URL for a given username.
|
|
@@ -344,12 +343,12 @@ export class _RedditAPIClient {
|
|
|
344
343
|
async getSnoovatarUrl(username) {
|
|
345
344
|
const currentUsername = await this.getCurrentUsername();
|
|
346
345
|
if (currentUsername && username === currentUsername) {
|
|
347
|
-
const snoovatarUrl = __classPrivateFieldGet(this,
|
|
346
|
+
const snoovatarUrl = __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f")?.[Header.UserSnoovatarUrl]?.values[0];
|
|
348
347
|
if (snoovatarUrl) {
|
|
349
348
|
return snoovatarUrl;
|
|
350
349
|
}
|
|
351
350
|
}
|
|
352
|
-
return User.getSnoovatarUrl(username, __classPrivateFieldGet(this,
|
|
351
|
+
return User.getSnoovatarUrl(username, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
353
352
|
}
|
|
354
353
|
/**
|
|
355
354
|
* Get a {@link Comment} object by ID
|
|
@@ -358,11 +357,11 @@ export class _RedditAPIClient {
|
|
|
358
357
|
* @returns A Promise that resolves to a Comment object.
|
|
359
358
|
* @example
|
|
360
359
|
* ```ts
|
|
361
|
-
* const comment = await getCommentById('t1_1qjpg');
|
|
360
|
+
* const comment = await reddit.getCommentById('t1_1qjpg');
|
|
362
361
|
* ```
|
|
363
362
|
*/
|
|
364
363
|
getCommentById(id) {
|
|
365
|
-
return Comment.getById(asTID(id), __classPrivateFieldGet(this,
|
|
364
|
+
return Comment.getById(asTID(id), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
366
365
|
}
|
|
367
366
|
/**
|
|
368
367
|
* Get a list of comments from a specific post or comment.
|
|
@@ -376,7 +375,7 @@ export class _RedditAPIClient {
|
|
|
376
375
|
* @returns A Listing of Comment objects.
|
|
377
376
|
* @example
|
|
378
377
|
* ```ts
|
|
379
|
-
* const comments = await getComments({
|
|
378
|
+
* const comments = await reddit.getComments({
|
|
380
379
|
* postId: 't3_1qjpg',
|
|
381
380
|
* limit: 1000,
|
|
382
381
|
* pageSize: 100
|
|
@@ -384,7 +383,7 @@ export class _RedditAPIClient {
|
|
|
384
383
|
* ```
|
|
385
384
|
*/
|
|
386
385
|
getComments(options) {
|
|
387
|
-
return Comment.getComments(options, __classPrivateFieldGet(this,
|
|
386
|
+
return Comment.getComments(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
388
387
|
}
|
|
389
388
|
/**
|
|
390
389
|
* Get a list of comments by a specific user.
|
|
@@ -398,7 +397,7 @@ export class _RedditAPIClient {
|
|
|
398
397
|
* @returns A Listing of Comment objects.
|
|
399
398
|
*/
|
|
400
399
|
getCommentsByUser(options) {
|
|
401
|
-
return Comment.getCommentsByUser(options, __classPrivateFieldGet(this,
|
|
400
|
+
return Comment.getCommentsByUser(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
402
401
|
}
|
|
403
402
|
/**
|
|
404
403
|
* Submit a new comment to a post or comment.
|
|
@@ -413,7 +412,7 @@ export class _RedditAPIClient {
|
|
|
413
412
|
* ```ts
|
|
414
413
|
* import { RunAs } from '@devvit/public-api';
|
|
415
414
|
*
|
|
416
|
-
* const comment = await submitComment({
|
|
415
|
+
* const comment = await reddit.submitComment({
|
|
417
416
|
* id: 't1_1qgif',
|
|
418
417
|
* text: 'Hello world!',
|
|
419
418
|
* runAs: RunAs.APP,
|
|
@@ -424,7 +423,7 @@ export class _RedditAPIClient {
|
|
|
424
423
|
return Comment.submit({
|
|
425
424
|
...options,
|
|
426
425
|
id: asTID(options.id),
|
|
427
|
-
}, __classPrivateFieldGet(this,
|
|
426
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
428
427
|
}
|
|
429
428
|
/**
|
|
430
429
|
* Get a list of controversial posts from a specific subreddit.
|
|
@@ -437,7 +436,7 @@ export class _RedditAPIClient {
|
|
|
437
436
|
* @returns A Listing of Post objects.
|
|
438
437
|
* @example
|
|
439
438
|
* ```ts
|
|
440
|
-
* const posts = await getControversialPosts({
|
|
439
|
+
* const posts = await reddit.getControversialPosts({
|
|
441
440
|
* subredditName: 'memes',
|
|
442
441
|
* timeframe: 'day',
|
|
443
442
|
* limit: 1000,
|
|
@@ -446,7 +445,7 @@ export class _RedditAPIClient {
|
|
|
446
445
|
* ```
|
|
447
446
|
*/
|
|
448
447
|
getControversialPosts(options) {
|
|
449
|
-
return Post.getControversialPosts(options, __classPrivateFieldGet(this,
|
|
448
|
+
return Post.getControversialPosts(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
450
449
|
}
|
|
451
450
|
/**
|
|
452
451
|
* Get a list of controversial posts from a specific subreddit.
|
|
@@ -459,7 +458,7 @@ export class _RedditAPIClient {
|
|
|
459
458
|
* @returns A Listing of Post objects.
|
|
460
459
|
* @example
|
|
461
460
|
* ```ts
|
|
462
|
-
* const posts = await getControversialPosts({
|
|
461
|
+
* const posts = await reddit.getControversialPosts({
|
|
463
462
|
* subredditName: 'memes',
|
|
464
463
|
* timeframe: 'day',
|
|
465
464
|
* limit: 1000,
|
|
@@ -468,7 +467,7 @@ export class _RedditAPIClient {
|
|
|
468
467
|
* ```
|
|
469
468
|
*/
|
|
470
469
|
getTopPosts(options) {
|
|
471
|
-
return Post.getTopPosts(options, __classPrivateFieldGet(this,
|
|
470
|
+
return Post.getTopPosts(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
472
471
|
}
|
|
473
472
|
/**
|
|
474
473
|
* Get a list of hot posts from a specific subreddit.
|
|
@@ -481,7 +480,7 @@ export class _RedditAPIClient {
|
|
|
481
480
|
* @returns A Listing of Post objects.
|
|
482
481
|
* @example
|
|
483
482
|
* ```ts
|
|
484
|
-
* const posts = await getHotPosts({
|
|
483
|
+
* const posts = await reddit.getHotPosts({
|
|
485
484
|
* subredditName: 'memes',
|
|
486
485
|
* timeframe: 'day',
|
|
487
486
|
* limit: 1000,
|
|
@@ -490,7 +489,7 @@ export class _RedditAPIClient {
|
|
|
490
489
|
* ```
|
|
491
490
|
*/
|
|
492
491
|
getHotPosts(options) {
|
|
493
|
-
return Post.getHotPosts(options, __classPrivateFieldGet(this,
|
|
492
|
+
return Post.getHotPosts(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
494
493
|
}
|
|
495
494
|
/**
|
|
496
495
|
* Get a list of new posts from a specific subreddit.
|
|
@@ -502,7 +501,7 @@ export class _RedditAPIClient {
|
|
|
502
501
|
* @returns A Listing of Post objects.
|
|
503
502
|
* @example
|
|
504
503
|
* ```ts
|
|
505
|
-
* const posts = await getNewPosts({
|
|
504
|
+
* const posts = await reddit.getNewPosts({
|
|
506
505
|
* subredditName: 'memes',
|
|
507
506
|
* limit: 1000,
|
|
508
507
|
* pageSize: 100
|
|
@@ -510,7 +509,7 @@ export class _RedditAPIClient {
|
|
|
510
509
|
* ```
|
|
511
510
|
*/
|
|
512
511
|
getNewPosts(options) {
|
|
513
|
-
return Post.getNewPosts(options, __classPrivateFieldGet(this,
|
|
512
|
+
return Post.getNewPosts(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
514
513
|
}
|
|
515
514
|
/**
|
|
516
515
|
* Get a list of hot posts from a specific subreddit.
|
|
@@ -523,7 +522,7 @@ export class _RedditAPIClient {
|
|
|
523
522
|
* @returns A Listing of Post objects.
|
|
524
523
|
* @example
|
|
525
524
|
* ```ts
|
|
526
|
-
* const posts = await getRisingPosts({
|
|
525
|
+
* const posts = await reddit.getRisingPosts({
|
|
527
526
|
* subredditName: 'memes',
|
|
528
527
|
* timeframe: 'day',
|
|
529
528
|
* limit: 1000,
|
|
@@ -532,7 +531,7 @@ export class _RedditAPIClient {
|
|
|
532
531
|
* ```
|
|
533
532
|
*/
|
|
534
533
|
getRisingPosts(options) {
|
|
535
|
-
return Post.getRisingPosts(options, __classPrivateFieldGet(this,
|
|
534
|
+
return Post.getRisingPosts(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
536
535
|
}
|
|
537
536
|
/**
|
|
538
537
|
* Get a list of posts from a specific user.
|
|
@@ -546,7 +545,7 @@ export class _RedditAPIClient {
|
|
|
546
545
|
* @returns A Listing of Post objects.
|
|
547
546
|
*/
|
|
548
547
|
getPostsByUser(options) {
|
|
549
|
-
return Post.getPostsByUser(options, __classPrivateFieldGet(this,
|
|
548
|
+
return Post.getPostsByUser(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
550
549
|
}
|
|
551
550
|
/**
|
|
552
551
|
* Get a list of posts and comments from a specific user.
|
|
@@ -560,7 +559,7 @@ export class _RedditAPIClient {
|
|
|
560
559
|
* @returns A Listing of `Post` and `Comment` objects.
|
|
561
560
|
*/
|
|
562
561
|
getCommentsAndPostsByUser(options) {
|
|
563
|
-
return User.getOverview(options, __classPrivateFieldGet(this,
|
|
562
|
+
return User.getOverview(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
564
563
|
}
|
|
565
564
|
/**
|
|
566
565
|
* Get the moderation log for a subreddit.
|
|
@@ -574,7 +573,7 @@ export class _RedditAPIClient {
|
|
|
574
573
|
* @returns A Listing of ModAction objects.
|
|
575
574
|
* @example
|
|
576
575
|
* ```ts
|
|
577
|
-
* const modActions = await getModerationLog({
|
|
576
|
+
* const modActions = await reddit.getModerationLog({
|
|
578
577
|
* subredditName: 'memes',
|
|
579
578
|
* moderatorUsernames: ['spez'],
|
|
580
579
|
* type: 'banuser',
|
|
@@ -584,7 +583,7 @@ export class _RedditAPIClient {
|
|
|
584
583
|
* ```
|
|
585
584
|
*/
|
|
586
585
|
getModerationLog(options) {
|
|
587
|
-
return
|
|
586
|
+
return getModerationLog(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
588
587
|
}
|
|
589
588
|
/**
|
|
590
589
|
* Get a list of users who have been approved to post in a subreddit.
|
|
@@ -600,7 +599,7 @@ export class _RedditAPIClient {
|
|
|
600
599
|
return User.getSubredditUsersByType({
|
|
601
600
|
type: 'contributors',
|
|
602
601
|
...options,
|
|
603
|
-
}, __classPrivateFieldGet(this,
|
|
602
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
604
603
|
}
|
|
605
604
|
/**
|
|
606
605
|
* Approve a user to post in a subreddit.
|
|
@@ -613,7 +612,7 @@ export class _RedditAPIClient {
|
|
|
613
612
|
username,
|
|
614
613
|
subredditName,
|
|
615
614
|
type: 'contributor',
|
|
616
|
-
}, __classPrivateFieldGet(this,
|
|
615
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
617
616
|
}
|
|
618
617
|
/**
|
|
619
618
|
* Remove a user's approval to post in a subreddit.
|
|
@@ -626,7 +625,7 @@ export class _RedditAPIClient {
|
|
|
626
625
|
username,
|
|
627
626
|
subredditName,
|
|
628
627
|
type: 'contributor',
|
|
629
|
-
}, __classPrivateFieldGet(this,
|
|
628
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
630
629
|
}
|
|
631
630
|
/**
|
|
632
631
|
* Get a list of users who are wiki contributors of a subreddit.
|
|
@@ -642,7 +641,7 @@ export class _RedditAPIClient {
|
|
|
642
641
|
return User.getSubredditUsersByType({
|
|
643
642
|
type: 'wikicontributors',
|
|
644
643
|
...options,
|
|
645
|
-
}, __classPrivateFieldGet(this,
|
|
644
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
646
645
|
}
|
|
647
646
|
/**
|
|
648
647
|
* Add a user as a wiki contributor for a subreddit.
|
|
@@ -655,7 +654,7 @@ export class _RedditAPIClient {
|
|
|
655
654
|
username,
|
|
656
655
|
subredditName,
|
|
657
656
|
type: 'wikicontributor',
|
|
658
|
-
}, __classPrivateFieldGet(this,
|
|
657
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
659
658
|
}
|
|
660
659
|
/**
|
|
661
660
|
* Remove a user's wiki contributor status for a subreddit.
|
|
@@ -668,7 +667,7 @@ export class _RedditAPIClient {
|
|
|
668
667
|
username,
|
|
669
668
|
subredditName,
|
|
670
669
|
type: 'wikicontributor',
|
|
671
|
-
}, __classPrivateFieldGet(this,
|
|
670
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
672
671
|
}
|
|
673
672
|
/**
|
|
674
673
|
* Get a list of users who are banned from a subreddit.
|
|
@@ -684,7 +683,7 @@ export class _RedditAPIClient {
|
|
|
684
683
|
return User.getSubredditUsersByType({
|
|
685
684
|
type: 'banned',
|
|
686
685
|
...options,
|
|
687
|
-
}, __classPrivateFieldGet(this,
|
|
686
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
688
687
|
}
|
|
689
688
|
/**
|
|
690
689
|
* Ban a user from a subreddit.
|
|
@@ -708,7 +707,7 @@ export class _RedditAPIClient {
|
|
|
708
707
|
note: options.note,
|
|
709
708
|
duration: options.duration,
|
|
710
709
|
banContext: options.context,
|
|
711
|
-
}, __classPrivateFieldGet(this,
|
|
710
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
712
711
|
}
|
|
713
712
|
/**
|
|
714
713
|
* Unban a user from a subreddit.
|
|
@@ -721,7 +720,7 @@ export class _RedditAPIClient {
|
|
|
721
720
|
username,
|
|
722
721
|
subredditName,
|
|
723
722
|
type: 'banned',
|
|
724
|
-
}, __classPrivateFieldGet(this,
|
|
723
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
725
724
|
}
|
|
726
725
|
/**
|
|
727
726
|
* Get a list of users who are banned from contributing to the wiki on a subreddit.
|
|
@@ -737,7 +736,7 @@ export class _RedditAPIClient {
|
|
|
737
736
|
return User.getSubredditUsersByType({
|
|
738
737
|
type: 'wikibanned',
|
|
739
738
|
...options,
|
|
740
|
-
}, __classPrivateFieldGet(this,
|
|
739
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
741
740
|
}
|
|
742
741
|
/**
|
|
743
742
|
* Ban a user from contributing to the wiki on a subreddit.
|
|
@@ -753,7 +752,7 @@ export class _RedditAPIClient {
|
|
|
753
752
|
return User.createRelationship({
|
|
754
753
|
...options,
|
|
755
754
|
type: 'wikibanned',
|
|
756
|
-
}, __classPrivateFieldGet(this,
|
|
755
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
757
756
|
}
|
|
758
757
|
/**
|
|
759
758
|
*
|
|
@@ -765,7 +764,7 @@ export class _RedditAPIClient {
|
|
|
765
764
|
username,
|
|
766
765
|
subredditName,
|
|
767
766
|
type: 'wikibanned',
|
|
768
|
-
}, __classPrivateFieldGet(this,
|
|
767
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
769
768
|
}
|
|
770
769
|
/**
|
|
771
770
|
* Get a list of users who are moderators for a subreddit.
|
|
@@ -781,7 +780,7 @@ export class _RedditAPIClient {
|
|
|
781
780
|
return User.getSubredditUsersByType({
|
|
782
781
|
type: 'moderators',
|
|
783
782
|
...options,
|
|
784
|
-
}, __classPrivateFieldGet(this,
|
|
783
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
785
784
|
}
|
|
786
785
|
/**
|
|
787
786
|
* Invite a user to become a moderator of a subreddit.
|
|
@@ -797,7 +796,7 @@ export class _RedditAPIClient {
|
|
|
797
796
|
subredditName: options.subredditName,
|
|
798
797
|
username: options.username,
|
|
799
798
|
permissions: options.permissions ?? [],
|
|
800
|
-
}, __classPrivateFieldGet(this,
|
|
799
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
801
800
|
}
|
|
802
801
|
/**
|
|
803
802
|
* Revoke a moderator invite for a user to a subreddit.
|
|
@@ -810,7 +809,7 @@ export class _RedditAPIClient {
|
|
|
810
809
|
username,
|
|
811
810
|
subredditName,
|
|
812
811
|
type: 'moderator_invite',
|
|
813
|
-
}, __classPrivateFieldGet(this,
|
|
812
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
814
813
|
}
|
|
815
814
|
/**
|
|
816
815
|
* Remove a user as a moderator of a subreddit.
|
|
@@ -823,7 +822,7 @@ export class _RedditAPIClient {
|
|
|
823
822
|
type: 'moderator',
|
|
824
823
|
subredditName,
|
|
825
824
|
username,
|
|
826
|
-
}, __classPrivateFieldGet(this,
|
|
825
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
827
826
|
}
|
|
828
827
|
/**
|
|
829
828
|
* Update the permissions of a moderator of a subreddit.
|
|
@@ -833,7 +832,7 @@ export class _RedditAPIClient {
|
|
|
833
832
|
* @param permissions - The permissions to give the user. e.g ['posts', 'wiki']
|
|
834
833
|
*/
|
|
835
834
|
setModeratorPermissions(username, subredditName, permissions) {
|
|
836
|
-
return User.setModeratorPermissions(username, subredditName, permissions, __classPrivateFieldGet(this,
|
|
835
|
+
return User.setModeratorPermissions(username, subredditName, permissions, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
837
836
|
}
|
|
838
837
|
/**
|
|
839
838
|
* Get a list of users who are muted in a subreddit.
|
|
@@ -849,7 +848,7 @@ export class _RedditAPIClient {
|
|
|
849
848
|
return User.getSubredditUsersByType({
|
|
850
849
|
type: 'muted',
|
|
851
850
|
...options,
|
|
852
|
-
}, __classPrivateFieldGet(this,
|
|
851
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
853
852
|
}
|
|
854
853
|
/**
|
|
855
854
|
* Mute a user in a subreddit. Muting a user prevents them from sending modmail.
|
|
@@ -863,7 +862,7 @@ export class _RedditAPIClient {
|
|
|
863
862
|
return User.createRelationship({
|
|
864
863
|
...options,
|
|
865
864
|
type: 'muted',
|
|
866
|
-
}, __classPrivateFieldGet(this,
|
|
865
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
867
866
|
}
|
|
868
867
|
/**
|
|
869
868
|
* Unmute a user in a subreddit. Unmuting a user allows them to send modmail.
|
|
@@ -876,7 +875,7 @@ export class _RedditAPIClient {
|
|
|
876
875
|
username,
|
|
877
876
|
subredditName,
|
|
878
877
|
type: 'muted',
|
|
879
|
-
}, __classPrivateFieldGet(this,
|
|
878
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
880
879
|
}
|
|
881
880
|
/**
|
|
882
881
|
* Get a list of mod notes related to a user in a subreddit.
|
|
@@ -890,7 +889,7 @@ export class _RedditAPIClient {
|
|
|
890
889
|
* @returns A listing of ModNote objects.
|
|
891
890
|
*/
|
|
892
891
|
getModNotes(options) {
|
|
893
|
-
return ModNote.get(options, __classPrivateFieldGet(this,
|
|
892
|
+
return ModNote.get(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
894
893
|
}
|
|
895
894
|
/**
|
|
896
895
|
* Delete a mod note.
|
|
@@ -901,7 +900,7 @@ export class _RedditAPIClient {
|
|
|
901
900
|
* @returns True if it was deleted successfully; false otherwise.
|
|
902
901
|
*/
|
|
903
902
|
deleteModNote(options) {
|
|
904
|
-
return ModNote.delete(options, __classPrivateFieldGet(this,
|
|
903
|
+
return ModNote.delete(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
905
904
|
}
|
|
906
905
|
/**
|
|
907
906
|
* Add a mod note.
|
|
@@ -919,7 +918,7 @@ export class _RedditAPIClient {
|
|
|
919
918
|
...options,
|
|
920
919
|
redditId: options.redditId ? asTID(options.redditId) : undefined,
|
|
921
920
|
};
|
|
922
|
-
return ModNote.add(req, __classPrivateFieldGet(this,
|
|
921
|
+
return ModNote.add(req, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
923
922
|
}
|
|
924
923
|
/**
|
|
925
924
|
* Add a mod note for why a post or comment was removed
|
|
@@ -929,7 +928,7 @@ export class _RedditAPIClient {
|
|
|
929
928
|
* @param options.modNote the reason for removal (maximum 100 characters) (optional)
|
|
930
929
|
*/
|
|
931
930
|
addRemovalNote(options) {
|
|
932
|
-
return ModNote.addRemovalNote(options, __classPrivateFieldGet(this,
|
|
931
|
+
return ModNote.addRemovalNote(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
933
932
|
}
|
|
934
933
|
/**
|
|
935
934
|
* Sends a private message to a user.
|
|
@@ -938,7 +937,7 @@ export class _RedditAPIClient {
|
|
|
938
937
|
* @returns A Promise that resolves if the private message was successfully sent.
|
|
939
938
|
*/
|
|
940
939
|
async sendPrivateMessage(options) {
|
|
941
|
-
return PrivateMessage.send(options, __classPrivateFieldGet(this,
|
|
940
|
+
return PrivateMessage.send(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
942
941
|
}
|
|
943
942
|
/**
|
|
944
943
|
* Sends a private message to a user on behalf of a subreddit.
|
|
@@ -947,7 +946,7 @@ export class _RedditAPIClient {
|
|
|
947
946
|
* @returns A Promise that resolves if the private message was successfully sent.
|
|
948
947
|
*/
|
|
949
948
|
async sendPrivateMessageAsSubreddit(options) {
|
|
950
|
-
return PrivateMessage.sendAsSubreddit(options, __classPrivateFieldGet(this,
|
|
949
|
+
return PrivateMessage.sendAsSubreddit(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
951
950
|
}
|
|
952
951
|
/**
|
|
953
952
|
* Approve a post or comment.
|
|
@@ -955,16 +954,16 @@ export class _RedditAPIClient {
|
|
|
955
954
|
* @param id - The id of the post (t3_) or comment (t1_) to approve.
|
|
956
955
|
* @example
|
|
957
956
|
* ```ts
|
|
958
|
-
* await approve('t3_123456');
|
|
959
|
-
* await approve('t1_123456');
|
|
957
|
+
* await reddit.approve('t3_123456');
|
|
958
|
+
* await reddit.approve('t1_123456');
|
|
960
959
|
* ```
|
|
961
960
|
*/
|
|
962
961
|
async approve(id) {
|
|
963
962
|
if (isT1ID(id)) {
|
|
964
|
-
return Comment.approve(id, __classPrivateFieldGet(this,
|
|
963
|
+
return Comment.approve(id, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
965
964
|
}
|
|
966
965
|
else if (isT3ID(id)) {
|
|
967
|
-
return Post.approve(id, __classPrivateFieldGet(this,
|
|
966
|
+
return Post.approve(id, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
968
967
|
}
|
|
969
968
|
throw new Error('id must start with either t1_ or t3_');
|
|
970
969
|
}
|
|
@@ -975,16 +974,16 @@ export class _RedditAPIClient {
|
|
|
975
974
|
* @param isSpam - Is the post or comment being removed because it's spam?
|
|
976
975
|
* @example
|
|
977
976
|
* ```ts
|
|
978
|
-
* await remove('t3_123456', false);
|
|
979
|
-
* await remove('t1_123456', true);
|
|
977
|
+
* await reddit.remove('t3_123456', false);
|
|
978
|
+
* await reddit.remove('t1_123456', true);
|
|
980
979
|
* ```
|
|
981
980
|
*/
|
|
982
981
|
async remove(id, isSpam) {
|
|
983
982
|
if (isT1ID(id)) {
|
|
984
|
-
return Comment.remove(id, isSpam, __classPrivateFieldGet(this,
|
|
983
|
+
return Comment.remove(id, isSpam, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
985
984
|
}
|
|
986
985
|
else if (isT3ID(id)) {
|
|
987
|
-
return Post.remove(id, isSpam, __classPrivateFieldGet(this,
|
|
986
|
+
return Post.remove(id, isSpam, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
988
987
|
}
|
|
989
988
|
throw new Error('id must start with either t1_ or t3_');
|
|
990
989
|
}
|
|
@@ -995,7 +994,7 @@ export class _RedditAPIClient {
|
|
|
995
994
|
* @returns A Promise that resolves with an array of FlairTemplate objects.
|
|
996
995
|
*/
|
|
997
996
|
async getPostFlairTemplates(subredditName) {
|
|
998
|
-
return FlairTemplate.getPostFlairTemplates(subredditName, __classPrivateFieldGet(this,
|
|
997
|
+
return FlairTemplate.getPostFlairTemplates(subredditName, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
999
998
|
}
|
|
1000
999
|
/**
|
|
1001
1000
|
* Get the list of user flair templates for a subreddit.
|
|
@@ -1004,7 +1003,7 @@ export class _RedditAPIClient {
|
|
|
1004
1003
|
* @returns A Promise that resolves with an array of FlairTemplate objects.
|
|
1005
1004
|
*/
|
|
1006
1005
|
async getUserFlairTemplates(subredditName) {
|
|
1007
|
-
return FlairTemplate.getUserFlairTemplates(subredditName, __classPrivateFieldGet(this,
|
|
1006
|
+
return FlairTemplate.getUserFlairTemplates(subredditName, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1008
1007
|
}
|
|
1009
1008
|
/**
|
|
1010
1009
|
* Create a post flair template for a subreddit.
|
|
@@ -1021,7 +1020,7 @@ export class _RedditAPIClient {
|
|
|
1021
1020
|
* @returns The created FlairTemplate object.
|
|
1022
1021
|
*/
|
|
1023
1022
|
async createPostFlairTemplate(options) {
|
|
1024
|
-
return FlairTemplate.createPostFlairTemplate(options, __classPrivateFieldGet(this,
|
|
1023
|
+
return FlairTemplate.createPostFlairTemplate(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1025
1024
|
}
|
|
1026
1025
|
/**
|
|
1027
1026
|
* Create a user flair template for a subreddit.
|
|
@@ -1038,7 +1037,7 @@ export class _RedditAPIClient {
|
|
|
1038
1037
|
* @returns The created FlairTemplate object.
|
|
1039
1038
|
*/
|
|
1040
1039
|
async createUserFlairTemplate(options) {
|
|
1041
|
-
return FlairTemplate.createUserFlairTemplate(options, __classPrivateFieldGet(this,
|
|
1040
|
+
return FlairTemplate.createUserFlairTemplate(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1042
1041
|
}
|
|
1043
1042
|
/**
|
|
1044
1043
|
* Edit a flair template for a subreddit. This can be either a post or user flair template.
|
|
@@ -1057,7 +1056,7 @@ export class _RedditAPIClient {
|
|
|
1057
1056
|
* @returns The edited FlairTemplate object.
|
|
1058
1057
|
*/
|
|
1059
1058
|
async editFlairTemplate(options) {
|
|
1060
|
-
return FlairTemplate.editFlairTemplate(options, __classPrivateFieldGet(this,
|
|
1059
|
+
return FlairTemplate.editFlairTemplate(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1061
1060
|
}
|
|
1062
1061
|
/**
|
|
1063
1062
|
* Delete a flair template from a subreddit.
|
|
@@ -1066,7 +1065,7 @@ export class _RedditAPIClient {
|
|
|
1066
1065
|
* @param flairTemplateId - The ID of the flair template to delete.
|
|
1067
1066
|
*/
|
|
1068
1067
|
async deleteFlairTemplate(subredditName, flairTemplateId) {
|
|
1069
|
-
return FlairTemplate.deleteFlairTemplate(subredditName, flairTemplateId, __classPrivateFieldGet(this,
|
|
1068
|
+
return FlairTemplate.deleteFlairTemplate(subredditName, flairTemplateId, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1070
1069
|
}
|
|
1071
1070
|
/**
|
|
1072
1071
|
* Set the flair for a user in a subreddit.
|
|
@@ -1081,7 +1080,7 @@ export class _RedditAPIClient {
|
|
|
1081
1080
|
* @param options.textColor - The text color of the flair.
|
|
1082
1081
|
*/
|
|
1083
1082
|
async setUserFlair(options) {
|
|
1084
|
-
return Flair.setUserFlair(options, __classPrivateFieldGet(this,
|
|
1083
|
+
return Flair.setUserFlair(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1085
1084
|
}
|
|
1086
1085
|
/**
|
|
1087
1086
|
* Set the flair of multiple users in the same subreddit with a single API call.
|
|
@@ -1095,7 +1094,7 @@ export class _RedditAPIClient {
|
|
|
1095
1094
|
* @returns {FlairCsvResult[]} - Array of statuses for each entry provided.
|
|
1096
1095
|
*/
|
|
1097
1096
|
async setUserFlairBatch(subredditName, flairs) {
|
|
1098
|
-
return Flair.setUserFlairBatch(subredditName, flairs, __classPrivateFieldGet(this,
|
|
1097
|
+
return Flair.setUserFlairBatch(subredditName, flairs, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1099
1098
|
}
|
|
1100
1099
|
/**
|
|
1101
1100
|
* Remove the flair for a user in a subreddit.
|
|
@@ -1104,7 +1103,7 @@ export class _RedditAPIClient {
|
|
|
1104
1103
|
* @param username - The username of the user to remove the flair from.
|
|
1105
1104
|
*/
|
|
1106
1105
|
async removeUserFlair(subredditName, username) {
|
|
1107
|
-
return Flair.removeUserFlair(subredditName, username, __classPrivateFieldGet(this,
|
|
1106
|
+
return Flair.removeUserFlair(subredditName, username, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1108
1107
|
}
|
|
1109
1108
|
/**
|
|
1110
1109
|
* Set the flair for a post in a subreddit.
|
|
@@ -1119,7 +1118,7 @@ export class _RedditAPIClient {
|
|
|
1119
1118
|
* @param options.textColor - The text color of the flair.
|
|
1120
1119
|
*/
|
|
1121
1120
|
async setPostFlair(options) {
|
|
1122
|
-
return Flair.setPostFlair(options, __classPrivateFieldGet(this,
|
|
1121
|
+
return Flair.setPostFlair(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1123
1122
|
}
|
|
1124
1123
|
/**
|
|
1125
1124
|
* Remove the flair for a post in a subreddit.
|
|
@@ -1128,7 +1127,7 @@ export class _RedditAPIClient {
|
|
|
1128
1127
|
* @param postId - The ID of the post to remove the flair from.
|
|
1129
1128
|
*/
|
|
1130
1129
|
async removePostFlair(subredditName, postId) {
|
|
1131
|
-
return Flair.removePostFlair(subredditName, asT3ID(postId), __classPrivateFieldGet(this,
|
|
1130
|
+
return Flair.removePostFlair(subredditName, asT3ID(postId), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1132
1131
|
}
|
|
1133
1132
|
/**
|
|
1134
1133
|
* Get the widgets for a subreddit.
|
|
@@ -1137,7 +1136,7 @@ export class _RedditAPIClient {
|
|
|
1137
1136
|
* @returns - An array of Widget objects.
|
|
1138
1137
|
*/
|
|
1139
1138
|
async getWidgets(subredditName) {
|
|
1140
|
-
return Widget.getWidgets(subredditName, __classPrivateFieldGet(this,
|
|
1139
|
+
return Widget.getWidgets(subredditName, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1141
1140
|
}
|
|
1142
1141
|
/**
|
|
1143
1142
|
* Delete a widget from a subreddit.
|
|
@@ -1146,7 +1145,7 @@ export class _RedditAPIClient {
|
|
|
1146
1145
|
* @param widgetId - The ID of the widget to delete.
|
|
1147
1146
|
*/
|
|
1148
1147
|
async deleteWidget(subredditName, widgetId) {
|
|
1149
|
-
return Widget.delete(subredditName, widgetId, __classPrivateFieldGet(this,
|
|
1148
|
+
return Widget.delete(subredditName, widgetId, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1150
1149
|
}
|
|
1151
1150
|
/**
|
|
1152
1151
|
* Add a widget to a subreddit.
|
|
@@ -1155,7 +1154,7 @@ export class _RedditAPIClient {
|
|
|
1155
1154
|
* @returns - The added Widget object.
|
|
1156
1155
|
*/
|
|
1157
1156
|
async addWidget(widgetData) {
|
|
1158
|
-
return Widget.add(widgetData, __classPrivateFieldGet(this,
|
|
1157
|
+
return Widget.add(widgetData, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1159
1158
|
}
|
|
1160
1159
|
/**
|
|
1161
1160
|
* Reorder the widgets for a subreddit.
|
|
@@ -1164,7 +1163,7 @@ export class _RedditAPIClient {
|
|
|
1164
1163
|
* @param orderByIds - An array of widget IDs in the order that they should be displayed.
|
|
1165
1164
|
*/
|
|
1166
1165
|
async reorderWidgets(subredditName, orderByIds) {
|
|
1167
|
-
return Widget.reorder(subredditName, orderByIds, __classPrivateFieldGet(this,
|
|
1166
|
+
return Widget.reorder(subredditName, orderByIds, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1168
1167
|
}
|
|
1169
1168
|
/**
|
|
1170
1169
|
* Get a wiki page from a subreddit.
|
|
@@ -1174,7 +1173,7 @@ export class _RedditAPIClient {
|
|
|
1174
1173
|
* @returns The requested WikiPage object.
|
|
1175
1174
|
*/
|
|
1176
1175
|
async getWikiPage(subredditName, page) {
|
|
1177
|
-
return WikiPage.getPage(subredditName, page, __classPrivateFieldGet(this,
|
|
1176
|
+
return WikiPage.getPage(subredditName, page, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1178
1177
|
}
|
|
1179
1178
|
/**
|
|
1180
1179
|
* Get the wiki pages for a subreddit.
|
|
@@ -1183,7 +1182,7 @@ export class _RedditAPIClient {
|
|
|
1183
1182
|
* @returns A list of the wiki page names for the subreddit.
|
|
1184
1183
|
*/
|
|
1185
1184
|
async getWikiPages(subredditName) {
|
|
1186
|
-
return WikiPage.getPages(subredditName, __classPrivateFieldGet(this,
|
|
1185
|
+
return WikiPage.getPages(subredditName, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1187
1186
|
}
|
|
1188
1187
|
/**
|
|
1189
1188
|
* Create a new wiki page for a subreddit.
|
|
@@ -1196,7 +1195,7 @@ export class _RedditAPIClient {
|
|
|
1196
1195
|
* @returns - The created WikiPage object.
|
|
1197
1196
|
*/
|
|
1198
1197
|
async createWikiPage(options) {
|
|
1199
|
-
return WikiPage.createPage(options, __classPrivateFieldGet(this,
|
|
1198
|
+
return WikiPage.createPage(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1200
1199
|
}
|
|
1201
1200
|
/**
|
|
1202
1201
|
* Update a wiki page.
|
|
@@ -1209,7 +1208,7 @@ export class _RedditAPIClient {
|
|
|
1209
1208
|
* @returns The updated WikiPage object.
|
|
1210
1209
|
*/
|
|
1211
1210
|
async updateWikiPage(options) {
|
|
1212
|
-
return WikiPage.updatePage(options, __classPrivateFieldGet(this,
|
|
1211
|
+
return WikiPage.updatePage(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1213
1212
|
}
|
|
1214
1213
|
/**
|
|
1215
1214
|
* Get the revisions for a wiki page.
|
|
@@ -1222,7 +1221,7 @@ export class _RedditAPIClient {
|
|
|
1222
1221
|
* @returns A Listing of WikiPageRevision objects.
|
|
1223
1222
|
*/
|
|
1224
1223
|
getWikiPageRevisions(options) {
|
|
1225
|
-
return WikiPage.getPageRevisions(options, __classPrivateFieldGet(this,
|
|
1224
|
+
return WikiPage.getPageRevisions(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1226
1225
|
}
|
|
1227
1226
|
/**
|
|
1228
1227
|
* Revert a wiki page to a previous revision.
|
|
@@ -1232,7 +1231,7 @@ export class _RedditAPIClient {
|
|
|
1232
1231
|
* @param revisionId - The ID of the revision to revert to.
|
|
1233
1232
|
*/
|
|
1234
1233
|
async revertWikiPage(subredditName, page, revisionId) {
|
|
1235
|
-
return WikiPage.revertPage(subredditName, page, revisionId, __classPrivateFieldGet(this,
|
|
1234
|
+
return WikiPage.revertPage(subredditName, page, revisionId, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1236
1235
|
}
|
|
1237
1236
|
/**
|
|
1238
1237
|
* Get the settings for a wiki page.
|
|
@@ -1242,7 +1241,7 @@ export class _RedditAPIClient {
|
|
|
1242
1241
|
* @returns A WikiPageSettings object.
|
|
1243
1242
|
*/
|
|
1244
1243
|
async getWikiPageSettings(subredditName, page) {
|
|
1245
|
-
return WikiPage.getPageSettings(subredditName, page, __classPrivateFieldGet(this,
|
|
1244
|
+
return WikiPage.getPageSettings(subredditName, page, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1246
1245
|
}
|
|
1247
1246
|
/**
|
|
1248
1247
|
* Update the settings for a wiki page.
|
|
@@ -1255,7 +1254,7 @@ export class _RedditAPIClient {
|
|
|
1255
1254
|
* @returns A WikiPageSettings object.
|
|
1256
1255
|
*/
|
|
1257
1256
|
async updateWikiPageSettings(options) {
|
|
1258
|
-
return WikiPage.updatePageSettings(options, __classPrivateFieldGet(this,
|
|
1257
|
+
return WikiPage.updatePageSettings(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1259
1258
|
}
|
|
1260
1259
|
/**
|
|
1261
1260
|
* Add an editor to a wiki page.
|
|
@@ -1265,7 +1264,7 @@ export class _RedditAPIClient {
|
|
|
1265
1264
|
* @param username - The username of the user to add as an editor.
|
|
1266
1265
|
*/
|
|
1267
1266
|
async addEditorToWikiPage(subredditName, page, username) {
|
|
1268
|
-
return WikiPage.addEditor(subredditName, page, username, __classPrivateFieldGet(this,
|
|
1267
|
+
return WikiPage.addEditor(subredditName, page, username, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1269
1268
|
}
|
|
1270
1269
|
/**
|
|
1271
1270
|
* Remove an editor from a wiki page.
|
|
@@ -1275,7 +1274,7 @@ export class _RedditAPIClient {
|
|
|
1275
1274
|
* @param username - The username of the user to remove as an editor.
|
|
1276
1275
|
*/
|
|
1277
1276
|
async removeEditorFromWikiPage(subredditName, page, username) {
|
|
1278
|
-
return WikiPage.removeEditor(subredditName, page, username, __classPrivateFieldGet(this,
|
|
1277
|
+
return WikiPage.removeEditor(subredditName, page, username, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1279
1278
|
}
|
|
1280
1279
|
/**
|
|
1281
1280
|
* Get private messages sent to the currently authenticated user.
|
|
@@ -1284,13 +1283,13 @@ export class _RedditAPIClient {
|
|
|
1284
1283
|
* @param options.type - The type of messages to get.
|
|
1285
1284
|
*/
|
|
1286
1285
|
getMessages(options) {
|
|
1287
|
-
return PrivateMessage.getMessages(options, __classPrivateFieldGet(this,
|
|
1286
|
+
return PrivateMessage.getMessages(options, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1288
1287
|
}
|
|
1289
1288
|
/**
|
|
1290
1289
|
* Mark all private messages as read.
|
|
1291
1290
|
*/
|
|
1292
1291
|
markAllMessagesAsRead() {
|
|
1293
|
-
return PrivateMessage.markAllAsRead(__classPrivateFieldGet(this,
|
|
1292
|
+
return PrivateMessage.markAllAsRead(__classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1294
1293
|
}
|
|
1295
1294
|
/**
|
|
1296
1295
|
* Report a Post or Comment
|
|
@@ -1303,7 +1302,7 @@ export class _RedditAPIClient {
|
|
|
1303
1302
|
*
|
|
1304
1303
|
* @example
|
|
1305
1304
|
* ```ts
|
|
1306
|
-
* await report(post, {
|
|
1305
|
+
* await reddit.report(post, {
|
|
1307
1306
|
* reason: 'This is spam!',
|
|
1308
1307
|
* })
|
|
1309
1308
|
* ```
|
|
@@ -1315,37 +1314,37 @@ export class _RedditAPIClient {
|
|
|
1315
1314
|
thingId: thing.id,
|
|
1316
1315
|
srName: thing.subredditName,
|
|
1317
1316
|
usernames: thing.authorName,
|
|
1318
|
-
}, __classPrivateFieldGet(this,
|
|
1317
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1319
1318
|
}
|
|
1320
1319
|
getModQueue(options) {
|
|
1321
1320
|
return Subreddit.aboutLocation({
|
|
1322
1321
|
...options,
|
|
1323
1322
|
location: AboutLocations.Modqueue,
|
|
1324
|
-
}, __classPrivateFieldGet(this,
|
|
1323
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1325
1324
|
}
|
|
1326
1325
|
getReports(options) {
|
|
1327
1326
|
return Subreddit.aboutLocation({
|
|
1328
1327
|
...options,
|
|
1329
1328
|
location: AboutLocations.Reports,
|
|
1330
|
-
}, __classPrivateFieldGet(this,
|
|
1329
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1331
1330
|
}
|
|
1332
1331
|
getSpam(options) {
|
|
1333
1332
|
return Subreddit.aboutLocation({
|
|
1334
1333
|
...options,
|
|
1335
1334
|
location: AboutLocations.Spam,
|
|
1336
|
-
}, __classPrivateFieldGet(this,
|
|
1335
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1337
1336
|
}
|
|
1338
1337
|
getUnmoderated(options) {
|
|
1339
1338
|
return Subreddit.aboutLocation({
|
|
1340
1339
|
...options,
|
|
1341
1340
|
location: AboutLocations.Unmoderated,
|
|
1342
|
-
}, __classPrivateFieldGet(this,
|
|
1341
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1343
1342
|
}
|
|
1344
1343
|
getEdited(options) {
|
|
1345
1344
|
return Subreddit.aboutLocation({
|
|
1346
1345
|
...options,
|
|
1347
1346
|
location: AboutLocations.Edited,
|
|
1348
|
-
}, __classPrivateFieldGet(this,
|
|
1347
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1349
1348
|
}
|
|
1350
1349
|
/**
|
|
1351
1350
|
* Gets a {@link Vault} for the specified address.
|
|
@@ -1353,11 +1352,11 @@ export class _RedditAPIClient {
|
|
|
1353
1352
|
* @param {string} address - The address (starting with 0x) of the Vault.
|
|
1354
1353
|
* @example
|
|
1355
1354
|
* ```ts
|
|
1356
|
-
* const vault = await getVaultByAddress('0x205ee28744456bDBf180A0Fa7De51e0F116d54Ed');
|
|
1355
|
+
* const vault = await reddit.getVaultByAddress('0x205ee28744456bDBf180A0Fa7De51e0F116d54Ed');
|
|
1357
1356
|
* ```
|
|
1358
1357
|
*/
|
|
1359
1358
|
getVaultByAddress(address) {
|
|
1360
|
-
return getVaultByAddress(address, __classPrivateFieldGet(this,
|
|
1359
|
+
return getVaultByAddress(address, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1361
1360
|
}
|
|
1362
1361
|
/**
|
|
1363
1362
|
* Gets a {@link Vault} for the specified user.
|
|
@@ -1365,11 +1364,11 @@ export class _RedditAPIClient {
|
|
|
1365
1364
|
* @param {string} userId - The ID (starting with t2_) of the Vault owner.
|
|
1366
1365
|
* @example
|
|
1367
1366
|
* ```ts
|
|
1368
|
-
* const vault = await getVaultByUserId('t2_1w72');
|
|
1367
|
+
* const vault = await reddit.getVaultByUserId('t2_1w72');
|
|
1369
1368
|
* ```
|
|
1370
1369
|
*/
|
|
1371
1370
|
getVaultByUserId(userId) {
|
|
1372
|
-
return getVaultByUserId(asTID(userId), __classPrivateFieldGet(this,
|
|
1371
|
+
return getVaultByUserId(asTID(userId), __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1373
1372
|
}
|
|
1374
1373
|
/**
|
|
1375
1374
|
* Returns a leaderboard for a given subreddit ID.
|
|
@@ -1379,7 +1378,7 @@ export class _RedditAPIClient {
|
|
|
1379
1378
|
* @returns {SubredditLeaderboard} Leaderboard for the given subreddit.
|
|
1380
1379
|
*/
|
|
1381
1380
|
getSubredditLeaderboard(subredditId) {
|
|
1382
|
-
return
|
|
1381
|
+
return getSubredditLeaderboard(subredditId, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1383
1382
|
}
|
|
1384
1383
|
/**
|
|
1385
1384
|
* Returns the styles for a given subreddit ID.
|
|
@@ -1389,7 +1388,7 @@ export class _RedditAPIClient {
|
|
|
1389
1388
|
* @returns {SubredditStyles} Styles for the given subreddit.
|
|
1390
1389
|
*/
|
|
1391
1390
|
getSubredditStyles(subredditId) {
|
|
1392
|
-
return
|
|
1391
|
+
return getSubredditStyles(subredditId, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1393
1392
|
}
|
|
1394
1393
|
/**
|
|
1395
1394
|
* Subscribes to the subreddit in which the app is installed. No-op if the user is already subscribed.
|
|
@@ -1405,7 +1404,7 @@ export class _RedditAPIClient {
|
|
|
1405
1404
|
srName: currentSubreddit.name,
|
|
1406
1405
|
sr: '',
|
|
1407
1406
|
skipInitialDefaults: true,
|
|
1408
|
-
}, __classPrivateFieldGet(this,
|
|
1407
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1409
1408
|
}
|
|
1410
1409
|
/**
|
|
1411
1410
|
* Unsubscribes from the subreddit in which the app is installed. No-op if the user isn't subscribed.
|
|
@@ -1421,7 +1420,7 @@ export class _RedditAPIClient {
|
|
|
1421
1420
|
srName: currentSubreddit.name,
|
|
1422
1421
|
sr: '',
|
|
1423
1422
|
skipInitialDefaults: false,
|
|
1424
|
-
}, __classPrivateFieldGet(this,
|
|
1423
|
+
}, __classPrivateFieldGet(this, _RedditAPIClient_metadata, "f"));
|
|
1425
1424
|
}
|
|
1426
1425
|
}
|
|
1427
|
-
|
|
1426
|
+
_RedditAPIClient_metadata = new WeakMap(), _RedditAPIClient_modMailService = new WeakMap(), _RedditAPIClient_currentUser = new WeakMap(), _RedditAPIClient_currentUsername = new WeakMap();
|