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