schedulifyx-sdk 1.0.3 → 1.2.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/README.md +134 -49
- package/dist/index.d.mts +492 -54
- package/dist/index.d.ts +492 -54
- package/dist/index.js +208 -31
- package/dist/index.mjs +208 -31
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,8 +26,8 @@ console.log(posts.data);
|
|
|
26
26
|
// Create a scheduled post
|
|
27
27
|
const post = await client.posts.create({
|
|
28
28
|
content: 'Hello from the SDK! 🚀',
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
platforms: [{ platform: 'twitter', accountId: 'acc_123' }],
|
|
30
|
+
scheduledFor: '2024-12-20T10:00:00Z'
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
// Publish immediately
|
|
@@ -39,14 +39,14 @@ await client.posts.publish(post.data.id);
|
|
|
39
39
|
```typescript
|
|
40
40
|
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
41
41
|
|
|
42
|
-
// Simple initialization
|
|
42
|
+
// Simple initialization with API key string
|
|
43
43
|
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
44
44
|
|
|
45
45
|
// With options
|
|
46
46
|
const client = new SchedulifyX({
|
|
47
47
|
apiKey: 'sk_live_YOUR_API_KEY',
|
|
48
|
-
baseUrl: 'https://api.schedulifyx.com', // optional
|
|
49
|
-
timeout: 30000 // optional, in ms
|
|
48
|
+
baseUrl: 'https://api.schedulifyx.com', // optional, default
|
|
49
|
+
timeout: 30000 // optional, in ms, default 30000
|
|
50
50
|
});
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -69,18 +69,18 @@ const post = await client.posts.get('post_123');
|
|
|
69
69
|
// Create post
|
|
70
70
|
const newPost = await client.posts.create({
|
|
71
71
|
content: 'Hello world!',
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
platforms: [
|
|
73
|
+
{ platform: 'twitter', accountId: 'acc_123' },
|
|
74
|
+
{ platform: 'instagram', accountId: 'acc_456' }
|
|
75
|
+
],
|
|
76
|
+
scheduledFor: '2024-12-20T10:00:00Z',
|
|
77
|
+
mediaUrls: ['https://example.com/image.jpg']
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
// Update post
|
|
81
81
|
await client.posts.update('post_123', {
|
|
82
82
|
content: 'Updated content',
|
|
83
|
-
|
|
83
|
+
scheduledFor: '2024-12-21T10:00:00Z'
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
// Delete post
|
|
@@ -108,31 +108,24 @@ const account = await client.accounts.get('acc_123');
|
|
|
108
108
|
const boards = await client.accounts.getPinterestBoards('acc_pinterest_123');
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
###
|
|
111
|
+
### Profiles
|
|
112
112
|
|
|
113
113
|
```typescript
|
|
114
|
-
//
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
// List publishing profiles
|
|
115
|
+
const profiles = await client.profiles.list();
|
|
116
|
+
|
|
117
|
+
// Create a profile
|
|
118
|
+
const profile = await client.profiles.create({
|
|
119
|
+
name: 'Morning Posts',
|
|
120
|
+
description: 'Profile for morning content',
|
|
121
|
+
color: '#3B82F6'
|
|
118
122
|
});
|
|
119
123
|
|
|
120
|
-
//
|
|
121
|
-
await
|
|
122
|
-
method: 'PUT',
|
|
123
|
-
headers: { 'Content-Type': 'image/jpeg' },
|
|
124
|
-
body: imageBuffer
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
// Use mediaUrl in your post
|
|
128
|
-
await client.posts.create({
|
|
129
|
-
content: 'Check out this image!',
|
|
130
|
-
accountIds: ['acc_123'],
|
|
131
|
-
mediaUrls: [data.mediaUrl]
|
|
132
|
-
});
|
|
124
|
+
// Update a profile
|
|
125
|
+
await client.profiles.update('profile_123', { name: 'Updated Name' });
|
|
133
126
|
|
|
134
|
-
//
|
|
135
|
-
|
|
127
|
+
// Delete a profile
|
|
128
|
+
await client.profiles.delete('profile_123');
|
|
136
129
|
```
|
|
137
130
|
|
|
138
131
|
### Analytics
|
|
@@ -142,9 +135,7 @@ const mediaUrl = await client.media.upload(imageBuffer, 'image.jpg', 'image/jpeg
|
|
|
142
135
|
const overview = await client.analytics.overview();
|
|
143
136
|
|
|
144
137
|
// Get account-specific analytics
|
|
145
|
-
const accountAnalytics = await client.analytics.forAccount('acc_123', {
|
|
146
|
-
days: 30
|
|
147
|
-
});
|
|
138
|
+
const accountAnalytics = await client.analytics.forAccount('acc_123', { days: 30 });
|
|
148
139
|
|
|
149
140
|
// Get all analytics
|
|
150
141
|
const allAnalytics = await client.analytics.list({
|
|
@@ -157,25 +148,99 @@ const allAnalytics = await client.analytics.list({
|
|
|
157
148
|
|
|
158
149
|
```typescript
|
|
159
150
|
// Get queue schedule
|
|
160
|
-
const queue = await client.queue.getSlots('
|
|
151
|
+
const queue = await client.queue.getSlots('acc_123');
|
|
161
152
|
|
|
162
153
|
// Set queue schedule
|
|
163
154
|
await client.queue.setSlots({
|
|
164
|
-
|
|
155
|
+
accountId: 'acc_123',
|
|
165
156
|
timezone: 'America/New_York',
|
|
166
157
|
slots: [
|
|
167
158
|
{ dayOfWeek: 1, time: '09:00' },
|
|
168
159
|
{ dayOfWeek: 1, time: '15:00' },
|
|
169
|
-
{ dayOfWeek:
|
|
160
|
+
{ dayOfWeek: 3, time: '12:00' }
|
|
170
161
|
],
|
|
171
|
-
|
|
162
|
+
isActive: true
|
|
172
163
|
});
|
|
173
164
|
|
|
174
165
|
// Get next available slot
|
|
175
|
-
const nextSlot = await client.queue.getNextSlot('
|
|
166
|
+
const nextSlot = await client.queue.getNextSlot('acc_123');
|
|
176
167
|
|
|
177
168
|
// Preview upcoming slots
|
|
178
|
-
const preview = await client.queue.preview('
|
|
169
|
+
const preview = await client.queue.preview('acc_123', 10);
|
|
170
|
+
|
|
171
|
+
// Get all queue schedules
|
|
172
|
+
const all = await client.queue.getAll();
|
|
173
|
+
|
|
174
|
+
// Delete queue schedule
|
|
175
|
+
await client.queue.deleteSlots('acc_123');
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Webhooks
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
// Create a webhook
|
|
182
|
+
const webhook = await client.webhooks.create({
|
|
183
|
+
name: 'My Webhook',
|
|
184
|
+
url: 'https://your-server.com/webhooks',
|
|
185
|
+
events: ['post.published', 'post.failed']
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// List webhooks
|
|
189
|
+
const webhooks = await client.webhooks.list();
|
|
190
|
+
|
|
191
|
+
// Update a webhook
|
|
192
|
+
await client.webhooks.update('wh_123', { events: ['post.published'], isActive: false });
|
|
193
|
+
|
|
194
|
+
// Rotate secret
|
|
195
|
+
const rotated = await client.webhooks.rotateSecret('wh_123');
|
|
196
|
+
|
|
197
|
+
// Test a webhook
|
|
198
|
+
await client.webhooks.test('wh_123', 'post.published');
|
|
199
|
+
|
|
200
|
+
// Get event history
|
|
201
|
+
const events = await client.webhooks.getEvents('wh_123');
|
|
202
|
+
|
|
203
|
+
// Get available event types
|
|
204
|
+
const types = await client.webhooks.getEventTypes();
|
|
205
|
+
|
|
206
|
+
// Delete a webhook
|
|
207
|
+
await client.webhooks.delete('wh_123');
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Comments
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const comments = await client.comments.list({ sentiment: 'positive', limit: 20 });
|
|
214
|
+
const comment = await client.comments.get('comment_123');
|
|
215
|
+
const replies = await client.comments.getReplies('comment_123');
|
|
216
|
+
await client.comments.reply('comment_123', { message: 'Thanks!' });
|
|
217
|
+
const stats = await client.comments.stats();
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Inbox
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
const conversations = await client.inbox.list({ status: 'open', hasUnread: true });
|
|
224
|
+
const messages = await client.inbox.getMessages('conv_123');
|
|
225
|
+
await client.inbox.reply('conv_123', { message: 'Thanks for reaching out!' });
|
|
226
|
+
const inboxStats = await client.inbox.stats();
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Mentions
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
const mentions = await client.mentions.list({ platform: 'instagram', status: 'unread' });
|
|
233
|
+
const mentionStats = await client.mentions.stats();
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### X/Twitter BYOK
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
const config = await client.xTwitter.getConfig();
|
|
240
|
+
await client.xTwitter.setCredentials({
|
|
241
|
+
apiKey: '...', apiSecret: '...', accessToken: '...', accessTokenSecret: '...'
|
|
242
|
+
});
|
|
243
|
+
await client.xTwitter.switchMode({ accountId: 'acc_123', mode: 'byok' });
|
|
179
244
|
```
|
|
180
245
|
|
|
181
246
|
### Usage
|
|
@@ -185,7 +250,7 @@ const usage = await client.usage();
|
|
|
185
250
|
console.log(`${usage.data.requestsToday}/${usage.data.dailyLimit} daily requests used`);
|
|
186
251
|
```
|
|
187
252
|
|
|
188
|
-
### Multi-Tenant
|
|
253
|
+
### Multi-Tenant
|
|
189
254
|
|
|
190
255
|
```typescript
|
|
191
256
|
// Create a tenant
|
|
@@ -197,11 +262,16 @@ const tenant = await client.tenants.create({
|
|
|
197
262
|
|
|
198
263
|
// Get OAuth URL for tenant
|
|
199
264
|
const { data } = await client.tenants.getConnectUrl(tenant.data.id, 'instagram');
|
|
200
|
-
// Redirect user to data.url
|
|
201
265
|
|
|
202
266
|
// List tenant's accounts
|
|
203
267
|
const accounts = await client.tenants.listAccounts(tenant.data.id);
|
|
204
268
|
|
|
269
|
+
// Connect Bluesky for tenant
|
|
270
|
+
await client.tenants.connectBluesky(tenant.data.id, {
|
|
271
|
+
identifier: 'user.bsky.social',
|
|
272
|
+
appPassword: 'xxxx-xxxx-xxxx-xxxx'
|
|
273
|
+
});
|
|
274
|
+
|
|
205
275
|
// Disconnect account
|
|
206
276
|
await client.tenants.disconnectAccount(tenant.data.id, 'acc_123');
|
|
207
277
|
```
|
|
@@ -227,13 +297,28 @@ try {
|
|
|
227
297
|
Full TypeScript support with exported types:
|
|
228
298
|
|
|
229
299
|
```typescript
|
|
230
|
-
import type {
|
|
231
|
-
Post,
|
|
232
|
-
Account,
|
|
233
|
-
|
|
234
|
-
|
|
300
|
+
import type {
|
|
301
|
+
Post,
|
|
302
|
+
Account,
|
|
303
|
+
Profile,
|
|
304
|
+
Analytics,
|
|
305
|
+
AnalyticsOverview,
|
|
306
|
+
Usage,
|
|
307
|
+
Tenant,
|
|
308
|
+
QueueSlot,
|
|
235
309
|
QueueSchedule,
|
|
236
|
-
|
|
310
|
+
Webhook,
|
|
311
|
+
WebhookEvent,
|
|
312
|
+
WebhookEventType,
|
|
313
|
+
Comment,
|
|
314
|
+
CommentStats,
|
|
315
|
+
Conversation,
|
|
316
|
+
InboxMessage,
|
|
317
|
+
InboxStats,
|
|
318
|
+
Mention,
|
|
319
|
+
MentionStats,
|
|
320
|
+
PaginatedResponse,
|
|
321
|
+
SchedulifyXConfig
|
|
237
322
|
} from 'schedulifyx-sdk';
|
|
238
323
|
```
|
|
239
324
|
|