@curviate/cli 0.14.0 → 0.15.1
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/CHANGELOG.md +161 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-FM473HEK.js} +38 -371
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/chunk-EEMJDJ4W.js +80 -0
- package/dist/{chunk-JXF47TRY.js → chunk-M33MI53G.js} +33 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-4JHGVY7R.js → chunk-TMU3CSPR.js} +4 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +127 -15
- package/dist/comment-NCDXERSI.js +555 -0
- package/dist/{company-RU2CA5DY.js → company-IYTMW64G.js} +27 -74
- package/dist/{config-Q2AEWSEC.js → config-P5CPF5WC.js} +1 -1
- package/dist/{connect-QT6ZOS75.js → connect-TTJHMBUP.js} +91 -45
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-EOOGJ3ZN.js} +55 -124
- package/dist/job-YARGTHUY.js +631 -0
- package/dist/{login-BBVQLXM7.js → login-MFB45PVZ.js} +1 -1
- package/dist/{message-6K5E3CUF.js → message-2DLIQIE6.js} +61 -51
- package/dist/{post-2JQZ3OSF.js → post-GRIJ7X52.js} +188 -221
- package/dist/profile-57RJEL7H.js +809 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-CTYH7AYG.js} +740 -226
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-NUMEYOEO.js} +119 -77
- package/dist/{search-ZGTS45BT.js → search-RD4TXNV7.js} +103 -39
- package/dist/{webhook-EIY5WWTE.js → webhook-CEP7SGP5.js} +8 -45
- package/package.json +4 -3
- package/dist/chunk-GXTZION6.js +0 -45
- package/dist/chunk-Q43HZUN3.js +0 -29
- package/dist/job-FGGQEXSU.js +0 -105
- package/dist/profile-DD5GMGNL.js +0 -501
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
AttachError,
|
|
4
|
-
readAttachment
|
|
5
|
-
} from "./chunk-Q43HZUN3.js";
|
|
6
2
|
import {
|
|
7
3
|
resolveTextOrStdin
|
|
8
4
|
} from "./chunk-U7Y4EXHT.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveMemberOrMeProviderId
|
|
7
|
+
} from "./chunk-QJZ3LWOX.js";
|
|
8
|
+
import {
|
|
9
|
+
AttachError,
|
|
10
|
+
readAttachment,
|
|
11
|
+
toAttachmentPayload
|
|
12
|
+
} from "./chunk-BGZW6B7G.js";
|
|
9
13
|
import {
|
|
10
14
|
buildPreviewOutput
|
|
11
15
|
} from "./chunk-R3VLWLVV.js";
|
|
16
|
+
import "./chunk-DMQZEPQE.js";
|
|
12
17
|
import {
|
|
18
|
+
pageDelayFromFlags,
|
|
13
19
|
streamAll
|
|
14
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-EEMJDJ4W.js";
|
|
15
21
|
import {
|
|
16
22
|
createClient,
|
|
17
23
|
renderError,
|
|
18
24
|
renderSuccess,
|
|
19
25
|
renderUnexpectedError,
|
|
20
26
|
resolveEffectiveConfig
|
|
21
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-M33MI53G.js";
|
|
22
28
|
import {
|
|
23
29
|
GLOBAL_FLAGS,
|
|
24
|
-
WRITE_FLAGS
|
|
25
|
-
|
|
30
|
+
WRITE_FLAGS,
|
|
31
|
+
WRITE_SINGLE_FLAGS
|
|
32
|
+
} from "./chunk-TMU3CSPR.js";
|
|
26
33
|
|
|
27
34
|
// src/commands/post.ts
|
|
28
35
|
import { defineCommand } from "citty";
|
|
@@ -72,39 +79,13 @@ function normalizeAttachPaths(attach) {
|
|
|
72
79
|
async function handleSdkError(err, outOpts, out) {
|
|
73
80
|
const { CurviateError } = await import("@curviate/sdk");
|
|
74
81
|
if (err instanceof CurviateError) {
|
|
75
|
-
const { getExitCode } = await import("./exit-codes-
|
|
82
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
76
83
|
renderError(err, outOpts, out);
|
|
77
84
|
process.exit(getExitCode(err.code));
|
|
78
85
|
}
|
|
79
86
|
renderUnexpectedError(err, out);
|
|
80
87
|
process.exit(1);
|
|
81
88
|
}
|
|
82
|
-
async function runPostList(client, flags, out) {
|
|
83
|
-
rejectPreviewOnRead(flags.preview, out);
|
|
84
|
-
const accountId = requireAccount(flags.account, out);
|
|
85
|
-
const ns = client.account(accountId);
|
|
86
|
-
const outOpts = resolveOutputOpts(flags);
|
|
87
|
-
const all = flags.all ?? false;
|
|
88
|
-
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
89
|
-
const params = buildPaginationParams(flags);
|
|
90
|
-
try {
|
|
91
|
-
if (all) {
|
|
92
|
-
const fn = (p) => ns.posts.list(p);
|
|
93
|
-
for await (const item of streamAll(fn, params, {
|
|
94
|
-
maxPages,
|
|
95
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
96
|
-
`)
|
|
97
|
-
})) {
|
|
98
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
99
|
-
}
|
|
100
|
-
} else {
|
|
101
|
-
const result = await ns.posts.list(params);
|
|
102
|
-
renderSuccess(result, outOpts, out);
|
|
103
|
-
}
|
|
104
|
-
} catch (err) {
|
|
105
|
-
await handleSdkError(err, outOpts, out);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
89
|
async function runPostGet(client, flags, out) {
|
|
109
90
|
rejectPreviewOnRead(flags.preview, out);
|
|
110
91
|
rejectAllOnNonPaginated(flags.all, out);
|
|
@@ -123,7 +104,6 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
123
104
|
const accountId = requireAccount(flags.account, out);
|
|
124
105
|
const rawText = flags.text ?? "";
|
|
125
106
|
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
126
|
-
const thumbPath = flags["video-thumbnail"];
|
|
127
107
|
const text = await resolveTextOrStdin(rawText, out, _readStdin);
|
|
128
108
|
let attachBuffers = [];
|
|
129
109
|
try {
|
|
@@ -136,30 +116,11 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
136
116
|
}
|
|
137
117
|
throw err;
|
|
138
118
|
}
|
|
139
|
-
let thumbBuffer;
|
|
140
|
-
if (thumbPath) {
|
|
141
|
-
try {
|
|
142
|
-
thumbBuffer = await readAttachment(thumbPath);
|
|
143
|
-
} catch (err) {
|
|
144
|
-
if (err instanceof AttachError) {
|
|
145
|
-
out.stderr.write(`error: ${err.message}
|
|
146
|
-
`);
|
|
147
|
-
process.exit(err.exitCode);
|
|
148
|
-
}
|
|
149
|
-
throw err;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
119
|
if (flags.preview) {
|
|
153
120
|
const allAttachmentPreviews = attachBuffers.map((buf, i) => ({
|
|
154
121
|
name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
|
|
155
122
|
buffer: buf
|
|
156
123
|
}));
|
|
157
|
-
if (thumbBuffer && thumbPath) {
|
|
158
|
-
allAttachmentPreviews.push({
|
|
159
|
-
name: `video_thumbnail:${thumbPath.split("/").pop() ?? thumbPath}`,
|
|
160
|
-
buffer: thumbBuffer
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
124
|
const preview = buildPreviewOutput({
|
|
164
125
|
method: "posts.create",
|
|
165
126
|
args: {},
|
|
@@ -170,13 +131,11 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
170
131
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
171
132
|
return;
|
|
172
133
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
body["video_thumbnail"] = thumbBuffer;
|
|
179
|
-
}
|
|
134
|
+
const attachmentPayloads = attachBuffers.map((buf, i) => toAttachmentPayload(attachPaths[i], buf));
|
|
135
|
+
const body = {
|
|
136
|
+
text,
|
|
137
|
+
...attachmentPayloads.length > 0 ? { attachments: attachmentPayloads } : {}
|
|
138
|
+
};
|
|
180
139
|
const ns = client.account(accountId);
|
|
181
140
|
const outOpts = resolveOutputOpts(flags);
|
|
182
141
|
try {
|
|
@@ -186,53 +145,43 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
186
145
|
await handleSdkError(err, outOpts, out);
|
|
187
146
|
}
|
|
188
147
|
}
|
|
189
|
-
async function
|
|
148
|
+
async function runPostReact(client, flags, out) {
|
|
190
149
|
const accountId = requireAccount(flags.account, out);
|
|
191
150
|
const postId = flags.postId ?? "";
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (err instanceof AttachError) {
|
|
201
|
-
out.stderr.write(`error: ${err.message}
|
|
202
|
-
`);
|
|
203
|
-
process.exit(err.exitCode);
|
|
204
|
-
}
|
|
205
|
-
throw err;
|
|
151
|
+
const reaction = flags.reaction ?? flags.reactionAlias ?? "";
|
|
152
|
+
if (!VALID_REACTIONS.has(reaction)) {
|
|
153
|
+
out.stderr.write(
|
|
154
|
+
`error: reaction must be one of: like, celebrate, support, love, insightful, funny. Got: "${reaction}"
|
|
155
|
+
`
|
|
156
|
+
);
|
|
157
|
+
process.exit(2);
|
|
158
|
+
return;
|
|
206
159
|
}
|
|
207
|
-
const
|
|
208
|
-
|
|
160
|
+
const asOrganization = flags["as-organization"];
|
|
161
|
+
const body = {
|
|
162
|
+
reaction,
|
|
163
|
+
...asOrganization ? { react_as: asOrganization } : {}
|
|
164
|
+
};
|
|
209
165
|
if (flags.preview) {
|
|
210
166
|
const preview = buildPreviewOutput({
|
|
211
|
-
method: "posts.
|
|
167
|
+
method: "posts.react",
|
|
212
168
|
args: { post_id: postId },
|
|
213
169
|
body,
|
|
214
|
-
account: accountId
|
|
215
|
-
attachments: attachBuffers.map((buf, i) => ({
|
|
216
|
-
name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
|
|
217
|
-
buffer: buf
|
|
218
|
-
}))
|
|
170
|
+
account: accountId
|
|
219
171
|
});
|
|
220
172
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
221
173
|
return;
|
|
222
174
|
}
|
|
223
|
-
if (attachBuffers.length > 0) {
|
|
224
|
-
body["attachments"] = attachBuffers;
|
|
225
|
-
}
|
|
226
175
|
const ns = client.account(accountId);
|
|
227
176
|
const outOpts = resolveOutputOpts(flags);
|
|
228
177
|
try {
|
|
229
|
-
const result = await ns.posts.
|
|
178
|
+
const result = await ns.posts.react(postId, body);
|
|
230
179
|
renderSuccess(result, outOpts, out);
|
|
231
180
|
} catch (err) {
|
|
232
181
|
await handleSdkError(err, outOpts, out);
|
|
233
182
|
}
|
|
234
183
|
}
|
|
235
|
-
async function
|
|
184
|
+
async function runPostReactions(client, flags, out) {
|
|
236
185
|
rejectPreviewOnRead(flags.preview, out);
|
|
237
186
|
const accountId = requireAccount(flags.account, out);
|
|
238
187
|
const postId = flags.postId ?? "";
|
|
@@ -241,116 +190,143 @@ async function runPostComments(client, flags, out) {
|
|
|
241
190
|
const all = flags.all ?? false;
|
|
242
191
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
243
192
|
const params = buildPaginationParams(flags);
|
|
244
|
-
if (flags["reply-to"]) params["comment_id"] = flags["reply-to"];
|
|
245
193
|
try {
|
|
246
194
|
if (all) {
|
|
247
|
-
const fn = (p) => ns.posts.
|
|
195
|
+
const fn = (p) => ns.posts.listReactions(postId, p);
|
|
248
196
|
for await (const item of streamAll(fn, params, {
|
|
249
197
|
maxPages,
|
|
250
|
-
|
|
251
|
-
|
|
198
|
+
out,
|
|
199
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
252
200
|
})) {
|
|
253
201
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
254
202
|
}
|
|
255
203
|
} else {
|
|
256
|
-
const result = await ns.posts.
|
|
204
|
+
const result = await ns.posts.listReactions(postId, params);
|
|
257
205
|
renderSuccess(result, outOpts, out);
|
|
258
206
|
}
|
|
259
207
|
} catch (err) {
|
|
260
208
|
await handleSdkError(err, outOpts, out);
|
|
261
209
|
}
|
|
262
210
|
}
|
|
263
|
-
async function
|
|
211
|
+
async function runPostDelete(client, flags, out) {
|
|
212
|
+
const accountId = requireAccount(flags.account, out);
|
|
213
|
+
const postId = flags.postId ?? "";
|
|
214
|
+
if (flags.preview) {
|
|
215
|
+
const preview = buildPreviewOutput({ method: "posts.delete", args: { post_id: postId }, body: {}, account: accountId });
|
|
216
|
+
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const ns = client.account(accountId);
|
|
220
|
+
const outOpts = resolveOutputOpts(flags);
|
|
221
|
+
try {
|
|
222
|
+
const result = await ns.posts.delete(postId);
|
|
223
|
+
renderSuccess(result, outOpts, out);
|
|
224
|
+
} catch (err) {
|
|
225
|
+
await handleSdkError(err, outOpts, out);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async function runPostUnreact(client, flags, out) {
|
|
264
229
|
const accountId = requireAccount(flags.account, out);
|
|
265
230
|
const postId = flags.postId ?? "";
|
|
266
231
|
const reaction = flags.reaction ?? "";
|
|
267
232
|
if (!VALID_REACTIONS.has(reaction)) {
|
|
268
233
|
out.stderr.write(
|
|
269
|
-
`error:
|
|
234
|
+
`error: reaction must be one of: like, celebrate, support, love, insightful, funny. Got: "${reaction}"
|
|
270
235
|
`
|
|
271
236
|
);
|
|
272
237
|
process.exit(2);
|
|
273
238
|
return;
|
|
274
239
|
}
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (commentId) body["comment_id"] = commentId;
|
|
279
|
-
if (asOrganization) body["as_organization"] = asOrganization;
|
|
240
|
+
const body = {
|
|
241
|
+
reaction
|
|
242
|
+
};
|
|
280
243
|
if (flags.preview) {
|
|
281
|
-
const preview = buildPreviewOutput({
|
|
282
|
-
method: "posts.react",
|
|
283
|
-
args: { post_id: postId },
|
|
284
|
-
body,
|
|
285
|
-
account: accountId
|
|
286
|
-
});
|
|
244
|
+
const preview = buildPreviewOutput({ method: "posts.unreact", args: { post_id: postId }, body, account: accountId });
|
|
287
245
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
288
246
|
return;
|
|
289
247
|
}
|
|
290
248
|
const ns = client.account(accountId);
|
|
291
249
|
const outOpts = resolveOutputOpts(flags);
|
|
292
250
|
try {
|
|
293
|
-
const result = await ns.posts.
|
|
251
|
+
const result = await ns.posts.unreact(postId, body);
|
|
294
252
|
renderSuccess(result, outOpts, out);
|
|
295
253
|
} catch (err) {
|
|
296
254
|
await handleSdkError(err, outOpts, out);
|
|
297
255
|
}
|
|
298
256
|
}
|
|
299
|
-
async function
|
|
257
|
+
async function runPostUserPosts(client, flags, out) {
|
|
300
258
|
rejectPreviewOnRead(flags.preview, out);
|
|
301
259
|
const accountId = requireAccount(flags.account, out);
|
|
302
|
-
const postId = flags.postId ?? "";
|
|
303
260
|
const ns = client.account(accountId);
|
|
304
261
|
const outOpts = resolveOutputOpts(flags);
|
|
262
|
+
let userId;
|
|
263
|
+
try {
|
|
264
|
+
userId = await resolveMemberOrMeProviderId(ns, flags.userId ?? "");
|
|
265
|
+
} catch (err) {
|
|
266
|
+
await handleSdkError(err, outOpts, out);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
305
269
|
const all = flags.all ?? false;
|
|
306
270
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
307
271
|
const params = buildPaginationParams(flags);
|
|
308
272
|
try {
|
|
309
273
|
if (all) {
|
|
310
|
-
const fn = (p) => ns.posts.
|
|
274
|
+
const fn = (p) => ns.posts.listUserPosts(userId, p);
|
|
311
275
|
for await (const item of streamAll(fn, params, {
|
|
312
276
|
maxPages,
|
|
313
|
-
|
|
314
|
-
|
|
277
|
+
out,
|
|
278
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
315
279
|
})) {
|
|
316
280
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
317
281
|
}
|
|
318
282
|
} else {
|
|
319
|
-
const result = await ns.posts.
|
|
283
|
+
const result = await ns.posts.listUserPosts(userId, params);
|
|
320
284
|
renderSuccess(result, outOpts, out);
|
|
321
285
|
}
|
|
322
286
|
} catch (err) {
|
|
323
287
|
await handleSdkError(err, outOpts, out);
|
|
324
288
|
}
|
|
325
289
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
290
|
+
async function runPostUserReactions(client, flags, out) {
|
|
291
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
292
|
+
const accountId = requireAccount(flags.account, out);
|
|
293
|
+
const ns = client.account(accountId);
|
|
294
|
+
const outOpts = resolveOutputOpts(flags);
|
|
295
|
+
let userId;
|
|
296
|
+
try {
|
|
297
|
+
userId = await resolveMemberOrMeProviderId(ns, flags.userId ?? "");
|
|
298
|
+
} catch (err) {
|
|
299
|
+
await handleSdkError(err, outOpts, out);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const all = flags.all ?? false;
|
|
303
|
+
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
304
|
+
const params = buildPaginationParams(flags);
|
|
305
|
+
try {
|
|
306
|
+
if (all) {
|
|
307
|
+
const fn = (p) => ns.posts.listUserReactions(userId, p);
|
|
308
|
+
for await (const item of streamAll(fn, params, {
|
|
309
|
+
maxPages,
|
|
310
|
+
out,
|
|
311
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
312
|
+
})) {
|
|
313
|
+
out.stdout.write(JSON.stringify(item) + "\n");
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
const result = await ns.posts.listUserReactions(userId, params);
|
|
317
|
+
renderSuccess(result, outOpts, out);
|
|
341
318
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
await runPostList(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
319
|
+
} catch (err) {
|
|
320
|
+
await handleSdkError(err, outOpts, out);
|
|
345
321
|
}
|
|
346
|
-
}
|
|
322
|
+
}
|
|
347
323
|
var postGetCommand = defineCommand({
|
|
348
324
|
meta: { name: "get", description: "Get a post by id." },
|
|
349
325
|
args: {
|
|
350
326
|
...GLOBAL_FLAGS,
|
|
351
327
|
postId: {
|
|
352
328
|
type: "positional",
|
|
353
|
-
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id. To list
|
|
329
|
+
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id. To list comments on a post, use 'comment list <post_id>'."
|
|
354
330
|
}
|
|
355
331
|
},
|
|
356
332
|
async run({ args }) {
|
|
@@ -379,11 +355,7 @@ var postCreateCommand = defineCommand({
|
|
|
379
355
|
text: { type: "positional", description: "Post body text. Pass - to read from stdin (enables multiline via heredoc or pipe)." },
|
|
380
356
|
attach: {
|
|
381
357
|
type: "string",
|
|
382
|
-
description: "Image/video/document to attach (repeatable for images;
|
|
383
|
-
},
|
|
384
|
-
"video-thumbnail": {
|
|
385
|
-
type: "string",
|
|
386
|
-
description: "Thumbnail image for a video attachment (required when attaching a video post)."
|
|
358
|
+
description: "Image/video/document to attach (repeatable for images; a single PDF produces a document post). Supported: jpg, png, gif, mp4, pdf."
|
|
387
359
|
}
|
|
388
360
|
},
|
|
389
361
|
async run({ args }) {
|
|
@@ -404,92 +376,28 @@ var postCreateCommand = defineCommand({
|
|
|
404
376
|
await runPostCreate(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
405
377
|
}
|
|
406
378
|
});
|
|
407
|
-
var postCommentCommand = defineCommand({
|
|
408
|
-
meta: { name: "comment", description: "Comment on a post, or reply to a comment with --reply-to." },
|
|
409
|
-
args: {
|
|
410
|
-
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
411
|
-
...WRITE_FLAGS,
|
|
412
|
-
postId: {
|
|
413
|
-
type: "positional",
|
|
414
|
-
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id; use --reply-to <comment_id> to reply to a specific comment within this post."
|
|
415
|
-
},
|
|
416
|
-
text: { type: "positional", description: "Comment text (max ~1,250 characters per LinkedIn limits). Pass - to read from stdin." },
|
|
417
|
-
attach: { type: "string", description: "Image to attach to the comment (optional; one image per comment)." },
|
|
418
|
-
"reply-to": {
|
|
419
|
-
type: "string",
|
|
420
|
-
description: "Post as a reply to this comment id (omit for a top-level comment on the post)."
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
async run({ args }) {
|
|
424
|
-
const flags = args;
|
|
425
|
-
const cfg = await resolveEffectiveConfig({
|
|
426
|
-
apiKey: flags["api-key"],
|
|
427
|
-
baseUrl: flags["base-url"],
|
|
428
|
-
timeout: flags.timeout,
|
|
429
|
-
account: flags.account,
|
|
430
|
-
profile: flags.profile
|
|
431
|
-
});
|
|
432
|
-
if (!cfg.apiKey) {
|
|
433
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
434
|
-
process.exit(3);
|
|
435
|
-
}
|
|
436
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
437
|
-
const out = buildOutputStreams();
|
|
438
|
-
await runPostComment(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
var postCommentsCommand = defineCommand({
|
|
442
|
-
meta: { name: "comments", description: "List comments on a post. Use --reply-to to fetch replies to a specific comment." },
|
|
443
|
-
args: {
|
|
444
|
-
...GLOBAL_FLAGS,
|
|
445
|
-
postId: {
|
|
446
|
-
type: "positional",
|
|
447
|
-
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id; to fetch replies to a comment, use --reply-to <comment_id>."
|
|
448
|
-
},
|
|
449
|
-
"reply-to": {
|
|
450
|
-
type: "string",
|
|
451
|
-
description: "Filter replies under this comment id (omit to list top-level comments on the post)."
|
|
452
|
-
}
|
|
453
|
-
},
|
|
454
|
-
async run({ args }) {
|
|
455
|
-
const flags = args;
|
|
456
|
-
const cfg = await resolveEffectiveConfig({
|
|
457
|
-
apiKey: flags["api-key"],
|
|
458
|
-
baseUrl: flags["base-url"],
|
|
459
|
-
timeout: flags.timeout,
|
|
460
|
-
account: flags.account,
|
|
461
|
-
profile: flags.profile
|
|
462
|
-
});
|
|
463
|
-
if (!cfg.apiKey) {
|
|
464
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
465
|
-
process.exit(3);
|
|
466
|
-
}
|
|
467
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
468
|
-
const out = buildOutputStreams();
|
|
469
|
-
await runPostComments(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
379
|
var postReactCommand = defineCommand({
|
|
473
|
-
meta: { name: "react", description: "React to a post
|
|
380
|
+
meta: { name: "react", description: "React to a post." },
|
|
474
381
|
args: {
|
|
475
382
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
476
383
|
...WRITE_FLAGS,
|
|
477
384
|
postId: {
|
|
478
385
|
type: "positional",
|
|
479
|
-
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id
|
|
386
|
+
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id."
|
|
480
387
|
},
|
|
481
388
|
reaction: {
|
|
482
|
-
type: "
|
|
483
|
-
required:
|
|
389
|
+
type: "positional",
|
|
390
|
+
required: false,
|
|
484
391
|
description: "Write-side reaction (lowercase). Write values: like, celebrate, support, love, insightful, funny. Read-side vocabulary (in the value and user_reacted response fields): LIKE, PRAISE, APPRECIATION, EMPATHY, INTEREST, ENTERTAINMENT. Confirmed write\u2192read mappings: like=LIKE, celebrate=PRAISE, insightful=INTEREST. (support, love, and funny are valid write values; their read-side pairings are unconfirmed.)"
|
|
485
392
|
},
|
|
486
|
-
|
|
393
|
+
reactionAlias: {
|
|
487
394
|
type: "string",
|
|
488
|
-
|
|
395
|
+
alias: "reaction",
|
|
396
|
+
description: "Deprecated: pass the reaction as the positional <reaction> instead. --reaction still works."
|
|
489
397
|
},
|
|
490
398
|
"as-organization": {
|
|
491
399
|
type: "string",
|
|
492
|
-
description: "React on behalf of an organization page
|
|
400
|
+
description: "React on behalf of an organization/company page you administer \u2014 pass that page's numeric id or URN."
|
|
493
401
|
}
|
|
494
402
|
},
|
|
495
403
|
async run({ args }) {
|
|
@@ -537,30 +445,89 @@ var postReactionsCommand = defineCommand({
|
|
|
537
445
|
await runPostReactions(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
538
446
|
}
|
|
539
447
|
});
|
|
448
|
+
async function withClient(flags, fn) {
|
|
449
|
+
const cfg = await resolveEffectiveConfig({
|
|
450
|
+
apiKey: flags["api-key"],
|
|
451
|
+
baseUrl: flags["base-url"],
|
|
452
|
+
timeout: flags.timeout,
|
|
453
|
+
account: flags.account,
|
|
454
|
+
profile: flags.profile
|
|
455
|
+
});
|
|
456
|
+
if (!cfg.apiKey) {
|
|
457
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
458
|
+
process.exit(3);
|
|
459
|
+
}
|
|
460
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
461
|
+
const out = buildOutputStreams();
|
|
462
|
+
await fn(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
463
|
+
}
|
|
464
|
+
var postDeleteCommand = defineCommand({
|
|
465
|
+
meta: { name: "delete", description: "Delete a post you own." },
|
|
466
|
+
args: {
|
|
467
|
+
...WRITE_SINGLE_FLAGS,
|
|
468
|
+
postId: { type: "positional", description: "Post id, urn:li:activity:N, or full share URL." }
|
|
469
|
+
},
|
|
470
|
+
async run({ args }) {
|
|
471
|
+
await withClient(args, runPostDelete);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
var postUnreactCommand = defineCommand({
|
|
475
|
+
meta: { name: "unreact", description: "Remove your reaction from a post." },
|
|
476
|
+
args: {
|
|
477
|
+
...WRITE_SINGLE_FLAGS,
|
|
478
|
+
postId: { type: "positional", description: "Post id, urn:li:activity:N, or full share URL." },
|
|
479
|
+
reaction: { type: "positional", description: "Reaction to remove: like|celebrate|support|love|insightful|funny." }
|
|
480
|
+
},
|
|
481
|
+
async run({ args }) {
|
|
482
|
+
await withClient(args, runPostUnreact);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
var postUserPostsCommand = defineCommand({
|
|
486
|
+
meta: { name: "user-posts", description: "List a member's own posts (accepts 'me'). A very recent create/delete may take a few minutes to appear or clear here (LinkedIn-side indexing); `post get <post_id>` reflects it immediately." },
|
|
487
|
+
args: {
|
|
488
|
+
...GLOBAL_FLAGS,
|
|
489
|
+
userId: { type: "positional", description: "Member identifier (URL, slug, provider id, or 'me')." }
|
|
490
|
+
},
|
|
491
|
+
async run({ args }) {
|
|
492
|
+
await withClient(args, runPostUserPosts);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
var postUserReactionsCommand = defineCommand({
|
|
496
|
+
meta: { name: "user-reactions", description: "List a member's own reactions (accepts 'me')." },
|
|
497
|
+
args: {
|
|
498
|
+
...GLOBAL_FLAGS,
|
|
499
|
+
userId: { type: "positional", description: "Member identifier (URL, slug, provider id, or 'me')." }
|
|
500
|
+
},
|
|
501
|
+
async run({ args }) {
|
|
502
|
+
await withClient(args, runPostUserReactions);
|
|
503
|
+
}
|
|
504
|
+
});
|
|
540
505
|
var postCommand = defineCommand({
|
|
541
506
|
meta: { name: "post", description: "Create and manage LinkedIn posts." },
|
|
542
507
|
subCommands: {
|
|
543
|
-
list: postListCommand,
|
|
544
508
|
get: postGetCommand,
|
|
545
509
|
create: postCreateCommand,
|
|
546
|
-
comment: postCommentCommand,
|
|
547
|
-
comments: postCommentsCommand,
|
|
548
510
|
react: postReactCommand,
|
|
549
|
-
reactions: postReactionsCommand
|
|
511
|
+
reactions: postReactionsCommand,
|
|
512
|
+
delete: postDeleteCommand,
|
|
513
|
+
unreact: postUnreactCommand,
|
|
514
|
+
"user-posts": postUserPostsCommand,
|
|
515
|
+
"user-reactions": postUserReactionsCommand
|
|
550
516
|
},
|
|
551
517
|
async run() {
|
|
552
518
|
process.stderr.write(
|
|
553
|
-
'Usage: curviate post <subcommand>\n
|
|
519
|
+
'Usage: curviate post <subcommand>\n get <post_id>\n create "<text>" [--attach <file>\u2026]\n react <post_id> <reaction> [--as-organization <org_id>]\n reactions <post_id>\n delete <post_id>\n unreact <post_id> <reaction>\n user-posts <user_id>\n user-reactions <user_id>\n\nComment operations moved to the `comment` command group.\n'
|
|
554
520
|
);
|
|
555
521
|
}
|
|
556
522
|
});
|
|
557
523
|
export {
|
|
558
524
|
postCommand,
|
|
559
|
-
runPostComment,
|
|
560
|
-
runPostComments,
|
|
561
525
|
runPostCreate,
|
|
526
|
+
runPostDelete,
|
|
562
527
|
runPostGet,
|
|
563
|
-
runPostList,
|
|
564
528
|
runPostReact,
|
|
565
|
-
runPostReactions
|
|
529
|
+
runPostReactions,
|
|
530
|
+
runPostUnreact,
|
|
531
|
+
runPostUserPosts,
|
|
532
|
+
runPostUserReactions
|
|
566
533
|
};
|