@curviate/cli 0.14.0 → 0.15.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/CHANGELOG.md +104 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-VB52GIUA.js} +34 -369
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/{chunk-GXTZION6.js → chunk-DNTRQZBT.js} +13 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +75 -12
- package/dist/comment-Y5IU42CR.js +550 -0
- package/dist/{company-RU2CA5DY.js → company-LGID3SK3.js} +21 -72
- package/dist/{connect-QT6ZOS75.js → connect-A7HEKKEE.js} +86 -43
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-44JRTJAP.js} +50 -122
- package/dist/job-TFTTCP5B.js +561 -0
- package/dist/{message-6K5E3CUF.js → message-FOJTDPW3.js} +47 -47
- package/dist/{post-2JQZ3OSF.js → post-FC6NZXM5.js} +177 -219
- package/dist/profile-I6YMVXSS.js +799 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-BHT5OJD7.js} +731 -224
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-6IYKQ4TC.js} +109 -75
- package/dist/{search-ZGTS45BT.js → search-6C72M563.js} +95 -37
- package/dist/{webhook-EIY5WWTE.js → webhook-NSXEIU44.js} +4 -43
- package/package.json +4 -3
- package/dist/chunk-Q43HZUN3.js +0 -29
- package/dist/job-FGGQEXSU.js +0 -105
- package/dist/profile-DD5GMGNL.js +0 -501
|
@@ -1,17 +1,22 @@
|
|
|
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 {
|
|
13
18
|
streamAll
|
|
14
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DNTRQZBT.js";
|
|
15
20
|
import {
|
|
16
21
|
createClient,
|
|
17
22
|
renderError,
|
|
@@ -21,7 +26,8 @@ import {
|
|
|
21
26
|
} from "./chunk-JXF47TRY.js";
|
|
22
27
|
import {
|
|
23
28
|
GLOBAL_FLAGS,
|
|
24
|
-
WRITE_FLAGS
|
|
29
|
+
WRITE_FLAGS,
|
|
30
|
+
WRITE_SINGLE_FLAGS
|
|
25
31
|
} from "./chunk-4JHGVY7R.js";
|
|
26
32
|
|
|
27
33
|
// src/commands/post.ts
|
|
@@ -72,39 +78,13 @@ function normalizeAttachPaths(attach) {
|
|
|
72
78
|
async function handleSdkError(err, outOpts, out) {
|
|
73
79
|
const { CurviateError } = await import("@curviate/sdk");
|
|
74
80
|
if (err instanceof CurviateError) {
|
|
75
|
-
const { getExitCode } = await import("./exit-codes-
|
|
81
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
76
82
|
renderError(err, outOpts, out);
|
|
77
83
|
process.exit(getExitCode(err.code));
|
|
78
84
|
}
|
|
79
85
|
renderUnexpectedError(err, out);
|
|
80
86
|
process.exit(1);
|
|
81
87
|
}
|
|
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
88
|
async function runPostGet(client, flags, out) {
|
|
109
89
|
rejectPreviewOnRead(flags.preview, out);
|
|
110
90
|
rejectAllOnNonPaginated(flags.all, out);
|
|
@@ -123,7 +103,6 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
123
103
|
const accountId = requireAccount(flags.account, out);
|
|
124
104
|
const rawText = flags.text ?? "";
|
|
125
105
|
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
126
|
-
const thumbPath = flags["video-thumbnail"];
|
|
127
106
|
const text = await resolveTextOrStdin(rawText, out, _readStdin);
|
|
128
107
|
let attachBuffers = [];
|
|
129
108
|
try {
|
|
@@ -136,30 +115,11 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
136
115
|
}
|
|
137
116
|
throw err;
|
|
138
117
|
}
|
|
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
118
|
if (flags.preview) {
|
|
153
119
|
const allAttachmentPreviews = attachBuffers.map((buf, i) => ({
|
|
154
120
|
name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
|
|
155
121
|
buffer: buf
|
|
156
122
|
}));
|
|
157
|
-
if (thumbBuffer && thumbPath) {
|
|
158
|
-
allAttachmentPreviews.push({
|
|
159
|
-
name: `video_thumbnail:${thumbPath.split("/").pop() ?? thumbPath}`,
|
|
160
|
-
buffer: thumbBuffer
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
123
|
const preview = buildPreviewOutput({
|
|
164
124
|
method: "posts.create",
|
|
165
125
|
args: {},
|
|
@@ -170,13 +130,11 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
170
130
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
171
131
|
return;
|
|
172
132
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
body["video_thumbnail"] = thumbBuffer;
|
|
179
|
-
}
|
|
133
|
+
const attachmentPayloads = attachBuffers.map((buf, i) => toAttachmentPayload(attachPaths[i], buf));
|
|
134
|
+
const body = {
|
|
135
|
+
text,
|
|
136
|
+
...attachmentPayloads.length > 0 ? { attachments: attachmentPayloads } : {}
|
|
137
|
+
};
|
|
180
138
|
const ns = client.account(accountId);
|
|
181
139
|
const outOpts = resolveOutputOpts(flags);
|
|
182
140
|
try {
|
|
@@ -186,53 +144,43 @@ async function runPostCreate(client, flags, out, _readStdin) {
|
|
|
186
144
|
await handleSdkError(err, outOpts, out);
|
|
187
145
|
}
|
|
188
146
|
}
|
|
189
|
-
async function
|
|
147
|
+
async function runPostReact(client, flags, out) {
|
|
190
148
|
const accountId = requireAccount(flags.account, out);
|
|
191
149
|
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;
|
|
150
|
+
const reaction = flags.reaction ?? "";
|
|
151
|
+
if (!VALID_REACTIONS.has(reaction)) {
|
|
152
|
+
out.stderr.write(
|
|
153
|
+
`error: --reaction must be one of: like, celebrate, support, love, insightful, funny. Got: "${reaction}"
|
|
154
|
+
`
|
|
155
|
+
);
|
|
156
|
+
process.exit(2);
|
|
157
|
+
return;
|
|
206
158
|
}
|
|
207
|
-
const
|
|
208
|
-
|
|
159
|
+
const asOrganization = flags["as-organization"];
|
|
160
|
+
const body = {
|
|
161
|
+
reaction,
|
|
162
|
+
...asOrganization ? { react_as: asOrganization } : {}
|
|
163
|
+
};
|
|
209
164
|
if (flags.preview) {
|
|
210
165
|
const preview = buildPreviewOutput({
|
|
211
|
-
method: "posts.
|
|
166
|
+
method: "posts.react",
|
|
212
167
|
args: { post_id: postId },
|
|
213
168
|
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
|
-
}))
|
|
169
|
+
account: accountId
|
|
219
170
|
});
|
|
220
171
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
221
172
|
return;
|
|
222
173
|
}
|
|
223
|
-
if (attachBuffers.length > 0) {
|
|
224
|
-
body["attachments"] = attachBuffers;
|
|
225
|
-
}
|
|
226
174
|
const ns = client.account(accountId);
|
|
227
175
|
const outOpts = resolveOutputOpts(flags);
|
|
228
176
|
try {
|
|
229
|
-
const result = await ns.posts.
|
|
177
|
+
const result = await ns.posts.react(postId, body);
|
|
230
178
|
renderSuccess(result, outOpts, out);
|
|
231
179
|
} catch (err) {
|
|
232
180
|
await handleSdkError(err, outOpts, out);
|
|
233
181
|
}
|
|
234
182
|
}
|
|
235
|
-
async function
|
|
183
|
+
async function runPostReactions(client, flags, out) {
|
|
236
184
|
rejectPreviewOnRead(flags.preview, out);
|
|
237
185
|
const accountId = requireAccount(flags.account, out);
|
|
238
186
|
const postId = flags.postId ?? "";
|
|
@@ -241,116 +189,140 @@ async function runPostComments(client, flags, out) {
|
|
|
241
189
|
const all = flags.all ?? false;
|
|
242
190
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
243
191
|
const params = buildPaginationParams(flags);
|
|
244
|
-
if (flags["reply-to"]) params["comment_id"] = flags["reply-to"];
|
|
245
192
|
try {
|
|
246
193
|
if (all) {
|
|
247
|
-
const fn = (p) => ns.posts.
|
|
194
|
+
const fn = (p) => ns.posts.listReactions(postId, p);
|
|
248
195
|
for await (const item of streamAll(fn, params, {
|
|
249
196
|
maxPages,
|
|
250
|
-
|
|
251
|
-
`)
|
|
197
|
+
out
|
|
252
198
|
})) {
|
|
253
199
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
254
200
|
}
|
|
255
201
|
} else {
|
|
256
|
-
const result = await ns.posts.
|
|
202
|
+
const result = await ns.posts.listReactions(postId, params);
|
|
257
203
|
renderSuccess(result, outOpts, out);
|
|
258
204
|
}
|
|
259
205
|
} catch (err) {
|
|
260
206
|
await handleSdkError(err, outOpts, out);
|
|
261
207
|
}
|
|
262
208
|
}
|
|
263
|
-
async function
|
|
209
|
+
async function runPostDelete(client, flags, out) {
|
|
210
|
+
const accountId = requireAccount(flags.account, out);
|
|
211
|
+
const postId = flags.postId ?? "";
|
|
212
|
+
if (flags.preview) {
|
|
213
|
+
const preview = buildPreviewOutput({ method: "posts.delete", args: { post_id: postId }, body: {}, account: accountId });
|
|
214
|
+
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const ns = client.account(accountId);
|
|
218
|
+
const outOpts = resolveOutputOpts(flags);
|
|
219
|
+
try {
|
|
220
|
+
const result = await ns.posts.delete(postId);
|
|
221
|
+
renderSuccess(result, outOpts, out);
|
|
222
|
+
} catch (err) {
|
|
223
|
+
await handleSdkError(err, outOpts, out);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async function runPostUnreact(client, flags, out) {
|
|
264
227
|
const accountId = requireAccount(flags.account, out);
|
|
265
228
|
const postId = flags.postId ?? "";
|
|
266
229
|
const reaction = flags.reaction ?? "";
|
|
267
230
|
if (!VALID_REACTIONS.has(reaction)) {
|
|
268
231
|
out.stderr.write(
|
|
269
|
-
`error:
|
|
232
|
+
`error: reaction must be one of: like, celebrate, support, love, insightful, funny. Got: "${reaction}"
|
|
270
233
|
`
|
|
271
234
|
);
|
|
272
235
|
process.exit(2);
|
|
273
236
|
return;
|
|
274
237
|
}
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (commentId) body["comment_id"] = commentId;
|
|
279
|
-
if (asOrganization) body["as_organization"] = asOrganization;
|
|
238
|
+
const body = {
|
|
239
|
+
reaction
|
|
240
|
+
};
|
|
280
241
|
if (flags.preview) {
|
|
281
|
-
const preview = buildPreviewOutput({
|
|
282
|
-
method: "posts.react",
|
|
283
|
-
args: { post_id: postId },
|
|
284
|
-
body,
|
|
285
|
-
account: accountId
|
|
286
|
-
});
|
|
242
|
+
const preview = buildPreviewOutput({ method: "posts.unreact", args: { post_id: postId }, body, account: accountId });
|
|
287
243
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
288
244
|
return;
|
|
289
245
|
}
|
|
290
246
|
const ns = client.account(accountId);
|
|
291
247
|
const outOpts = resolveOutputOpts(flags);
|
|
292
248
|
try {
|
|
293
|
-
const result = await ns.posts.
|
|
249
|
+
const result = await ns.posts.unreact(postId, body);
|
|
294
250
|
renderSuccess(result, outOpts, out);
|
|
295
251
|
} catch (err) {
|
|
296
252
|
await handleSdkError(err, outOpts, out);
|
|
297
253
|
}
|
|
298
254
|
}
|
|
299
|
-
async function
|
|
255
|
+
async function runPostUserPosts(client, flags, out) {
|
|
300
256
|
rejectPreviewOnRead(flags.preview, out);
|
|
301
257
|
const accountId = requireAccount(flags.account, out);
|
|
302
|
-
const postId = flags.postId ?? "";
|
|
303
258
|
const ns = client.account(accountId);
|
|
304
259
|
const outOpts = resolveOutputOpts(flags);
|
|
260
|
+
let userId;
|
|
261
|
+
try {
|
|
262
|
+
userId = await resolveMemberOrMeProviderId(ns, flags.userId ?? "");
|
|
263
|
+
} catch (err) {
|
|
264
|
+
await handleSdkError(err, outOpts, out);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
305
267
|
const all = flags.all ?? false;
|
|
306
268
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
307
269
|
const params = buildPaginationParams(flags);
|
|
308
270
|
try {
|
|
309
271
|
if (all) {
|
|
310
|
-
const fn = (p) => ns.posts.
|
|
272
|
+
const fn = (p) => ns.posts.listUserPosts(userId, p);
|
|
311
273
|
for await (const item of streamAll(fn, params, {
|
|
312
274
|
maxPages,
|
|
313
|
-
|
|
314
|
-
`)
|
|
275
|
+
out
|
|
315
276
|
})) {
|
|
316
277
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
317
278
|
}
|
|
318
279
|
} else {
|
|
319
|
-
const result = await ns.posts.
|
|
280
|
+
const result = await ns.posts.listUserPosts(userId, params);
|
|
320
281
|
renderSuccess(result, outOpts, out);
|
|
321
282
|
}
|
|
322
283
|
} catch (err) {
|
|
323
284
|
await handleSdkError(err, outOpts, out);
|
|
324
285
|
}
|
|
325
286
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
287
|
+
async function runPostUserReactions(client, flags, out) {
|
|
288
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
289
|
+
const accountId = requireAccount(flags.account, out);
|
|
290
|
+
const ns = client.account(accountId);
|
|
291
|
+
const outOpts = resolveOutputOpts(flags);
|
|
292
|
+
let userId;
|
|
293
|
+
try {
|
|
294
|
+
userId = await resolveMemberOrMeProviderId(ns, flags.userId ?? "");
|
|
295
|
+
} catch (err) {
|
|
296
|
+
await handleSdkError(err, outOpts, out);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const all = flags.all ?? false;
|
|
300
|
+
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
301
|
+
const params = buildPaginationParams(flags);
|
|
302
|
+
try {
|
|
303
|
+
if (all) {
|
|
304
|
+
const fn = (p) => ns.posts.listUserReactions(userId, p);
|
|
305
|
+
for await (const item of streamAll(fn, params, {
|
|
306
|
+
maxPages,
|
|
307
|
+
out
|
|
308
|
+
})) {
|
|
309
|
+
out.stdout.write(JSON.stringify(item) + "\n");
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
const result = await ns.posts.listUserReactions(userId, params);
|
|
313
|
+
renderSuccess(result, outOpts, out);
|
|
341
314
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
await runPostList(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
315
|
+
} catch (err) {
|
|
316
|
+
await handleSdkError(err, outOpts, out);
|
|
345
317
|
}
|
|
346
|
-
}
|
|
318
|
+
}
|
|
347
319
|
var postGetCommand = defineCommand({
|
|
348
320
|
meta: { name: "get", description: "Get a post by id." },
|
|
349
321
|
args: {
|
|
350
322
|
...GLOBAL_FLAGS,
|
|
351
323
|
postId: {
|
|
352
324
|
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
|
|
325
|
+
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
326
|
}
|
|
355
327
|
},
|
|
356
328
|
async run({ args }) {
|
|
@@ -379,11 +351,7 @@ var postCreateCommand = defineCommand({
|
|
|
379
351
|
text: { type: "positional", description: "Post body text. Pass - to read from stdin (enables multiline via heredoc or pipe)." },
|
|
380
352
|
attach: {
|
|
381
353
|
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)."
|
|
354
|
+
description: "Image/video/document to attach (repeatable for images; a single PDF produces a document post). Supported: jpg, png, gif, mp4, pdf."
|
|
387
355
|
}
|
|
388
356
|
},
|
|
389
357
|
async run({ args }) {
|
|
@@ -404,92 +372,23 @@ var postCreateCommand = defineCommand({
|
|
|
404
372
|
await runPostCreate(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
405
373
|
}
|
|
406
374
|
});
|
|
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
375
|
var postReactCommand = defineCommand({
|
|
473
|
-
meta: { name: "react", description: "React to a post
|
|
376
|
+
meta: { name: "react", description: "React to a post." },
|
|
474
377
|
args: {
|
|
475
378
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
476
379
|
...WRITE_FLAGS,
|
|
477
380
|
postId: {
|
|
478
381
|
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
|
|
382
|
+
description: "Numeric post id, urn:li:activity:N, or full LinkedIn share URL (activity-<N>- extracted). POSTID is always the post's id."
|
|
480
383
|
},
|
|
481
384
|
reaction: {
|
|
482
385
|
type: "string",
|
|
483
386
|
required: true,
|
|
484
387
|
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
388
|
},
|
|
486
|
-
"comment-id": {
|
|
487
|
-
type: "string",
|
|
488
|
-
description: "React to this specific comment id within the post (omit to react to the post itself)."
|
|
489
|
-
},
|
|
490
389
|
"as-organization": {
|
|
491
390
|
type: "string",
|
|
492
|
-
description: "React on behalf of an organization page
|
|
391
|
+
description: "React on behalf of an organization/company page you administer \u2014 pass that page's numeric id or URN."
|
|
493
392
|
}
|
|
494
393
|
},
|
|
495
394
|
async run({ args }) {
|
|
@@ -537,30 +436,89 @@ var postReactionsCommand = defineCommand({
|
|
|
537
436
|
await runPostReactions(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
538
437
|
}
|
|
539
438
|
});
|
|
439
|
+
async function withClient(flags, fn) {
|
|
440
|
+
const cfg = await resolveEffectiveConfig({
|
|
441
|
+
apiKey: flags["api-key"],
|
|
442
|
+
baseUrl: flags["base-url"],
|
|
443
|
+
timeout: flags.timeout,
|
|
444
|
+
account: flags.account,
|
|
445
|
+
profile: flags.profile
|
|
446
|
+
});
|
|
447
|
+
if (!cfg.apiKey) {
|
|
448
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
449
|
+
process.exit(3);
|
|
450
|
+
}
|
|
451
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
452
|
+
const out = buildOutputStreams();
|
|
453
|
+
await fn(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
454
|
+
}
|
|
455
|
+
var postDeleteCommand = defineCommand({
|
|
456
|
+
meta: { name: "delete", description: "Delete a post you own." },
|
|
457
|
+
args: {
|
|
458
|
+
...WRITE_SINGLE_FLAGS,
|
|
459
|
+
postId: { type: "positional", description: "Post id, urn:li:activity:N, or full share URL." }
|
|
460
|
+
},
|
|
461
|
+
async run({ args }) {
|
|
462
|
+
await withClient(args, runPostDelete);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
var postUnreactCommand = defineCommand({
|
|
466
|
+
meta: { name: "unreact", description: "Remove your reaction from a post." },
|
|
467
|
+
args: {
|
|
468
|
+
...WRITE_SINGLE_FLAGS,
|
|
469
|
+
postId: { type: "positional", description: "Post id, urn:li:activity:N, or full share URL." },
|
|
470
|
+
reaction: { type: "positional", description: "Reaction to remove: like|celebrate|support|love|insightful|funny." }
|
|
471
|
+
},
|
|
472
|
+
async run({ args }) {
|
|
473
|
+
await withClient(args, runPostUnreact);
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
var postUserPostsCommand = defineCommand({
|
|
477
|
+
meta: { name: "user-posts", description: "List a member's own posts (accepts 'me')." },
|
|
478
|
+
args: {
|
|
479
|
+
...GLOBAL_FLAGS,
|
|
480
|
+
userId: { type: "positional", description: "Member identifier (URL, slug, provider id, or 'me')." }
|
|
481
|
+
},
|
|
482
|
+
async run({ args }) {
|
|
483
|
+
await withClient(args, runPostUserPosts);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
var postUserReactionsCommand = defineCommand({
|
|
487
|
+
meta: { name: "user-reactions", description: "List a member's own reactions (accepts 'me')." },
|
|
488
|
+
args: {
|
|
489
|
+
...GLOBAL_FLAGS,
|
|
490
|
+
userId: { type: "positional", description: "Member identifier (URL, slug, provider id, or 'me')." }
|
|
491
|
+
},
|
|
492
|
+
async run({ args }) {
|
|
493
|
+
await withClient(args, runPostUserReactions);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
540
496
|
var postCommand = defineCommand({
|
|
541
497
|
meta: { name: "post", description: "Create and manage LinkedIn posts." },
|
|
542
498
|
subCommands: {
|
|
543
|
-
list: postListCommand,
|
|
544
499
|
get: postGetCommand,
|
|
545
500
|
create: postCreateCommand,
|
|
546
|
-
comment: postCommentCommand,
|
|
547
|
-
comments: postCommentsCommand,
|
|
548
501
|
react: postReactCommand,
|
|
549
|
-
reactions: postReactionsCommand
|
|
502
|
+
reactions: postReactionsCommand,
|
|
503
|
+
delete: postDeleteCommand,
|
|
504
|
+
unreact: postUnreactCommand,
|
|
505
|
+
"user-posts": postUserPostsCommand,
|
|
506
|
+
"user-reactions": postUserReactionsCommand
|
|
550
507
|
},
|
|
551
508
|
async run() {
|
|
552
509
|
process.stderr.write(
|
|
553
|
-
'Usage: curviate post <subcommand>\n
|
|
510
|
+
'Usage: curviate post <subcommand>\n get <post_id>\n create "<text>" [--attach <file>\u2026]\n react <post_id> --reaction <r> [--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
511
|
);
|
|
555
512
|
}
|
|
556
513
|
});
|
|
557
514
|
export {
|
|
558
515
|
postCommand,
|
|
559
|
-
runPostComment,
|
|
560
|
-
runPostComments,
|
|
561
516
|
runPostCreate,
|
|
517
|
+
runPostDelete,
|
|
562
518
|
runPostGet,
|
|
563
|
-
runPostList,
|
|
564
519
|
runPostReact,
|
|
565
|
-
runPostReactions
|
|
520
|
+
runPostReactions,
|
|
521
|
+
runPostUnreact,
|
|
522
|
+
runPostUserPosts,
|
|
523
|
+
runPostUserReactions
|
|
566
524
|
};
|