@productcraft/social 1.0.2 → 1.0.4
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 +10 -10
- package/dist/index.d.cts +9794 -884
- package/dist/index.d.ts +9794 -884
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ The customer backend acts on behalf of one of its EndUsers via the `X-Acting-As`
|
|
|
21
21
|
|
|
22
22
|
## Quick start — create a community (admin)
|
|
23
23
|
|
|
24
|
-
```ts
|
|
24
|
+
```ts before
|
|
25
25
|
import { Social } from "@productcraft/social";
|
|
26
26
|
|
|
27
27
|
// Reads PRODUCTCRAFT_API_KEY from the environment
|
|
@@ -38,7 +38,7 @@ const { data, error } = await social.client.POST(
|
|
|
38
38
|
|
|
39
39
|
## Quick start — post on behalf of an EndUser (customer backend)
|
|
40
40
|
|
|
41
|
-
```ts
|
|
41
|
+
```ts before
|
|
42
42
|
const actor_id = "<actor-uuid>"; // the EndUser's Social actor id
|
|
43
43
|
|
|
44
44
|
const { data, error } = await social.client.POST(
|
|
@@ -66,7 +66,7 @@ Social's wire is snake_case both at the DTO level and in TS types — there's no
|
|
|
66
66
|
|
|
67
67
|
1.0 renames every **path parameter** to snake_case, to match the rest of the ProductCraft APIs: `{communityId}` is now `{community_id}`, `{actorId}` is `{actor_id}`, `{srcActorId}` is `{src_actor_id}`, and so on. Request URLs are unchanged, so nothing breaks at runtime; the change is in the TypeScript path keys and in `params.path`:
|
|
68
68
|
|
|
69
|
-
```ts
|
|
69
|
+
```ts before
|
|
70
70
|
// 0.x
|
|
71
71
|
await social.client.GET("/v1/communities/{communityId}/posts/{postId}", {
|
|
72
72
|
params: { path: { communityId, postId } },
|
|
@@ -95,7 +95,7 @@ PRODUCTCRAFT_API_KEY=pcft_live_...
|
|
|
95
95
|
|
|
96
96
|
## Configuration
|
|
97
97
|
|
|
98
|
-
```ts
|
|
98
|
+
```ts before
|
|
99
99
|
new Social({
|
|
100
100
|
// Omit to use PRODUCTCRAFT_API_KEY from the environment
|
|
101
101
|
auth: { type: "apiKey", key: "pcft_live_..." }
|
|
@@ -110,7 +110,7 @@ new Social({
|
|
|
110
110
|
|
|
111
111
|
### Posts + feeds
|
|
112
112
|
|
|
113
|
-
```ts
|
|
113
|
+
```ts before
|
|
114
114
|
// Create a post
|
|
115
115
|
await social.client.POST(
|
|
116
116
|
"/v1/communities/{community_id}/posts",
|
|
@@ -134,7 +134,7 @@ await social.client.GET(
|
|
|
134
134
|
|
|
135
135
|
### Stories
|
|
136
136
|
|
|
137
|
-
```ts
|
|
137
|
+
```ts before
|
|
138
138
|
// Post a story (24h TTL)
|
|
139
139
|
await social.client.POST(
|
|
140
140
|
"/v1/communities/{community_id}/stories",
|
|
@@ -150,7 +150,7 @@ await social.client.GET(
|
|
|
150
150
|
|
|
151
151
|
### Social graph
|
|
152
152
|
|
|
153
|
-
```ts
|
|
153
|
+
```ts before
|
|
154
154
|
// Follow / unfollow
|
|
155
155
|
await social.client.PUT(
|
|
156
156
|
"/v1/communities/{community_id}/follows/{src_actor_id}/{dst_actor_id}",
|
|
@@ -163,7 +163,7 @@ await social.client.PUT(
|
|
|
163
163
|
|
|
164
164
|
### Notifications
|
|
165
165
|
|
|
166
|
-
```ts
|
|
166
|
+
```ts before
|
|
167
167
|
// List
|
|
168
168
|
await social.client.GET(
|
|
169
169
|
"/v1/communities/{community_id}/actors/{actor_id}/notifications",
|
|
@@ -185,7 +185,7 @@ await social.client.POST(
|
|
|
185
185
|
|
|
186
186
|
### Direct conversations
|
|
187
187
|
|
|
188
|
-
```ts
|
|
188
|
+
```ts before
|
|
189
189
|
// Start / open a conversation
|
|
190
190
|
await social.client.POST(
|
|
191
191
|
"/v1/communities/{community_id}/conversations",
|
|
@@ -201,7 +201,7 @@ await social.client.POST(
|
|
|
201
201
|
|
|
202
202
|
### Moderation (workspace admin)
|
|
203
203
|
|
|
204
|
-
```ts
|
|
204
|
+
```ts before
|
|
205
205
|
// List flags
|
|
206
206
|
await social.client.GET(
|
|
207
207
|
"/v1/workspaces/{workspace_id}/communities/{community_id}/moderation/flags",
|