@fulldivevr/workcord-cli 1.0.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/LICENSE +18 -0
- package/README.md +312 -0
- package/dist/auth.js +9 -0
- package/dist/cli.js +46 -0
- package/dist/client.js +125 -0
- package/dist/commands/_group.js +5 -0
- package/dist/commands/auth.js +125 -0
- package/dist/commands/challenges.js +51 -0
- package/dist/commands/custom-agents.js +120 -0
- package/dist/commands/dm.js +35 -0
- package/dist/commands/messages.js +360 -0
- package/dist/commands/room-agents.js +47 -0
- package/dist/commands/rooms.js +687 -0
- package/dist/commands/users.js +126 -0
- package/dist/commands/whoami.js +15 -0
- package/dist/generated/_helpers.js +8 -0
- package/dist/generated/commands/activity.js +46 -0
- package/dist/generated/commands/ai.js +40 -0
- package/dist/generated/commands/ambassador.js +34 -0
- package/dist/generated/commands/apple-iap.js +61 -0
- package/dist/generated/commands/attribution.js +130 -0
- package/dist/generated/commands/auth.js +205 -0
- package/dist/generated/commands/challenges.js +251 -0
- package/dist/generated/commands/clips.js +71 -0
- package/dist/generated/commands/contact-match.js +92 -0
- package/dist/generated/commands/content-crawler.js +27 -0
- package/dist/generated/commands/custom-agents.js +346 -0
- package/dist/generated/commands/desktop-releases.js +236 -0
- package/dist/generated/commands/discover.js +236 -0
- package/dist/generated/commands/dm.js +155 -0
- package/dist/generated/commands/drafts.js +41 -0
- package/dist/generated/commands/embed.js +34 -0
- package/dist/generated/commands/explore.js +19 -0
- package/dist/generated/commands/feed.js +67 -0
- package/dist/generated/commands/feedback.js +44 -0
- package/dist/generated/commands/gamification.js +33 -0
- package/dist/generated/commands/google-play-iap.js +73 -0
- package/dist/generated/commands/health.js +32 -0
- package/dist/generated/commands/internal.js +162 -0
- package/dist/generated/commands/interview.js +76 -0
- package/dist/generated/commands/invite-redirect.js +20 -0
- package/dist/generated/commands/jesuscord-admin.js +36 -0
- package/dist/generated/commands/join.js +27 -0
- package/dist/generated/commands/kits.js +108 -0
- package/dist/generated/commands/meetings.js +81 -0
- package/dist/generated/commands/message-folders.js +68 -0
- package/dist/generated/commands/messages.js +418 -0
- package/dist/generated/commands/one-emulator.js +32 -0
- package/dist/generated/commands/pdf-export.js +19 -0
- package/dist/generated/commands/pin-folders.js +72 -0
- package/dist/generated/commands/pinned-messages.js +81 -0
- package/dist/generated/commands/polls.js +152 -0
- package/dist/generated/commands/premium-feeds.js +32 -0
- package/dist/generated/commands/processors.js +22 -0
- package/dist/generated/commands/questions.js +54 -0
- package/dist/generated/commands/referrals.js +19 -0
- package/dist/generated/commands/reports.js +21 -0
- package/dist/generated/commands/room-a2-a.js +81 -0
- package/dist/generated/commands/room-agents.js +273 -0
- package/dist/generated/commands/room-invites.js +155 -0
- package/dist/generated/commands/room-owned-agent.js +36 -0
- package/dist/generated/commands/room-page.js +20 -0
- package/dist/generated/commands/rooms.js +1117 -0
- package/dist/generated/commands/saved-messages.js +84 -0
- package/dist/generated/commands/saved-stories.js +125 -0
- package/dist/generated/commands/search.js +44 -0
- package/dist/generated/commands/shadow-home-agent.js +36 -0
- package/dist/generated/commands/shadow.js +64 -0
- package/dist/generated/commands/share-cards.js +85 -0
- package/dist/generated/commands/share.js +20 -0
- package/dist/generated/commands/sponsors.js +20 -0
- package/dist/generated/commands/stories.js +324 -0
- package/dist/generated/commands/story-by-id.js +20 -0
- package/dist/generated/commands/submissions.js +112 -0
- package/dist/generated/commands/subscriptions.js +103 -0
- package/dist/generated/commands/tips.js +76 -0
- package/dist/generated/commands/users.js +373 -0
- package/dist/generated/commands/voice-token.js +21 -0
- package/dist/generated/commands/well-known.js +32 -0
- package/dist/generated/commands/wrapped.js +20 -0
- package/dist/generated/index.js +131 -0
- package/package.json +60 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { call } from "../../client.js";
|
|
2
|
+
import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
|
|
3
|
+
export function register(program) {
|
|
4
|
+
const group = getOrCreateGroup(program, "stories", "Stories operations");
|
|
5
|
+
if (!hasSubcommand(group, "create")) {
|
|
6
|
+
group
|
|
7
|
+
.command("create")
|
|
8
|
+
.description("POST /api/v1/rooms/{roomId}/stories")
|
|
9
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
10
|
+
.requiredOption("--headline <value>", "string")
|
|
11
|
+
.option("--summary <value>", "string")
|
|
12
|
+
.option("--bullet-points <comma-separated>", "array")
|
|
13
|
+
.option("--category <value>", "string")
|
|
14
|
+
.option("--tags <comma-separated>", "array")
|
|
15
|
+
.option("--is-anonymous <true|false>", "boolean")
|
|
16
|
+
.option("--source-url <value>", "string")
|
|
17
|
+
.option("--sources <json>", "array (JSON)")
|
|
18
|
+
.option("--claims <json>", "array (JSON)")
|
|
19
|
+
.option("--hero-image-url <value>", "string")
|
|
20
|
+
.option("--image-urls <comma-separated>", "array, ≤5 items")
|
|
21
|
+
.option("--meme-image-url <value>", "string")
|
|
22
|
+
.option("--meme-top-text <value>", "string")
|
|
23
|
+
.option("--meme-bottom-text <value>", "string")
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
const { as } = program.opts();
|
|
26
|
+
if (!as)
|
|
27
|
+
throw new Error("--as <userId> is required");
|
|
28
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories`;
|
|
29
|
+
const body = {};
|
|
30
|
+
{
|
|
31
|
+
const v = opts.headline;
|
|
32
|
+
if (v !== undefined)
|
|
33
|
+
body["headline"] = v;
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
const v = opts.summary;
|
|
37
|
+
if (v !== undefined)
|
|
38
|
+
body["summary"] = v;
|
|
39
|
+
}
|
|
40
|
+
{
|
|
41
|
+
const v = opts.bulletPoints === undefined ? undefined : opts.bulletPoints.split(",").map((s) => s.trim()).filter(Boolean);
|
|
42
|
+
if (v !== undefined)
|
|
43
|
+
body["bulletPoints"] = v;
|
|
44
|
+
}
|
|
45
|
+
{
|
|
46
|
+
const v = opts.category;
|
|
47
|
+
if (v !== undefined)
|
|
48
|
+
body["category"] = v;
|
|
49
|
+
}
|
|
50
|
+
{
|
|
51
|
+
const v = opts.tags === undefined ? undefined : opts.tags.split(",").map((s) => s.trim()).filter(Boolean);
|
|
52
|
+
if (v !== undefined)
|
|
53
|
+
body["tags"] = v;
|
|
54
|
+
}
|
|
55
|
+
{
|
|
56
|
+
const v = opts.isAnonymous === undefined ? undefined : opts.isAnonymous === "true";
|
|
57
|
+
if (v !== undefined)
|
|
58
|
+
body["isAnonymous"] = v;
|
|
59
|
+
}
|
|
60
|
+
{
|
|
61
|
+
const v = opts.sourceUrl;
|
|
62
|
+
if (v !== undefined)
|
|
63
|
+
body["sourceUrl"] = v;
|
|
64
|
+
}
|
|
65
|
+
{
|
|
66
|
+
const v = opts.sources === undefined ? undefined : JSON.parse(opts.sources);
|
|
67
|
+
if (v !== undefined)
|
|
68
|
+
body["sources"] = v;
|
|
69
|
+
}
|
|
70
|
+
{
|
|
71
|
+
const v = opts.claims === undefined ? undefined : JSON.parse(opts.claims);
|
|
72
|
+
if (v !== undefined)
|
|
73
|
+
body["claims"] = v;
|
|
74
|
+
}
|
|
75
|
+
{
|
|
76
|
+
const v = opts.heroImageUrl;
|
|
77
|
+
if (v !== undefined)
|
|
78
|
+
body["heroImageUrl"] = v;
|
|
79
|
+
}
|
|
80
|
+
{
|
|
81
|
+
const v = opts.imageUrls === undefined ? undefined : opts.imageUrls.split(",").map((s) => s.trim()).filter(Boolean);
|
|
82
|
+
if (v !== undefined)
|
|
83
|
+
body["imageUrls"] = v;
|
|
84
|
+
}
|
|
85
|
+
{
|
|
86
|
+
const v = opts.memeImageUrl;
|
|
87
|
+
if (v !== undefined)
|
|
88
|
+
body["memeImageUrl"] = v;
|
|
89
|
+
}
|
|
90
|
+
{
|
|
91
|
+
const v = opts.memeTopText;
|
|
92
|
+
if (v !== undefined)
|
|
93
|
+
body["memeTopText"] = v;
|
|
94
|
+
}
|
|
95
|
+
{
|
|
96
|
+
const v = opts.memeBottomText;
|
|
97
|
+
if (v !== undefined)
|
|
98
|
+
body["memeBottomText"] = v;
|
|
99
|
+
}
|
|
100
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
101
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (!hasSubcommand(group, "list")) {
|
|
105
|
+
group
|
|
106
|
+
.command("list")
|
|
107
|
+
.description("GET /api/v1/rooms/{roomId}/stories")
|
|
108
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
109
|
+
.option("--status <value>", "string")
|
|
110
|
+
.option("--search <value>", "string")
|
|
111
|
+
.option("--cursor <value>", "string")
|
|
112
|
+
.option("--limit <value>", "string")
|
|
113
|
+
.option("--ids <value>", "string")
|
|
114
|
+
.action(async (opts) => {
|
|
115
|
+
const { as } = program.opts();
|
|
116
|
+
if (!as)
|
|
117
|
+
throw new Error("--as <userId> is required");
|
|
118
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories`;
|
|
119
|
+
const query = {};
|
|
120
|
+
{
|
|
121
|
+
const v = opts.status;
|
|
122
|
+
if (v !== undefined)
|
|
123
|
+
query["status"] = v;
|
|
124
|
+
}
|
|
125
|
+
{
|
|
126
|
+
const v = opts.search;
|
|
127
|
+
if (v !== undefined)
|
|
128
|
+
query["search"] = v;
|
|
129
|
+
}
|
|
130
|
+
{
|
|
131
|
+
const v = opts.cursor;
|
|
132
|
+
if (v !== undefined)
|
|
133
|
+
query["cursor"] = v;
|
|
134
|
+
}
|
|
135
|
+
{
|
|
136
|
+
const v = opts.limit;
|
|
137
|
+
if (v !== undefined)
|
|
138
|
+
query["limit"] = v;
|
|
139
|
+
}
|
|
140
|
+
{
|
|
141
|
+
const v = opts.ids;
|
|
142
|
+
if (v !== undefined)
|
|
143
|
+
query["ids"] = v;
|
|
144
|
+
}
|
|
145
|
+
const data = await call({ method: "GET", path, asUserId: as, query });
|
|
146
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (!hasSubcommand(group, "get")) {
|
|
150
|
+
group
|
|
151
|
+
.command("get")
|
|
152
|
+
.description("GET /api/v1/rooms/{roomId}/stories/{storyId}")
|
|
153
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
154
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
155
|
+
.action(async (opts) => {
|
|
156
|
+
const { as } = program.opts();
|
|
157
|
+
if (!as)
|
|
158
|
+
throw new Error("--as <userId> is required");
|
|
159
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}`;
|
|
160
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
161
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (!hasSubcommand(group, "sources")) {
|
|
165
|
+
group
|
|
166
|
+
.command("sources")
|
|
167
|
+
.description("GET /api/v1/rooms/{roomId}/stories/{storyId}/sources")
|
|
168
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
169
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
170
|
+
.action(async (opts) => {
|
|
171
|
+
const { as } = program.opts();
|
|
172
|
+
if (!as)
|
|
173
|
+
throw new Error("--as <userId> is required");
|
|
174
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/sources`;
|
|
175
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
176
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (!hasSubcommand(group, "claims")) {
|
|
180
|
+
group
|
|
181
|
+
.command("claims")
|
|
182
|
+
.description("GET /api/v1/rooms/{roomId}/stories/{storyId}/claims")
|
|
183
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
184
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
185
|
+
.action(async (opts) => {
|
|
186
|
+
const { as } = program.opts();
|
|
187
|
+
if (!as)
|
|
188
|
+
throw new Error("--as <userId> is required");
|
|
189
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/claims`;
|
|
190
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
191
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
if (!hasSubcommand(group, "add-reaction")) {
|
|
195
|
+
group
|
|
196
|
+
.command("add-reaction")
|
|
197
|
+
.description("POST /api/v1/rooms/{roomId}/stories/{storyId}/reactions")
|
|
198
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
199
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
200
|
+
.requiredOption("--type <value>", "string")
|
|
201
|
+
.action(async (opts) => {
|
|
202
|
+
const { as } = program.opts();
|
|
203
|
+
if (!as)
|
|
204
|
+
throw new Error("--as <userId> is required");
|
|
205
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/reactions`;
|
|
206
|
+
const body = {};
|
|
207
|
+
{
|
|
208
|
+
const v = opts.type;
|
|
209
|
+
if (v !== undefined)
|
|
210
|
+
body["type"] = v;
|
|
211
|
+
}
|
|
212
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
213
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
if (!hasSubcommand(group, "remove-reaction")) {
|
|
217
|
+
group
|
|
218
|
+
.command("remove-reaction")
|
|
219
|
+
.description("DELETE /api/v1/rooms/{roomId}/stories/{storyId}/reactions/{reactionId}")
|
|
220
|
+
.requiredOption("--reaction-id <value>", "reactionId (path param)")
|
|
221
|
+
.action(async (opts) => {
|
|
222
|
+
const { as } = program.opts();
|
|
223
|
+
if (!as)
|
|
224
|
+
throw new Error("--as <userId> is required");
|
|
225
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/reactions/${encodeURIComponent(opts.reactionId)}`;
|
|
226
|
+
const data = await call({ method: "DELETE", path, asUserId: as });
|
|
227
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (!hasSubcommand(group, "disputes")) {
|
|
231
|
+
group
|
|
232
|
+
.command("disputes")
|
|
233
|
+
.description("GET /api/v1/rooms/{roomId}/stories/{storyId}/disputes")
|
|
234
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
235
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
236
|
+
.action(async (opts) => {
|
|
237
|
+
const { as } = program.opts();
|
|
238
|
+
if (!as)
|
|
239
|
+
throw new Error("--as <userId> is required");
|
|
240
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/disputes`;
|
|
241
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
242
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (!hasSubcommand(group, "create-dispute")) {
|
|
246
|
+
group
|
|
247
|
+
.command("create-dispute")
|
|
248
|
+
.description("POST /api/v1/rooms/{roomId}/stories/{storyId}/disputes")
|
|
249
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
250
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
251
|
+
.requiredOption("--type <value>", "string")
|
|
252
|
+
.option("--note <value>", "string")
|
|
253
|
+
.option("--counter-source-url <value>", "string")
|
|
254
|
+
.action(async (opts) => {
|
|
255
|
+
const { as } = program.opts();
|
|
256
|
+
if (!as)
|
|
257
|
+
throw new Error("--as <userId> is required");
|
|
258
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/disputes`;
|
|
259
|
+
const body = {};
|
|
260
|
+
{
|
|
261
|
+
const v = opts.type;
|
|
262
|
+
if (v !== undefined)
|
|
263
|
+
body["type"] = v;
|
|
264
|
+
}
|
|
265
|
+
{
|
|
266
|
+
const v = opts.note;
|
|
267
|
+
if (v !== undefined)
|
|
268
|
+
body["note"] = v;
|
|
269
|
+
}
|
|
270
|
+
{
|
|
271
|
+
const v = opts.counterSourceUrl;
|
|
272
|
+
if (v !== undefined)
|
|
273
|
+
body["counterSourceUrl"] = v;
|
|
274
|
+
}
|
|
275
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
276
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (!hasSubcommand(group, "syndicate")) {
|
|
280
|
+
group
|
|
281
|
+
.command("syndicate")
|
|
282
|
+
.description("POST /api/v1/rooms/{roomId}/stories/{storyId}/syndicate")
|
|
283
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
284
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
285
|
+
.requiredOption("--target-room-id <value>", "string")
|
|
286
|
+
.action(async (opts) => {
|
|
287
|
+
const { as } = program.opts();
|
|
288
|
+
if (!as)
|
|
289
|
+
throw new Error("--as <userId> is required");
|
|
290
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/syndicate`;
|
|
291
|
+
const body = {};
|
|
292
|
+
{
|
|
293
|
+
const v = opts.targetRoomId;
|
|
294
|
+
if (v !== undefined)
|
|
295
|
+
body["targetRoomId"] = v;
|
|
296
|
+
}
|
|
297
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
298
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (!hasSubcommand(group, "ask-question")) {
|
|
302
|
+
group
|
|
303
|
+
.command("ask-question")
|
|
304
|
+
.description("POST /api/v1/rooms/{roomId}/stories/{storyId}/questions")
|
|
305
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
306
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
307
|
+
.requiredOption("--question <value>", "string")
|
|
308
|
+
.action(async (opts) => {
|
|
309
|
+
const { as } = program.opts();
|
|
310
|
+
if (!as)
|
|
311
|
+
throw new Error("--as <userId> is required");
|
|
312
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/questions`;
|
|
313
|
+
const body = {};
|
|
314
|
+
{
|
|
315
|
+
const v = opts.question;
|
|
316
|
+
if (v !== undefined)
|
|
317
|
+
body["question"] = v;
|
|
318
|
+
}
|
|
319
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
320
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=stories.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { call } from "../../client.js";
|
|
2
|
+
import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
|
|
3
|
+
export function register(program) {
|
|
4
|
+
const group = getOrCreateGroup(program, "story-by-id", "StoryById operations");
|
|
5
|
+
if (!hasSubcommand(group, "get")) {
|
|
6
|
+
group
|
|
7
|
+
.command("get")
|
|
8
|
+
.description("GET /api/v1/stories/{storyId}")
|
|
9
|
+
.requiredOption("--story-id <value>", "storyId (path param)")
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
const { as } = program.opts();
|
|
12
|
+
if (!as)
|
|
13
|
+
throw new Error("--as <userId> is required");
|
|
14
|
+
const path = `/api/v1/stories/${encodeURIComponent(opts.storyId)}`;
|
|
15
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
16
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=story-by-id.js.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { call } from "../../client.js";
|
|
2
|
+
import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
|
|
3
|
+
export function register(program) {
|
|
4
|
+
const group = getOrCreateGroup(program, "submissions", "Submissions operations");
|
|
5
|
+
if (!hasSubcommand(group, "create")) {
|
|
6
|
+
group
|
|
7
|
+
.command("create")
|
|
8
|
+
.description("POST /api/v1/rooms/{roomId}/submissions")
|
|
9
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
10
|
+
.option("--content <value>", "string")
|
|
11
|
+
.option("--headline <value>", "string")
|
|
12
|
+
.option("--source-url <value>", "string")
|
|
13
|
+
.option("--tags <comma-separated>", "array")
|
|
14
|
+
.option("--is-anonymous <true|false>", "boolean")
|
|
15
|
+
.option("--image-url <value>", "string")
|
|
16
|
+
.option("--image-urls <comma-separated>", "array, ≤5 items")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const { as } = program.opts();
|
|
19
|
+
if (!as)
|
|
20
|
+
throw new Error("--as <userId> is required");
|
|
21
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/submissions`;
|
|
22
|
+
const body = {};
|
|
23
|
+
{
|
|
24
|
+
const v = opts.content;
|
|
25
|
+
if (v !== undefined)
|
|
26
|
+
body["content"] = v;
|
|
27
|
+
}
|
|
28
|
+
{
|
|
29
|
+
const v = opts.headline;
|
|
30
|
+
if (v !== undefined)
|
|
31
|
+
body["headline"] = v;
|
|
32
|
+
}
|
|
33
|
+
{
|
|
34
|
+
const v = opts.sourceUrl;
|
|
35
|
+
if (v !== undefined)
|
|
36
|
+
body["sourceUrl"] = v;
|
|
37
|
+
}
|
|
38
|
+
{
|
|
39
|
+
const v = opts.tags === undefined ? undefined : opts.tags.split(",").map((s) => s.trim()).filter(Boolean);
|
|
40
|
+
if (v !== undefined)
|
|
41
|
+
body["tags"] = v;
|
|
42
|
+
}
|
|
43
|
+
{
|
|
44
|
+
const v = opts.isAnonymous === undefined ? undefined : opts.isAnonymous === "true";
|
|
45
|
+
if (v !== undefined)
|
|
46
|
+
body["isAnonymous"] = v;
|
|
47
|
+
}
|
|
48
|
+
{
|
|
49
|
+
const v = opts.imageUrl;
|
|
50
|
+
if (v !== undefined)
|
|
51
|
+
body["imageUrl"] = v;
|
|
52
|
+
}
|
|
53
|
+
{
|
|
54
|
+
const v = opts.imageUrls === undefined ? undefined : opts.imageUrls.split(",").map((s) => s.trim()).filter(Boolean);
|
|
55
|
+
if (v !== undefined)
|
|
56
|
+
body["imageUrls"] = v;
|
|
57
|
+
}
|
|
58
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
59
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (!hasSubcommand(group, "list")) {
|
|
63
|
+
group
|
|
64
|
+
.command("list")
|
|
65
|
+
.description("GET /api/v1/rooms/{roomId}/submissions")
|
|
66
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
67
|
+
.option("--cursor <value>", "string")
|
|
68
|
+
.option("--limit <value>", "string")
|
|
69
|
+
.action(async (opts) => {
|
|
70
|
+
const { as } = program.opts();
|
|
71
|
+
if (!as)
|
|
72
|
+
throw new Error("--as <userId> is required");
|
|
73
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/submissions`;
|
|
74
|
+
const query = {};
|
|
75
|
+
{
|
|
76
|
+
const v = opts.cursor;
|
|
77
|
+
if (v !== undefined)
|
|
78
|
+
query["cursor"] = v;
|
|
79
|
+
}
|
|
80
|
+
{
|
|
81
|
+
const v = opts.limit;
|
|
82
|
+
if (v !== undefined)
|
|
83
|
+
query["limit"] = v;
|
|
84
|
+
}
|
|
85
|
+
const data = await call({ method: "GET", path, asUserId: as, query });
|
|
86
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!hasSubcommand(group, "update")) {
|
|
90
|
+
group
|
|
91
|
+
.command("update")
|
|
92
|
+
.description("PATCH /api/v1/rooms/{roomId}/submissions/{submissionId}")
|
|
93
|
+
.requiredOption("--room-id <value>", "roomId (path param)")
|
|
94
|
+
.requiredOption("--submission-id <value>", "submissionId (path param)")
|
|
95
|
+
.requiredOption("--status <value>", "string")
|
|
96
|
+
.action(async (opts) => {
|
|
97
|
+
const { as } = program.opts();
|
|
98
|
+
if (!as)
|
|
99
|
+
throw new Error("--as <userId> is required");
|
|
100
|
+
const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/submissions/${encodeURIComponent(opts.submissionId)}`;
|
|
101
|
+
const body = {};
|
|
102
|
+
{
|
|
103
|
+
const v = opts.status;
|
|
104
|
+
if (v !== undefined)
|
|
105
|
+
body["status"] = v;
|
|
106
|
+
}
|
|
107
|
+
const data = await call({ method: "PATCH", path, asUserId: as, body });
|
|
108
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=submissions.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { call } from "../../client.js";
|
|
2
|
+
import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
|
|
3
|
+
export function register(program) {
|
|
4
|
+
const group = getOrCreateGroup(program, "subscriptions", "Subscriptions operations");
|
|
5
|
+
if (!hasSubcommand(group, "list-plans")) {
|
|
6
|
+
group
|
|
7
|
+
.command("list-plans")
|
|
8
|
+
.description("GET /api/v1/plans")
|
|
9
|
+
.action(async (opts) => {
|
|
10
|
+
const { as } = program.opts();
|
|
11
|
+
if (!as)
|
|
12
|
+
throw new Error("--as <userId> is required");
|
|
13
|
+
const path = `/api/v1/plans`;
|
|
14
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
15
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (!hasSubcommand(group, "get")) {
|
|
19
|
+
group
|
|
20
|
+
.command("get")
|
|
21
|
+
.description("GET /api/v1/users/me/subscription")
|
|
22
|
+
.action(async (opts) => {
|
|
23
|
+
const { as } = program.opts();
|
|
24
|
+
if (!as)
|
|
25
|
+
throw new Error("--as <userId> is required");
|
|
26
|
+
const path = `/api/v1/users/me/subscription`;
|
|
27
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
28
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!hasSubcommand(group, "create-checkout-session")) {
|
|
32
|
+
group
|
|
33
|
+
.command("create-checkout-session")
|
|
34
|
+
.description("POST /api/v1/subscriptions/checkout-session")
|
|
35
|
+
.option("--body <json>", "request body as JSON (no schema available)")
|
|
36
|
+
.action(async (opts) => {
|
|
37
|
+
const { as } = program.opts();
|
|
38
|
+
if (!as)
|
|
39
|
+
throw new Error("--as <userId> is required");
|
|
40
|
+
const path = `/api/v1/subscriptions/checkout-session`;
|
|
41
|
+
const body = opts.body ? JSON.parse(opts.body) : undefined;
|
|
42
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
43
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (!hasSubcommand(group, "create-portal-session")) {
|
|
47
|
+
group
|
|
48
|
+
.command("create-portal-session")
|
|
49
|
+
.description("POST /api/v1/subscriptions/portal-session")
|
|
50
|
+
.option("--body <json>", "request body as JSON (no schema available)")
|
|
51
|
+
.action(async (opts) => {
|
|
52
|
+
const { as } = program.opts();
|
|
53
|
+
if (!as)
|
|
54
|
+
throw new Error("--as <userId> is required");
|
|
55
|
+
const path = `/api/v1/subscriptions/portal-session`;
|
|
56
|
+
const body = opts.body ? JSON.parse(opts.body) : undefined;
|
|
57
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
58
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (!hasSubcommand(group, "handle-stripe-webhook")) {
|
|
62
|
+
group
|
|
63
|
+
.command("handle-stripe-webhook")
|
|
64
|
+
.description("POST /api/v1/webhooks/stripe")
|
|
65
|
+
.option("--body <json>", "request body as JSON (no schema available)")
|
|
66
|
+
.action(async (opts) => {
|
|
67
|
+
const { as } = program.opts();
|
|
68
|
+
if (!as)
|
|
69
|
+
throw new Error("--as <userId> is required");
|
|
70
|
+
const path = `/api/v1/webhooks/stripe`;
|
|
71
|
+
const body = opts.body ? JSON.parse(opts.body) : undefined;
|
|
72
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
73
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (!hasSubcommand(group, "success-page")) {
|
|
77
|
+
group
|
|
78
|
+
.command("success-page")
|
|
79
|
+
.description("GET /api/v1/subscriptions/success")
|
|
80
|
+
.action(async (opts) => {
|
|
81
|
+
const { as } = program.opts();
|
|
82
|
+
if (!as)
|
|
83
|
+
throw new Error("--as <userId> is required");
|
|
84
|
+
const path = `/api/v1/subscriptions/success`;
|
|
85
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
86
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!hasSubcommand(group, "cancel-page")) {
|
|
90
|
+
group
|
|
91
|
+
.command("cancel-page")
|
|
92
|
+
.description("GET /api/v1/subscriptions/cancel")
|
|
93
|
+
.action(async (opts) => {
|
|
94
|
+
const { as } = program.opts();
|
|
95
|
+
if (!as)
|
|
96
|
+
throw new Error("--as <userId> is required");
|
|
97
|
+
const path = `/api/v1/subscriptions/cancel`;
|
|
98
|
+
const data = await call({ method: "GET", path, asUserId: as });
|
|
99
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { call } from "../../client.js";
|
|
2
|
+
import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
|
|
3
|
+
export function register(program) {
|
|
4
|
+
const group = getOrCreateGroup(program, "tips", "Tips operations");
|
|
5
|
+
if (!hasSubcommand(group, "send")) {
|
|
6
|
+
group
|
|
7
|
+
.command("send")
|
|
8
|
+
.description("POST /api/v1/tips")
|
|
9
|
+
.requiredOption("--to-user-id <value>", "string")
|
|
10
|
+
.requiredOption("--story-id <value>", "string")
|
|
11
|
+
.requiredOption("--room-id <value>", "string")
|
|
12
|
+
.requiredOption("--amount <n>", "number")
|
|
13
|
+
.requiredOption("--currency <value>", "string")
|
|
14
|
+
.action(async (opts) => {
|
|
15
|
+
const { as } = program.opts();
|
|
16
|
+
if (!as)
|
|
17
|
+
throw new Error("--as <userId> is required");
|
|
18
|
+
const path = `/api/v1/tips`;
|
|
19
|
+
const body = {};
|
|
20
|
+
{
|
|
21
|
+
const v = opts.toUserId;
|
|
22
|
+
if (v !== undefined)
|
|
23
|
+
body["toUserId"] = v;
|
|
24
|
+
}
|
|
25
|
+
{
|
|
26
|
+
const v = opts.storyId;
|
|
27
|
+
if (v !== undefined)
|
|
28
|
+
body["storyId"] = v;
|
|
29
|
+
}
|
|
30
|
+
{
|
|
31
|
+
const v = opts.roomId;
|
|
32
|
+
if (v !== undefined)
|
|
33
|
+
body["roomId"] = v;
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
const v = opts.amount === undefined ? undefined : Number(opts.amount);
|
|
37
|
+
if (v !== undefined)
|
|
38
|
+
body["amount"] = v;
|
|
39
|
+
}
|
|
40
|
+
{
|
|
41
|
+
const v = opts.currency;
|
|
42
|
+
if (v !== undefined)
|
|
43
|
+
body["currency"] = v;
|
|
44
|
+
}
|
|
45
|
+
const data = await call({ method: "POST", path, asUserId: as, body });
|
|
46
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!hasSubcommand(group, "received")) {
|
|
50
|
+
group
|
|
51
|
+
.command("received")
|
|
52
|
+
.description("GET /api/v1/users/me/tips/received")
|
|
53
|
+
.option("--cursor <value>", "string")
|
|
54
|
+
.option("--limit <value>", "string")
|
|
55
|
+
.action(async (opts) => {
|
|
56
|
+
const { as } = program.opts();
|
|
57
|
+
if (!as)
|
|
58
|
+
throw new Error("--as <userId> is required");
|
|
59
|
+
const path = `/api/v1/users/me/tips/received`;
|
|
60
|
+
const query = {};
|
|
61
|
+
{
|
|
62
|
+
const v = opts.cursor;
|
|
63
|
+
if (v !== undefined)
|
|
64
|
+
query["cursor"] = v;
|
|
65
|
+
}
|
|
66
|
+
{
|
|
67
|
+
const v = opts.limit;
|
|
68
|
+
if (v !== undefined)
|
|
69
|
+
query["limit"] = v;
|
|
70
|
+
}
|
|
71
|
+
const data = await call({ method: "GET", path, asUserId: as, query });
|
|
72
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=tips.js.map
|