@postpeer/node 0.8.0 → 0.8.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/CHANGELOG.md +4 -0
- package/LICENSE +1 -1
- package/README.md +36 -32
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
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,32 +56,32 @@ 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.cancel({ path: { postId } });
|
|
68
|
+
client.posts.scheduled.reschedule({ path: { postId }, body });
|
|
69
|
+
|
|
70
|
+
client.connect.getOAuthUrl({ path: { platform }, query });
|
|
71
|
+
client.connect.integrations.list();
|
|
72
|
+
client.connect.integrations.disconnect({ path: { id } });
|
|
73
|
+
|
|
74
|
+
client.profiles.list();
|
|
75
|
+
client.apps.list();
|
|
76
|
+
client.notifications.list();
|
|
77
|
+
client.platforms.list();
|
|
78
|
+
client.media.upload({ body });
|
|
79
|
+
client.analytics.get({ query });
|
|
80
|
+
client.usage.get();
|
|
81
|
+
client.pinterest.getBoards({ query });
|
|
82
|
+
client.tiktok.getCreatorInfo({ query });
|
|
83
|
+
client.ai.write({ body });
|
|
84
|
+
client.ai.generateImage({ body });
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
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.
|
|
@@ -91,8 +91,10 @@ Request parameters are grouped under `body`, `path`, `query`, and `headers`. Res
|
|
|
91
91
|
```ts
|
|
92
92
|
import PostPeer, { NotFoundError, RateLimitError } from '@postpeer/node';
|
|
93
93
|
|
|
94
|
+
const client = new PostPeer();
|
|
95
|
+
|
|
94
96
|
try {
|
|
95
|
-
await
|
|
97
|
+
await client.posts.get({ path: { postId: 'missing' } });
|
|
96
98
|
} catch (error) {
|
|
97
99
|
if (error instanceof NotFoundError) {
|
|
98
100
|
console.error(error.status, error.requestId, error.message);
|
|
@@ -114,7 +116,9 @@ pnpm generate
|
|
|
114
116
|
pnpm check
|
|
115
117
|
```
|
|
116
118
|
|
|
117
|
-
Commit `openapi.json` and `src/generated` together. This updates the code but does not publish a package.
|
|
119
|
+
Commit `openapi.json` and `src/generated` together. This updates the code but does not publish a package.
|
|
120
|
+
|
|
121
|
+
For a release, update `package.json`, `src/version.ts`, and `CHANGELOG.md`, run `pnpm check`, then publish with `npm publish --access public`.
|
|
118
122
|
|
|
119
123
|
Generated files under `src/generated` must not be edited by hand.
|
|
120
124
|
|
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
|
}
|
|
@@ -1378,14 +1378,14 @@ var Ai = class extends HeyApiClient {
|
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
1380
|
};
|
|
1381
|
-
var
|
|
1381
|
+
var PostPeer = class _PostPeer extends HeyApiClient {
|
|
1382
1382
|
static {
|
|
1383
|
-
__name(this, "
|
|
1383
|
+
__name(this, "PostPeer");
|
|
1384
1384
|
}
|
|
1385
1385
|
static __registry = new HeyApiRegistry();
|
|
1386
1386
|
constructor(args) {
|
|
1387
1387
|
super(args);
|
|
1388
|
-
|
|
1388
|
+
_PostPeer.__registry.set(this, args?.key);
|
|
1389
1389
|
}
|
|
1390
1390
|
_health;
|
|
1391
1391
|
get health() {
|
|
@@ -1580,7 +1580,7 @@ var createAPIError = /* @__PURE__ */ __name((response, body) => {
|
|
|
1580
1580
|
}, "createAPIError");
|
|
1581
1581
|
|
|
1582
1582
|
// src/version.ts
|
|
1583
|
-
var VERSION = "0.8.
|
|
1583
|
+
var VERSION = "0.8.1";
|
|
1584
1584
|
|
|
1585
1585
|
// src/client.ts
|
|
1586
1586
|
var DEFAULT_BASE_URL = "https://api.postpeer.dev";
|
|
@@ -1633,7 +1633,7 @@ var createPostPeerFetch = /* @__PURE__ */ __name(({
|
|
|
1633
1633
|
throw new APIConnectionError("Connection failed.");
|
|
1634
1634
|
};
|
|
1635
1635
|
}, "createPostPeerFetch");
|
|
1636
|
-
var
|
|
1636
|
+
var PostPeer2 = class _PostPeer extends PostPeer {
|
|
1637
1637
|
static {
|
|
1638
1638
|
__name(this, "PostPeer");
|
|
1639
1639
|
}
|
|
@@ -1699,11 +1699,11 @@ exports.ConflictError = ConflictError;
|
|
|
1699
1699
|
exports.InternalServerError = InternalServerError;
|
|
1700
1700
|
exports.NotFoundError = NotFoundError;
|
|
1701
1701
|
exports.PermissionDeniedError = PermissionDeniedError;
|
|
1702
|
-
exports.PostPeer =
|
|
1702
|
+
exports.PostPeer = PostPeer2;
|
|
1703
1703
|
exports.PostPeerError = PostPeerError;
|
|
1704
1704
|
exports.RateLimitError = RateLimitError;
|
|
1705
1705
|
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
1706
1706
|
exports.VERSION = VERSION;
|
|
1707
|
-
exports.default =
|
|
1707
|
+
exports.default = PostPeer2;
|
|
1708
1708
|
//# sourceMappingURL=index.cjs.map
|
|
1709
1709
|
//# sourceMappingURL=index.cjs.map
|