@pindownai/client-js 1.3.2 → 1.3.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 +29 -5
- package/dist/PindownClient-Blc0tgqw.d.cts +668 -0
- package/dist/PindownClient-Blc0tgqw.d.ts +668 -0
- package/dist/ai/index.cjs +9 -0
- package/dist/ai/index.cjs.map +1 -0
- package/dist/ai/index.d.cts +93 -0
- package/dist/ai/index.d.ts +93 -0
- package/dist/ai/index.js +9 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -646
- package/dist/index.d.ts +33 -646
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +27 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Requires a **Workspace** plan API key (`pk_…`).
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Typed **`pin_type` + `pin_config`** for all
|
|
9
|
+
- Typed **`pin_type` + `pin_config`** for all 37 pin shapes
|
|
10
10
|
- Full CRUD + batch + share on `/v1/pins`
|
|
11
11
|
- ESM + CJS, zero runtime dependencies (native `fetch`)
|
|
12
12
|
|
|
@@ -36,15 +36,24 @@ const pin = await client.pins.get(created.id)
|
|
|
36
36
|
const content = (pin.metadata?.pin_config as MarkdownPinConfig | undefined)?.content
|
|
37
37
|
|
|
38
38
|
await client.pins.update(created.id, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
pin_config: { content: '# Updated body' },
|
|
42
|
-
},
|
|
39
|
+
pin_config: { content: '# Updated body' },
|
|
40
|
+
metadata: { title: 'My doc (updated)' },
|
|
43
41
|
})
|
|
44
42
|
|
|
45
43
|
await client.pins.delete(created.id)
|
|
46
44
|
```
|
|
47
45
|
|
|
46
|
+
## Client-side rate limiting
|
|
47
|
+
|
|
48
|
+
The client performs local preflight rate limiting for `/v1/pins*` to reduce avoidable 429s.
|
|
49
|
+
It mirrors backend buckets (`read_standard`, `read_batch`, `write_core`) with the same 60s caps.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
const client = new PindownClient({
|
|
53
|
+
apiKey: process.env.PINDOWN_API_KEY!,
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
48
57
|
## Pin types (importable interfaces)
|
|
49
58
|
|
|
50
59
|
Each pin type has its own `*PinConfig` interface:
|
|
@@ -64,6 +73,10 @@ Product types: `PRODUCT_PIN_TYPES` (same as `ALL_PIN_TYPES`)
|
|
|
64
73
|
|
|
65
74
|
## Helpers
|
|
66
75
|
|
|
76
|
+
Use either:
|
|
77
|
+
- `createPin(pinType, input)` / `updatePin(pinId, pinType, input)` for every type, or
|
|
78
|
+
- generated named helpers: `createMarkdown`, `updateMarkdown`, `createTable`, `updateTable`, `createTimeline`, etc.
|
|
79
|
+
|
|
67
80
|
```typescript
|
|
68
81
|
await client.pins.createMarkdown({
|
|
69
82
|
title: 'Notes',
|
|
@@ -87,6 +100,17 @@ await client.pins.createEmbed({
|
|
|
87
100
|
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
|
88
101
|
type: 'youtube',
|
|
89
102
|
})
|
|
103
|
+
|
|
104
|
+
// Generic helper for any pin_type
|
|
105
|
+
await client.pins.createPin('timeline', {
|
|
106
|
+
title: 'Roadmap timeline',
|
|
107
|
+
items: [{ id: 'm1', title: 'Milestone 1' }],
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// Generated update helper per type
|
|
111
|
+
await client.pins.updateMarkdown('p-abc123', {
|
|
112
|
+
content: '# Updated via updateMarkdown helper',
|
|
113
|
+
})
|
|
90
114
|
```
|
|
91
115
|
|
|
92
116
|
## Pins API surface
|