schedulifyx-sdk 1.0.0 → 1.0.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/README.md +14 -14
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +12 -12
- package/dist/index.mjs +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# schedulifyx-sdk
|
|
2
2
|
|
|
3
|
-
Official JavaScript/TypeScript SDK for [SchedulifyX API](https://schedulifyx.com/docs) - Social media scheduling made easy.
|
|
3
|
+
Official JavaScript/TypeScript SDK for [SchedulifyX API](https://app.schedulifyx.com/docs/) - Social media scheduling made easy.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install schedulifyx-sdk
|
|
9
9
|
# or
|
|
10
|
-
yarn add
|
|
10
|
+
yarn add schedulifyx-sdk
|
|
11
11
|
# or
|
|
12
|
-
pnpm add
|
|
12
|
+
pnpm add schedulifyx-sdk
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import {
|
|
18
|
+
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
19
19
|
|
|
20
|
-
const client = new
|
|
20
|
+
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
21
21
|
|
|
22
22
|
// List all posts
|
|
23
23
|
const posts = await client.posts.list();
|
|
@@ -37,13 +37,13 @@ await client.posts.publish(post.data.id);
|
|
|
37
37
|
## Configuration
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
|
-
import {
|
|
40
|
+
import { SchedulifyX } from 'schedulifyx-sdk';
|
|
41
41
|
|
|
42
42
|
// Simple initialization
|
|
43
|
-
const client = new
|
|
43
|
+
const client = new SchedulifyX('sk_live_YOUR_API_KEY');
|
|
44
44
|
|
|
45
45
|
// With options
|
|
46
|
-
const client = new
|
|
46
|
+
const client = new SchedulifyX({
|
|
47
47
|
apiKey: 'sk_live_YOUR_API_KEY',
|
|
48
48
|
baseUrl: 'https://api.schedulifyx.com', // optional
|
|
49
49
|
timeout: 30000 // optional, in ms
|
|
@@ -209,12 +209,12 @@ await client.tenants.disconnectAccount(tenant.data.id, 'acc_123');
|
|
|
209
209
|
## Error Handling
|
|
210
210
|
|
|
211
211
|
```typescript
|
|
212
|
-
import {
|
|
212
|
+
import { SchedulifyX, SchedulifyXError } from 'schedulifyx-sdk';
|
|
213
213
|
|
|
214
214
|
try {
|
|
215
215
|
await client.posts.create({...});
|
|
216
216
|
} catch (error) {
|
|
217
|
-
if (error instanceof
|
|
217
|
+
if (error instanceof SchedulifyXError) {
|
|
218
218
|
console.error('API Error:', error.code, error.message);
|
|
219
219
|
console.error('Status:', error.status);
|
|
220
220
|
console.error('Details:', error.details);
|
|
@@ -233,8 +233,8 @@ import type {
|
|
|
233
233
|
Analytics,
|
|
234
234
|
Tenant,
|
|
235
235
|
QueueSchedule,
|
|
236
|
-
|
|
237
|
-
} from '
|
|
236
|
+
SchedulifyXConfig
|
|
237
|
+
} from 'schedulifyx-sdk';
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
## License
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SchedulifyX SDK - Official JavaScript/TypeScript SDK
|
|
3
|
-
* https://schedulifyx.com/docs
|
|
3
|
+
* https://app.schedulifyx.com/docs/
|
|
4
4
|
*/
|
|
5
|
-
interface
|
|
5
|
+
interface SchedulifyXConfig {
|
|
6
6
|
apiKey: string;
|
|
7
7
|
baseUrl?: string;
|
|
8
8
|
timeout?: number;
|
|
@@ -92,17 +92,17 @@ interface ApiError {
|
|
|
92
92
|
message: string;
|
|
93
93
|
details?: Record<string, unknown>;
|
|
94
94
|
}
|
|
95
|
-
declare class
|
|
95
|
+
declare class SchedulifyXError extends Error {
|
|
96
96
|
code: string;
|
|
97
97
|
status: number;
|
|
98
98
|
details?: Record<string, unknown>;
|
|
99
99
|
constructor(message: string, code: string, status: number, details?: Record<string, unknown>);
|
|
100
100
|
}
|
|
101
|
-
declare class
|
|
101
|
+
declare class SchedulifyX {
|
|
102
102
|
private apiKey;
|
|
103
103
|
private baseUrl;
|
|
104
104
|
private timeout;
|
|
105
|
-
constructor(config:
|
|
105
|
+
constructor(config: SchedulifyXConfig | string);
|
|
106
106
|
private request;
|
|
107
107
|
posts: {
|
|
108
108
|
/**
|
|
@@ -360,4 +360,4 @@ declare class Schedulify {
|
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
export { type Account, type Analytics, type AnalyticsOverview, type ApiError, type MediaUploadResponse, type PaginatedResponse, type Post, type QueueSchedule, type QueueSlot,
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SchedulifyX SDK - Official JavaScript/TypeScript SDK
|
|
3
|
-
* https://schedulifyx.com/docs
|
|
3
|
+
* https://app.schedulifyx.com/docs/
|
|
4
4
|
*/
|
|
5
|
-
interface
|
|
5
|
+
interface SchedulifyXConfig {
|
|
6
6
|
apiKey: string;
|
|
7
7
|
baseUrl?: string;
|
|
8
8
|
timeout?: number;
|
|
@@ -92,17 +92,17 @@ interface ApiError {
|
|
|
92
92
|
message: string;
|
|
93
93
|
details?: Record<string, unknown>;
|
|
94
94
|
}
|
|
95
|
-
declare class
|
|
95
|
+
declare class SchedulifyXError extends Error {
|
|
96
96
|
code: string;
|
|
97
97
|
status: number;
|
|
98
98
|
details?: Record<string, unknown>;
|
|
99
99
|
constructor(message: string, code: string, status: number, details?: Record<string, unknown>);
|
|
100
100
|
}
|
|
101
|
-
declare class
|
|
101
|
+
declare class SchedulifyX {
|
|
102
102
|
private apiKey;
|
|
103
103
|
private baseUrl;
|
|
104
104
|
private timeout;
|
|
105
|
-
constructor(config:
|
|
105
|
+
constructor(config: SchedulifyXConfig | string);
|
|
106
106
|
private request;
|
|
107
107
|
posts: {
|
|
108
108
|
/**
|
|
@@ -360,4 +360,4 @@ declare class Schedulify {
|
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
export { type Account, type Analytics, type AnalyticsOverview, type ApiError, type MediaUploadResponse, type PaginatedResponse, type Post, type QueueSchedule, type QueueSlot,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -20,21 +20,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
SchedulifyX: () => SchedulifyX,
|
|
24
|
+
SchedulifyXError: () => SchedulifyXError,
|
|
25
25
|
default: () => index_default
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var
|
|
28
|
+
var SchedulifyXError = class extends Error {
|
|
29
29
|
constructor(message, code, status, details) {
|
|
30
30
|
super(message);
|
|
31
|
-
this.name = "
|
|
31
|
+
this.name = "SchedulifyXError";
|
|
32
32
|
this.code = code;
|
|
33
33
|
this.status = status;
|
|
34
34
|
this.details = details;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
var
|
|
37
|
+
var SchedulifyX = class {
|
|
38
38
|
constructor(config) {
|
|
39
39
|
// ==================== POSTS ====================
|
|
40
40
|
this.posts = {
|
|
@@ -275,7 +275,7 @@ var Schedulify = class {
|
|
|
275
275
|
clearTimeout(timeoutId);
|
|
276
276
|
if (!response.ok) {
|
|
277
277
|
const errorData = await response.json().catch(() => ({}));
|
|
278
|
-
throw new
|
|
278
|
+
throw new SchedulifyXError(
|
|
279
279
|
errorData.error?.message || `HTTP ${response.status}`,
|
|
280
280
|
errorData.error?.code || "http_error",
|
|
281
281
|
response.status,
|
|
@@ -285,11 +285,11 @@ var Schedulify = class {
|
|
|
285
285
|
return response.json();
|
|
286
286
|
} catch (error) {
|
|
287
287
|
clearTimeout(timeoutId);
|
|
288
|
-
if (error instanceof
|
|
288
|
+
if (error instanceof SchedulifyXError) throw error;
|
|
289
289
|
if (error instanceof Error && error.name === "AbortError") {
|
|
290
|
-
throw new
|
|
290
|
+
throw new SchedulifyXError("Request timeout", "timeout", 408);
|
|
291
291
|
}
|
|
292
|
-
throw new
|
|
292
|
+
throw new SchedulifyXError(
|
|
293
293
|
error instanceof Error ? error.message : "Network error",
|
|
294
294
|
"network_error",
|
|
295
295
|
0
|
|
@@ -297,9 +297,9 @@ var Schedulify = class {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
var index_default =
|
|
300
|
+
var index_default = SchedulifyX;
|
|
301
301
|
// Annotate the CommonJS export names for ESM import in node:
|
|
302
302
|
0 && (module.exports = {
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
SchedulifyX,
|
|
304
|
+
SchedulifyXError
|
|
305
305
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
var
|
|
2
|
+
var SchedulifyXError = class extends Error {
|
|
3
3
|
constructor(message, code, status, details) {
|
|
4
4
|
super(message);
|
|
5
|
-
this.name = "
|
|
5
|
+
this.name = "SchedulifyXError";
|
|
6
6
|
this.code = code;
|
|
7
7
|
this.status = status;
|
|
8
8
|
this.details = details;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
var
|
|
11
|
+
var SchedulifyX = class {
|
|
12
12
|
constructor(config) {
|
|
13
13
|
// ==================== POSTS ====================
|
|
14
14
|
this.posts = {
|
|
@@ -249,7 +249,7 @@ var Schedulify = class {
|
|
|
249
249
|
clearTimeout(timeoutId);
|
|
250
250
|
if (!response.ok) {
|
|
251
251
|
const errorData = await response.json().catch(() => ({}));
|
|
252
|
-
throw new
|
|
252
|
+
throw new SchedulifyXError(
|
|
253
253
|
errorData.error?.message || `HTTP ${response.status}`,
|
|
254
254
|
errorData.error?.code || "http_error",
|
|
255
255
|
response.status,
|
|
@@ -259,11 +259,11 @@ var Schedulify = class {
|
|
|
259
259
|
return response.json();
|
|
260
260
|
} catch (error) {
|
|
261
261
|
clearTimeout(timeoutId);
|
|
262
|
-
if (error instanceof
|
|
262
|
+
if (error instanceof SchedulifyXError) throw error;
|
|
263
263
|
if (error instanceof Error && error.name === "AbortError") {
|
|
264
|
-
throw new
|
|
264
|
+
throw new SchedulifyXError("Request timeout", "timeout", 408);
|
|
265
265
|
}
|
|
266
|
-
throw new
|
|
266
|
+
throw new SchedulifyXError(
|
|
267
267
|
error instanceof Error ? error.message : "Network error",
|
|
268
268
|
"network_error",
|
|
269
269
|
0
|
|
@@ -271,9 +271,9 @@ var Schedulify = class {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
-
var index_default =
|
|
274
|
+
var index_default = SchedulifyX;
|
|
275
275
|
export {
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
SchedulifyX,
|
|
277
|
+
SchedulifyXError,
|
|
278
278
|
index_default as default
|
|
279
279
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schedulifyx-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Official JavaScript/TypeScript SDK for SchedulifyX API - Social media scheduling made easy",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"bugs": {
|
|
48
48
|
"url": "https://github.com/Eh-Mr-SK/schedulifyx-sdk-js/issues"
|
|
49
49
|
},
|
|
50
|
-
"homepage": "https://schedulifyx.com/docs",
|
|
50
|
+
"homepage": "https://app.schedulifyx.com/docs/",
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"tsup": "^8.0.0",
|
|
53
53
|
"typescript": "^5.3.0",
|