@pindownai/client-js 1.1.0 → 1.3.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/dist/index.d.cts CHANGED
@@ -1,239 +1,490 @@
1
1
  /**
2
- * API Types for Pindown
2
+ * Pin types for the v1 Pins API.
3
+ * Aligned with backend-api/src/lib/pin-types.ts + pin-config-schemas.ts.
4
+ * Import per-type *PinConfig interfaces for typed CRUD payloads.
3
5
  */
4
- interface ApiResponse<T = any> {
5
- success: boolean;
6
- data: T;
7
- error?: {
8
- code: string;
9
- message: string;
10
- details?: any;
11
- };
6
+ declare const PRODUCT_PIN_TYPES: readonly ["markdown", "image", "gallery", "table", "charts", "mermaid", "embed", "pdf-viewer", "excel-viewer", "stat-cards", "timeline", "json-viewer", "json-list", "links", "qr-code", "steps", "trace", "plan", "notes", "csv-viewer", "user-story", "chat", "intro", "mastra", "text-media", "business-card", "video", "file-upload", "kanban-board", "checklist", "calendar", "roadmap", "realtime-canvas"];
7
+ declare const ALL_PIN_TYPES: readonly ["markdown", "image", "gallery", "table", "charts", "mermaid", "embed", "pdf-viewer", "excel-viewer", "stat-cards", "timeline", "json-viewer", "json-list", "links", "qr-code", "steps", "trace", "plan", "notes", "csv-viewer", "user-story", "chat", "intro", "mastra", "text-media", "business-card", "video", "file-upload", "kanban-board", "checklist", "calendar", "roadmap", "realtime-canvas"];
8
+ type ProductPinTypeId = (typeof PRODUCT_PIN_TYPES)[number];
9
+ type PinTypeId = (typeof ALL_PIN_TYPES)[number];
10
+ type PinLayout = '1x1' | '1x2' | '2x1' | '2x2' | '3x1' | '3x2' | '3x3' | '4x4';
11
+ type PinDataType = 'markdown' | 'json' | 'text' | 'pin-card';
12
+ /** @deprecated Use PinTypeId */
13
+ type PinCardType = PinTypeId;
14
+ interface StatCardItem {
15
+ title: string;
16
+ value: string | number;
17
+ change?: string;
18
+ trend?: 'up' | 'down' | 'neutral' | string;
19
+ icon?: string;
20
+ [key: string]: unknown;
12
21
  }
13
- interface PaginatedResponse<T> {
14
- items: T[];
15
- total: number;
16
- limit: number;
17
- offset: number;
22
+ interface TableColumn {
23
+ id: string;
24
+ name: string;
25
+ type?: string;
26
+ [key: string]: unknown;
18
27
  }
19
- type PinDataType = 'markdown' | 'json' | 'text' | 'pin-card';
20
- type PinCardType = 'stat-cards' | 'line-chart' | 'flexible-table' | 'embed' | 'markdown' | 'image' | 'score-gauge' | 'indicator-table' | 'alert-action' | 'bottom-detector' | 'long-short-pie';
21
- interface Pin {
28
+ interface TableRow {
22
29
  id: string;
23
- user_id: string;
24
- owner_id: string;
25
- data_type: PinDataType;
26
- pin_card_type?: PinCardType;
27
- metadata?: {
28
- name?: string;
29
- tags?: string[];
30
- [key: string]: any;
30
+ cells: Record<string, unknown>;
31
+ [key: string]: unknown;
32
+ }
33
+ interface KanbanColumn {
34
+ id: string;
35
+ title: string;
36
+ cards?: Array<Record<string, unknown>>;
37
+ [key: string]: unknown;
38
+ }
39
+ interface ChecklistItem {
40
+ id: string;
41
+ name: string;
42
+ checked?: boolean;
43
+ [key: string]: unknown;
44
+ }
45
+ interface GalleryImage {
46
+ url: string;
47
+ alt?: string;
48
+ [key: string]: unknown;
49
+ }
50
+ interface LinkItem {
51
+ title: string;
52
+ url: string;
53
+ [key: string]: unknown;
54
+ }
55
+ interface StepItem {
56
+ title: string;
57
+ description?: string;
58
+ [key: string]: unknown;
59
+ }
60
+ interface MarkdownPinConfig {
61
+ content?: string;
62
+ collaboration?: {
63
+ enabled?: boolean;
31
64
  };
32
- is_public: boolean;
33
- allow_edit: boolean;
34
- require_sign_in: boolean;
35
- allow_comments: boolean;
36
- created_at: string;
37
- updated_at: string;
65
+ [key: string]: unknown;
66
+ }
67
+ interface ImagePinConfig {
68
+ url?: string;
69
+ altText?: string;
70
+ fit?: 'cover' | 'contain' | string;
71
+ [key: string]: unknown;
72
+ }
73
+ interface GalleryPinConfig {
74
+ images?: GalleryImage[];
75
+ [key: string]: unknown;
76
+ }
77
+ interface TablePinConfig {
78
+ columns: TableColumn[];
79
+ rows?: TableRow[];
80
+ [key: string]: unknown;
81
+ }
82
+ interface ChartsPinConfig {
83
+ chartType?: string;
84
+ data?: Array<Record<string, unknown>>;
85
+ xAxis?: string;
86
+ yAxis?: string;
87
+ [key: string]: unknown;
88
+ }
89
+ interface MermaidPinConfig {
90
+ code?: string;
91
+ diagram?: string;
92
+ title?: string;
93
+ [key: string]: unknown;
38
94
  }
39
- interface CreatePinRequest {
40
- data_type?: PinDataType;
41
- pin_card_type?: PinCardType;
42
- is_public?: boolean;
43
- metadata: {
44
- title: string;
45
- tags?: string[];
46
- allow_edit?: boolean;
47
- require_sign_in?: boolean;
48
- allow_comments?: boolean;
49
- pin_card_type?: PinCardType;
50
- pin_card_layout?: string;
51
- pin_card_config?: any;
52
- [key: string]: any;
95
+ interface EmbedPinConfig {
96
+ url?: string;
97
+ type?: string;
98
+ [key: string]: unknown;
99
+ }
100
+ interface PdfViewerPinConfig {
101
+ pdf: {
102
+ url: string;
103
+ fileName?: string;
104
+ title?: string;
105
+ [key: string]: unknown;
53
106
  };
54
- pending_invites?: Record<string, 'editor' | 'viewer'>;
107
+ [key: string]: unknown;
55
108
  }
56
- interface UpdatePinRequest {
57
- is_public?: boolean;
58
- metadata?: Pin['metadata'];
109
+ interface ExcelViewerPinConfig {
110
+ excel: {
111
+ url: string;
112
+ fileName?: string;
113
+ title?: string;
114
+ [key: string]: unknown;
115
+ };
116
+ [key: string]: unknown;
59
117
  }
60
- interface SharePinRequest {
61
- is_public?: boolean;
62
- allow_edit?: boolean;
63
- require_sign_in?: boolean;
64
- allow_comments?: boolean;
118
+ interface StatCardsPinConfig {
119
+ cards: StatCardItem[];
120
+ [key: string]: unknown;
65
121
  }
66
- interface ListPinsOptions {
67
- limit?: number;
68
- offset?: number;
122
+ interface TimelinePinConfig {
123
+ mode?: string;
124
+ items?: Array<Record<string, unknown>>;
125
+ [key: string]: unknown;
69
126
  }
70
- interface Pinboard {
71
- id: string;
72
- user_id: string;
127
+ interface JsonViewerPinConfig {
128
+ json?: unknown;
129
+ jsonString?: string;
130
+ title?: string;
131
+ [key: string]: unknown;
132
+ }
133
+ interface JsonListPinConfig {
134
+ json?: unknown[];
135
+ jsonString?: string;
136
+ [key: string]: unknown;
137
+ }
138
+ interface LinksPinConfig {
139
+ links?: LinkItem[];
140
+ [key: string]: unknown;
141
+ }
142
+ interface QrCodePinConfig {
143
+ url?: string;
144
+ label?: string;
145
+ [key: string]: unknown;
146
+ }
147
+ interface StepsPinConfig {
148
+ steps: StepItem[];
149
+ [key: string]: unknown;
150
+ }
151
+ type TraceSpanStatus = 'completed' | 'running' | 'pending' | 'failed';
152
+ type TraceSpanType = 'system' | 'agent' | 'tool';
153
+ interface TraceSpanItem {
154
+ id?: string;
155
+ type?: TraceSpanType;
156
+ name: string;
157
+ status: TraceSpanStatus;
158
+ timestamp?: string;
159
+ duration?: string;
160
+ details?: string;
161
+ }
162
+ interface TracePinConfig {
163
+ title?: string;
164
+ live?: boolean;
165
+ spans: TraceSpanItem[];
166
+ [key: string]: unknown;
167
+ }
168
+ type PlanContentBlock = {
169
+ type: 'details';
170
+ title?: string;
171
+ items: string[];
172
+ } | {
173
+ type: 'command';
174
+ command: string;
175
+ label?: string;
176
+ } | {
177
+ type: 'code';
178
+ code: string;
179
+ language?: string;
180
+ filename?: string;
181
+ } | {
182
+ type: 'text';
183
+ content: string;
184
+ } | {
185
+ type: 'link';
186
+ url: string;
187
+ label?: string;
188
+ } | {
189
+ type: 'mermaid';
190
+ diagram: string;
191
+ title?: string;
192
+ } | {
193
+ type: 'summary';
194
+ content: string;
195
+ title?: string;
196
+ };
197
+ interface PlanTaskItem {
198
+ id?: string;
199
+ number?: string;
73
200
  title: string;
74
- tags?: string[];
75
- layout?: Record<string, any>;
76
- mobile_layout?: Record<string, any>;
77
- pins?: Pin[];
78
- is_public: boolean;
79
- allow_comments: boolean;
80
- require_sign_in: boolean;
81
- created_at: string;
82
- updated_at: string;
201
+ label?: string;
202
+ description?: string;
203
+ blocks?: PlanContentBlock[];
204
+ [key: string]: unknown;
83
205
  }
84
- interface CreatePinboardRequest {
206
+ interface PlanPhaseItem {
207
+ id?: string;
85
208
  title: string;
86
- tags?: string[];
87
- layout?: Record<string, any>;
88
- mobile_layout?: Record<string, any>;
209
+ status?: 'pending' | 'in-progress' | 'completed';
210
+ tasks: PlanTaskItem[];
211
+ [key: string]: unknown;
89
212
  }
90
- interface UpdatePinboardRequest {
213
+ interface PlanPinConfig {
91
214
  title?: string;
92
- tags?: string[];
93
- is_public?: boolean;
94
- allow_comments?: boolean;
95
- require_sign_in?: boolean;
215
+ status?: 'draft' | 'in-progress' | 'completed';
216
+ breadcrumbs?: Array<{
217
+ label: string;
218
+ }>;
219
+ phases: PlanPhaseItem[];
220
+ [key: string]: unknown;
96
221
  }
97
- interface AddPinToPinboardRequest {
98
- pin_id: string;
99
- position?: {
100
- x: number;
101
- y: number;
102
- w: number;
103
- h: number;
104
- };
222
+ interface NoteItem {
223
+ id?: string;
224
+ title: string;
225
+ content?: string;
226
+ order?: number;
227
+ createdAt?: number;
228
+ updatedAt?: number;
105
229
  }
106
- interface UpdatePinboardLayoutRequest {
107
- layout?: Record<string, any>;
108
- mobile_layout?: Record<string, any>;
230
+ interface NotesPinConfig {
231
+ notes?: NoteItem[];
232
+ [key: string]: unknown;
109
233
  }
110
- type DatasetType = 'json' | 'markdown';
111
- interface Dataset {
112
- id: string;
113
- user_id: string;
114
- name: string;
115
- type: DatasetType;
116
- data: any;
117
- created_at: string;
118
- updated_at: string;
234
+ interface CsvViewerPinConfig {
235
+ csvText?: string;
236
+ csvData?: Array<Record<string, unknown>>;
237
+ fileName?: string;
238
+ [key: string]: unknown;
119
239
  }
120
- interface CreateDatasetRequest {
121
- name: string;
122
- type: DatasetType;
123
- data: any;
240
+ interface UserStoryPinConfig {
241
+ title?: string;
242
+ userStory: string;
243
+ acceptanceCriteria?: string;
244
+ [key: string]: unknown;
245
+ }
246
+ interface ChatPinConfig {
247
+ title?: string;
248
+ placeholder?: string;
249
+ [key: string]: unknown;
250
+ }
251
+ interface IntroPinConfig {
252
+ heading: string;
253
+ subheading?: string;
254
+ [key: string]: unknown;
124
255
  }
125
- interface UpdateDatasetRequest {
126
- name?: string;
127
- type?: DatasetType;
128
- data?: any;
256
+ interface MastraPinConfig {
257
+ mode?: 'workflow' | 'agent' | string;
258
+ agentId?: string;
259
+ workflowId?: string;
260
+ [key: string]: unknown;
129
261
  }
130
- interface Page {
262
+ interface BusinessCardField {
131
263
  id: string;
132
- owner_id: string;
133
- is_public: boolean;
134
- metadata: {
135
- title: string;
136
- description?: string;
137
- tags: string[];
138
- created_at: string;
139
- updated_at?: string;
264
+ key: string;
265
+ value: string;
266
+ }
267
+ interface BusinessCardPinConfig {
268
+ sectionTitle?: string;
269
+ fields?: BusinessCardField[];
270
+ imageConfig?: {
271
+ url?: string;
272
+ alt?: string;
273
+ fileId?: string;
274
+ [key: string]: unknown;
140
275
  };
141
- pins: string[];
142
- layout?: Record<string, any>;
143
- created_at: number;
144
- updated_at: number;
145
- }
146
- interface CreatePageRequest {
147
- metadata: {
148
- title: string;
149
- description?: string;
150
- tags?: string[];
276
+ imagePosition?: 'left' | 'right' | string;
277
+ [key: string]: unknown;
278
+ }
279
+ interface VideoPinConfig {
280
+ url?: string;
281
+ fileId?: string;
282
+ fileName?: string;
283
+ mimeType?: 'video/mp4' | string;
284
+ caption?: string;
285
+ size?: number;
286
+ [key: string]: unknown;
287
+ }
288
+ interface TextMediaPinConfig {
289
+ title?: string;
290
+ text?: string;
291
+ subtext?: string;
292
+ textPosition?: 'left' | 'right' | string;
293
+ mediaType?: 'embed' | 'image' | string;
294
+ embedConfig?: {
295
+ type?: string;
296
+ url?: string;
297
+ aspectRatio?: string;
298
+ autoplay?: boolean;
299
+ [key: string]: unknown;
151
300
  };
152
- pins?: string[];
153
- layout?: Record<string, any>;
154
- is_public?: boolean;
155
- allow_comments?: boolean;
301
+ imageConfig?: {
302
+ url?: string;
303
+ alt?: string;
304
+ fileId?: string;
305
+ [key: string]: unknown;
306
+ };
307
+ [key: string]: unknown;
308
+ }
309
+ interface FileUploadPinConfig {
310
+ files?: Array<Record<string, unknown>>;
311
+ displayMode?: string;
312
+ [key: string]: unknown;
313
+ }
314
+ interface KanbanBoardPinConfig {
315
+ columns: KanbanColumn[];
316
+ [key: string]: unknown;
317
+ }
318
+ interface ChecklistPinConfig {
319
+ title?: string;
320
+ items: ChecklistItem[];
321
+ [key: string]: unknown;
322
+ }
323
+ interface CalendarPinConfig {
324
+ weekStartsOn?: number;
325
+ events?: Array<Record<string, unknown>>;
326
+ [key: string]: unknown;
327
+ }
328
+ interface RoadmapPinConfig {
329
+ title?: string;
330
+ months?: Array<Record<string, unknown>>;
331
+ [key: string]: unknown;
332
+ }
333
+ interface RealtimeCanvasPinConfig {
334
+ title?: string;
335
+ description?: string;
336
+ roomId?: string;
337
+ [key: string]: unknown;
338
+ }
339
+ interface PinConfigByType {
340
+ markdown: MarkdownPinConfig;
341
+ image: ImagePinConfig;
342
+ gallery: GalleryPinConfig;
343
+ table: TablePinConfig;
344
+ charts: ChartsPinConfig;
345
+ mermaid: MermaidPinConfig;
346
+ embed: EmbedPinConfig;
347
+ 'pdf-viewer': PdfViewerPinConfig;
348
+ 'excel-viewer': ExcelViewerPinConfig;
349
+ 'stat-cards': StatCardsPinConfig;
350
+ timeline: TimelinePinConfig;
351
+ 'json-viewer': JsonViewerPinConfig;
352
+ 'json-list': JsonListPinConfig;
353
+ links: LinksPinConfig;
354
+ 'qr-code': QrCodePinConfig;
355
+ steps: StepsPinConfig;
356
+ trace: TracePinConfig;
357
+ plan: PlanPinConfig;
358
+ notes: NotesPinConfig;
359
+ 'csv-viewer': CsvViewerPinConfig;
360
+ 'user-story': UserStoryPinConfig;
361
+ chat: ChatPinConfig;
362
+ intro: IntroPinConfig;
363
+ mastra: MastraPinConfig;
364
+ 'text-media': TextMediaPinConfig;
365
+ 'business-card': BusinessCardPinConfig;
366
+ video: VideoPinConfig;
367
+ 'file-upload': FileUploadPinConfig;
368
+ 'kanban-board': KanbanBoardPinConfig;
369
+ checklist: ChecklistPinConfig;
370
+ calendar: CalendarPinConfig;
371
+ roadmap: RoadmapPinConfig;
372
+ 'realtime-canvas': RealtimeCanvasPinConfig;
373
+ }
374
+ interface PinMetadataBase {
375
+ title: string;
376
+ tags?: string[];
377
+ description?: string;
378
+ allow_edit?: boolean;
156
379
  require_sign_in?: boolean;
157
- include_datasets?: boolean;
380
+ allow_comments?: boolean;
158
381
  }
159
- interface UpdatePageRequest {
160
- metadata?: {
161
- title?: string;
162
- description?: string;
163
- tags?: string[];
164
- };
382
+ type PinMetadata<T extends PinTypeId = PinTypeId> = PinMetadataBase & {
383
+ pin_type?: T;
384
+ pin_config?: PinConfigByType[T];
385
+ pin_layout?: PinLayout;
386
+ };
387
+ interface CreateTypedPinRequest<T extends PinTypeId> {
388
+ pin_type: T;
389
+ pin_config: PinConfigByType[T];
390
+ pin_layout?: PinLayout;
165
391
  is_public?: boolean;
392
+ allow_edit?: boolean;
393
+ require_sign_in?: boolean;
166
394
  allow_comments?: boolean;
395
+ metadata: PinMetadataBase;
396
+ pending_invites?: Record<string, 'editor' | 'viewer'>;
397
+ /** @deprecated Inferred from pin_type */
398
+ data_type?: PinDataType;
399
+ }
400
+ interface CreateNestedPinRequest<T extends PinTypeId> {
401
+ pin_layout?: PinLayout;
402
+ is_public?: boolean;
403
+ allow_edit?: boolean;
167
404
  require_sign_in?: boolean;
168
- include_datasets?: boolean;
405
+ allow_comments?: boolean;
406
+ metadata: PinMetadata<T> & PinMetadataBase;
407
+ pending_invites?: Record<string, 'editor' | 'viewer'>;
408
+ data_type?: PinDataType;
409
+ }
410
+ type CreatePinRequest<T extends PinTypeId = PinTypeId> = CreateTypedPinRequest<T> | CreateNestedPinRequest<T>;
411
+ interface UpdatePinRequest<T extends PinTypeId = PinTypeId> {
412
+ pin_type?: T;
413
+ pin_config?: PinConfigByType[T];
414
+ pin_layout?: PinLayout;
415
+ is_public?: boolean;
416
+ metadata?: Partial<PinMetadata<T>>;
417
+ }
418
+ interface Pin<T extends PinTypeId = PinTypeId> {
419
+ id: string;
420
+ owner_id: string;
421
+ user_id?: string;
422
+ title?: string;
423
+ description?: string;
424
+ data_type: PinDataType;
425
+ is_public: boolean;
426
+ allow_edit: boolean;
427
+ require_sign_in: boolean;
428
+ allow_comments: boolean;
429
+ metadata?: PinMetadata<T>;
430
+ created_at: string | number;
431
+ updated_at: string | number;
169
432
  }
170
- interface AddPinToPageRequest {
171
- pin_id: string;
433
+ interface SharePinRequest {
434
+ is_public?: boolean;
435
+ allow_edit?: boolean;
436
+ require_sign_in?: boolean;
437
+ allow_comments?: boolean;
172
438
  }
173
- interface ListPagesOptions {
439
+ interface ListPinsOptions {
174
440
  limit?: number;
175
441
  offset?: number;
176
442
  }
177
- type BlockType = 'markdown' | 'mermaid' | 'conditional' | 'image' | 'stat-cards' | 'line-chart' | 'flexible-table' | 'embed';
178
- interface Block {
179
- id: string;
180
- pin_id?: string;
181
- title: string;
182
- type: BlockType;
183
- template: string | Record<string, any>;
184
- order: number;
185
- created_at?: string;
186
- updated_at?: string;
443
+ interface CreateMarkdownPinInput extends PinMetadataBase {
444
+ content: string;
445
+ pin_layout?: PinLayout;
446
+ is_public?: boolean;
447
+ allow_edit?: boolean;
448
+ require_sign_in?: boolean;
449
+ allow_comments?: boolean;
450
+ pending_invites?: Record<string, 'editor' | 'viewer'>;
187
451
  }
188
- interface CreateBlockRequest {
189
- title: string;
190
- type: BlockType;
191
- template: string | Record<string, any>;
192
- order?: number;
452
+ interface CreateStatCardsPinInput extends PinMetadataBase {
453
+ cards: StatCardItem[];
454
+ pin_layout?: PinLayout;
455
+ is_public?: boolean;
193
456
  }
194
- interface UpdateBlockRequest {
195
- title?: string;
196
- type?: BlockType;
197
- template?: string | Record<string, any>;
198
- order?: number;
457
+ interface CreateTablePinInput extends PinMetadataBase {
458
+ columns: TableColumn[];
459
+ rows?: TableRow[];
460
+ pin_layout?: PinLayout;
461
+ is_public?: boolean;
199
462
  }
200
- type CollaboratorRole = 'viewer' | 'editor' | 'owner';
201
- interface Collaborator {
202
- user_id: string;
203
- email: string;
204
- role: CollaboratorRole;
205
- added_at: string;
206
- }
207
- interface InviteCollaboratorRequest {
208
- email: string;
209
- role: CollaboratorRole;
210
- }
211
- interface UpdateCollaboratorRoleRequest {
212
- role: CollaboratorRole;
213
- }
214
- interface Permissions {
215
- role: CollaboratorRole;
216
- can_view: boolean;
217
- can_edit: boolean;
218
- can_delete: boolean;
219
- can_share: boolean;
220
- can_manage_collaborators: boolean;
221
- }
222
- interface RateLimitInfo {
223
- tier: string;
224
- minute: {
225
- limit: number;
226
- used: number;
227
- remaining: number;
228
- resetAt: Date;
229
- };
230
- hour: {
231
- limit: number;
232
- used: number;
233
- remaining: number;
234
- resetAt: Date;
463
+ interface CreateEmbedPinInput extends PinMetadataBase {
464
+ url: string;
465
+ type?: string;
466
+ pin_layout?: PinLayout;
467
+ is_public?: boolean;
468
+ }
469
+
470
+ /**
471
+ * API types shared by the v1 Pins client
472
+ */
473
+ interface ApiResponse<T = unknown> {
474
+ success: boolean;
475
+ data: T;
476
+ error?: {
477
+ code: string;
478
+ message: string;
479
+ details?: unknown;
235
480
  };
236
481
  }
482
+ interface PaginatedResponse<T> {
483
+ items: T[];
484
+ total: number;
485
+ limit: number;
486
+ offset: number;
487
+ }
237
488
 
238
489
  /**
239
490
  * Pins API Methods
@@ -242,41 +493,18 @@ interface RateLimitInfo {
242
493
  declare class PinsMethods {
243
494
  private client;
244
495
  constructor(client: PindownClient);
245
- /**
246
- * Create a new pin
247
- */
248
- create(request: CreatePinRequest): Promise<Pin>;
249
- /**
250
- * Get a pin by ID
251
- */
252
- get(pinId: string): Promise<Pin>;
253
- /**
254
- * List all pins
255
- */
496
+ /** Create a pin (typed via CreatePinRequest&lt;T&gt;) */
497
+ create<T extends PinTypeId>(request: CreatePinRequest<T>): Promise<Pin<T>>;
498
+ get<T extends PinTypeId = PinTypeId>(pinId: string): Promise<Pin<T>>;
256
499
  list(options?: ListPinsOptions): Promise<PaginatedResponse<Pin>>;
257
- /**
258
- * Update a pin
259
- */
260
- update(pinId: string, request: UpdatePinRequest): Promise<Pin>;
261
- /**
262
- * Delete a pin
263
- */
500
+ update<T extends PinTypeId = PinTypeId>(pinId: string, request: UpdatePinRequest<T>): Promise<Pin<T>>;
264
501
  delete(pinId: string): Promise<void>;
265
- /**
266
- * Update pin sharing settings
267
- */
268
502
  share(pinId: string, request: SharePinRequest): Promise<Pin>;
269
- /**
270
- * Get multiple pins by IDs in a single request (max 100 pins)
271
- */
272
503
  batchGet(pinIds: string[]): Promise<{
273
504
  found: Pin[];
274
505
  not_found: string[];
275
506
  permission_denied: string[];
276
507
  }>;
277
- /**
278
- * Create multiple pins in a single request (max 50 pins)
279
- */
280
508
  batchCreate(pins: CreatePinRequest[]): Promise<{
281
509
  created: Array<{
282
510
  id: string;
@@ -288,9 +516,6 @@ declare class PinsMethods {
288
516
  error: string;
289
517
  }>;
290
518
  }>;
291
- /**
292
- * Update multiple pins in a single request (max 50 pins)
293
- */
294
519
  batchUpdate(updates: Array<{
295
520
  id: string;
296
521
  } & UpdatePinRequest>): Promise<{
@@ -301,9 +526,6 @@ declare class PinsMethods {
301
526
  }>;
302
527
  updated_at: number;
303
528
  }>;
304
- /**
305
- * Delete multiple pins in a single request (max 50 pins)
306
- */
307
529
  batchDelete(pinIds: string[]): Promise<{
308
530
  deleted: string[];
309
531
  failed: Array<{
@@ -311,589 +533,46 @@ declare class PinsMethods {
311
533
  error: string;
312
534
  }>;
313
535
  }>;
536
+ /** Create a markdown pin with pin_config.content (seeds Yjs on the server). */
537
+ createMarkdown(input: CreateMarkdownPinInput): Promise<Pin<'markdown'>>;
538
+ createStatCards(input: CreateStatCardsPinInput): Promise<Pin<'stat-cards'>>;
539
+ createTable(input: CreateTablePinInput): Promise<Pin<'table'>>;
540
+ createEmbed(input: CreateEmbedPinInput): Promise<Pin<'embed'>>;
314
541
  /**
315
- * Create a markdown pin (content comes from blocks)
316
- */
317
- createMarkdown(title: string, additionalMetadata?: Partial<CreatePinRequest['metadata']>): Promise<Pin>;
318
- /**
319
- * Create a stat card pin
320
- */
321
- createStatCard(data: {
322
- title: string;
323
- value: string | number;
324
- change?: string;
325
- icon?: string;
326
- }, title: string, additionalMetadata?: Partial<CreatePinRequest['metadata']>): Promise<Pin>;
327
- /**
328
- * Create a flexible table pin
329
- */
330
- createTable(data: {
331
- columns: Array<{
332
- id: string;
333
- label: string;
334
- type?: string;
335
- }>;
336
- rows: Array<Record<string, any>>;
337
- }, title: string, additionalMetadata?: Partial<CreatePinRequest['metadata']>): Promise<Pin>;
338
- /**
339
- * Create an embed pin (YouTube, Figma, etc.)
340
- */
341
- createEmbed(url: string, title: string, additionalMetadata?: Partial<CreatePinRequest['metadata']>): Promise<Pin>;
342
- }
343
-
344
- /**
345
- * Pinboards API Methods
346
- */
347
-
348
- declare class PinboardsMethods {
349
- private client;
350
- constructor(client: PindownClient);
351
- /**
352
- * Create a new pinboard
353
- */
354
- create(request: CreatePinboardRequest): Promise<Pinboard>;
355
- /**
356
- * Get a pinboard by ID
357
- */
358
- get(boardId: string): Promise<Pinboard>;
359
- /**
360
- * List all pinboards
361
- */
362
- list(): Promise<Pinboard[]>;
363
- /**
364
- * Update a pinboard
365
- */
366
- update(boardId: string, request: UpdatePinboardRequest): Promise<Pinboard>;
367
- /**
368
- * Delete a pinboard
369
- */
370
- delete(boardId: string): Promise<void>;
371
- /**
372
- * Add a pin to a pinboard
373
- */
374
- addPin(boardId: string, request: AddPinToPinboardRequest): Promise<Pinboard>;
375
- /**
376
- * Remove a pin from a pinboard
377
- */
378
- removePin(boardId: string, pinId: string): Promise<void>;
379
- /**
380
- * Update pinboard layout
381
- */
382
- updateLayout(boardId: string, request: UpdatePinboardLayoutRequest): Promise<Pinboard>;
383
- /**
384
- * Update pinboard sharing settings
385
- */
386
- share(boardId: string, request: {
387
- is_public?: boolean;
388
- require_sign_in?: boolean;
389
- allow_comments?: boolean;
390
- }): Promise<Pinboard>;
391
- /**
392
- * Get multiple pinboards by IDs in a single request (max 100 pinboards)
393
- */
394
- batchGet(pinboardIds: string[]): Promise<{
395
- found: Pinboard[];
396
- not_found: string[];
397
- permission_denied: string[];
398
- }>;
399
- /**
400
- * Add multiple pins to a pinboard with layout in a single request (max 50 pins)
401
- */
402
- batchAddPins(boardId: string, pinIds: string[], layout?: Record<string, {
403
- x: number;
404
- y: number;
405
- w: number;
406
- h: number;
407
- }>): Promise<{
408
- added: string[];
409
- failed: Array<{
410
- id: string;
411
- error: string;
412
- }>;
413
- layout_updated: boolean;
414
- }>;
415
- /**
416
- * Remove multiple pins from a pinboard in a single request (max 50 pins)
417
- */
418
- batchRemovePins(boardId: string, pinIds: string[]): Promise<{
419
- removed: string[];
420
- failed: Array<{
421
- id: string;
422
- error: string;
423
- }>;
424
- }>;
425
- /**
426
- * Create a custom role for a pinboard (max 5 roles per pinboard)
427
- */
428
- createRole(boardId: string, request: {
429
- name: string;
430
- color: string;
431
- permissions?: Record<string, any>;
432
- }): Promise<{
433
- roleId: string;
434
- name: string;
435
- color: string;
436
- }>;
437
- /**
438
- * List custom roles for a pinboard
439
- */
440
- listRoles(boardId: string): Promise<Record<string, any>>;
441
- /**
442
- * Update a custom role
443
- */
444
- updateRole(boardId: string, roleId: string, request: {
445
- name?: string;
446
- color?: string;
447
- permissions?: Record<string, any>;
448
- }): Promise<void>;
449
- /**
450
- * Delete a custom role
451
- */
452
- deleteRole(boardId: string, roleId: string): Promise<void>;
453
- /**
454
- * Assign custom roles to a user (user must be a collaborator first)
455
- */
456
- assignUserRoles(boardId: string, userId: string, roleIds: string[]): Promise<void>;
457
- /**
458
- * Set role requirements for a pin (only users with these roles can see the pin)
459
- */
460
- setPinRoleRequirements(boardId: string, pinId: string, roleIds: string[]): Promise<void>;
461
- }
462
-
463
- /**
464
- * Pages API Methods
465
- */
466
-
467
- declare class PagesMethods {
468
- private client;
469
- constructor(client: PindownClient);
470
- /**
471
- * Create a new page
472
- */
473
- create(request: CreatePageRequest): Promise<Page>;
474
- /**
475
- * Get a page by ID
476
- */
477
- get(pageId: string): Promise<Page>;
478
- /**
479
- * List all pages
480
- */
481
- list(options?: ListPagesOptions): Promise<{
482
- pages: Page[];
483
- total: number;
484
- }>;
485
- /**
486
- * List pages shared with user
487
- */
488
- listShared(options?: ListPagesOptions): Promise<{
489
- pages: Page[];
490
- total: number;
491
- }>;
492
- /**
493
- * Update a page
494
- */
495
- update(pageId: string, request: UpdatePageRequest): Promise<Page>;
496
- /**
497
- * Delete a page
498
- */
499
- delete(pageId: string): Promise<void>;
500
- /**
501
- * Add a pin to a page
502
- */
503
- addPin(pageId: string, request: AddPinToPageRequest): Promise<void>;
504
- /**
505
- * Remove a pin from a page
506
- */
507
- removePin(pageId: string, pinId: string): Promise<void>;
508
- /**
509
- * List pins in a page
510
- */
511
- listPins(pageId: string): Promise<{
512
- pins: string[];
513
- total: number;
514
- }>;
515
- /**
516
- * Get multiple pages by IDs in a single request (max 100 pages)
517
- */
518
- batchGet(pageIds: string[]): Promise<{
519
- found: Page[];
520
- not_found: string[];
521
- permission_denied: string[];
522
- }>;
523
- /**
524
- * Create multiple pages in a single request (max 50 pages)
525
- */
526
- batchCreate(pages: CreatePageRequest[]): Promise<{
527
- created: Array<{
528
- id: string;
529
- index: number;
530
- created_at: number;
531
- }>;
532
- failed: Array<{
533
- index: number;
534
- error: string;
535
- }>;
536
- }>;
537
- /**
538
- * Update multiple pages in a single request (max 50 pages)
539
- */
540
- batchUpdate(updates: Array<{
541
- id: string;
542
- } & UpdatePageRequest>): Promise<{
543
- updated: string[];
544
- failed: Array<{
545
- id: string;
546
- error: string;
547
- }>;
548
- updated_at: number;
549
- }>;
550
- /**
551
- * Delete multiple pages in a single request (max 50 pages)
552
- */
553
- batchDelete(pageIds: string[]): Promise<{
554
- deleted: string[];
555
- failed: Array<{
556
- id: string;
557
- error: string;
558
- }>;
559
- }>;
560
- }
561
-
562
- /**
563
- * Datasets API Methods
564
- */
565
-
566
- declare class DatasetsMethods {
567
- private client;
568
- constructor(client: PindownClient);
569
- /**
570
- * Create a new dataset
571
- */
572
- create(request: CreateDatasetRequest): Promise<Dataset>;
573
- /**
574
- * Get a dataset by ID
575
- */
576
- get(datasetId: string): Promise<Dataset>;
577
- /**
578
- * List all datasets
579
- */
580
- list(): Promise<Dataset[]>;
581
- /**
582
- * Update a dataset
583
- */
584
- update(datasetId: string, request: UpdateDatasetRequest): Promise<Dataset>;
585
- /**
586
- * Delete a dataset
587
- */
588
- delete(datasetId: string): Promise<void>;
589
- /**
590
- * Invite a collaborator to a dataset
591
- */
592
- inviteCollaborator(datasetId: string, request: {
593
- email: string;
594
- role: 'editor' | 'viewer';
595
- }): Promise<{
596
- email: string;
597
- role: 'editor' | 'viewer';
598
- inviteToken: string;
599
- expiresAt: number;
600
- }>;
601
- /**
602
- * Get multiple datasets by IDs in a single request (max 100 datasets)
603
- */
604
- batchGet(datasetIds: string[]): Promise<{
605
- found: Dataset[];
606
- not_found: string[];
607
- permission_denied: string[];
608
- }>;
609
- /**
610
- * Create multiple datasets in a single request (max 50 datasets)
611
- */
612
- batchCreate(datasets: Array<{
613
- name: string;
614
- schema?: any;
615
- data?: any;
616
- is_public?: boolean;
617
- }>): Promise<{
618
- created: Dataset[];
619
- failed: Array<{
620
- index: number;
621
- error: string;
622
- }>;
623
- }>;
624
- /**
625
- * Update multiple datasets in a single request (max 50 datasets)
626
- */
627
- batchUpdate(updates: Array<{
628
- id: string;
629
- name?: string;
630
- schema?: any;
631
- data?: any;
632
- is_public?: boolean;
633
- }>): Promise<{
634
- updated: string[];
635
- failed: Array<{
636
- id: string;
637
- error: string;
638
- }>;
639
- }>;
640
- /**
641
- * Delete multiple datasets in a single request (max 50 datasets)
642
- */
643
- batchDelete(datasetIds: string[]): Promise<{
644
- deleted: string[];
645
- failed: Array<{
646
- id: string;
647
- error: string;
648
- }>;
649
- }>;
650
- }
651
-
652
- /**
653
- * Blocks API Methods
654
- */
655
-
656
- declare class BlocksMethods {
657
- private client;
658
- constructor(client: PindownClient);
659
- /**
660
- * Create a new block for a pin
661
- */
662
- create(pinId: string, request: CreateBlockRequest): Promise<Block>;
663
- /**
664
- * Get a block by ID
665
- */
666
- get(pinId: string, blockId: string): Promise<Block>;
667
- /**
668
- * List all blocks in a pin
669
- */
670
- list(pinId: string): Promise<Block[]>;
671
- /**
672
- * Update a block
673
- */
674
- update(pinId: string, blockId: string, request: UpdateBlockRequest): Promise<Block>;
675
- /**
676
- * Delete a block
677
- */
678
- delete(pinId: string, blockId: string): Promise<void>;
679
- /**
680
- * Get multiple blocks by IDs in a single request (max 100 blocks)
681
- */
682
- batchGet(blockIds: Array<{
683
- pin_id: string;
684
- block_id: string;
685
- }>): Promise<{
686
- found: Block[];
687
- not_found: Array<{
688
- pin_id: string;
689
- block_id: string;
690
- }>;
691
- permission_denied: Array<{
692
- pin_id: string;
693
- block_id: string;
694
- }>;
695
- }>;
696
- /**
697
- * Create multiple blocks for a pin in a single request (max 50 blocks)
698
- */
699
- batchCreate(pinId: string, blocks: Array<{
700
- title: string;
701
- type?: 'markdown' | 'code' | 'text' | 'image';
702
- template?: string;
703
- order?: number;
704
- }>): Promise<{
705
- created: Block[];
706
- failed: Array<{
707
- index: number;
708
- error: string;
709
- }>;
710
- }>;
711
- /**
712
- * Update multiple blocks in a single request (max 50 blocks)
542
+ * @deprecated Use createMarkdown({ title, content, ... }) — old signature ignored content in title
713
543
  */
714
- batchUpdate(updates: Array<{
715
- pin_id: string;
716
- block_id: string;
717
- title?: string;
718
- type?: 'markdown' | 'code' | 'text' | 'image';
719
- template?: string;
720
- order?: number;
721
- }>): Promise<{
722
- updated: Array<{
723
- pin_id: string;
724
- block_id: string;
725
- }>;
726
- failed: Array<{
727
- pin_id: string;
728
- block_id: string;
729
- error: string;
730
- }>;
731
- }>;
732
- /**
733
- * Delete multiple blocks in a single request (max 50 blocks)
734
- */
735
- batchDelete(blockIds: Array<{
736
- pin_id: string;
737
- block_id: string;
738
- }>): Promise<{
739
- deleted: Array<{
740
- pin_id: string;
741
- block_id: string;
742
- }>;
743
- failed: Array<{
744
- pin_id: string;
745
- block_id: string;
746
- error: string;
747
- }>;
748
- }>;
544
+ createMarkdownLegacy(title: string, additionalMetadata?: Record<string, unknown>): Promise<Pin<'markdown'>>;
749
545
  }
750
546
 
751
547
  /**
752
- * Collaborators API Methods
548
+ * Configuration for the v1 Pins API client
753
549
  */
754
-
755
- declare class CollaboratorsMethods {
756
- private client;
757
- constructor(client: PindownClient);
758
- /**
759
- * List collaborators for a pin
760
- */
761
- listForPin(pinId: string): Promise<{
762
- owner: Collaborator;
763
- collaborators: Collaborator[];
764
- pending_invites: Array<{
765
- email: string;
766
- role: string;
767
- invited_at: string;
768
- }>;
769
- }>;
770
- /**
771
- * Invite a collaborator to a pin
772
- */
773
- inviteToPin(pinId: string, request: InviteCollaboratorRequest): Promise<void>;
774
- /**
775
- * Update a pin collaborator's role
776
- */
777
- updatePinRole(pinId: string, userId: string, request: UpdateCollaboratorRoleRequest): Promise<void>;
778
- /**
779
- * Remove a collaborator from a pin
780
- */
781
- removeFromPin(pinId: string, userId: string): Promise<void>;
782
- /**
783
- * Get current user's permissions for a pin
784
- */
785
- getPinPermissions(pinId: string): Promise<Permissions>;
786
- /**
787
- * List collaborators for a pinboard
788
- */
789
- listForPinboard(boardId: string): Promise<{
790
- owner: Collaborator;
791
- collaborators: Collaborator[];
792
- pending_invites: Array<{
793
- email: string;
794
- role: string;
795
- invited_at: string;
796
- }>;
797
- }>;
798
- /**
799
- * Invite a collaborator to a pinboard
800
- */
801
- inviteToPinboard(boardId: string, request: InviteCollaboratorRequest): Promise<void>;
802
- /**
803
- * Update a pinboard collaborator's role
804
- */
805
- updatePinboardRole(boardId: string, userId: string, request: UpdateCollaboratorRoleRequest): Promise<void>;
806
- /**
807
- * Remove a collaborator from a pinboard
808
- */
809
- removeFromPinboard(boardId: string, userId: string): Promise<void>;
810
- /**
811
- * Get current user's permissions for a pinboard
812
- */
813
- getPinboardPermissions(boardId: string): Promise<Permissions>;
814
- }
815
-
816
- /**
817
- * Configuration types for Pindown API Client
818
- */
819
- type Tier = 'starter' | 'hobby' | 'pro' | 'teams' | 'agency';
820
550
  interface PindownConfig {
821
- /**
822
- * Your Pindown API key (from https://pindown.ai/api-keys)
823
- */
551
+ /** Workspace-plan API key from https://pindown.ai/api-keys */
824
552
  apiKey: string;
825
- /**
826
- * Your subscription tier (auto-detected from server if not provided)
827
- * @internal Only use for testing - production should auto-detect
828
- */
829
- tier?: Tier;
830
- /**
831
- * Base URL for the API
832
- * @default 'https://api.pindown.ai/v1'
833
- */
553
+ /** @default 'https://api.pindown.ai/v1' */
834
554
  baseURL?: string;
835
- /**
836
- * Enable rate limit tracking
837
- * @default true
838
- */
839
- enableRateLimitTracking?: boolean;
840
- /**
841
- * Maximum number of retry attempts for failed requests
842
- * @default 3
843
- */
555
+ /** @default 3 */
844
556
  maxRetries?: number;
845
- /**
846
- * Timeout for requests in milliseconds
847
- * @default 30000 (30 seconds)
848
- */
557
+ /** @default 30000 */
849
558
  timeout?: number;
850
559
  }
851
560
 
852
561
  /**
853
- * Pindown API Client
562
+ * Pindown API Client — v1 Pins API only
854
563
  */
855
564
 
856
565
  declare class PindownClient {
857
566
  private config;
858
- private rateLimiter?;
859
- private tierDetected;
860
567
  readonly pins: PinsMethods;
861
- readonly pinboards: PinboardsMethods;
862
- readonly pages: PagesMethods;
863
- readonly datasets: DatasetsMethods;
864
- readonly blocks: BlocksMethods;
865
- readonly collaborators: CollaboratorsMethods;
866
568
  constructor(config: PindownConfig);
867
- /**
868
- * Core request method
869
- */
870
- request<T = any>(method: string, endpoint: string, data?: any): Promise<T>;
871
- /**
872
- * Handle error responses from API
873
- */
569
+ request<T = unknown>(method: string, endpoint: string, data?: unknown): Promise<T>;
874
570
  private handleErrorResponse;
875
- /**
876
- * Detect tier from response headers
877
- */
878
- private detectTierFromHeaders;
879
- /**
880
- * Get current rate limit info
881
- */
882
- getRateLimitInfo(): RateLimitInfo | null;
883
- /**
884
- * Get current tier
885
- */
886
- getTier(): Tier | null;
887
- /**
888
- * Destroy the client (cleanup resources)
889
- */
890
- destroy(): void;
891
571
  }
892
572
 
893
573
  /**
894
- * Error classes for Pindown API Client
574
+ * Error classes for the v1 Pins API client
895
575
  */
896
-
897
576
  declare class PindownError extends Error {
898
577
  constructor(message: string);
899
578
  }
@@ -907,24 +586,11 @@ declare class NotFoundError extends PindownError {
907
586
  constructor(resource: string);
908
587
  }
909
588
  declare class ValidationError extends PindownError {
910
- details?: any;
911
- constructor(message: string, details?: any);
589
+ details?: unknown;
590
+ constructor(message: string, details?: unknown);
912
591
  }
913
592
  declare class RateLimitError extends PindownError {
914
- window: 'minute' | 'hour';
915
- limit: number;
916
- used: number;
917
- remaining: number;
918
- resetAt: Date;
919
- tier: Tier;
920
- constructor(params: {
921
- window: 'minute' | 'hour';
922
- limit: number;
923
- used: number;
924
- remaining: number;
925
- resetAt: Date;
926
- tier: Tier;
927
- });
593
+ constructor(message?: string);
928
594
  }
929
595
  declare class ServerError extends PindownError {
930
596
  statusCode: number;
@@ -934,4 +600,4 @@ declare class NetworkError extends PindownError {
934
600
  constructor(message?: string);
935
601
  }
936
602
 
937
- export { type AddPinToPageRequest, type AddPinToPinboardRequest, type ApiResponse, AuthenticationError, type Block, type BlockType, type Collaborator, type CollaboratorRole, type CreateBlockRequest, type CreateDatasetRequest, type CreatePageRequest, type CreatePinRequest, type CreatePinboardRequest, type Dataset, type DatasetType, ForbiddenError, type InviteCollaboratorRequest, type ListPagesOptions, type ListPinsOptions, NetworkError, NotFoundError, type Page, type PaginatedResponse, type Permissions, type Pin, type PinCardType, type PinDataType, type Pinboard, PindownClient, type PindownConfig, PindownError, RateLimitError, type RateLimitInfo, ServerError, type SharePinRequest, type Tier, type UpdateBlockRequest, type UpdateCollaboratorRoleRequest, type UpdateDatasetRequest, type UpdatePageRequest, type UpdatePinRequest, type UpdatePinboardLayoutRequest, type UpdatePinboardRequest, ValidationError };
603
+ export { ALL_PIN_TYPES, type ApiResponse, AuthenticationError, type BusinessCardField, type BusinessCardPinConfig, type CalendarPinConfig, type ChartsPinConfig, type ChatPinConfig, type ChecklistItem, type ChecklistPinConfig, type CreateEmbedPinInput, type CreateMarkdownPinInput, type CreateNestedPinRequest, type CreatePinRequest, type CreateStatCardsPinInput, type CreateTablePinInput, type CreateTypedPinRequest, type CsvViewerPinConfig, type EmbedPinConfig, type ExcelViewerPinConfig, type FileUploadPinConfig, ForbiddenError, type GalleryImage, type GalleryPinConfig, type ImagePinConfig, type IntroPinConfig, type JsonListPinConfig, type JsonViewerPinConfig, type KanbanBoardPinConfig, type KanbanColumn, type LinkItem, type LinksPinConfig, type ListPinsOptions, type MarkdownPinConfig, type MastraPinConfig, type MermaidPinConfig, NetworkError, NotFoundError, PRODUCT_PIN_TYPES, type PaginatedResponse, type PdfViewerPinConfig, type Pin, type PinCardType, type PinConfigByType, type PinDataType, type PinLayout, type PinMetadata, type PinMetadataBase, type PinTypeId, PindownClient, type PindownConfig, PindownError, type ProductPinTypeId, type QrCodePinConfig, RateLimitError, type RealtimeCanvasPinConfig, type RoadmapPinConfig, ServerError, type SharePinRequest, type StatCardItem, type StatCardsPinConfig, type StepItem, type StepsPinConfig, type TableColumn, type TablePinConfig, type TableRow, type TextMediaPinConfig, type TimelinePinConfig, type UpdatePinRequest, type UserStoryPinConfig, ValidationError, type VideoPinConfig };