@postpeer/node 0.8.0 → 0.8.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/CHANGELOG.md +9 -0
- package/LICENSE +1 -1
- package/README.md +51 -32
- package/dist/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +242 -6
- package/dist/index.d.ts +242 -6
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
- Added scheduled-post editing through `client.posts.scheduled.edit()`.
|
|
6
|
+
- Added LinkedIn company-page mentions and Instagram Story publishing options.
|
|
7
|
+
|
|
8
|
+
## 0.8.1
|
|
9
|
+
|
|
10
|
+
- Standardized the public SDK class name as `PostPeer` throughout generated code and documentation.
|
|
11
|
+
|
|
3
12
|
## 0.8.0
|
|
4
13
|
|
|
5
14
|
- Rebuilt the SDK with Hey API from the PostPeer OpenAPI specification.
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2026
|
|
189
|
+
Copyright 2026 PostPeer
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ Node.js 20 or newer is required.
|
|
|
15
15
|
```ts
|
|
16
16
|
import PostPeer from '@postpeer/node';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const client = new PostPeer(); // Uses POSTPEER_API_KEY
|
|
19
19
|
|
|
20
|
-
const { data: post } = await
|
|
20
|
+
const { data: post } = await client.posts.create({
|
|
21
21
|
body: {
|
|
22
22
|
content: 'Hello from PostPeer!',
|
|
23
23
|
platforms: [{ platform: 'twitter', accountId: 'integration-id' }],
|
|
@@ -31,7 +31,7 @@ console.log(post);
|
|
|
31
31
|
You can also pass the key directly:
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
const
|
|
34
|
+
const client = new PostPeer({
|
|
35
35
|
apiKey: 'your-access-key',
|
|
36
36
|
});
|
|
37
37
|
```
|
|
@@ -39,7 +39,7 @@ const postPeer = new PostPeer({
|
|
|
39
39
|
## Configuration
|
|
40
40
|
|
|
41
41
|
```ts
|
|
42
|
-
const
|
|
42
|
+
const client = new PostPeer({
|
|
43
43
|
apiKey: 'your-access-key',
|
|
44
44
|
baseURL: 'https://api.postpeer.dev',
|
|
45
45
|
timeout: 60_000,
|
|
@@ -56,43 +56,60 @@ Every `PostPeer` instance owns an isolated HTTP client, so separate API keys and
|
|
|
56
56
|
The SDK follows the API's resource structure:
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
client.health.check();
|
|
60
|
+
client.health.verifyAccessKey();
|
|
61
|
+
|
|
62
|
+
client.posts.create({ body });
|
|
63
|
+
client.posts.list({ query });
|
|
64
|
+
client.posts.get({ path: { postId } });
|
|
65
|
+
client.posts.delete({ path: { postId } });
|
|
66
|
+
client.posts.scheduled.list();
|
|
67
|
+
client.posts.scheduled.edit({ path: { postId }, body });
|
|
68
|
+
client.posts.scheduled.cancel({ path: { postId } });
|
|
69
|
+
client.posts.scheduled.reschedule({ path: { postId }, body });
|
|
70
|
+
|
|
71
|
+
client.connect.getOAuthUrl({ path: { platform }, query });
|
|
72
|
+
client.connect.integrations.list();
|
|
73
|
+
client.connect.integrations.disconnect({ path: { id } });
|
|
74
|
+
|
|
75
|
+
client.profiles.list();
|
|
76
|
+
client.apps.list();
|
|
77
|
+
client.notifications.list();
|
|
78
|
+
client.platforms.list();
|
|
79
|
+
client.media.upload({ body });
|
|
80
|
+
client.analytics.get({ query });
|
|
81
|
+
client.usage.get();
|
|
82
|
+
client.pinterest.getBoards({ query });
|
|
83
|
+
client.tiktok.getCreatorInfo({ query });
|
|
84
|
+
client.ai.write({ body });
|
|
85
|
+
client.ai.generateImage({ body });
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
Request parameters are grouped under `body`, `path`, `query`, and `headers`. Responses include `data`, `request`, and `response`, giving you access to the parsed result and the native Fetch objects.
|
|
88
89
|
|
|
90
|
+
### Instagram Stories
|
|
91
|
+
|
|
92
|
+
The generated `InstagramConfigurations` type now supports Story publishing:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import type { InstagramConfigurations } from '@postpeer/node';
|
|
96
|
+
|
|
97
|
+
const platformSpecificData: InstagramConfigurations = {
|
|
98
|
+
contentType: 'story',
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Pass `platformSpecificData` on an Instagram platform entry when creating or editing a post. Omit `contentType` to keep the existing behavior: images publish to Feed and videos publish as Reels.
|
|
103
|
+
|
|
89
104
|
## Error handling
|
|
90
105
|
|
|
91
106
|
```ts
|
|
92
107
|
import PostPeer, { NotFoundError, RateLimitError } from '@postpeer/node';
|
|
93
108
|
|
|
109
|
+
const client = new PostPeer();
|
|
110
|
+
|
|
94
111
|
try {
|
|
95
|
-
await
|
|
112
|
+
await client.posts.get({ path: { postId: 'missing' } });
|
|
96
113
|
} catch (error) {
|
|
97
114
|
if (error instanceof NotFoundError) {
|
|
98
115
|
console.error(error.status, error.requestId, error.message);
|
|
@@ -114,7 +131,9 @@ pnpm generate
|
|
|
114
131
|
pnpm check
|
|
115
132
|
```
|
|
116
133
|
|
|
117
|
-
Commit `openapi.json` and `src/generated` together. This updates the code but does not publish a package.
|
|
134
|
+
Commit `openapi.json` and `src/generated` together. This updates the code but does not publish a package.
|
|
135
|
+
|
|
136
|
+
For a release, update `package.json`, `src/version.ts`, and `CHANGELOG.md`, run `pnpm check`, then publish with `npm publish --access public`.
|
|
118
137
|
|
|
119
138
|
Generated files under `src/generated` must not be edited by hand.
|
|
120
139
|
|
package/dist/index.cjs
CHANGED
|
@@ -809,7 +809,7 @@ var HeyApiRegistry = class {
|
|
|
809
809
|
get(key) {
|
|
810
810
|
const instance = this.instances.get(key ?? this.defaultKey);
|
|
811
811
|
if (!instance) {
|
|
812
|
-
throw new Error(`No SDK client found. Create one with "new
|
|
812
|
+
throw new Error(`No SDK client found. Create one with "new PostPeer()" to fix this error.`);
|
|
813
813
|
}
|
|
814
814
|
return instance;
|
|
815
815
|
}
|
|
@@ -1200,6 +1200,22 @@ var Scheduled = class extends HeyApiClient {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Edit a scheduled post (content, media, platforms, time)
|
|
1205
|
+
*
|
|
1206
|
+
* Replaces the editable fields of a scheduled post: text content, media attachments, target platforms + platform-specific data, and optionally the scheduled time/timezone. Re-validates each platform and reconciles the credit difference. Only works while the post is still scheduled.
|
|
1207
|
+
*/
|
|
1208
|
+
edit(options) {
|
|
1209
|
+
return (options.client ?? this.client).put({
|
|
1210
|
+
security: [{ name: "x-access-key", type: "apiKey" }],
|
|
1211
|
+
url: "/v1/posts/scheduled/{postId}",
|
|
1212
|
+
...options,
|
|
1213
|
+
headers: {
|
|
1214
|
+
"Content-Type": "application/json",
|
|
1215
|
+
...options.headers
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1203
1219
|
};
|
|
1204
1220
|
var Posts = class extends HeyApiClient {
|
|
1205
1221
|
static {
|
|
@@ -1378,14 +1394,14 @@ var Ai = class extends HeyApiClient {
|
|
|
1378
1394
|
});
|
|
1379
1395
|
}
|
|
1380
1396
|
};
|
|
1381
|
-
var
|
|
1397
|
+
var PostPeer = class _PostPeer extends HeyApiClient {
|
|
1382
1398
|
static {
|
|
1383
|
-
__name(this, "
|
|
1399
|
+
__name(this, "PostPeer");
|
|
1384
1400
|
}
|
|
1385
1401
|
static __registry = new HeyApiRegistry();
|
|
1386
1402
|
constructor(args) {
|
|
1387
1403
|
super(args);
|
|
1388
|
-
|
|
1404
|
+
_PostPeer.__registry.set(this, args?.key);
|
|
1389
1405
|
}
|
|
1390
1406
|
_health;
|
|
1391
1407
|
get health() {
|
|
@@ -1580,7 +1596,7 @@ var createAPIError = /* @__PURE__ */ __name((response, body) => {
|
|
|
1580
1596
|
}, "createAPIError");
|
|
1581
1597
|
|
|
1582
1598
|
// src/version.ts
|
|
1583
|
-
var VERSION = "0.8.
|
|
1599
|
+
var VERSION = "0.8.2";
|
|
1584
1600
|
|
|
1585
1601
|
// src/client.ts
|
|
1586
1602
|
var DEFAULT_BASE_URL = "https://api.postpeer.dev";
|
|
@@ -1633,7 +1649,7 @@ var createPostPeerFetch = /* @__PURE__ */ __name(({
|
|
|
1633
1649
|
throw new APIConnectionError("Connection failed.");
|
|
1634
1650
|
};
|
|
1635
1651
|
}, "createPostPeerFetch");
|
|
1636
|
-
var
|
|
1652
|
+
var PostPeer2 = class _PostPeer extends PostPeer {
|
|
1637
1653
|
static {
|
|
1638
1654
|
__name(this, "PostPeer");
|
|
1639
1655
|
}
|
|
@@ -1699,11 +1715,11 @@ exports.ConflictError = ConflictError;
|
|
|
1699
1715
|
exports.InternalServerError = InternalServerError;
|
|
1700
1716
|
exports.NotFoundError = NotFoundError;
|
|
1701
1717
|
exports.PermissionDeniedError = PermissionDeniedError;
|
|
1702
|
-
exports.PostPeer =
|
|
1718
|
+
exports.PostPeer = PostPeer2;
|
|
1703
1719
|
exports.PostPeerError = PostPeerError;
|
|
1704
1720
|
exports.RateLimitError = RateLimitError;
|
|
1705
1721
|
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
1706
1722
|
exports.VERSION = VERSION;
|
|
1707
|
-
exports.default =
|
|
1723
|
+
exports.default = PostPeer2;
|
|
1708
1724
|
//# sourceMappingURL=index.cjs.map
|
|
1709
1725
|
//# sourceMappingURL=index.cjs.map
|