@getlatedev/node 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlatedev/node",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "The official Node.js library for the Late API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,10 +25,11 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "scripts": {
28
- "generate": "openapi-ts -i openapi.yaml -o src/generated -c @hey-api/client-fetch",
28
+ "generate": "openapi-ts -i openapi.yaml -o src/generated -c @hey-api/client-fetch && npm run generate:client",
29
+ "generate:client": "npx tsx scripts/generate-client.ts",
29
30
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",
30
31
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
31
- "lint": "eslint src --ext .ts",
32
+ "lint": "eslint src",
32
33
  "typecheck": "tsc --noEmit",
33
34
  "test": "vitest run",
34
35
  "test:watch": "vitest",
@@ -71,9 +72,13 @@
71
72
  "@hey-api/client-fetch": "^0.6.0",
72
73
  "@hey-api/openapi-ts": "^0.61.0",
73
74
  "@types/node": "^20.11.0",
75
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
76
+ "@typescript-eslint/parser": "^7.18.0",
74
77
  "eslint": "^8.56.0",
75
78
  "tsup": "^8.0.1",
79
+ "tsx": "^4.7.0",
76
80
  "typescript": "^5.3.3",
77
- "vitest": "^1.2.0"
81
+ "vitest": "^1.2.0",
82
+ "yaml": "^2.3.4"
78
83
  }
79
84
  }
package/src/client.ts CHANGED
@@ -1,114 +1,93 @@
1
1
  import {
2
2
  client,
3
- // Posts
4
- getV1Posts,
5
- postV1Posts,
6
- getV1PostsByPostId,
7
- putV1PostsByPostId,
8
- deleteV1PostsByPostId,
9
- postV1PostsByPostIdRetry,
10
- postV1PostsBulkUpload,
11
- getV1PostsByPostIdLogs,
12
- // Accounts
13
- getV1Accounts,
14
- putV1AccountsByAccountId,
15
- deleteV1AccountsByAccountId,
16
- getV1AccountsFollowerStats,
17
- getV1AccountsHealth,
18
- getV1AccountsByAccountIdHealth,
19
- // Profiles
20
- getV1Profiles,
21
- postV1Profiles,
22
- getV1ProfilesByProfileId,
23
- putV1ProfilesByProfileId,
24
- deleteV1ProfilesByProfileId,
25
- // Analytics
26
- getV1Analytics,
27
- getV1AnalyticsYoutubeDailyViews,
28
- getV1AccountsByAccountIdLinkedinAggregateAnalytics,
29
- getV1AccountsByAccountIdLinkedinPostAnalytics,
30
- // Account Groups
31
- getV1AccountGroups,
32
- postV1AccountGroups,
33
- putV1AccountGroupsByGroupId,
34
- deleteV1AccountGroupsByGroupId,
35
- // Queue
36
- getV1QueueSlots,
37
- postV1QueueSlots,
38
- putV1QueueSlots,
39
- deleteV1QueueSlots,
40
- getV1QueuePreview,
41
- getV1QueueNextSlot,
42
- // Webhooks
43
- getV1WebhooksSettings,
44
- postV1WebhooksSettings,
45
- putV1WebhooksSettings,
46
- deleteV1WebhooksSettings,
47
- postV1WebhooksTest,
48
- getV1WebhooksLogs,
49
- // API Keys
50
- getV1ApiKeys,
51
- postV1ApiKeys,
52
- deleteV1ApiKeysByKeyId,
53
- // Media
54
- postV1MediaPresign,
55
- // Tools
56
- getV1ToolsYoutubeDownload,
57
- getV1ToolsYoutubeTranscript,
58
- getV1ToolsInstagramDownload,
59
- postV1ToolsInstagramHashtagChecker,
60
- getV1ToolsTiktokDownload,
61
- getV1ToolsTwitterDownload,
62
- getV1ToolsFacebookDownload,
63
- getV1ToolsLinkedinDownload,
64
- getV1ToolsBlueskyDownload,
65
- // Users
66
- getV1Users,
67
- getV1UsersByUserId,
68
- // Usage
69
- getV1UsageStats,
70
- // Logs
71
- getV1Logs,
72
- getV1LogsByLogId,
73
- // Connect
74
- getV1ConnectByPlatform,
75
- postV1ConnectByPlatform,
76
- getV1ConnectFacebookSelectPage,
77
- postV1ConnectFacebookSelectPage,
78
- getV1ConnectGooglebusinessLocations,
79
- postV1ConnectGooglebusinessSelectLocation,
80
- getV1ConnectLinkedinOrganizations,
81
- postV1ConnectLinkedinSelectOrganization,
82
- getV1ConnectPinterestSelectBoard,
83
- postV1ConnectPinterestSelectBoard,
84
- getV1ConnectSnapchatSelectProfile,
85
- postV1ConnectSnapchatSelectProfile,
86
- postV1ConnectBlueskyCredentials,
87
- getV1ConnectTelegram,
88
- postV1ConnectTelegram,
89
- patchV1ConnectTelegram,
90
- // Reddit
91
- getV1RedditSearch,
92
- getV1RedditFeed,
93
- // Invites
94
- postV1InviteTokens,
95
- getV1PlatformInvites,
96
- postV1PlatformInvites,
97
- deleteV1PlatformInvites,
98
- // Account-specific endpoints
99
- putV1AccountsByAccountIdFacebookPage,
100
- getV1AccountsByAccountIdLinkedinOrganizations,
101
- putV1AccountsByAccountIdLinkedinOrganization,
102
- getV1AccountsByAccountIdLinkedinMentions,
103
- getV1AccountsByAccountIdPinterestBoards,
104
- putV1AccountsByAccountIdPinterestBoards,
105
- getV1AccountsByAccountIdRedditSubreddits,
106
- putV1AccountsByAccountIdRedditSubreddits,
107
- getV1AccountsByAccountIdGmbReviews,
3
+ bulkUploadPosts,
4
+ checkInstagramHashtags,
5
+ completeTelegramConnect,
6
+ connectBlueskyCredentials,
7
+ createAccountGroup,
8
+ createApiKey,
9
+ createInviteToken,
10
+ createPost,
11
+ createProfile,
12
+ createQueueSlot,
13
+ createWebhookSettings,
14
+ deleteAccount,
15
+ deleteAccountGroup,
16
+ deleteApiKey,
17
+ deletePost,
18
+ deleteProfile,
19
+ deleteQueueSlot,
20
+ deleteWebhookSettings,
21
+ downloadBlueskyMedia,
22
+ downloadFacebookVideo,
23
+ downloadInstagramMedia,
24
+ downloadLinkedInVideo,
25
+ downloadTikTokVideo,
26
+ downloadTwitterMedia,
27
+ downloadYouTubeVideo,
28
+ getAccountHealth,
29
+ getAllAccountsHealth,
30
+ getAnalytics,
31
+ getConnectUrl,
32
+ getFollowerStats,
33
+ getGoogleBusinessReviews,
34
+ getLinkedInAggregateAnalytics,
35
+ getLinkedInMentions,
36
+ getLinkedInOrganizations,
37
+ getLinkedInPostAnalytics,
38
+ getLog,
39
+ getMediaPresignedUrl,
40
+ getNextQueueSlot,
41
+ getPinterestBoards,
42
+ getPost,
43
+ getPostLogs,
44
+ getProfile,
45
+ getRedditFeed,
46
+ getRedditSubreddits,
47
+ getTelegramConnectStatus,
48
+ getUsageStats,
49
+ getUser,
50
+ getWebhookLogs,
51
+ getWebhookSettings,
52
+ getYouTubeDailyViews,
53
+ getYouTubeTranscript,
54
+ handleOAuthCallback,
55
+ initiateTelegramConnect,
56
+ listAccountGroups,
57
+ listAccounts,
58
+ listApiKeys,
59
+ listFacebookPages,
60
+ listGoogleBusinessLocations,
61
+ listLinkedInOrganizations,
62
+ listLogs,
63
+ listPinterestBoardsForSelection,
64
+ listPosts,
65
+ listProfiles,
66
+ listQueueSlots,
67
+ listSnapchatProfiles,
68
+ listUsers,
69
+ previewQueue,
70
+ retryPost,
71
+ searchReddit,
72
+ selectFacebookPage,
73
+ selectGoogleBusinessLocation,
74
+ selectLinkedInOrganization,
75
+ selectPinterestBoard,
76
+ selectSnapchatProfile,
77
+ testWebhook,
78
+ updateAccount,
79
+ updateAccountGroup,
80
+ updateFacebookPage,
81
+ updateLinkedInOrganization,
82
+ updatePinterestBoards,
83
+ updatePost,
84
+ updateProfile,
85
+ updateQueueSlot,
86
+ updateRedditSubreddits,
87
+ updateWebhookSettings,
108
88
  } from './generated/sdk.gen';
109
89
 
110
90
  import { LateApiError, parseApiError } from './errors';
111
-
112
91
  export interface ClientOptions {
113
92
  /**
114
93
  * API key for authentication. Defaults to process.env['LATE_API_KEY'].
@@ -132,7 +111,6 @@ export interface ClientOptions {
132
111
  */
133
112
  defaultHeaders?: Record<string, string>;
134
113
  }
135
-
136
114
  /**
137
115
  * API Client for the Late API.
138
116
  *
@@ -172,201 +150,198 @@ export class Late {
172
150
  baseURL: string;
173
151
 
174
152
  /**
175
- * Posts API - Create, schedule, and manage social media posts
176
- */
177
- posts = {
178
- list: getV1Posts,
179
- create: postV1Posts,
180
- get: getV1PostsByPostId,
181
- update: putV1PostsByPostId,
182
- delete: deleteV1PostsByPostId,
183
- retry: postV1PostsByPostIdRetry,
184
- bulkUpload: postV1PostsBulkUpload,
185
- getLogs: getV1PostsByPostIdLogs,
186
- };
187
-
188
- /**
189
- * Accounts API - Manage connected social media accounts
190
- */
191
- accounts = {
192
- list: getV1Accounts,
193
- update: putV1AccountsByAccountId,
194
- delete: deleteV1AccountsByAccountId,
195
- getFollowerStats: getV1AccountsFollowerStats,
196
- getAllHealth: getV1AccountsHealth,
197
- getHealth: getV1AccountsByAccountIdHealth,
198
- updateFacebookPage: putV1AccountsByAccountIdFacebookPage,
199
- getLinkedInOrganizations: getV1AccountsByAccountIdLinkedinOrganizations,
200
- updateLinkedInOrganization: putV1AccountsByAccountIdLinkedinOrganization,
201
- getLinkedInMentions: getV1AccountsByAccountIdLinkedinMentions,
202
- getPinterestBoards: getV1AccountsByAccountIdPinterestBoards,
203
- updatePinterestBoards: putV1AccountsByAccountIdPinterestBoards,
204
- getRedditSubreddits: getV1AccountsByAccountIdRedditSubreddits,
205
- updateRedditSubreddits: putV1AccountsByAccountIdRedditSubreddits,
206
- getGoogleBusinessReviews: getV1AccountsByAccountIdGmbReviews,
207
- };
208
-
209
- /**
210
- * Profiles API - Manage workspace profiles
153
+ * Tools API - Media download and utilities
211
154
  */
212
- profiles = {
213
- list: getV1Profiles,
214
- create: postV1Profiles,
215
- get: getV1ProfilesByProfileId,
216
- update: putV1ProfilesByProfileId,
217
- delete: deleteV1ProfilesByProfileId,
155
+ tools = {
156
+ downloadYouTubeVideo: downloadYouTubeVideo,
157
+ getYouTubeTranscript: getYouTubeTranscript,
158
+ downloadInstagramMedia: downloadInstagramMedia,
159
+ checkInstagramHashtags: checkInstagramHashtags,
160
+ downloadTikTokVideo: downloadTikTokVideo,
161
+ downloadTwitterMedia: downloadTwitterMedia,
162
+ downloadFacebookVideo: downloadFacebookVideo,
163
+ downloadLinkedInVideo: downloadLinkedInVideo,
164
+ downloadBlueskyMedia: downloadBlueskyMedia,
218
165
  };
219
166
 
220
167
  /**
221
168
  * Analytics API - Get performance metrics
222
169
  */
223
170
  analytics = {
224
- get: getV1Analytics,
225
- getYouTubeDailyViews: getV1AnalyticsYoutubeDailyViews,
226
- getLinkedInAggregate: getV1AccountsByAccountIdLinkedinAggregateAnalytics,
227
- getLinkedInPostAnalytics: getV1AccountsByAccountIdLinkedinPostAnalytics,
171
+ getAnalytics: getAnalytics,
172
+ getYouTubeDailyViews: getYouTubeDailyViews,
173
+ getLinkedInAggregateAnalytics: getLinkedInAggregateAnalytics,
174
+ getLinkedInPostAnalytics: getLinkedInPostAnalytics,
228
175
  };
229
176
 
230
177
  /**
231
178
  * Account Groups API - Organize accounts into groups
232
179
  */
233
180
  accountGroups = {
234
- list: getV1AccountGroups,
235
- create: postV1AccountGroups,
236
- update: putV1AccountGroupsByGroupId,
237
- delete: deleteV1AccountGroupsByGroupId,
181
+ listAccountGroups: listAccountGroups,
182
+ createAccountGroup: createAccountGroup,
183
+ updateAccountGroup: updateAccountGroup,
184
+ deleteAccountGroup: deleteAccountGroup,
238
185
  };
239
186
 
240
187
  /**
241
- * Queue API - Manage posting queue
188
+ * Media API - Upload and manage media files
242
189
  */
243
- queue = {
244
- listSlots: getV1QueueSlots,
245
- createSlot: postV1QueueSlots,
246
- updateSlot: putV1QueueSlots,
247
- deleteSlot: deleteV1QueueSlots,
248
- preview: getV1QueuePreview,
249
- getNextSlot: getV1QueueNextSlot,
190
+ media = {
191
+ getMediaPresignedUrl: getMediaPresignedUrl,
250
192
  };
251
193
 
252
194
  /**
253
- * Webhooks API - Configure event webhooks
195
+ * Reddit API - Search and feed
254
196
  */
255
- webhooks = {
256
- getSettings: getV1WebhooksSettings,
257
- createSettings: postV1WebhooksSettings,
258
- updateSettings: putV1WebhooksSettings,
259
- deleteSettings: deleteV1WebhooksSettings,
260
- test: postV1WebhooksTest,
261
- getLogs: getV1WebhooksLogs,
197
+ reddit = {
198
+ searchReddit: searchReddit,
199
+ getRedditFeed: getRedditFeed,
262
200
  };
263
201
 
264
202
  /**
265
- * API Keys API - Manage API keys
203
+ * Usage API - Get usage statistics
266
204
  */
267
- apiKeys = {
268
- list: getV1ApiKeys,
269
- create: postV1ApiKeys,
270
- delete: deleteV1ApiKeysByKeyId,
205
+ usage = {
206
+ getUsageStats: getUsageStats,
271
207
  };
272
208
 
273
209
  /**
274
- * Media API - Upload and manage media files
210
+ * Posts API - Create, schedule, and manage social media posts
275
211
  */
276
- media = {
277
- getPresignedUrl: postV1MediaPresign,
212
+ posts = {
213
+ listPosts: listPosts,
214
+ createPost: createPost,
215
+ getPost: getPost,
216
+ updatePost: updatePost,
217
+ deletePost: deletePost,
218
+ bulkUploadPosts: bulkUploadPosts,
219
+ retryPost: retryPost,
278
220
  };
279
221
 
280
222
  /**
281
- * Tools API - Media download and utilities
223
+ * Users API - User management
282
224
  */
283
- tools = {
284
- downloadYouTube: getV1ToolsYoutubeDownload,
285
- getYouTubeTranscript: getV1ToolsYoutubeTranscript,
286
- downloadInstagram: getV1ToolsInstagramDownload,
287
- checkInstagramHashtags: postV1ToolsInstagramHashtagChecker,
288
- downloadTikTok: getV1ToolsTiktokDownload,
289
- downloadTwitter: getV1ToolsTwitterDownload,
290
- downloadFacebook: getV1ToolsFacebookDownload,
291
- downloadLinkedIn: getV1ToolsLinkedinDownload,
292
- downloadBluesky: getV1ToolsBlueskyDownload,
225
+ users = {
226
+ listUsers: listUsers,
227
+ getUser: getUser,
293
228
  };
294
229
 
295
230
  /**
296
- * Users API - User management
231
+ * Profiles API - Manage workspace profiles
297
232
  */
298
- users = {
299
- list: getV1Users,
300
- get: getV1UsersByUserId,
233
+ profiles = {
234
+ listProfiles: listProfiles,
235
+ createProfile: createProfile,
236
+ getProfile: getProfile,
237
+ updateProfile: updateProfile,
238
+ deleteProfile: deleteProfile,
301
239
  };
302
240
 
303
241
  /**
304
- * Usage API - Get usage statistics
242
+ * Accounts API - Manage connected social media accounts
305
243
  */
306
- usage = {
307
- getStats: getV1UsageStats,
244
+ accounts = {
245
+ listAccounts: listAccounts,
246
+ getFollowerStats: getFollowerStats,
247
+ updateAccount: updateAccount,
248
+ deleteAccount: deleteAccount,
249
+ getAllAccountsHealth: getAllAccountsHealth,
250
+ getAccountHealth: getAccountHealth,
251
+ getGoogleBusinessReviews: getGoogleBusinessReviews,
252
+ getLinkedInMentions: getLinkedInMentions,
308
253
  };
309
254
 
310
255
  /**
311
- * Logs API - Publishing logs
256
+ * API Keys API - Manage API keys
312
257
  */
313
- logs = {
314
- list: getV1Logs,
315
- get: getV1LogsByLogId,
258
+ apiKeys = {
259
+ listApiKeys: listApiKeys,
260
+ createApiKey: createApiKey,
261
+ deleteApiKey: deleteApiKey,
262
+ };
263
+
264
+ /**
265
+ * Invites API - Team invitations
266
+ */
267
+ invites = {
268
+ createInviteToken: createInviteToken,
316
269
  };
317
270
 
318
271
  /**
319
272
  * Connect API - OAuth connection flows
320
273
  */
321
274
  connect = {
322
- getUrl: getV1ConnectByPlatform,
323
- handleCallback: postV1ConnectByPlatform,
275
+ getConnectUrl: getConnectUrl,
276
+ handleOAuthCallback: handleOAuthCallback,
277
+ updateFacebookPage: updateFacebookPage,
278
+ getLinkedInOrganizations: getLinkedInOrganizations,
279
+ updateLinkedInOrganization: updateLinkedInOrganization,
280
+ getPinterestBoards: getPinterestBoards,
281
+ updatePinterestBoards: updatePinterestBoards,
282
+ getRedditSubreddits: getRedditSubreddits,
283
+ updateRedditSubreddits: updateRedditSubreddits,
324
284
  facebook: {
325
- listPages: getV1ConnectFacebookSelectPage,
326
- selectPage: postV1ConnectFacebookSelectPage,
285
+ listFacebookPages: listFacebookPages,
286
+ selectFacebookPage: selectFacebookPage,
327
287
  },
328
288
  googleBusiness: {
329
- listLocations: getV1ConnectGooglebusinessLocations,
330
- selectLocation: postV1ConnectGooglebusinessSelectLocation,
289
+ listGoogleBusinessLocations: listGoogleBusinessLocations,
290
+ selectGoogleBusinessLocation: selectGoogleBusinessLocation,
331
291
  },
332
- linkedIn: {
333
- listOrganizations: getV1ConnectLinkedinOrganizations,
334
- selectOrganization: postV1ConnectLinkedinSelectOrganization,
292
+ linkedin: {
293
+ listLinkedInOrganizations: listLinkedInOrganizations,
294
+ selectLinkedInOrganization: selectLinkedInOrganization,
335
295
  },
336
296
  pinterest: {
337
- listBoards: getV1ConnectPinterestSelectBoard,
338
- selectBoard: postV1ConnectPinterestSelectBoard,
297
+ listPinterestBoardsForSelection: listPinterestBoardsForSelection,
298
+ selectPinterestBoard: selectPinterestBoard,
339
299
  },
340
300
  snapchat: {
341
- listProfiles: getV1ConnectSnapchatSelectProfile,
342
- selectProfile: postV1ConnectSnapchatSelectProfile,
301
+ listSnapchatProfiles: listSnapchatProfiles,
302
+ selectSnapchatProfile: selectSnapchatProfile,
343
303
  },
344
304
  bluesky: {
345
- connectCredentials: postV1ConnectBlueskyCredentials,
305
+ connectBlueskyCredentials: connectBlueskyCredentials,
346
306
  },
347
307
  telegram: {
348
- getStatus: getV1ConnectTelegram,
349
- initiate: postV1ConnectTelegram,
350
- complete: patchV1ConnectTelegram,
308
+ getTelegramConnectStatus: getTelegramConnectStatus,
309
+ initiateTelegramConnect: initiateTelegramConnect,
310
+ completeTelegramConnect: completeTelegramConnect,
351
311
  },
352
312
  };
353
313
 
354
314
  /**
355
- * Reddit API - Search and feed
315
+ * Queue API - Manage posting queue
356
316
  */
357
- reddit = {
358
- search: getV1RedditSearch,
359
- getFeed: getV1RedditFeed,
317
+ queue = {
318
+ listQueueSlots: listQueueSlots,
319
+ createQueueSlot: createQueueSlot,
320
+ updateQueueSlot: updateQueueSlot,
321
+ deleteQueueSlot: deleteQueueSlot,
322
+ previewQueue: previewQueue,
323
+ getNextQueueSlot: getNextQueueSlot,
360
324
  };
361
325
 
362
326
  /**
363
- * Invites API - Team invitations
327
+ * Webhooks API - Configure event webhooks
364
328
  */
365
- invites = {
366
- createToken: postV1InviteTokens,
367
- list: getV1PlatformInvites,
368
- create: postV1PlatformInvites,
369
- delete: deleteV1PlatformInvites,
329
+ webhooks = {
330
+ getWebhookSettings: getWebhookSettings,
331
+ createWebhookSettings: createWebhookSettings,
332
+ updateWebhookSettings: updateWebhookSettings,
333
+ deleteWebhookSettings: deleteWebhookSettings,
334
+ testWebhook: testWebhook,
335
+ getWebhookLogs: getWebhookLogs,
336
+ };
337
+
338
+ /**
339
+ * Logs API - Publishing logs
340
+ */
341
+ logs = {
342
+ listLogs: listLogs,
343
+ getLog: getLog,
344
+ getPostLogs: getPostLogs,
370
345
  };
371
346
 
372
347
  /**