schedulifyx-sdk 1.0.1 → 1.0.5
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 +242 -242
- package/dist/index.d.mts +158 -14
- package/dist/index.d.ts +158 -14
- package/dist/index.js +72 -9
- package/dist/index.mjs +72 -9
- package/package.json +59 -59
package/README.md
CHANGED
|
@@ -1,242 +1,242 @@
|
|
|
1
|
-
# schedulifyx-sdk
|
|
2
|
-
|
|
3
|
-
Official JavaScript/TypeScript SDK for [SchedulifyX API](https://app.schedulifyx.com/docs/) - Social media scheduling made easy.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install schedulifyx-sdk
|
|
9
|
-
# or
|
|
10
|
-
yarn add schedulifyx-sdk
|
|
11
|
-
# or
|
|
12
|
-
pnpm add schedulifyx-sdk
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Quick Start
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
19
|
-
|
|
20
|
-
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
21
|
-
|
|
22
|
-
// List all posts
|
|
23
|
-
const posts = await client.posts.list();
|
|
24
|
-
console.log(posts.data);
|
|
25
|
-
|
|
26
|
-
// Create a scheduled post
|
|
27
|
-
const post = await client.posts.create({
|
|
28
|
-
content: 'Hello from the SDK! 🚀',
|
|
29
|
-
accountIds: ['acc_123'],
|
|
30
|
-
publishAt: '2024-12-20T10:00:00Z'
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Publish immediately
|
|
34
|
-
await client.posts.publish(post.data.id);
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Configuration
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
41
|
-
|
|
42
|
-
// Simple initialization
|
|
43
|
-
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
44
|
-
|
|
45
|
-
// With options
|
|
46
|
-
const client = new SchedulifyX({
|
|
47
|
-
apiKey: 'sk_live_YOUR_API_KEY',
|
|
48
|
-
baseUrl: 'https://api.schedulifyx.com', // optional
|
|
49
|
-
timeout: 30000 // optional, in ms
|
|
50
|
-
});
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## API Reference
|
|
54
|
-
|
|
55
|
-
### Posts
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
// List posts with filters
|
|
59
|
-
const posts = await client.posts.list({
|
|
60
|
-
status: 'scheduled',
|
|
61
|
-
accountId: 'acc_123',
|
|
62
|
-
limit: 20,
|
|
63
|
-
offset: 0
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Get single post
|
|
67
|
-
const post = await client.posts.get('post_123');
|
|
68
|
-
|
|
69
|
-
// Create post
|
|
70
|
-
const newPost = await client.posts.create({
|
|
71
|
-
content: 'Hello world!',
|
|
72
|
-
accountIds: ['acc_123', 'acc_456'],
|
|
73
|
-
publishAt: '2024-12-20T10:00:00Z',
|
|
74
|
-
mediaUrls: ['https://example.com/image.jpg'],
|
|
75
|
-
platformOverrides: {
|
|
76
|
-
twitter: { content: 'Hello Twitter! #launch' }
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Update post
|
|
81
|
-
await client.posts.update('post_123', {
|
|
82
|
-
content: 'Updated content',
|
|
83
|
-
publishAt: '2024-12-21T10:00:00Z'
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// Delete post
|
|
87
|
-
await client.posts.delete('post_123');
|
|
88
|
-
|
|
89
|
-
// Publish immediately
|
|
90
|
-
await client.posts.publish('post_123');
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Accounts
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
// List all connected accounts
|
|
97
|
-
const accounts = await client.accounts.list();
|
|
98
|
-
|
|
99
|
-
// Filter by platform
|
|
100
|
-
const instagramAccounts = await client.accounts.list({
|
|
101
|
-
platform: 'instagram'
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Get single account
|
|
105
|
-
const account = await client.accounts.get('acc_123');
|
|
106
|
-
|
|
107
|
-
// Get Pinterest boards
|
|
108
|
-
const boards = await client.accounts.getPinterestBoards('acc_pinterest_123');
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Media Upload
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
// Get presigned upload URL
|
|
115
|
-
const { data } = await client.media.getUploadUrl({
|
|
116
|
-
filename: 'my-image.jpg',
|
|
117
|
-
contentType: 'image/jpeg'
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// Upload using the presigned URL
|
|
121
|
-
await fetch(data.uploadUrl, {
|
|
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
|
-
});
|
|
133
|
-
|
|
134
|
-
// Or use the convenience helper (Node.js)
|
|
135
|
-
const mediaUrl = await client.media.upload(imageBuffer, 'image.jpg', 'image/jpeg');
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Analytics
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
// Get overview
|
|
142
|
-
const overview = await client.analytics.overview();
|
|
143
|
-
|
|
144
|
-
// Get account-specific analytics
|
|
145
|
-
const accountAnalytics = await client.analytics.forAccount('acc_123', {
|
|
146
|
-
days: 30
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// Get all analytics
|
|
150
|
-
const allAnalytics = await client.analytics.list({
|
|
151
|
-
startDate: '2024-01-01',
|
|
152
|
-
endDate: '2024-12-31'
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Queue
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
// Get queue schedule
|
|
160
|
-
const queue = await client.queue.getSlots('profile_123');
|
|
161
|
-
|
|
162
|
-
// Set queue schedule
|
|
163
|
-
await client.queue.setSlots({
|
|
164
|
-
profileId: 'profile_123',
|
|
165
|
-
timezone: 'America/New_York',
|
|
166
|
-
slots: [
|
|
167
|
-
{ dayOfWeek: 1, time: '09:00' },
|
|
168
|
-
{ dayOfWeek: 1, time: '15:00' },
|
|
169
|
-
{ dayOfWeek: 2, time: '09:00' }
|
|
170
|
-
],
|
|
171
|
-
active: true
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// Get next available slot
|
|
175
|
-
const nextSlot = await client.queue.getNextSlot('profile_123');
|
|
176
|
-
|
|
177
|
-
// Preview upcoming slots
|
|
178
|
-
const preview = await client.queue.preview('profile_123', 10);
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Usage
|
|
182
|
-
|
|
183
|
-
```typescript
|
|
184
|
-
const usage = await client.usage();
|
|
185
|
-
console.log(`${usage.data.requestsToday}/${usage.data.dailyLimit} daily requests used`);
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Multi-Tenant (Enterprise)
|
|
189
|
-
|
|
190
|
-
```typescript
|
|
191
|
-
// Create a tenant
|
|
192
|
-
const tenant = await client.tenants.create({
|
|
193
|
-
externalId: 'user_123',
|
|
194
|
-
email: 'user@example.com',
|
|
195
|
-
name: 'John Doe'
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// Get OAuth URL for tenant
|
|
199
|
-
const { data } = await client.tenants.getConnectUrl(tenant.data.id, 'instagram');
|
|
200
|
-
// Redirect user to data.url
|
|
201
|
-
|
|
202
|
-
// List tenant's accounts
|
|
203
|
-
const accounts = await client.tenants.listAccounts(tenant.data.id);
|
|
204
|
-
|
|
205
|
-
// Disconnect account
|
|
206
|
-
await client.tenants.disconnectAccount(tenant.data.id, 'acc_123');
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
## Error Handling
|
|
210
|
-
|
|
211
|
-
```typescript
|
|
212
|
-
import { SchedulifyX, SchedulifyXError } from 'schedulifyx-sdk';
|
|
213
|
-
|
|
214
|
-
try {
|
|
215
|
-
await client.posts.create({...});
|
|
216
|
-
} catch (error) {
|
|
217
|
-
if (error instanceof SchedulifyXError) {
|
|
218
|
-
console.error('API Error:', error.code, error.message);
|
|
219
|
-
console.error('Status:', error.status);
|
|
220
|
-
console.error('Details:', error.details);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
## TypeScript Support
|
|
226
|
-
|
|
227
|
-
Full TypeScript support with exported types:
|
|
228
|
-
|
|
229
|
-
```typescript
|
|
230
|
-
import type {
|
|
231
|
-
Post,
|
|
232
|
-
Account,
|
|
233
|
-
Analytics,
|
|
234
|
-
Tenant,
|
|
235
|
-
QueueSchedule,
|
|
236
|
-
SchedulifyXConfig
|
|
237
|
-
} from 'schedulifyx-sdk';
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
## License
|
|
241
|
-
|
|
242
|
-
MIT
|
|
1
|
+
# schedulifyx-sdk
|
|
2
|
+
|
|
3
|
+
Official JavaScript/TypeScript SDK for [SchedulifyX API](https://app.schedulifyx.com/docs/) - Social media scheduling made easy.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install schedulifyx-sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add schedulifyx-sdk
|
|
11
|
+
# or
|
|
12
|
+
pnpm add schedulifyx-sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
19
|
+
|
|
20
|
+
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
21
|
+
|
|
22
|
+
// List all posts
|
|
23
|
+
const posts = await client.posts.list();
|
|
24
|
+
console.log(posts.data);
|
|
25
|
+
|
|
26
|
+
// Create a scheduled post
|
|
27
|
+
const post = await client.posts.create({
|
|
28
|
+
content: 'Hello from the SDK! 🚀',
|
|
29
|
+
accountIds: ['acc_123'],
|
|
30
|
+
publishAt: '2024-12-20T10:00:00Z'
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Publish immediately
|
|
34
|
+
await client.posts.publish(post.data.id);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
41
|
+
|
|
42
|
+
// Simple initialization
|
|
43
|
+
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
44
|
+
|
|
45
|
+
// With options
|
|
46
|
+
const client = new SchedulifyX({
|
|
47
|
+
apiKey: 'sk_live_YOUR_API_KEY',
|
|
48
|
+
baseUrl: 'https://api.schedulifyx.com', // optional
|
|
49
|
+
timeout: 30000 // optional, in ms
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## API Reference
|
|
54
|
+
|
|
55
|
+
### Posts
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// List posts with filters
|
|
59
|
+
const posts = await client.posts.list({
|
|
60
|
+
status: 'scheduled',
|
|
61
|
+
accountId: 'acc_123',
|
|
62
|
+
limit: 20,
|
|
63
|
+
offset: 0
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Get single post
|
|
67
|
+
const post = await client.posts.get('post_123');
|
|
68
|
+
|
|
69
|
+
// Create post
|
|
70
|
+
const newPost = await client.posts.create({
|
|
71
|
+
content: 'Hello world!',
|
|
72
|
+
accountIds: ['acc_123', 'acc_456'],
|
|
73
|
+
publishAt: '2024-12-20T10:00:00Z',
|
|
74
|
+
mediaUrls: ['https://example.com/image.jpg'],
|
|
75
|
+
platformOverrides: {
|
|
76
|
+
twitter: { content: 'Hello Twitter! #launch' }
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Update post
|
|
81
|
+
await client.posts.update('post_123', {
|
|
82
|
+
content: 'Updated content',
|
|
83
|
+
publishAt: '2024-12-21T10:00:00Z'
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Delete post
|
|
87
|
+
await client.posts.delete('post_123');
|
|
88
|
+
|
|
89
|
+
// Publish immediately
|
|
90
|
+
await client.posts.publish('post_123');
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Accounts
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// List all connected accounts
|
|
97
|
+
const accounts = await client.accounts.list();
|
|
98
|
+
|
|
99
|
+
// Filter by platform
|
|
100
|
+
const instagramAccounts = await client.accounts.list({
|
|
101
|
+
platform: 'instagram'
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Get single account
|
|
105
|
+
const account = await client.accounts.get('acc_123');
|
|
106
|
+
|
|
107
|
+
// Get Pinterest boards
|
|
108
|
+
const boards = await client.accounts.getPinterestBoards('acc_pinterest_123');
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Media Upload
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Get presigned upload URL
|
|
115
|
+
const { data } = await client.media.getUploadUrl({
|
|
116
|
+
filename: 'my-image.jpg',
|
|
117
|
+
contentType: 'image/jpeg'
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Upload using the presigned URL
|
|
121
|
+
await fetch(data.uploadUrl, {
|
|
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
|
+
});
|
|
133
|
+
|
|
134
|
+
// Or use the convenience helper (Node.js)
|
|
135
|
+
const mediaUrl = await client.media.upload(imageBuffer, 'image.jpg', 'image/jpeg');
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Analytics
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// Get overview
|
|
142
|
+
const overview = await client.analytics.overview();
|
|
143
|
+
|
|
144
|
+
// Get account-specific analytics
|
|
145
|
+
const accountAnalytics = await client.analytics.forAccount('acc_123', {
|
|
146
|
+
days: 30
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Get all analytics
|
|
150
|
+
const allAnalytics = await client.analytics.list({
|
|
151
|
+
startDate: '2024-01-01',
|
|
152
|
+
endDate: '2024-12-31'
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Queue
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// Get queue schedule
|
|
160
|
+
const queue = await client.queue.getSlots('profile_123');
|
|
161
|
+
|
|
162
|
+
// Set queue schedule
|
|
163
|
+
await client.queue.setSlots({
|
|
164
|
+
profileId: 'profile_123',
|
|
165
|
+
timezone: 'America/New_York',
|
|
166
|
+
slots: [
|
|
167
|
+
{ dayOfWeek: 1, time: '09:00' },
|
|
168
|
+
{ dayOfWeek: 1, time: '15:00' },
|
|
169
|
+
{ dayOfWeek: 2, time: '09:00' }
|
|
170
|
+
],
|
|
171
|
+
active: true
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Get next available slot
|
|
175
|
+
const nextSlot = await client.queue.getNextSlot('profile_123');
|
|
176
|
+
|
|
177
|
+
// Preview upcoming slots
|
|
178
|
+
const preview = await client.queue.preview('profile_123', 10);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Usage
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
const usage = await client.usage();
|
|
185
|
+
console.log(`${usage.data.requestsToday}/${usage.data.dailyLimit} daily requests used`);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Multi-Tenant (Enterprise)
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// Create a tenant
|
|
192
|
+
const tenant = await client.tenants.create({
|
|
193
|
+
externalId: 'user_123',
|
|
194
|
+
email: 'user@example.com',
|
|
195
|
+
name: 'John Doe'
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Get OAuth URL for tenant
|
|
199
|
+
const { data } = await client.tenants.getConnectUrl(tenant.data.id, 'instagram');
|
|
200
|
+
// Redirect user to data.url
|
|
201
|
+
|
|
202
|
+
// List tenant's accounts
|
|
203
|
+
const accounts = await client.tenants.listAccounts(tenant.data.id);
|
|
204
|
+
|
|
205
|
+
// Disconnect account
|
|
206
|
+
await client.tenants.disconnectAccount(tenant.data.id, 'acc_123');
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Error Handling
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import { SchedulifyX, SchedulifyXError } from 'schedulifyx-sdk';
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
await client.posts.create({...});
|
|
216
|
+
} catch (error) {
|
|
217
|
+
if (error instanceof SchedulifyXError) {
|
|
218
|
+
console.error('API Error:', error.code, error.message);
|
|
219
|
+
console.error('Status:', error.status);
|
|
220
|
+
console.error('Details:', error.details);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## TypeScript Support
|
|
226
|
+
|
|
227
|
+
Full TypeScript support with exported types:
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import type {
|
|
231
|
+
Post,
|
|
232
|
+
Account,
|
|
233
|
+
Analytics,
|
|
234
|
+
Tenant,
|
|
235
|
+
QueueSchedule,
|
|
236
|
+
SchedulifyXConfig
|
|
237
|
+
} from 'schedulifyx-sdk';
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -68,10 +68,50 @@ interface QueueSlot {
|
|
|
68
68
|
}
|
|
69
69
|
interface QueueSchedule {
|
|
70
70
|
id: string;
|
|
71
|
-
|
|
71
|
+
accountId: string;
|
|
72
72
|
timezone: string;
|
|
73
73
|
slots: QueueSlot[];
|
|
74
|
-
|
|
74
|
+
isActive: boolean;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
}
|
|
78
|
+
interface Webhook {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
url: string;
|
|
82
|
+
secret?: string;
|
|
83
|
+
events: string[];
|
|
84
|
+
isActive: boolean;
|
|
85
|
+
retryCount: number;
|
|
86
|
+
timeoutSeconds: number;
|
|
87
|
+
lastTriggeredAt?: string;
|
|
88
|
+
lastSuccessAt?: string;
|
|
89
|
+
lastFailureAt?: string;
|
|
90
|
+
stats: {
|
|
91
|
+
totalTriggers: number;
|
|
92
|
+
totalSuccesses: number;
|
|
93
|
+
totalFailures: number;
|
|
94
|
+
};
|
|
95
|
+
createdAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
}
|
|
98
|
+
interface WebhookEvent {
|
|
99
|
+
id: string;
|
|
100
|
+
webhookId: string;
|
|
101
|
+
eventType: string;
|
|
102
|
+
status: 'pending' | 'delivered' | 'failed';
|
|
103
|
+
httpStatus?: number;
|
|
104
|
+
responseBody?: string;
|
|
105
|
+
errorMessage?: string;
|
|
106
|
+
attempts: number;
|
|
107
|
+
deliveredAt?: string;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
}
|
|
110
|
+
interface WebhookEventType {
|
|
111
|
+
event: string;
|
|
112
|
+
category: string;
|
|
113
|
+
action: string;
|
|
114
|
+
description: string;
|
|
75
115
|
}
|
|
76
116
|
interface MediaUploadResponse {
|
|
77
117
|
uploadUrl: string;
|
|
@@ -222,7 +262,7 @@ declare class SchedulifyX {
|
|
|
222
262
|
/**
|
|
223
263
|
* Helper to upload a file and return the media URL
|
|
224
264
|
*/
|
|
225
|
-
upload: (file: Blob
|
|
265
|
+
upload: (file: Blob, filename: string, contentType: string) => Promise<string>;
|
|
226
266
|
};
|
|
227
267
|
/**
|
|
228
268
|
* Get API usage statistics
|
|
@@ -232,9 +272,9 @@ declare class SchedulifyX {
|
|
|
232
272
|
}>;
|
|
233
273
|
queue: {
|
|
234
274
|
/**
|
|
235
|
-
* Get queue schedule for
|
|
275
|
+
* Get queue schedule for an account
|
|
236
276
|
*/
|
|
237
|
-
getSlots: (
|
|
277
|
+
getSlots: (accountId: string) => Promise<{
|
|
238
278
|
data: {
|
|
239
279
|
exists: boolean;
|
|
240
280
|
schedule?: QueueSchedule;
|
|
@@ -245,25 +285,32 @@ declare class SchedulifyX {
|
|
|
245
285
|
* Create or update queue schedule
|
|
246
286
|
*/
|
|
247
287
|
setSlots: (data: {
|
|
248
|
-
|
|
288
|
+
accountId: string;
|
|
249
289
|
timezone: string;
|
|
250
290
|
slots: QueueSlot[];
|
|
251
|
-
|
|
252
|
-
reshuffleExisting?: boolean;
|
|
291
|
+
isActive?: boolean;
|
|
253
292
|
}) => Promise<{
|
|
254
|
-
data:
|
|
293
|
+
data: {
|
|
294
|
+
success: boolean;
|
|
295
|
+
schedule: QueueSchedule;
|
|
296
|
+
nextSlots: string[];
|
|
297
|
+
};
|
|
255
298
|
}>;
|
|
256
299
|
/**
|
|
257
300
|
* Delete queue schedule
|
|
258
301
|
*/
|
|
259
|
-
deleteSlots: (
|
|
260
|
-
|
|
302
|
+
deleteSlots: (accountId: string) => Promise<{
|
|
303
|
+
data: {
|
|
304
|
+
deleted: boolean;
|
|
305
|
+
message: string;
|
|
306
|
+
};
|
|
261
307
|
}>;
|
|
262
308
|
/**
|
|
263
309
|
* Get the next available slot
|
|
264
310
|
*/
|
|
265
|
-
getNextSlot: (
|
|
311
|
+
getNextSlot: (accountId: string) => Promise<{
|
|
266
312
|
data: {
|
|
313
|
+
accountId: string;
|
|
267
314
|
nextSlot: string;
|
|
268
315
|
timezone: string;
|
|
269
316
|
};
|
|
@@ -271,11 +318,108 @@ declare class SchedulifyX {
|
|
|
271
318
|
/**
|
|
272
319
|
* Preview upcoming slots
|
|
273
320
|
*/
|
|
274
|
-
preview: (
|
|
321
|
+
preview: (accountId: string, count?: number) => Promise<{
|
|
275
322
|
data: {
|
|
323
|
+
accountId: string;
|
|
324
|
+
timezone: string;
|
|
325
|
+
count: number;
|
|
276
326
|
slots: string[];
|
|
277
327
|
};
|
|
278
328
|
}>;
|
|
329
|
+
/**
|
|
330
|
+
* Get all queue schedules
|
|
331
|
+
*/
|
|
332
|
+
getAll: () => Promise<{
|
|
333
|
+
data: QueueSchedule[];
|
|
334
|
+
}>;
|
|
335
|
+
};
|
|
336
|
+
webhooks: {
|
|
337
|
+
/**
|
|
338
|
+
* List all webhooks
|
|
339
|
+
*/
|
|
340
|
+
list: () => Promise<{
|
|
341
|
+
data: Webhook[];
|
|
342
|
+
}>;
|
|
343
|
+
/**
|
|
344
|
+
* Get a specific webhook
|
|
345
|
+
*/
|
|
346
|
+
get: (webhookId: string) => Promise<{
|
|
347
|
+
data: Webhook;
|
|
348
|
+
}>;
|
|
349
|
+
/**
|
|
350
|
+
* Create a new webhook
|
|
351
|
+
*/
|
|
352
|
+
create: (data: {
|
|
353
|
+
name: string;
|
|
354
|
+
url: string;
|
|
355
|
+
events: string[];
|
|
356
|
+
isActive?: boolean;
|
|
357
|
+
retryCount?: number;
|
|
358
|
+
timeoutSeconds?: number;
|
|
359
|
+
}) => Promise<{
|
|
360
|
+
data: Webhook;
|
|
361
|
+
message: string;
|
|
362
|
+
}>;
|
|
363
|
+
/**
|
|
364
|
+
* Update a webhook
|
|
365
|
+
*/
|
|
366
|
+
update: (webhookId: string, data: {
|
|
367
|
+
name?: string;
|
|
368
|
+
url?: string;
|
|
369
|
+
events?: string[];
|
|
370
|
+
isActive?: boolean;
|
|
371
|
+
retryCount?: number;
|
|
372
|
+
timeoutSeconds?: number;
|
|
373
|
+
}) => Promise<{
|
|
374
|
+
data: Webhook;
|
|
375
|
+
}>;
|
|
376
|
+
/**
|
|
377
|
+
* Delete a webhook
|
|
378
|
+
*/
|
|
379
|
+
delete: (webhookId: string) => Promise<{
|
|
380
|
+
data: {
|
|
381
|
+
deleted: boolean;
|
|
382
|
+
id: string;
|
|
383
|
+
};
|
|
384
|
+
}>;
|
|
385
|
+
/**
|
|
386
|
+
* Rotate webhook secret
|
|
387
|
+
*/
|
|
388
|
+
rotateSecret: (webhookId: string) => Promise<{
|
|
389
|
+
data: {
|
|
390
|
+
secret: string;
|
|
391
|
+
message: string;
|
|
392
|
+
};
|
|
393
|
+
}>;
|
|
394
|
+
/**
|
|
395
|
+
* Test a webhook by sending a test event
|
|
396
|
+
*/
|
|
397
|
+
test: (webhookId: string, eventType?: string) => Promise<{
|
|
398
|
+
data: {
|
|
399
|
+
success: boolean;
|
|
400
|
+
eventId: string;
|
|
401
|
+
};
|
|
402
|
+
}>;
|
|
403
|
+
/**
|
|
404
|
+
* Get webhook event history
|
|
405
|
+
*/
|
|
406
|
+
getEvents: (webhookId: string, params?: {
|
|
407
|
+
limit?: number;
|
|
408
|
+
offset?: number;
|
|
409
|
+
}) => Promise<{
|
|
410
|
+
data: WebhookEvent[];
|
|
411
|
+
pagination: {
|
|
412
|
+
total: number;
|
|
413
|
+
limit: number;
|
|
414
|
+
offset: number;
|
|
415
|
+
};
|
|
416
|
+
}>;
|
|
417
|
+
/**
|
|
418
|
+
* Get available event types
|
|
419
|
+
*/
|
|
420
|
+
getEventTypes: () => Promise<{
|
|
421
|
+
data: WebhookEventType[];
|
|
422
|
+
}>;
|
|
279
423
|
};
|
|
280
424
|
tenants: {
|
|
281
425
|
/**
|
|
@@ -360,4 +504,4 @@ declare class SchedulifyX {
|
|
|
360
504
|
};
|
|
361
505
|
}
|
|
362
506
|
|
|
363
|
-
export { type Account, type Analytics, type AnalyticsOverview, type ApiError, type MediaUploadResponse, type PaginatedResponse, type Post, type QueueSchedule, type QueueSlot, SchedulifyX, type SchedulifyXConfig, SchedulifyXError, type Tenant, type Usage, SchedulifyX as default };
|
|
507
|
+
export { type Account, type Analytics, type AnalyticsOverview, type ApiError, type MediaUploadResponse, type PaginatedResponse, type Post, type QueueSchedule, type QueueSlot, SchedulifyX, type SchedulifyXConfig, SchedulifyXError, type Tenant, type Usage, type Webhook, type WebhookEvent, type WebhookEventType, SchedulifyX as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -68,10 +68,50 @@ interface QueueSlot {
|
|
|
68
68
|
}
|
|
69
69
|
interface QueueSchedule {
|
|
70
70
|
id: string;
|
|
71
|
-
|
|
71
|
+
accountId: string;
|
|
72
72
|
timezone: string;
|
|
73
73
|
slots: QueueSlot[];
|
|
74
|
-
|
|
74
|
+
isActive: boolean;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
}
|
|
78
|
+
interface Webhook {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
url: string;
|
|
82
|
+
secret?: string;
|
|
83
|
+
events: string[];
|
|
84
|
+
isActive: boolean;
|
|
85
|
+
retryCount: number;
|
|
86
|
+
timeoutSeconds: number;
|
|
87
|
+
lastTriggeredAt?: string;
|
|
88
|
+
lastSuccessAt?: string;
|
|
89
|
+
lastFailureAt?: string;
|
|
90
|
+
stats: {
|
|
91
|
+
totalTriggers: number;
|
|
92
|
+
totalSuccesses: number;
|
|
93
|
+
totalFailures: number;
|
|
94
|
+
};
|
|
95
|
+
createdAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
}
|
|
98
|
+
interface WebhookEvent {
|
|
99
|
+
id: string;
|
|
100
|
+
webhookId: string;
|
|
101
|
+
eventType: string;
|
|
102
|
+
status: 'pending' | 'delivered' | 'failed';
|
|
103
|
+
httpStatus?: number;
|
|
104
|
+
responseBody?: string;
|
|
105
|
+
errorMessage?: string;
|
|
106
|
+
attempts: number;
|
|
107
|
+
deliveredAt?: string;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
}
|
|
110
|
+
interface WebhookEventType {
|
|
111
|
+
event: string;
|
|
112
|
+
category: string;
|
|
113
|
+
action: string;
|
|
114
|
+
description: string;
|
|
75
115
|
}
|
|
76
116
|
interface MediaUploadResponse {
|
|
77
117
|
uploadUrl: string;
|
|
@@ -222,7 +262,7 @@ declare class SchedulifyX {
|
|
|
222
262
|
/**
|
|
223
263
|
* Helper to upload a file and return the media URL
|
|
224
264
|
*/
|
|
225
|
-
upload: (file: Blob
|
|
265
|
+
upload: (file: Blob, filename: string, contentType: string) => Promise<string>;
|
|
226
266
|
};
|
|
227
267
|
/**
|
|
228
268
|
* Get API usage statistics
|
|
@@ -232,9 +272,9 @@ declare class SchedulifyX {
|
|
|
232
272
|
}>;
|
|
233
273
|
queue: {
|
|
234
274
|
/**
|
|
235
|
-
* Get queue schedule for
|
|
275
|
+
* Get queue schedule for an account
|
|
236
276
|
*/
|
|
237
|
-
getSlots: (
|
|
277
|
+
getSlots: (accountId: string) => Promise<{
|
|
238
278
|
data: {
|
|
239
279
|
exists: boolean;
|
|
240
280
|
schedule?: QueueSchedule;
|
|
@@ -245,25 +285,32 @@ declare class SchedulifyX {
|
|
|
245
285
|
* Create or update queue schedule
|
|
246
286
|
*/
|
|
247
287
|
setSlots: (data: {
|
|
248
|
-
|
|
288
|
+
accountId: string;
|
|
249
289
|
timezone: string;
|
|
250
290
|
slots: QueueSlot[];
|
|
251
|
-
|
|
252
|
-
reshuffleExisting?: boolean;
|
|
291
|
+
isActive?: boolean;
|
|
253
292
|
}) => Promise<{
|
|
254
|
-
data:
|
|
293
|
+
data: {
|
|
294
|
+
success: boolean;
|
|
295
|
+
schedule: QueueSchedule;
|
|
296
|
+
nextSlots: string[];
|
|
297
|
+
};
|
|
255
298
|
}>;
|
|
256
299
|
/**
|
|
257
300
|
* Delete queue schedule
|
|
258
301
|
*/
|
|
259
|
-
deleteSlots: (
|
|
260
|
-
|
|
302
|
+
deleteSlots: (accountId: string) => Promise<{
|
|
303
|
+
data: {
|
|
304
|
+
deleted: boolean;
|
|
305
|
+
message: string;
|
|
306
|
+
};
|
|
261
307
|
}>;
|
|
262
308
|
/**
|
|
263
309
|
* Get the next available slot
|
|
264
310
|
*/
|
|
265
|
-
getNextSlot: (
|
|
311
|
+
getNextSlot: (accountId: string) => Promise<{
|
|
266
312
|
data: {
|
|
313
|
+
accountId: string;
|
|
267
314
|
nextSlot: string;
|
|
268
315
|
timezone: string;
|
|
269
316
|
};
|
|
@@ -271,11 +318,108 @@ declare class SchedulifyX {
|
|
|
271
318
|
/**
|
|
272
319
|
* Preview upcoming slots
|
|
273
320
|
*/
|
|
274
|
-
preview: (
|
|
321
|
+
preview: (accountId: string, count?: number) => Promise<{
|
|
275
322
|
data: {
|
|
323
|
+
accountId: string;
|
|
324
|
+
timezone: string;
|
|
325
|
+
count: number;
|
|
276
326
|
slots: string[];
|
|
277
327
|
};
|
|
278
328
|
}>;
|
|
329
|
+
/**
|
|
330
|
+
* Get all queue schedules
|
|
331
|
+
*/
|
|
332
|
+
getAll: () => Promise<{
|
|
333
|
+
data: QueueSchedule[];
|
|
334
|
+
}>;
|
|
335
|
+
};
|
|
336
|
+
webhooks: {
|
|
337
|
+
/**
|
|
338
|
+
* List all webhooks
|
|
339
|
+
*/
|
|
340
|
+
list: () => Promise<{
|
|
341
|
+
data: Webhook[];
|
|
342
|
+
}>;
|
|
343
|
+
/**
|
|
344
|
+
* Get a specific webhook
|
|
345
|
+
*/
|
|
346
|
+
get: (webhookId: string) => Promise<{
|
|
347
|
+
data: Webhook;
|
|
348
|
+
}>;
|
|
349
|
+
/**
|
|
350
|
+
* Create a new webhook
|
|
351
|
+
*/
|
|
352
|
+
create: (data: {
|
|
353
|
+
name: string;
|
|
354
|
+
url: string;
|
|
355
|
+
events: string[];
|
|
356
|
+
isActive?: boolean;
|
|
357
|
+
retryCount?: number;
|
|
358
|
+
timeoutSeconds?: number;
|
|
359
|
+
}) => Promise<{
|
|
360
|
+
data: Webhook;
|
|
361
|
+
message: string;
|
|
362
|
+
}>;
|
|
363
|
+
/**
|
|
364
|
+
* Update a webhook
|
|
365
|
+
*/
|
|
366
|
+
update: (webhookId: string, data: {
|
|
367
|
+
name?: string;
|
|
368
|
+
url?: string;
|
|
369
|
+
events?: string[];
|
|
370
|
+
isActive?: boolean;
|
|
371
|
+
retryCount?: number;
|
|
372
|
+
timeoutSeconds?: number;
|
|
373
|
+
}) => Promise<{
|
|
374
|
+
data: Webhook;
|
|
375
|
+
}>;
|
|
376
|
+
/**
|
|
377
|
+
* Delete a webhook
|
|
378
|
+
*/
|
|
379
|
+
delete: (webhookId: string) => Promise<{
|
|
380
|
+
data: {
|
|
381
|
+
deleted: boolean;
|
|
382
|
+
id: string;
|
|
383
|
+
};
|
|
384
|
+
}>;
|
|
385
|
+
/**
|
|
386
|
+
* Rotate webhook secret
|
|
387
|
+
*/
|
|
388
|
+
rotateSecret: (webhookId: string) => Promise<{
|
|
389
|
+
data: {
|
|
390
|
+
secret: string;
|
|
391
|
+
message: string;
|
|
392
|
+
};
|
|
393
|
+
}>;
|
|
394
|
+
/**
|
|
395
|
+
* Test a webhook by sending a test event
|
|
396
|
+
*/
|
|
397
|
+
test: (webhookId: string, eventType?: string) => Promise<{
|
|
398
|
+
data: {
|
|
399
|
+
success: boolean;
|
|
400
|
+
eventId: string;
|
|
401
|
+
};
|
|
402
|
+
}>;
|
|
403
|
+
/**
|
|
404
|
+
* Get webhook event history
|
|
405
|
+
*/
|
|
406
|
+
getEvents: (webhookId: string, params?: {
|
|
407
|
+
limit?: number;
|
|
408
|
+
offset?: number;
|
|
409
|
+
}) => Promise<{
|
|
410
|
+
data: WebhookEvent[];
|
|
411
|
+
pagination: {
|
|
412
|
+
total: number;
|
|
413
|
+
limit: number;
|
|
414
|
+
offset: number;
|
|
415
|
+
};
|
|
416
|
+
}>;
|
|
417
|
+
/**
|
|
418
|
+
* Get available event types
|
|
419
|
+
*/
|
|
420
|
+
getEventTypes: () => Promise<{
|
|
421
|
+
data: WebhookEventType[];
|
|
422
|
+
}>;
|
|
279
423
|
};
|
|
280
424
|
tenants: {
|
|
281
425
|
/**
|
|
@@ -360,4 +504,4 @@ declare class SchedulifyX {
|
|
|
360
504
|
};
|
|
361
505
|
}
|
|
362
506
|
|
|
363
|
-
export { type Account, type Analytics, type AnalyticsOverview, type ApiError, type MediaUploadResponse, type PaginatedResponse, type Post, type QueueSchedule, type QueueSlot, SchedulifyX, type SchedulifyXConfig, SchedulifyXError, type Tenant, type Usage, SchedulifyX as default };
|
|
507
|
+
export { type Account, type Analytics, type AnalyticsOverview, type ApiError, type MediaUploadResponse, type PaginatedResponse, type Post, type QueueSchedule, type QueueSlot, SchedulifyX, type SchedulifyXConfig, SchedulifyXError, type Tenant, type Usage, type Webhook, type WebhookEvent, type WebhookEventType, SchedulifyX as default };
|
package/dist/index.js
CHANGED
|
@@ -148,10 +148,10 @@ var SchedulifyX = class {
|
|
|
148
148
|
// ==================== QUEUE ====================
|
|
149
149
|
this.queue = {
|
|
150
150
|
/**
|
|
151
|
-
* Get queue schedule for
|
|
151
|
+
* Get queue schedule for an account
|
|
152
152
|
*/
|
|
153
|
-
getSlots: async (
|
|
154
|
-
return this.request("GET", "/queue/slots", void 0, {
|
|
153
|
+
getSlots: async (accountId) => {
|
|
154
|
+
return this.request("GET", "/queue/slots", void 0, { accountId });
|
|
155
155
|
},
|
|
156
156
|
/**
|
|
157
157
|
* Create or update queue schedule
|
|
@@ -162,20 +162,83 @@ var SchedulifyX = class {
|
|
|
162
162
|
/**
|
|
163
163
|
* Delete queue schedule
|
|
164
164
|
*/
|
|
165
|
-
deleteSlots: async (
|
|
166
|
-
return this.request("DELETE", "/queue/slots", void 0, {
|
|
165
|
+
deleteSlots: async (accountId) => {
|
|
166
|
+
return this.request("DELETE", "/queue/slots", void 0, { accountId });
|
|
167
167
|
},
|
|
168
168
|
/**
|
|
169
169
|
* Get the next available slot
|
|
170
170
|
*/
|
|
171
|
-
getNextSlot: async (
|
|
172
|
-
return this.request("GET", "/queue/next-slot", void 0, {
|
|
171
|
+
getNextSlot: async (accountId) => {
|
|
172
|
+
return this.request("GET", "/queue/next-slot", void 0, { accountId });
|
|
173
173
|
},
|
|
174
174
|
/**
|
|
175
175
|
* Preview upcoming slots
|
|
176
176
|
*/
|
|
177
|
-
preview: async (
|
|
178
|
-
return this.request("GET", "/queue/preview", void 0, {
|
|
177
|
+
preview: async (accountId, count) => {
|
|
178
|
+
return this.request("GET", "/queue/preview", void 0, { accountId, count });
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* Get all queue schedules
|
|
182
|
+
*/
|
|
183
|
+
getAll: async () => {
|
|
184
|
+
return this.request("GET", "/queue/all");
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
// ==================== WEBHOOKS ====================
|
|
188
|
+
this.webhooks = {
|
|
189
|
+
/**
|
|
190
|
+
* List all webhooks
|
|
191
|
+
*/
|
|
192
|
+
list: async () => {
|
|
193
|
+
return this.request("GET", "/webhooks");
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Get a specific webhook
|
|
197
|
+
*/
|
|
198
|
+
get: async (webhookId) => {
|
|
199
|
+
return this.request("GET", `/webhooks/${webhookId}`);
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* Create a new webhook
|
|
203
|
+
*/
|
|
204
|
+
create: async (data) => {
|
|
205
|
+
return this.request("POST", "/webhooks", data);
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Update a webhook
|
|
209
|
+
*/
|
|
210
|
+
update: async (webhookId, data) => {
|
|
211
|
+
return this.request("PATCH", `/webhooks/${webhookId}`, data);
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Delete a webhook
|
|
215
|
+
*/
|
|
216
|
+
delete: async (webhookId) => {
|
|
217
|
+
return this.request("DELETE", `/webhooks/${webhookId}`);
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* Rotate webhook secret
|
|
221
|
+
*/
|
|
222
|
+
rotateSecret: async (webhookId) => {
|
|
223
|
+
return this.request("POST", `/webhooks/${webhookId}/rotate-secret`);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* Test a webhook by sending a test event
|
|
227
|
+
*/
|
|
228
|
+
test: async (webhookId, eventType) => {
|
|
229
|
+
return this.request("POST", `/webhooks/${webhookId}/test`, { eventType });
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Get webhook event history
|
|
233
|
+
*/
|
|
234
|
+
getEvents: async (webhookId, params) => {
|
|
235
|
+
return this.request("GET", `/webhooks/${webhookId}/events`, void 0, params);
|
|
236
|
+
},
|
|
237
|
+
/**
|
|
238
|
+
* Get available event types
|
|
239
|
+
*/
|
|
240
|
+
getEventTypes: async () => {
|
|
241
|
+
return this.request("GET", "/webhooks/events/types");
|
|
179
242
|
}
|
|
180
243
|
};
|
|
181
244
|
// ==================== TENANTS (Multi-tenant) ====================
|
package/dist/index.mjs
CHANGED
|
@@ -122,10 +122,10 @@ var SchedulifyX = class {
|
|
|
122
122
|
// ==================== QUEUE ====================
|
|
123
123
|
this.queue = {
|
|
124
124
|
/**
|
|
125
|
-
* Get queue schedule for
|
|
125
|
+
* Get queue schedule for an account
|
|
126
126
|
*/
|
|
127
|
-
getSlots: async (
|
|
128
|
-
return this.request("GET", "/queue/slots", void 0, {
|
|
127
|
+
getSlots: async (accountId) => {
|
|
128
|
+
return this.request("GET", "/queue/slots", void 0, { accountId });
|
|
129
129
|
},
|
|
130
130
|
/**
|
|
131
131
|
* Create or update queue schedule
|
|
@@ -136,20 +136,83 @@ var SchedulifyX = class {
|
|
|
136
136
|
/**
|
|
137
137
|
* Delete queue schedule
|
|
138
138
|
*/
|
|
139
|
-
deleteSlots: async (
|
|
140
|
-
return this.request("DELETE", "/queue/slots", void 0, {
|
|
139
|
+
deleteSlots: async (accountId) => {
|
|
140
|
+
return this.request("DELETE", "/queue/slots", void 0, { accountId });
|
|
141
141
|
},
|
|
142
142
|
/**
|
|
143
143
|
* Get the next available slot
|
|
144
144
|
*/
|
|
145
|
-
getNextSlot: async (
|
|
146
|
-
return this.request("GET", "/queue/next-slot", void 0, {
|
|
145
|
+
getNextSlot: async (accountId) => {
|
|
146
|
+
return this.request("GET", "/queue/next-slot", void 0, { accountId });
|
|
147
147
|
},
|
|
148
148
|
/**
|
|
149
149
|
* Preview upcoming slots
|
|
150
150
|
*/
|
|
151
|
-
preview: async (
|
|
152
|
-
return this.request("GET", "/queue/preview", void 0, {
|
|
151
|
+
preview: async (accountId, count) => {
|
|
152
|
+
return this.request("GET", "/queue/preview", void 0, { accountId, count });
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* Get all queue schedules
|
|
156
|
+
*/
|
|
157
|
+
getAll: async () => {
|
|
158
|
+
return this.request("GET", "/queue/all");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
// ==================== WEBHOOKS ====================
|
|
162
|
+
this.webhooks = {
|
|
163
|
+
/**
|
|
164
|
+
* List all webhooks
|
|
165
|
+
*/
|
|
166
|
+
list: async () => {
|
|
167
|
+
return this.request("GET", "/webhooks");
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* Get a specific webhook
|
|
171
|
+
*/
|
|
172
|
+
get: async (webhookId) => {
|
|
173
|
+
return this.request("GET", `/webhooks/${webhookId}`);
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Create a new webhook
|
|
177
|
+
*/
|
|
178
|
+
create: async (data) => {
|
|
179
|
+
return this.request("POST", "/webhooks", data);
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* Update a webhook
|
|
183
|
+
*/
|
|
184
|
+
update: async (webhookId, data) => {
|
|
185
|
+
return this.request("PATCH", `/webhooks/${webhookId}`, data);
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* Delete a webhook
|
|
189
|
+
*/
|
|
190
|
+
delete: async (webhookId) => {
|
|
191
|
+
return this.request("DELETE", `/webhooks/${webhookId}`);
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Rotate webhook secret
|
|
195
|
+
*/
|
|
196
|
+
rotateSecret: async (webhookId) => {
|
|
197
|
+
return this.request("POST", `/webhooks/${webhookId}/rotate-secret`);
|
|
198
|
+
},
|
|
199
|
+
/**
|
|
200
|
+
* Test a webhook by sending a test event
|
|
201
|
+
*/
|
|
202
|
+
test: async (webhookId, eventType) => {
|
|
203
|
+
return this.request("POST", `/webhooks/${webhookId}/test`, { eventType });
|
|
204
|
+
},
|
|
205
|
+
/**
|
|
206
|
+
* Get webhook event history
|
|
207
|
+
*/
|
|
208
|
+
getEvents: async (webhookId, params) => {
|
|
209
|
+
return this.request("GET", `/webhooks/${webhookId}/events`, void 0, params);
|
|
210
|
+
},
|
|
211
|
+
/**
|
|
212
|
+
* Get available event types
|
|
213
|
+
*/
|
|
214
|
+
getEventTypes: async () => {
|
|
215
|
+
return this.request("GET", "/webhooks/events/types");
|
|
153
216
|
}
|
|
154
217
|
};
|
|
155
218
|
// ==================== TENANTS (Multi-tenant) ====================
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "schedulifyx-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Official JavaScript/TypeScript SDK for SchedulifyX API - Social media scheduling made easy",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"require": "./dist/index.js",
|
|
12
|
-
"import": "./dist/index.mjs"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
20
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
21
|
-
"test": "vitest",
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"schedulify",
|
|
26
|
-
"schedulifyx",
|
|
27
|
-
"social-media",
|
|
28
|
-
"scheduling",
|
|
29
|
-
"api",
|
|
30
|
-
"sdk",
|
|
31
|
-
"instagram",
|
|
32
|
-
"twitter",
|
|
33
|
-
"facebook",
|
|
34
|
-
"linkedin",
|
|
35
|
-
"tiktok",
|
|
36
|
-
"threads",
|
|
37
|
-
"bluesky",
|
|
38
|
-
"mastodon",
|
|
39
|
-
"pinterest"
|
|
40
|
-
],
|
|
41
|
-
"author": "SchedulifyX",
|
|
42
|
-
"license": "MIT",
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "https://github.com/Eh-Mr-SK/schedulifyx-sdk-js"
|
|
46
|
-
},
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/Eh-Mr-SK/schedulifyx-sdk-js/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://app.schedulifyx.com/docs/",
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"tsup": "^8.0.0",
|
|
53
|
-
"typescript": "^5.3.0",
|
|
54
|
-
"vitest": "^1.0.0"
|
|
55
|
-
},
|
|
56
|
-
"engines": {
|
|
57
|
-
"node": ">=16"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "schedulifyx-sdk",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Official JavaScript/TypeScript SDK for SchedulifyX API - Social media scheduling made easy",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
20
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"schedulify",
|
|
26
|
+
"schedulifyx",
|
|
27
|
+
"social-media",
|
|
28
|
+
"scheduling",
|
|
29
|
+
"api",
|
|
30
|
+
"sdk",
|
|
31
|
+
"instagram",
|
|
32
|
+
"twitter",
|
|
33
|
+
"facebook",
|
|
34
|
+
"linkedin",
|
|
35
|
+
"tiktok",
|
|
36
|
+
"threads",
|
|
37
|
+
"bluesky",
|
|
38
|
+
"mastodon",
|
|
39
|
+
"pinterest"
|
|
40
|
+
],
|
|
41
|
+
"author": "SchedulifyX",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/Eh-Mr-SK/schedulifyx-sdk-js"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/Eh-Mr-SK/schedulifyx-sdk-js/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://app.schedulifyx.com/docs/",
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"tsup": "^8.0.0",
|
|
53
|
+
"typescript": "^5.3.0",
|
|
54
|
+
"vitest": "^1.0.0"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=16"
|
|
58
|
+
}
|
|
59
|
+
}
|