@getlatedev/node 0.1.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/dist/index.js ADDED
@@ -0,0 +1,1135 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+
22
+ // src/index.ts
23
+ var index_exports = {};
24
+ __export(index_exports, {
25
+ Late: () => Late,
26
+ LateApiError: () => LateApiError,
27
+ RateLimitError: () => RateLimitError,
28
+ ValidationError: () => ValidationError,
29
+ default: () => Late,
30
+ parseApiError: () => parseApiError
31
+ });
32
+ module.exports = __toCommonJS(index_exports);
33
+
34
+ // node_modules/@hey-api/client-fetch/dist/index.js
35
+ var U = /\{[^{}]+\}/g;
36
+ var S = ({ allowReserved: t, name: r, value: e }) => {
37
+ if (e == null) return "";
38
+ if (typeof e == "object") throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
39
+ return `${r}=${t ? e : encodeURIComponent(e)}`;
40
+ };
41
+ var $ = (t) => {
42
+ switch (t) {
43
+ case "label":
44
+ return ".";
45
+ case "matrix":
46
+ return ";";
47
+ case "simple":
48
+ return ",";
49
+ default:
50
+ return "&";
51
+ }
52
+ };
53
+ var k = (t) => {
54
+ switch (t) {
55
+ case "form":
56
+ return ",";
57
+ case "pipeDelimited":
58
+ return "|";
59
+ case "spaceDelimited":
60
+ return "%20";
61
+ default:
62
+ return ",";
63
+ }
64
+ };
65
+ var D = (t) => {
66
+ switch (t) {
67
+ case "label":
68
+ return ".";
69
+ case "matrix":
70
+ return ";";
71
+ case "simple":
72
+ return ",";
73
+ default:
74
+ return "&";
75
+ }
76
+ };
77
+ var j = ({ allowReserved: t, explode: r, name: e, style: s, value: o }) => {
78
+ if (!r) {
79
+ let n = (t ? o : o.map((c) => encodeURIComponent(c))).join(k(s));
80
+ switch (s) {
81
+ case "label":
82
+ return `.${n}`;
83
+ case "matrix":
84
+ return `;${e}=${n}`;
85
+ case "simple":
86
+ return n;
87
+ default:
88
+ return `${e}=${n}`;
89
+ }
90
+ }
91
+ let a = $(s), i = o.map((n) => s === "label" || s === "simple" ? t ? n : encodeURIComponent(n) : S({ allowReserved: t, name: e, value: n })).join(a);
92
+ return s === "label" || s === "matrix" ? a + i : i;
93
+ };
94
+ var A = ({ allowReserved: t, explode: r, name: e, style: s, value: o }) => {
95
+ if (o instanceof Date) return `${e}=${o.toISOString()}`;
96
+ if (s !== "deepObject" && !r) {
97
+ let n = [];
98
+ Object.entries(o).forEach(([f, p]) => {
99
+ n = [...n, f, t ? p : encodeURIComponent(p)];
100
+ });
101
+ let c = n.join(",");
102
+ switch (s) {
103
+ case "form":
104
+ return `${e}=${c}`;
105
+ case "label":
106
+ return `.${c}`;
107
+ case "matrix":
108
+ return `;${e}=${c}`;
109
+ default:
110
+ return c;
111
+ }
112
+ }
113
+ let a = D(s), i = Object.entries(o).map(([n, c]) => S({ allowReserved: t, name: s === "deepObject" ? `${e}[${n}]` : n, value: c })).join(a);
114
+ return s === "label" || s === "matrix" ? a + i : i;
115
+ };
116
+ var _ = ({ path: t, url: r }) => {
117
+ let e = r, s = r.match(U);
118
+ if (s) for (let o of s) {
119
+ let a = false, i = o.substring(1, o.length - 1), n = "simple";
120
+ i.endsWith("*") && (a = true, i = i.substring(0, i.length - 1)), i.startsWith(".") ? (i = i.substring(1), n = "label") : i.startsWith(";") && (i = i.substring(1), n = "matrix");
121
+ let c = t[i];
122
+ if (c == null) continue;
123
+ if (Array.isArray(c)) {
124
+ e = e.replace(o, j({ explode: a, name: i, style: n, value: c }));
125
+ continue;
126
+ }
127
+ if (typeof c == "object") {
128
+ e = e.replace(o, A({ explode: a, name: i, style: n, value: c }));
129
+ continue;
130
+ }
131
+ if (n === "matrix") {
132
+ e = e.replace(o, `;${S({ name: i, value: c })}`);
133
+ continue;
134
+ }
135
+ let f = encodeURIComponent(n === "label" ? `.${c}` : c);
136
+ e = e.replace(o, f);
137
+ }
138
+ return e;
139
+ };
140
+ var C = ({ allowReserved: t, array: r, object: e } = {}) => (o) => {
141
+ let a = [];
142
+ if (o && typeof o == "object") for (let i in o) {
143
+ let n = o[i];
144
+ if (n != null) {
145
+ if (Array.isArray(n)) {
146
+ a = [...a, j({ allowReserved: t, explode: true, name: i, style: "form", value: n, ...r })];
147
+ continue;
148
+ }
149
+ if (typeof n == "object") {
150
+ a = [...a, A({ allowReserved: t, explode: true, name: i, style: "deepObject", value: n, ...e })];
151
+ continue;
152
+ }
153
+ a = [...a, S({ allowReserved: t, name: i, value: n })];
154
+ }
155
+ }
156
+ return a.join("&");
157
+ };
158
+ var w = (t) => {
159
+ if (!t) return "stream";
160
+ let r = t.split(";")[0]?.trim();
161
+ if (r) {
162
+ if (r.startsWith("application/json") || r.endsWith("+json")) return "json";
163
+ if (r === "multipart/form-data") return "formData";
164
+ if (["application/", "audio/", "image/", "video/"].some((e) => r.startsWith(e))) return "blob";
165
+ if (r.startsWith("text/")) return "text";
166
+ }
167
+ };
168
+ var H = async (t, r) => {
169
+ let e = typeof r == "function" ? await r(t) : r;
170
+ if (e) return t.scheme === "bearer" ? `Bearer ${e}` : t.scheme === "basic" ? `Basic ${btoa(e)}` : e;
171
+ };
172
+ var P = async ({ security: t, ...r }) => {
173
+ for (let e of t) {
174
+ let s = await H(e, r.auth);
175
+ if (!s) continue;
176
+ let o = e.name ?? "Authorization";
177
+ switch (e.in) {
178
+ case "query":
179
+ r.query || (r.query = {}), r.query[o] = s;
180
+ break;
181
+ case "header":
182
+ default:
183
+ r.headers.set(o, s);
184
+ break;
185
+ }
186
+ return;
187
+ }
188
+ };
189
+ var b = (t) => B({ baseUrl: t.baseUrl ?? "", path: t.path, query: t.query, querySerializer: typeof t.querySerializer == "function" ? t.querySerializer : C(t.querySerializer), url: t.url });
190
+ var B = ({ baseUrl: t, path: r, query: e, querySerializer: s, url: o }) => {
191
+ let a = o.startsWith("/") ? o : `/${o}`, i = t + a;
192
+ r && (i = _({ path: r, url: i }));
193
+ let n = e ? s(e) : "";
194
+ return n.startsWith("?") && (n = n.substring(1)), n && (i += `?${n}`), i;
195
+ };
196
+ var R = (t, r) => {
197
+ let e = { ...t, ...r };
198
+ return e.baseUrl?.endsWith("/") && (e.baseUrl = e.baseUrl.substring(0, e.baseUrl.length - 1)), e.headers = O(t.headers, r.headers), e;
199
+ };
200
+ var O = (...t) => {
201
+ let r = new Headers();
202
+ for (let e of t) {
203
+ if (!e || typeof e != "object") continue;
204
+ let s = e instanceof Headers ? e.entries() : Object.entries(e);
205
+ for (let [o, a] of s) if (a === null) r.delete(o);
206
+ else if (Array.isArray(a)) for (let i of a) r.append(o, i);
207
+ else a !== void 0 && r.set(o, typeof a == "object" ? JSON.stringify(a) : a);
208
+ }
209
+ return r;
210
+ };
211
+ var y = class {
212
+ constructor() {
213
+ __publicField(this, "_fns");
214
+ this._fns = [];
215
+ }
216
+ clear() {
217
+ this._fns = [];
218
+ }
219
+ exists(r) {
220
+ return this._fns.indexOf(r) !== -1;
221
+ }
222
+ eject(r) {
223
+ let e = this._fns.indexOf(r);
224
+ e !== -1 && (this._fns = [...this._fns.slice(0, e), ...this._fns.slice(e + 1)]);
225
+ }
226
+ use(r) {
227
+ this._fns = [...this._fns, r];
228
+ }
229
+ };
230
+ var E = () => ({ error: new y(), request: new y(), response: new y() });
231
+ var x = (t, r, e) => {
232
+ typeof e == "string" || e instanceof Blob ? t.append(r, e) : t.append(r, JSON.stringify(e));
233
+ };
234
+ var W = { bodySerializer: (t) => {
235
+ let r = new FormData();
236
+ return Object.entries(t).forEach(([e, s]) => {
237
+ s != null && (Array.isArray(s) ? s.forEach((o) => x(r, e, o)) : x(r, e, s));
238
+ }), r;
239
+ } };
240
+ var I = { bodySerializer: (t) => JSON.stringify(t) };
241
+ var Q = C({ allowReserved: false, array: { explode: true, style: "form" }, object: { explode: true, style: "deepObject" } });
242
+ var V = { "Content-Type": "application/json" };
243
+ var q = (t = {}) => ({ ...I, baseUrl: "", headers: V, parseAs: "auto", querySerializer: Q, ...t });
244
+ var M = (t = {}) => {
245
+ let r = R(q(), t), e = () => ({ ...r }), s = (i) => (r = R(r, i), e()), o = E(), a = async (i) => {
246
+ let n = { ...r, ...i, fetch: i.fetch ?? r.fetch ?? globalThis.fetch, headers: O(r.headers, i.headers) };
247
+ n.security && await P({ ...n, security: n.security }), n.body && n.bodySerializer && (n.body = n.bodySerializer(n.body)), n.body || n.headers.delete("Content-Type");
248
+ let c = b(n), f = { redirect: "follow", ...n }, p = new Request(c, f);
249
+ for (let u of o.request._fns) p = await u(p, n);
250
+ let T = n.fetch, l = await T(p);
251
+ for (let u of o.response._fns) l = await u(l, p, n);
252
+ let h = { request: p, response: l };
253
+ if (l.ok) {
254
+ if (l.status === 204 || l.headers.get("Content-Length") === "0") return { data: {}, ...h };
255
+ let u = (n.parseAs === "auto" ? w(l.headers.get("Content-Type")) : n.parseAs) ?? "json";
256
+ if (u === "stream") return { data: l.body, ...h };
257
+ let g = await l[u]();
258
+ return u === "json" && (n.responseValidator && await n.responseValidator(g), n.responseTransformer && (g = await n.responseTransformer(g))), { data: g, ...h };
259
+ }
260
+ let m = await l.text();
261
+ try {
262
+ m = JSON.parse(m);
263
+ } catch {
264
+ }
265
+ let d = m;
266
+ for (let u of o.error._fns) d = await u(m, l, p, n);
267
+ if (d = d || {}, n.throwOnError) throw d;
268
+ return { error: d, ...h };
269
+ };
270
+ return { buildUrl: b, connect: (i) => a({ ...i, method: "CONNECT" }), delete: (i) => a({ ...i, method: "DELETE" }), get: (i) => a({ ...i, method: "GET" }), getConfig: e, head: (i) => a({ ...i, method: "HEAD" }), interceptors: o, options: (i) => a({ ...i, method: "OPTIONS" }), patch: (i) => a({ ...i, method: "PATCH" }), post: (i) => a({ ...i, method: "POST" }), put: (i) => a({ ...i, method: "PUT" }), request: a, setConfig: s, trace: (i) => a({ ...i, method: "TRACE" }) };
271
+ };
272
+
273
+ // src/generated/sdk.gen.ts
274
+ var client = M(q());
275
+ var getV1ToolsYoutubeDownload = (options) => {
276
+ return (options?.client ?? client).get({
277
+ ...options,
278
+ url: "/v1/tools/youtube/download"
279
+ });
280
+ };
281
+ var getV1ToolsYoutubeTranscript = (options) => {
282
+ return (options?.client ?? client).get({
283
+ ...options,
284
+ url: "/v1/tools/youtube/transcript"
285
+ });
286
+ };
287
+ var getV1ToolsInstagramDownload = (options) => {
288
+ return (options?.client ?? client).get({
289
+ ...options,
290
+ url: "/v1/tools/instagram/download"
291
+ });
292
+ };
293
+ var postV1ToolsInstagramHashtagChecker = (options) => {
294
+ return (options?.client ?? client).post({
295
+ ...options,
296
+ url: "/v1/tools/instagram/hashtag-checker"
297
+ });
298
+ };
299
+ var getV1ToolsTiktokDownload = (options) => {
300
+ return (options?.client ?? client).get({
301
+ ...options,
302
+ url: "/v1/tools/tiktok/download"
303
+ });
304
+ };
305
+ var getV1ToolsTwitterDownload = (options) => {
306
+ return (options?.client ?? client).get({
307
+ ...options,
308
+ url: "/v1/tools/twitter/download"
309
+ });
310
+ };
311
+ var getV1ToolsFacebookDownload = (options) => {
312
+ return (options?.client ?? client).get({
313
+ ...options,
314
+ url: "/v1/tools/facebook/download"
315
+ });
316
+ };
317
+ var getV1ToolsLinkedinDownload = (options) => {
318
+ return (options?.client ?? client).get({
319
+ ...options,
320
+ url: "/v1/tools/linkedin/download"
321
+ });
322
+ };
323
+ var getV1ToolsBlueskyDownload = (options) => {
324
+ return (options?.client ?? client).get({
325
+ ...options,
326
+ url: "/v1/tools/bluesky/download"
327
+ });
328
+ };
329
+ var getV1Analytics = (options) => {
330
+ return (options?.client ?? client).get({
331
+ ...options,
332
+ url: "/v1/analytics"
333
+ });
334
+ };
335
+ var getV1AnalyticsYoutubeDailyViews = (options) => {
336
+ return (options?.client ?? client).get({
337
+ ...options,
338
+ url: "/v1/analytics/youtube/daily-views"
339
+ });
340
+ };
341
+ var getV1AccountGroups = (options) => {
342
+ return (options?.client ?? client).get({
343
+ ...options,
344
+ url: "/v1/account-groups"
345
+ });
346
+ };
347
+ var postV1AccountGroups = (options) => {
348
+ return (options?.client ?? client).post({
349
+ ...options,
350
+ url: "/v1/account-groups"
351
+ });
352
+ };
353
+ var putV1AccountGroupsByGroupId = (options) => {
354
+ return (options?.client ?? client).put({
355
+ ...options,
356
+ url: "/v1/account-groups/{groupId}"
357
+ });
358
+ };
359
+ var deleteV1AccountGroupsByGroupId = (options) => {
360
+ return (options?.client ?? client).delete({
361
+ ...options,
362
+ url: "/v1/account-groups/{groupId}"
363
+ });
364
+ };
365
+ var postV1MediaPresign = (options) => {
366
+ return (options?.client ?? client).post({
367
+ ...options,
368
+ url: "/v1/media/presign"
369
+ });
370
+ };
371
+ var getV1RedditSearch = (options) => {
372
+ return (options?.client ?? client).get({
373
+ ...options,
374
+ url: "/v1/reddit/search"
375
+ });
376
+ };
377
+ var getV1RedditFeed = (options) => {
378
+ return (options?.client ?? client).get({
379
+ ...options,
380
+ url: "/v1/reddit/feed"
381
+ });
382
+ };
383
+ var getV1UsageStats = (options) => {
384
+ return (options?.client ?? client).get({
385
+ ...options,
386
+ url: "/v1/usage-stats"
387
+ });
388
+ };
389
+ var getV1Posts = (options) => {
390
+ return (options?.client ?? client).get({
391
+ ...options,
392
+ url: "/v1/posts"
393
+ });
394
+ };
395
+ var postV1Posts = (options) => {
396
+ return (options?.client ?? client).post({
397
+ ...options,
398
+ url: "/v1/posts"
399
+ });
400
+ };
401
+ var getV1PostsByPostId = (options) => {
402
+ return (options?.client ?? client).get({
403
+ ...options,
404
+ url: "/v1/posts/{postId}"
405
+ });
406
+ };
407
+ var putV1PostsByPostId = (options) => {
408
+ return (options?.client ?? client).put({
409
+ ...options,
410
+ url: "/v1/posts/{postId}"
411
+ });
412
+ };
413
+ var deleteV1PostsByPostId = (options) => {
414
+ return (options?.client ?? client).delete({
415
+ ...options,
416
+ url: "/v1/posts/{postId}"
417
+ });
418
+ };
419
+ var postV1PostsBulkUpload = (options) => {
420
+ return (options?.client ?? client).post({
421
+ ...options,
422
+ ...W,
423
+ headers: {
424
+ "Content-Type": null,
425
+ ...options?.headers
426
+ },
427
+ url: "/v1/posts/bulk-upload"
428
+ });
429
+ };
430
+ var postV1PostsByPostIdRetry = (options) => {
431
+ return (options?.client ?? client).post({
432
+ ...options,
433
+ url: "/v1/posts/{postId}/retry"
434
+ });
435
+ };
436
+ var getV1Users = (options) => {
437
+ return (options?.client ?? client).get({
438
+ ...options,
439
+ url: "/v1/users"
440
+ });
441
+ };
442
+ var getV1UsersByUserId = (options) => {
443
+ return (options?.client ?? client).get({
444
+ ...options,
445
+ url: "/v1/users/{userId}"
446
+ });
447
+ };
448
+ var getV1Profiles = (options) => {
449
+ return (options?.client ?? client).get({
450
+ ...options,
451
+ url: "/v1/profiles"
452
+ });
453
+ };
454
+ var postV1Profiles = (options) => {
455
+ return (options?.client ?? client).post({
456
+ ...options,
457
+ url: "/v1/profiles"
458
+ });
459
+ };
460
+ var getV1ProfilesByProfileId = (options) => {
461
+ return (options?.client ?? client).get({
462
+ ...options,
463
+ url: "/v1/profiles/{profileId}"
464
+ });
465
+ };
466
+ var putV1ProfilesByProfileId = (options) => {
467
+ return (options?.client ?? client).put({
468
+ ...options,
469
+ url: "/v1/profiles/{profileId}"
470
+ });
471
+ };
472
+ var deleteV1ProfilesByProfileId = (options) => {
473
+ return (options?.client ?? client).delete({
474
+ ...options,
475
+ url: "/v1/profiles/{profileId}"
476
+ });
477
+ };
478
+ var getV1Accounts = (options) => {
479
+ return (options?.client ?? client).get({
480
+ ...options,
481
+ url: "/v1/accounts"
482
+ });
483
+ };
484
+ var getV1AccountsFollowerStats = (options) => {
485
+ return (options?.client ?? client).get({
486
+ ...options,
487
+ url: "/v1/accounts/follower-stats"
488
+ });
489
+ };
490
+ var putV1AccountsByAccountId = (options) => {
491
+ return (options?.client ?? client).put({
492
+ ...options,
493
+ url: "/v1/accounts/{accountId}"
494
+ });
495
+ };
496
+ var deleteV1AccountsByAccountId = (options) => {
497
+ return (options?.client ?? client).delete({
498
+ ...options,
499
+ url: "/v1/accounts/{accountId}"
500
+ });
501
+ };
502
+ var getV1AccountsHealth = (options) => {
503
+ return (options?.client ?? client).get({
504
+ ...options,
505
+ url: "/v1/accounts/health"
506
+ });
507
+ };
508
+ var getV1AccountsByAccountIdHealth = (options) => {
509
+ return (options?.client ?? client).get({
510
+ ...options,
511
+ url: "/v1/accounts/{accountId}/health"
512
+ });
513
+ };
514
+ var getV1ApiKeys = (options) => {
515
+ return (options?.client ?? client).get({
516
+ ...options,
517
+ url: "/v1/api-keys"
518
+ });
519
+ };
520
+ var postV1ApiKeys = (options) => {
521
+ return (options?.client ?? client).post({
522
+ ...options,
523
+ url: "/v1/api-keys"
524
+ });
525
+ };
526
+ var deleteV1ApiKeysByKeyId = (options) => {
527
+ return (options?.client ?? client).delete({
528
+ ...options,
529
+ url: "/v1/api-keys/{keyId}"
530
+ });
531
+ };
532
+ var postV1InviteTokens = (options) => {
533
+ return (options?.client ?? client).post({
534
+ ...options,
535
+ url: "/v1/invite/tokens"
536
+ });
537
+ };
538
+ var getV1PlatformInvites = (options) => {
539
+ return (options?.client ?? client).get({
540
+ ...options,
541
+ url: "/v1/platform-invites"
542
+ });
543
+ };
544
+ var postV1PlatformInvites = (options) => {
545
+ return (options?.client ?? client).post({
546
+ ...options,
547
+ url: "/v1/platform-invites"
548
+ });
549
+ };
550
+ var deleteV1PlatformInvites = (options) => {
551
+ return (options?.client ?? client).delete({
552
+ ...options,
553
+ url: "/v1/platform-invites"
554
+ });
555
+ };
556
+ var getV1ConnectByPlatform = (options) => {
557
+ return (options?.client ?? client).get({
558
+ ...options,
559
+ url: "/v1/connect/{platform}"
560
+ });
561
+ };
562
+ var postV1ConnectByPlatform = (options) => {
563
+ return (options?.client ?? client).post({
564
+ ...options,
565
+ url: "/v1/connect/{platform}"
566
+ });
567
+ };
568
+ var getV1ConnectFacebookSelectPage = (options) => {
569
+ return (options?.client ?? client).get({
570
+ ...options,
571
+ url: "/v1/connect/facebook/select-page"
572
+ });
573
+ };
574
+ var postV1ConnectFacebookSelectPage = (options) => {
575
+ return (options?.client ?? client).post({
576
+ ...options,
577
+ url: "/v1/connect/facebook/select-page"
578
+ });
579
+ };
580
+ var getV1ConnectGooglebusinessLocations = (options) => {
581
+ return (options?.client ?? client).get({
582
+ ...options,
583
+ url: "/v1/connect/googlebusiness/locations"
584
+ });
585
+ };
586
+ var postV1ConnectGooglebusinessSelectLocation = (options) => {
587
+ return (options?.client ?? client).post({
588
+ ...options,
589
+ url: "/v1/connect/googlebusiness/select-location"
590
+ });
591
+ };
592
+ var getV1AccountsByAccountIdGmbReviews = (options) => {
593
+ return (options?.client ?? client).get({
594
+ ...options,
595
+ url: "/v1/accounts/{accountId}/gmb-reviews"
596
+ });
597
+ };
598
+ var getV1ConnectLinkedinOrganizations = (options) => {
599
+ return (options?.client ?? client).get({
600
+ ...options,
601
+ url: "/v1/connect/linkedin/organizations"
602
+ });
603
+ };
604
+ var postV1ConnectLinkedinSelectOrganization = (options) => {
605
+ return (options?.client ?? client).post({
606
+ ...options,
607
+ url: "/v1/connect/linkedin/select-organization"
608
+ });
609
+ };
610
+ var getV1ConnectPinterestSelectBoard = (options) => {
611
+ return (options?.client ?? client).get({
612
+ ...options,
613
+ url: "/v1/connect/pinterest/select-board"
614
+ });
615
+ };
616
+ var postV1ConnectPinterestSelectBoard = (options) => {
617
+ return (options?.client ?? client).post({
618
+ ...options,
619
+ url: "/v1/connect/pinterest/select-board"
620
+ });
621
+ };
622
+ var getV1ConnectSnapchatSelectProfile = (options) => {
623
+ return (options?.client ?? client).get({
624
+ ...options,
625
+ url: "/v1/connect/snapchat/select-profile"
626
+ });
627
+ };
628
+ var postV1ConnectSnapchatSelectProfile = (options) => {
629
+ return (options?.client ?? client).post({
630
+ ...options,
631
+ url: "/v1/connect/snapchat/select-profile"
632
+ });
633
+ };
634
+ var postV1ConnectBlueskyCredentials = (options) => {
635
+ return (options?.client ?? client).post({
636
+ ...options,
637
+ url: "/v1/connect/bluesky/credentials"
638
+ });
639
+ };
640
+ var getV1ConnectTelegram = (options) => {
641
+ return (options?.client ?? client).get({
642
+ ...options,
643
+ url: "/v1/connect/telegram"
644
+ });
645
+ };
646
+ var postV1ConnectTelegram = (options) => {
647
+ return (options?.client ?? client).post({
648
+ ...options,
649
+ url: "/v1/connect/telegram"
650
+ });
651
+ };
652
+ var patchV1ConnectTelegram = (options) => {
653
+ return (options?.client ?? client).patch({
654
+ ...options,
655
+ url: "/v1/connect/telegram"
656
+ });
657
+ };
658
+ var putV1AccountsByAccountIdFacebookPage = (options) => {
659
+ return (options?.client ?? client).put({
660
+ ...options,
661
+ url: "/v1/accounts/{accountId}/facebook-page"
662
+ });
663
+ };
664
+ var getV1AccountsByAccountIdLinkedinOrganizations = (options) => {
665
+ return (options?.client ?? client).get({
666
+ ...options,
667
+ url: "/v1/accounts/{accountId}/linkedin-organizations"
668
+ });
669
+ };
670
+ var getV1AccountsByAccountIdLinkedinAggregateAnalytics = (options) => {
671
+ return (options?.client ?? client).get({
672
+ ...options,
673
+ url: "/v1/accounts/{accountId}/linkedin-aggregate-analytics"
674
+ });
675
+ };
676
+ var getV1AccountsByAccountIdLinkedinPostAnalytics = (options) => {
677
+ return (options?.client ?? client).get({
678
+ ...options,
679
+ url: "/v1/accounts/{accountId}/linkedin-post-analytics"
680
+ });
681
+ };
682
+ var putV1AccountsByAccountIdLinkedinOrganization = (options) => {
683
+ return (options?.client ?? client).put({
684
+ ...options,
685
+ url: "/v1/accounts/{accountId}/linkedin-organization"
686
+ });
687
+ };
688
+ var getV1AccountsByAccountIdLinkedinMentions = (options) => {
689
+ return (options?.client ?? client).get({
690
+ ...options,
691
+ url: "/v1/accounts/{accountId}/linkedin-mentions"
692
+ });
693
+ };
694
+ var getV1AccountsByAccountIdPinterestBoards = (options) => {
695
+ return (options?.client ?? client).get({
696
+ ...options,
697
+ url: "/v1/accounts/{accountId}/pinterest-boards"
698
+ });
699
+ };
700
+ var putV1AccountsByAccountIdPinterestBoards = (options) => {
701
+ return (options?.client ?? client).put({
702
+ ...options,
703
+ url: "/v1/accounts/{accountId}/pinterest-boards"
704
+ });
705
+ };
706
+ var getV1AccountsByAccountIdRedditSubreddits = (options) => {
707
+ return (options?.client ?? client).get({
708
+ ...options,
709
+ url: "/v1/accounts/{accountId}/reddit-subreddits"
710
+ });
711
+ };
712
+ var putV1AccountsByAccountIdRedditSubreddits = (options) => {
713
+ return (options?.client ?? client).put({
714
+ ...options,
715
+ url: "/v1/accounts/{accountId}/reddit-subreddits"
716
+ });
717
+ };
718
+ var getV1QueueSlots = (options) => {
719
+ return (options?.client ?? client).get({
720
+ ...options,
721
+ url: "/v1/queue/slots"
722
+ });
723
+ };
724
+ var postV1QueueSlots = (options) => {
725
+ return (options?.client ?? client).post({
726
+ ...options,
727
+ url: "/v1/queue/slots"
728
+ });
729
+ };
730
+ var putV1QueueSlots = (options) => {
731
+ return (options?.client ?? client).put({
732
+ ...options,
733
+ url: "/v1/queue/slots"
734
+ });
735
+ };
736
+ var deleteV1QueueSlots = (options) => {
737
+ return (options?.client ?? client).delete({
738
+ ...options,
739
+ url: "/v1/queue/slots"
740
+ });
741
+ };
742
+ var getV1QueuePreview = (options) => {
743
+ return (options?.client ?? client).get({
744
+ ...options,
745
+ url: "/v1/queue/preview"
746
+ });
747
+ };
748
+ var getV1QueueNextSlot = (options) => {
749
+ return (options?.client ?? client).get({
750
+ ...options,
751
+ url: "/v1/queue/next-slot"
752
+ });
753
+ };
754
+ var getV1WebhooksSettings = (options) => {
755
+ return (options?.client ?? client).get({
756
+ ...options,
757
+ url: "/v1/webhooks/settings"
758
+ });
759
+ };
760
+ var postV1WebhooksSettings = (options) => {
761
+ return (options?.client ?? client).post({
762
+ ...options,
763
+ url: "/v1/webhooks/settings"
764
+ });
765
+ };
766
+ var putV1WebhooksSettings = (options) => {
767
+ return (options?.client ?? client).put({
768
+ ...options,
769
+ url: "/v1/webhooks/settings"
770
+ });
771
+ };
772
+ var deleteV1WebhooksSettings = (options) => {
773
+ return (options?.client ?? client).delete({
774
+ ...options,
775
+ url: "/v1/webhooks/settings"
776
+ });
777
+ };
778
+ var postV1WebhooksTest = (options) => {
779
+ return (options?.client ?? client).post({
780
+ ...options,
781
+ url: "/v1/webhooks/test"
782
+ });
783
+ };
784
+ var getV1WebhooksLogs = (options) => {
785
+ return (options?.client ?? client).get({
786
+ ...options,
787
+ url: "/v1/webhooks/logs"
788
+ });
789
+ };
790
+ var getV1Logs = (options) => {
791
+ return (options?.client ?? client).get({
792
+ ...options,
793
+ url: "/v1/logs"
794
+ });
795
+ };
796
+ var getV1LogsByLogId = (options) => {
797
+ return (options?.client ?? client).get({
798
+ ...options,
799
+ url: "/v1/logs/{logId}"
800
+ });
801
+ };
802
+ var getV1PostsByPostIdLogs = (options) => {
803
+ return (options?.client ?? client).get({
804
+ ...options,
805
+ url: "/v1/posts/{postId}/logs"
806
+ });
807
+ };
808
+
809
+ // src/errors.ts
810
+ var LateApiError = class _LateApiError extends Error {
811
+ constructor(message, statusCode, code, details) {
812
+ super(message);
813
+ this.name = "LateApiError";
814
+ this.statusCode = statusCode;
815
+ this.code = code;
816
+ this.details = details;
817
+ if (Error.captureStackTrace) {
818
+ Error.captureStackTrace(this, _LateApiError);
819
+ }
820
+ }
821
+ /**
822
+ * Check if this is a rate limit error
823
+ */
824
+ isRateLimited() {
825
+ return this.statusCode === 429;
826
+ }
827
+ /**
828
+ * Check if this is an authentication error
829
+ */
830
+ isAuthError() {
831
+ return this.statusCode === 401;
832
+ }
833
+ /**
834
+ * Check if this is a permission/access error
835
+ */
836
+ isForbidden() {
837
+ return this.statusCode === 403;
838
+ }
839
+ /**
840
+ * Check if this is a not found error
841
+ */
842
+ isNotFound() {
843
+ return this.statusCode === 404;
844
+ }
845
+ /**
846
+ * Check if this is a validation error
847
+ */
848
+ isValidationError() {
849
+ return this.statusCode === 400;
850
+ }
851
+ /**
852
+ * Check if this is a payment required error
853
+ */
854
+ isPaymentRequired() {
855
+ return this.statusCode === 402;
856
+ }
857
+ };
858
+ var RateLimitError = class extends LateApiError {
859
+ constructor(message, limit, remaining, resetAt) {
860
+ super(message, 429, "rate_limit_exceeded");
861
+ this.name = "RateLimitError";
862
+ this.limit = limit;
863
+ this.remaining = remaining;
864
+ this.resetAt = resetAt;
865
+ }
866
+ /**
867
+ * Get seconds until rate limit resets
868
+ */
869
+ getSecondsUntilReset() {
870
+ if (!this.resetAt) return void 0;
871
+ return Math.max(0, Math.ceil((this.resetAt.getTime() - Date.now()) / 1e3));
872
+ }
873
+ };
874
+ var ValidationError = class extends LateApiError {
875
+ constructor(message, fields) {
876
+ super(message, 400, "validation_error", { fields });
877
+ this.name = "ValidationError";
878
+ this.fields = fields;
879
+ }
880
+ };
881
+ function parseApiError(response, body) {
882
+ const message = body?.error || body?.message || response.statusText || "Unknown error";
883
+ const code = body?.code;
884
+ const details = body?.details;
885
+ if (response.status === 429) {
886
+ const limit = response.headers.get("X-RateLimit-Limit");
887
+ const remaining = response.headers.get("X-RateLimit-Remaining");
888
+ const reset = response.headers.get("X-RateLimit-Reset");
889
+ return new RateLimitError(
890
+ message,
891
+ limit ? parseInt(limit, 10) : void 0,
892
+ remaining ? parseInt(remaining, 10) : void 0,
893
+ reset ? new Date(parseInt(reset, 10) * 1e3) : void 0
894
+ );
895
+ }
896
+ if (response.status === 400 && details?.fields) {
897
+ return new ValidationError(message, details.fields);
898
+ }
899
+ return new LateApiError(message, response.status, code, details);
900
+ }
901
+
902
+ // src/client.ts
903
+ var Late = class {
904
+ /**
905
+ * Create a new Late API client.
906
+ *
907
+ * @param options - Configuration options for the client
908
+ */
909
+ constructor(options = {}) {
910
+ /**
911
+ * Posts API - Create, schedule, and manage social media posts
912
+ */
913
+ this.posts = {
914
+ list: getV1Posts,
915
+ create: postV1Posts,
916
+ get: getV1PostsByPostId,
917
+ update: putV1PostsByPostId,
918
+ delete: deleteV1PostsByPostId,
919
+ retry: postV1PostsByPostIdRetry,
920
+ bulkUpload: postV1PostsBulkUpload,
921
+ getLogs: getV1PostsByPostIdLogs
922
+ };
923
+ /**
924
+ * Accounts API - Manage connected social media accounts
925
+ */
926
+ this.accounts = {
927
+ list: getV1Accounts,
928
+ update: putV1AccountsByAccountId,
929
+ delete: deleteV1AccountsByAccountId,
930
+ getFollowerStats: getV1AccountsFollowerStats,
931
+ getAllHealth: getV1AccountsHealth,
932
+ getHealth: getV1AccountsByAccountIdHealth,
933
+ updateFacebookPage: putV1AccountsByAccountIdFacebookPage,
934
+ getLinkedInOrganizations: getV1AccountsByAccountIdLinkedinOrganizations,
935
+ updateLinkedInOrganization: putV1AccountsByAccountIdLinkedinOrganization,
936
+ getLinkedInMentions: getV1AccountsByAccountIdLinkedinMentions,
937
+ getPinterestBoards: getV1AccountsByAccountIdPinterestBoards,
938
+ updatePinterestBoards: putV1AccountsByAccountIdPinterestBoards,
939
+ getRedditSubreddits: getV1AccountsByAccountIdRedditSubreddits,
940
+ updateRedditSubreddits: putV1AccountsByAccountIdRedditSubreddits,
941
+ getGoogleBusinessReviews: getV1AccountsByAccountIdGmbReviews
942
+ };
943
+ /**
944
+ * Profiles API - Manage workspace profiles
945
+ */
946
+ this.profiles = {
947
+ list: getV1Profiles,
948
+ create: postV1Profiles,
949
+ get: getV1ProfilesByProfileId,
950
+ update: putV1ProfilesByProfileId,
951
+ delete: deleteV1ProfilesByProfileId
952
+ };
953
+ /**
954
+ * Analytics API - Get performance metrics
955
+ */
956
+ this.analytics = {
957
+ get: getV1Analytics,
958
+ getYouTubeDailyViews: getV1AnalyticsYoutubeDailyViews,
959
+ getLinkedInAggregate: getV1AccountsByAccountIdLinkedinAggregateAnalytics,
960
+ getLinkedInPostAnalytics: getV1AccountsByAccountIdLinkedinPostAnalytics
961
+ };
962
+ /**
963
+ * Account Groups API - Organize accounts into groups
964
+ */
965
+ this.accountGroups = {
966
+ list: getV1AccountGroups,
967
+ create: postV1AccountGroups,
968
+ update: putV1AccountGroupsByGroupId,
969
+ delete: deleteV1AccountGroupsByGroupId
970
+ };
971
+ /**
972
+ * Queue API - Manage posting queue
973
+ */
974
+ this.queue = {
975
+ listSlots: getV1QueueSlots,
976
+ createSlot: postV1QueueSlots,
977
+ updateSlot: putV1QueueSlots,
978
+ deleteSlot: deleteV1QueueSlots,
979
+ preview: getV1QueuePreview,
980
+ getNextSlot: getV1QueueNextSlot
981
+ };
982
+ /**
983
+ * Webhooks API - Configure event webhooks
984
+ */
985
+ this.webhooks = {
986
+ getSettings: getV1WebhooksSettings,
987
+ createSettings: postV1WebhooksSettings,
988
+ updateSettings: putV1WebhooksSettings,
989
+ deleteSettings: deleteV1WebhooksSettings,
990
+ test: postV1WebhooksTest,
991
+ getLogs: getV1WebhooksLogs
992
+ };
993
+ /**
994
+ * API Keys API - Manage API keys
995
+ */
996
+ this.apiKeys = {
997
+ list: getV1ApiKeys,
998
+ create: postV1ApiKeys,
999
+ delete: deleteV1ApiKeysByKeyId
1000
+ };
1001
+ /**
1002
+ * Media API - Upload and manage media files
1003
+ */
1004
+ this.media = {
1005
+ getPresignedUrl: postV1MediaPresign
1006
+ };
1007
+ /**
1008
+ * Tools API - Media download and utilities
1009
+ */
1010
+ this.tools = {
1011
+ downloadYouTube: getV1ToolsYoutubeDownload,
1012
+ getYouTubeTranscript: getV1ToolsYoutubeTranscript,
1013
+ downloadInstagram: getV1ToolsInstagramDownload,
1014
+ checkInstagramHashtags: postV1ToolsInstagramHashtagChecker,
1015
+ downloadTikTok: getV1ToolsTiktokDownload,
1016
+ downloadTwitter: getV1ToolsTwitterDownload,
1017
+ downloadFacebook: getV1ToolsFacebookDownload,
1018
+ downloadLinkedIn: getV1ToolsLinkedinDownload,
1019
+ downloadBluesky: getV1ToolsBlueskyDownload
1020
+ };
1021
+ /**
1022
+ * Users API - User management
1023
+ */
1024
+ this.users = {
1025
+ list: getV1Users,
1026
+ get: getV1UsersByUserId
1027
+ };
1028
+ /**
1029
+ * Usage API - Get usage statistics
1030
+ */
1031
+ this.usage = {
1032
+ getStats: getV1UsageStats
1033
+ };
1034
+ /**
1035
+ * Logs API - Publishing logs
1036
+ */
1037
+ this.logs = {
1038
+ list: getV1Logs,
1039
+ get: getV1LogsByLogId
1040
+ };
1041
+ /**
1042
+ * Connect API - OAuth connection flows
1043
+ */
1044
+ this.connect = {
1045
+ getUrl: getV1ConnectByPlatform,
1046
+ handleCallback: postV1ConnectByPlatform,
1047
+ facebook: {
1048
+ listPages: getV1ConnectFacebookSelectPage,
1049
+ selectPage: postV1ConnectFacebookSelectPage
1050
+ },
1051
+ googleBusiness: {
1052
+ listLocations: getV1ConnectGooglebusinessLocations,
1053
+ selectLocation: postV1ConnectGooglebusinessSelectLocation
1054
+ },
1055
+ linkedIn: {
1056
+ listOrganizations: getV1ConnectLinkedinOrganizations,
1057
+ selectOrganization: postV1ConnectLinkedinSelectOrganization
1058
+ },
1059
+ pinterest: {
1060
+ listBoards: getV1ConnectPinterestSelectBoard,
1061
+ selectBoard: postV1ConnectPinterestSelectBoard
1062
+ },
1063
+ snapchat: {
1064
+ listProfiles: getV1ConnectSnapchatSelectProfile,
1065
+ selectProfile: postV1ConnectSnapchatSelectProfile
1066
+ },
1067
+ bluesky: {
1068
+ connectCredentials: postV1ConnectBlueskyCredentials
1069
+ },
1070
+ telegram: {
1071
+ getStatus: getV1ConnectTelegram,
1072
+ initiate: postV1ConnectTelegram,
1073
+ complete: patchV1ConnectTelegram
1074
+ }
1075
+ };
1076
+ /**
1077
+ * Reddit API - Search and feed
1078
+ */
1079
+ this.reddit = {
1080
+ search: getV1RedditSearch,
1081
+ getFeed: getV1RedditFeed
1082
+ };
1083
+ /**
1084
+ * Invites API - Team invitations
1085
+ */
1086
+ this.invites = {
1087
+ createToken: postV1InviteTokens,
1088
+ list: getV1PlatformInvites,
1089
+ create: postV1PlatformInvites,
1090
+ delete: deleteV1PlatformInvites
1091
+ };
1092
+ const apiKey = options.apiKey ?? process.env["LATE_API_KEY"];
1093
+ if (!apiKey) {
1094
+ throw new LateApiError(
1095
+ "The LATE_API_KEY environment variable is missing or empty; either provide it, or instantiate the Late client with an apiKey option, like new Late({ apiKey: 'sk_...' }).",
1096
+ 401,
1097
+ "missing_api_key"
1098
+ );
1099
+ }
1100
+ this.apiKey = apiKey;
1101
+ this.baseURL = options.baseURL ?? "https://getlate.dev/api";
1102
+ this._options = options;
1103
+ client.setConfig({
1104
+ baseUrl: this.baseURL
1105
+ });
1106
+ client.interceptors.request.use((request) => {
1107
+ request.headers.set("Authorization", `Bearer ${this.apiKey}`);
1108
+ if (options.defaultHeaders) {
1109
+ for (const [key, value] of Object.entries(options.defaultHeaders)) {
1110
+ request.headers.set(key, value);
1111
+ }
1112
+ }
1113
+ return request;
1114
+ });
1115
+ client.interceptors.response.use(async (response) => {
1116
+ if (!response.ok) {
1117
+ let body;
1118
+ try {
1119
+ body = await response.clone().json();
1120
+ } catch {
1121
+ }
1122
+ throw parseApiError(response, body);
1123
+ }
1124
+ return response;
1125
+ });
1126
+ }
1127
+ };
1128
+ // Annotate the CommonJS export names for ESM import in node:
1129
+ 0 && (module.exports = {
1130
+ Late,
1131
+ LateApiError,
1132
+ RateLimitError,
1133
+ ValidationError,
1134
+ parseApiError
1135
+ });