@sdg.la/wishlist-stack-sdk 0.9.4 → 0.9.6
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 +929 -53
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ TypeScript/JavaScript SDK for the Wishlist Stack API.
|
|
|
22
22
|
- [Lists](#lists)
|
|
23
23
|
- [Shared](#shared)
|
|
24
24
|
- [TypeScript Types](#typescript-types)
|
|
25
|
+
- [Domain Types](#domain-types)
|
|
25
26
|
- [Related Packages](#related-packages)
|
|
26
27
|
- [License](#license)
|
|
27
28
|
|
|
@@ -175,107 +176,982 @@ await client.lists.getById('list-id', { page: 1, pageSize: 25 });
|
|
|
175
176
|
|
|
176
177
|
### Groups
|
|
177
178
|
|
|
178
|
-
|
|
179
|
-
|--------|----------|-------------|
|
|
180
|
-
| `groups.getAll(query?)` | `GET /api/groups` | Fetch all groups for the authenticated customer |
|
|
181
|
-
| `groups.getById(groupId, query?)` | `GET /api/groups/{groupId}` | Fetch a single group by ID (lists are paginated) |
|
|
182
|
-
| `groups.create(body)` | `POST /api/groups` | Create a new group |
|
|
183
|
-
| `groups.update(groupId, body)` | `PATCH /api/groups/{groupId}` | Update group name/description |
|
|
184
|
-
| `groups.remove(groupId)` | `DELETE /api/groups/{groupId}` | Remove a group |
|
|
185
|
-
| `groups.reorder(groupId, body)` | `POST /api/groups/{groupId}/reorder` | Reorder lists within a group |
|
|
186
|
-
| `groups.share(groupId)` | `POST /api/groups/{groupId}/share` | Mark a group as shared (public read-only) |
|
|
187
|
-
| `groups.unshare(groupId)` | `DELETE /api/groups/{groupId}/share` | Revoke sharing for a group |
|
|
179
|
+
> [View full Groups API reference](https://wishlist.devteam.run/docs#/groups)
|
|
188
180
|
|
|
189
|
-
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
#### `groups.getAll(query?)`
|
|
184
|
+
|
|
185
|
+
Fetch all groups for the authenticated customer.
|
|
186
|
+
|
|
187
|
+
- **Endpoint:** `GET /api/groups`
|
|
188
|
+
- **Parameters:** `query?` — `{ page?: number; pageSize?: number }`
|
|
189
|
+
- **Returns:** `Promise<GetGroupsResponse>`
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
const { groups, pagination } = await client.groups.getAll({ page: 1, pageSize: 10 });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
<details>
|
|
196
|
+
<summary>Example response</summary>
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"groups": [
|
|
201
|
+
{
|
|
202
|
+
"id": "cml8drad90001js09weonjojg",
|
|
203
|
+
"name": "Holiday Lists",
|
|
204
|
+
"description": "All my holiday wishlists",
|
|
205
|
+
"position": 1,
|
|
206
|
+
"shared": false,
|
|
207
|
+
"listCount": 2,
|
|
208
|
+
"createdAt": "2025-01-10T08:00:00.000Z",
|
|
209
|
+
"updatedAt": "2025-01-18T12:00:00.000Z",
|
|
210
|
+
"featuredItems": [
|
|
211
|
+
{
|
|
212
|
+
"variantId": 46932429275374,
|
|
213
|
+
"image": {
|
|
214
|
+
"altText": "Product image",
|
|
215
|
+
"url": "https://cdn.shopify.com/s/files/1/example.jpg",
|
|
216
|
+
"width": 800,
|
|
217
|
+
"height": 800
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"pagination": {
|
|
224
|
+
"page": 1,
|
|
225
|
+
"pageSize": 10,
|
|
226
|
+
"totalCount": 1,
|
|
227
|
+
"totalPages": 1
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
</details>
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
#### `groups.getById(groupId, query?)`
|
|
237
|
+
|
|
238
|
+
Fetch a single group by ID. Lists within the group are paginated.
|
|
239
|
+
|
|
240
|
+
- **Endpoint:** `GET /api/groups/{groupId}`
|
|
241
|
+
- **Parameters:**
|
|
242
|
+
- `groupId` — `string`
|
|
243
|
+
- `query?` — `{ page?: number; pageSize?: number }`
|
|
244
|
+
- **Returns:** `Promise<GetGroupResponse>`
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
const group = await client.groups.getById('group-id', { page: 1, pageSize: 25 });
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
<details>
|
|
251
|
+
<summary>Example response</summary>
|
|
252
|
+
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"id": "cml8drad90001js09weonjojg",
|
|
256
|
+
"name": "Holiday Lists",
|
|
257
|
+
"description": "All my holiday wishlists",
|
|
258
|
+
"position": 1,
|
|
259
|
+
"shared": false,
|
|
260
|
+
"listCount": 1,
|
|
261
|
+
"createdAt": "2025-01-10T08:00:00.000Z",
|
|
262
|
+
"updatedAt": "2025-01-18T12:00:00.000Z",
|
|
263
|
+
"lists": [
|
|
264
|
+
{
|
|
265
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
266
|
+
"name": "Gift Ideas",
|
|
267
|
+
"description": "Birthday gift ideas",
|
|
268
|
+
"position": 1,
|
|
269
|
+
"shared": false,
|
|
270
|
+
"itemCount": 2,
|
|
271
|
+
"featuredItems": [
|
|
272
|
+
{
|
|
273
|
+
"variantId": 46932429275374,
|
|
274
|
+
"image": {
|
|
275
|
+
"altText": "Product image",
|
|
276
|
+
"url": "https://cdn.shopify.com/s/files/1/example.jpg",
|
|
277
|
+
"width": 800,
|
|
278
|
+
"height": 800
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"pagination": {
|
|
285
|
+
"page": 1,
|
|
286
|
+
"pageSize": 10,
|
|
287
|
+
"totalCount": 1,
|
|
288
|
+
"totalPages": 1
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
</details>
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
#### `groups.create(body)`
|
|
298
|
+
|
|
299
|
+
Create a new group.
|
|
300
|
+
|
|
301
|
+
- **Endpoint:** `POST /api/groups`
|
|
302
|
+
- **Parameters:** `body` — `{ name?: string; description?: string }`
|
|
303
|
+
- **Returns:** `Promise<CreateGroupResponse>`
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
const group = await client.groups.create({ name: 'Favorites', description: 'My favorite items' });
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
<details>
|
|
310
|
+
<summary>Example response</summary>
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"id": "cml8drad90001js09weonjojg",
|
|
315
|
+
"name": "Favorites",
|
|
316
|
+
"description": "My favorite items",
|
|
317
|
+
"position": 1,
|
|
318
|
+
"shared": false,
|
|
319
|
+
"listCount": 0,
|
|
320
|
+
"createdAt": "2025-01-10T08:00:00.000Z",
|
|
321
|
+
"updatedAt": "2025-01-10T08:00:00.000Z"
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
</details>
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
#### `groups.update(groupId, body)`
|
|
330
|
+
|
|
331
|
+
Update a group's name or description.
|
|
332
|
+
|
|
333
|
+
- **Endpoint:** `PATCH /api/groups/{groupId}`
|
|
334
|
+
- **Parameters:**
|
|
335
|
+
- `groupId` — `string`
|
|
336
|
+
- `body` — `{ name?: string; description?: string }`
|
|
337
|
+
- **Returns:** `Promise<UpdateGroupDetailsResponse>`
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
await client.groups.update('group-id', { name: 'Renamed Group' });
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
<details>
|
|
344
|
+
<summary>Example response</summary>
|
|
345
|
+
|
|
346
|
+
```json
|
|
347
|
+
{
|
|
348
|
+
"id": "cml8drad90001js09weonjojg",
|
|
349
|
+
"name": "Renamed Group",
|
|
350
|
+
"description": "All my holiday wishlists",
|
|
351
|
+
"position": 1,
|
|
352
|
+
"shared": false,
|
|
353
|
+
"listCount": 2,
|
|
354
|
+
"createdAt": "2025-01-10T08:00:00.000Z",
|
|
355
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
</details>
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
#### `groups.remove(groupId)`
|
|
364
|
+
|
|
365
|
+
Remove a group. Lists assigned to the group are unassigned, not deleted.
|
|
366
|
+
|
|
367
|
+
- **Endpoint:** `DELETE /api/groups/{groupId}`
|
|
368
|
+
- **Parameters:** `groupId` — `string`
|
|
369
|
+
- **Returns:** `Promise<RemoveGroupResponse>`
|
|
370
|
+
|
|
371
|
+
```ts
|
|
372
|
+
await client.groups.remove('group-id');
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
<details>
|
|
376
|
+
<summary>Example response</summary>
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{ "ok": true }
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
</details>
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
#### `groups.reorder(groupId, body)`
|
|
387
|
+
|
|
388
|
+
Reorder lists within a group.
|
|
389
|
+
|
|
390
|
+
- **Endpoint:** `POST /api/groups/{groupId}/reorder`
|
|
391
|
+
- **Parameters:**
|
|
392
|
+
- `groupId` — `string`
|
|
393
|
+
- `body` — `{ listIds?: string[] }`
|
|
394
|
+
- **Returns:** `Promise<ReorderGroupResponse>`
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
await client.groups.reorder('group-id', { listIds: ['list-3', 'list-1', 'list-2'] });
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
#### `groups.share(groupId)`
|
|
403
|
+
|
|
404
|
+
Mark a group as shared (public read-only). Also shares all lists within the group.
|
|
405
|
+
|
|
406
|
+
- **Endpoint:** `POST /api/groups/{groupId}/share`
|
|
407
|
+
- **Parameters:** `groupId` — `string`
|
|
408
|
+
- **Returns:** `Promise<MarkGroupSharedResponse>`
|
|
190
409
|
|
|
191
410
|
```ts
|
|
192
|
-
|
|
193
|
-
|
|
411
|
+
await client.groups.share('group-id');
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
<details>
|
|
415
|
+
<summary>Example response</summary>
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"id": "cmlbe49qk0001ju094x1ya9co",
|
|
420
|
+
"name": "Holiday Lists",
|
|
421
|
+
"description": "All my holiday wishlists",
|
|
422
|
+
"position": 1,
|
|
423
|
+
"shared": true,
|
|
424
|
+
"listCount": 2,
|
|
425
|
+
"createdAt": "2025-01-10T08:00:00.000Z",
|
|
426
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
</details>
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
#### `groups.unshare(groupId)`
|
|
194
435
|
|
|
195
|
-
|
|
196
|
-
{ name?: string; description?: string }
|
|
436
|
+
Revoke sharing for a group and all of its lists.
|
|
197
437
|
|
|
198
|
-
|
|
199
|
-
|
|
438
|
+
- **Endpoint:** `DELETE /api/groups/{groupId}/share`
|
|
439
|
+
- **Parameters:** `groupId` — `string`
|
|
440
|
+
- **Returns:** `Promise<RevokeGroupSharedResponse>`
|
|
441
|
+
|
|
442
|
+
```ts
|
|
443
|
+
await client.groups.unshare('group-id');
|
|
200
444
|
```
|
|
201
445
|
|
|
446
|
+
<details>
|
|
447
|
+
<summary>Example response</summary>
|
|
448
|
+
|
|
449
|
+
```json
|
|
450
|
+
{
|
|
451
|
+
"id": "cmlbe49qk0001ju094x1ya9co",
|
|
452
|
+
"name": "Holiday Lists",
|
|
453
|
+
"description": "All my holiday wishlists",
|
|
454
|
+
"position": 1,
|
|
455
|
+
"shared": false,
|
|
456
|
+
"listCount": 2,
|
|
457
|
+
"createdAt": "2025-01-10T08:00:00.000Z",
|
|
458
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
</details>
|
|
463
|
+
|
|
202
464
|
### Lists
|
|
203
465
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
466
|
+
> [View full Lists API reference](https://wishlist.devteam.run/docs#/lists)
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
#### `lists.getAll(query?)`
|
|
471
|
+
|
|
472
|
+
Fetch all lists for the authenticated customer.
|
|
473
|
+
|
|
474
|
+
- **Endpoint:** `GET /api/lists`
|
|
475
|
+
- **Parameters:** `query?` — `{ page?: number; pageSize?: number }`
|
|
476
|
+
- **Returns:** `Promise<GetListsResponse>`
|
|
477
|
+
|
|
478
|
+
```ts
|
|
479
|
+
const { lists, pagination } = await client.lists.getAll({ page: 1, pageSize: 10 });
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
<details>
|
|
483
|
+
<summary>Example response</summary>
|
|
484
|
+
|
|
485
|
+
```json
|
|
486
|
+
{
|
|
487
|
+
"lists": [
|
|
488
|
+
{
|
|
489
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
490
|
+
"name": "Gift Ideas",
|
|
491
|
+
"description": "Birthday gift ideas",
|
|
492
|
+
"position": 1,
|
|
493
|
+
"shared": false,
|
|
494
|
+
"itemCount": 3,
|
|
495
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
496
|
+
"updatedAt": "2025-01-20T14:00:00.000Z",
|
|
497
|
+
"featuredProducts": [
|
|
498
|
+
{
|
|
499
|
+
"variantId": 46932429275374,
|
|
500
|
+
"image": {
|
|
501
|
+
"altText": "Product image",
|
|
502
|
+
"url": "https://cdn.shopify.com/s/files/1/example.jpg",
|
|
503
|
+
"width": 800,
|
|
504
|
+
"height": 800
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
"pagination": {
|
|
511
|
+
"page": 1,
|
|
512
|
+
"pageSize": 10,
|
|
513
|
+
"totalCount": 1,
|
|
514
|
+
"totalPages": 1
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
</details>
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
#### `lists.getById(listId, query?)`
|
|
524
|
+
|
|
525
|
+
Fetch a single list by ID. Items are hydrated with Shopify product data and paginated.
|
|
526
|
+
|
|
527
|
+
- **Endpoint:** `GET /api/lists/{listId}`
|
|
528
|
+
- **Parameters:**
|
|
529
|
+
- `listId` — `string`
|
|
530
|
+
- `query?` — `{ page?: number; pageSize?: number }`
|
|
531
|
+
- **Returns:** `Promise<GetListResponse>`
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
const list = await client.lists.getById('list-id', { page: 1, pageSize: 25 });
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
<details>
|
|
538
|
+
<summary>Example response</summary>
|
|
539
|
+
|
|
540
|
+
```json
|
|
541
|
+
{
|
|
542
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
543
|
+
"name": "Gift Ideas",
|
|
544
|
+
"description": "Birthday gift ideas",
|
|
545
|
+
"position": 1,
|
|
546
|
+
"shared": false,
|
|
547
|
+
"itemCount": 1,
|
|
548
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
549
|
+
"updatedAt": "2025-01-20T14:00:00.000Z",
|
|
550
|
+
"items": [
|
|
551
|
+
{
|
|
552
|
+
"id": "cml8dveoj0002jf09vsqw10r2",
|
|
553
|
+
"userNote": "Love this one",
|
|
554
|
+
"quantity": 1,
|
|
555
|
+
"position": 1,
|
|
556
|
+
"product": {
|
|
557
|
+
"id": "gid://shopify/Product/123456789",
|
|
558
|
+
"title": "Classic T-Shirt",
|
|
559
|
+
"description": "A comfortable classic t-shirt",
|
|
560
|
+
"availableForSale": true,
|
|
561
|
+
"handle": "classic-t-shirt",
|
|
562
|
+
"productType": "Apparel",
|
|
563
|
+
"category": null,
|
|
564
|
+
"tags": ["summer", "casual"],
|
|
565
|
+
"onlineStoreUrl": "https://example.myshopify.com/products/classic-t-shirt",
|
|
566
|
+
"metafields": [],
|
|
567
|
+
"variant": {
|
|
568
|
+
"id": "gid://shopify/ProductVariant/46932429275374",
|
|
569
|
+
"title": "Medium / Blue",
|
|
570
|
+
"sku": "TSHIRT-M-BLUE",
|
|
571
|
+
"price": { "amount": "29.99", "currencyCode": "USD" },
|
|
572
|
+
"compareAtPrice": null,
|
|
573
|
+
"availableForSale": true,
|
|
574
|
+
"currentlyNotInStock": false,
|
|
575
|
+
"selectedOptions": [
|
|
576
|
+
{ "name": "Size", "value": "Medium" },
|
|
577
|
+
{ "name": "Color", "value": "Blue" }
|
|
578
|
+
],
|
|
579
|
+
"image": {
|
|
580
|
+
"altText": "Classic T-Shirt in Blue",
|
|
581
|
+
"url": "https://cdn.shopify.com/s/files/1/example.jpg",
|
|
582
|
+
"width": 800,
|
|
583
|
+
"height": 800
|
|
584
|
+
},
|
|
585
|
+
"metafields": []
|
|
586
|
+
},
|
|
587
|
+
"vendor": "Example Brand"
|
|
588
|
+
},
|
|
589
|
+
"properties": null
|
|
590
|
+
}
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
</details>
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
#### `lists.create(body)`
|
|
600
|
+
|
|
601
|
+
Create a new list, optionally assigned to a group.
|
|
602
|
+
|
|
603
|
+
- **Endpoint:** `POST /api/lists`
|
|
604
|
+
- **Parameters:** `body` — `{ name?: string; description?: string; groupId?: string }`
|
|
605
|
+
- **Returns:** `Promise<CreateListResponse>`
|
|
606
|
+
|
|
607
|
+
```ts
|
|
608
|
+
const list = await client.lists.create({ name: 'Gift Ideas', groupId: 'group-id' });
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
<details>
|
|
612
|
+
<summary>Example response</summary>
|
|
613
|
+
|
|
614
|
+
```json
|
|
615
|
+
{
|
|
616
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
617
|
+
"name": "Gift Ideas",
|
|
618
|
+
"description": null,
|
|
619
|
+
"position": 1,
|
|
620
|
+
"shared": false,
|
|
621
|
+
"itemCount": 0,
|
|
622
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
623
|
+
"updatedAt": "2025-01-15T10:30:00.000Z"
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
</details>
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
#### `lists.update(listId, body)`
|
|
632
|
+
|
|
633
|
+
Update a list's name, description, or group assignment.
|
|
634
|
+
|
|
635
|
+
- **Endpoint:** `PATCH /api/lists/{listId}`
|
|
636
|
+
- **Parameters:**
|
|
637
|
+
- `listId` — `string`
|
|
638
|
+
- `body` — `{ name?: string; description?: string; groupId?: string }`
|
|
639
|
+
- **Returns:** `Promise<UpdateListDetailsResponse>`
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
await client.lists.update('list-id', { name: 'Renamed List' });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
<details>
|
|
646
|
+
<summary>Example response</summary>
|
|
216
647
|
|
|
217
|
-
|
|
648
|
+
```json
|
|
649
|
+
{
|
|
650
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
651
|
+
"name": "Renamed List",
|
|
652
|
+
"description": "Birthday gift ideas",
|
|
653
|
+
"position": 1,
|
|
654
|
+
"shared": false,
|
|
655
|
+
"itemCount": 3,
|
|
656
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
657
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
658
|
+
}
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
</details>
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
#### `lists.remove(listId)`
|
|
666
|
+
|
|
667
|
+
Remove a list and all of its items.
|
|
668
|
+
|
|
669
|
+
- **Endpoint:** `DELETE /api/lists/{listId}`
|
|
670
|
+
- **Parameters:** `listId` — `string`
|
|
671
|
+
- **Returns:** `Promise<RemoveListResponse>`
|
|
672
|
+
|
|
673
|
+
```ts
|
|
674
|
+
await client.lists.remove('list-id');
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
<details>
|
|
678
|
+
<summary>Example response</summary>
|
|
679
|
+
|
|
680
|
+
```json
|
|
681
|
+
{ "ok": true }
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
</details>
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
#### `lists.addItems(listId, body)`
|
|
689
|
+
|
|
690
|
+
Add one or more items to a list.
|
|
691
|
+
|
|
692
|
+
- **Endpoint:** `POST /api/lists/{listId}/add`
|
|
693
|
+
- **Parameters:**
|
|
694
|
+
- `listId` — `string`
|
|
695
|
+
- `body` — `AddItemsToListBody`
|
|
696
|
+
|
|
697
|
+
```ts
|
|
698
|
+
type AddItemsToListBody = {
|
|
699
|
+
items?: Array<{
|
|
700
|
+
variantId?: string;
|
|
701
|
+
quantity?: number;
|
|
702
|
+
note?: string;
|
|
703
|
+
properties?: Record<string, unknown> | null;
|
|
704
|
+
}>;
|
|
705
|
+
};
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
- **Returns:** `Promise<AddItemsToListResponse>` — the updated list with hydrated items (same shape as `getById`)
|
|
709
|
+
|
|
710
|
+
```ts
|
|
711
|
+
await client.lists.addItems('list-id', {
|
|
712
|
+
items: [
|
|
713
|
+
{ variantId: 'gid://shopify/ProductVariant/123', quantity: 1 },
|
|
714
|
+
{ variantId: 'gid://shopify/ProductVariant/456', note: 'Size M' },
|
|
715
|
+
],
|
|
716
|
+
});
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
---
|
|
720
|
+
|
|
721
|
+
#### `lists.updateItem(listId, itemId, body)`
|
|
722
|
+
|
|
723
|
+
Update an item on a list (variant, quantity, note, position, or custom properties). When `variantId` is provided, the item's product data is re-fetched from Shopify to reflect the new variant.
|
|
724
|
+
|
|
725
|
+
- **Endpoint:** `PATCH /api/lists/{listId}/items/{itemId}`
|
|
726
|
+
- **Parameters:**
|
|
727
|
+
- `listId` — `string`
|
|
728
|
+
- `itemId` — `string`
|
|
729
|
+
- `body` — `{ variantId?: string; quantity?: number; note?: string; position?: number; properties?: Record<string, unknown> | null }`
|
|
730
|
+
- **Returns:** `Promise<UpdateListItemResponse>` — the updated hydrated item
|
|
731
|
+
|
|
732
|
+
```ts
|
|
733
|
+
await client.lists.updateItem('list-id', 'item-id', { quantity: 3, note: 'Updated note' });
|
|
734
|
+
|
|
735
|
+
// Change the variant stored on the item
|
|
736
|
+
await client.lists.updateItem('list-id', 'item-id', { variantId: '46932429275374' });
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
<details>
|
|
740
|
+
<summary>Example response</summary>
|
|
741
|
+
|
|
742
|
+
```json
|
|
743
|
+
{
|
|
744
|
+
"id": "cml8dveoj0002jf09vsqw10r2",
|
|
745
|
+
"userNote": "Updated note",
|
|
746
|
+
"quantity": 3,
|
|
747
|
+
"position": 1,
|
|
748
|
+
"product": {
|
|
749
|
+
"id": "gid://shopify/Product/123456789",
|
|
750
|
+
"title": "Classic T-Shirt",
|
|
751
|
+
"description": "A comfortable classic t-shirt",
|
|
752
|
+
"availableForSale": true,
|
|
753
|
+
"handle": "classic-t-shirt",
|
|
754
|
+
"productType": "Apparel",
|
|
755
|
+
"category": null,
|
|
756
|
+
"tags": ["summer", "casual"],
|
|
757
|
+
"onlineStoreUrl": "https://example.myshopify.com/products/classic-t-shirt",
|
|
758
|
+
"metafields": [],
|
|
759
|
+
"variant": {
|
|
760
|
+
"id": "gid://shopify/ProductVariant/46932429275374",
|
|
761
|
+
"title": "Medium / Blue",
|
|
762
|
+
"sku": "TSHIRT-M-BLUE",
|
|
763
|
+
"price": { "amount": "29.99", "currencyCode": "USD" },
|
|
764
|
+
"compareAtPrice": null,
|
|
765
|
+
"availableForSale": true,
|
|
766
|
+
"currentlyNotInStock": false,
|
|
767
|
+
"selectedOptions": [
|
|
768
|
+
{ "name": "Size", "value": "Medium" },
|
|
769
|
+
{ "name": "Color", "value": "Blue" }
|
|
770
|
+
],
|
|
771
|
+
"image": {
|
|
772
|
+
"altText": "Classic T-Shirt in Blue",
|
|
773
|
+
"url": "https://cdn.shopify.com/s/files/1/example.jpg",
|
|
774
|
+
"width": 800,
|
|
775
|
+
"height": 800
|
|
776
|
+
},
|
|
777
|
+
"metafields": []
|
|
778
|
+
},
|
|
779
|
+
"vendor": "Example Brand"
|
|
780
|
+
},
|
|
781
|
+
"properties": null
|
|
782
|
+
}
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
</details>
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
789
|
+
#### `lists.removeItem(listId, itemId)`
|
|
790
|
+
|
|
791
|
+
Remove an item from a list.
|
|
792
|
+
|
|
793
|
+
- **Endpoint:** `DELETE /api/lists/{listId}/items/{itemId}`
|
|
794
|
+
- **Parameters:**
|
|
795
|
+
- `listId` — `string`
|
|
796
|
+
- `itemId` — `string`
|
|
797
|
+
- **Returns:** `Promise<RemoveItemFromListResponse>`
|
|
218
798
|
|
|
219
799
|
```ts
|
|
220
|
-
|
|
221
|
-
|
|
800
|
+
await client.lists.removeItem('list-id', 'item-id');
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
<details>
|
|
804
|
+
<summary>Example response</summary>
|
|
805
|
+
|
|
806
|
+
```json
|
|
807
|
+
{ "ok": true }
|
|
808
|
+
```
|
|
222
809
|
|
|
223
|
-
|
|
224
|
-
{ name?: string; description?: string, groupId?: string }
|
|
810
|
+
</details>
|
|
225
811
|
|
|
226
|
-
|
|
227
|
-
{ items: Array<{ variantId: string; quantity?: number; note?: string; properties?: object }> }
|
|
228
|
-
// properties: optional custom key-value data for the item (plain JSON object)
|
|
812
|
+
---
|
|
229
813
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
814
|
+
#### `lists.share(listId)`
|
|
815
|
+
|
|
816
|
+
Mark a list as shared (public read-only).
|
|
817
|
+
|
|
818
|
+
- **Endpoint:** `POST /api/lists/{listId}/share`
|
|
819
|
+
- **Parameters:** `listId` — `string`
|
|
820
|
+
- **Returns:** `Promise<MarkListSharedResponse>`
|
|
821
|
+
|
|
822
|
+
```ts
|
|
823
|
+
await client.lists.share('list-id');
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
<details>
|
|
827
|
+
<summary>Example response</summary>
|
|
828
|
+
|
|
829
|
+
```json
|
|
830
|
+
{
|
|
831
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
832
|
+
"name": "Gift Ideas",
|
|
833
|
+
"description": "Birthday gift ideas",
|
|
834
|
+
"position": 1,
|
|
835
|
+
"shared": true,
|
|
836
|
+
"itemCount": 3,
|
|
837
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
838
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
839
|
+
}
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
</details>
|
|
843
|
+
|
|
844
|
+
---
|
|
845
|
+
|
|
846
|
+
#### `lists.unshare(listId)`
|
|
847
|
+
|
|
848
|
+
Revoke sharing for a list.
|
|
849
|
+
|
|
850
|
+
- **Endpoint:** `DELETE /api/lists/{listId}/share`
|
|
851
|
+
- **Parameters:** `listId` — `string`
|
|
852
|
+
- **Returns:** `Promise<RevokeListSharedResponse>`
|
|
853
|
+
|
|
854
|
+
```ts
|
|
855
|
+
await client.lists.unshare('list-id');
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
<details>
|
|
859
|
+
<summary>Example response</summary>
|
|
860
|
+
|
|
861
|
+
```json
|
|
862
|
+
{
|
|
863
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
864
|
+
"name": "Gift Ideas",
|
|
865
|
+
"description": "Birthday gift ideas",
|
|
866
|
+
"position": 1,
|
|
867
|
+
"shared": false,
|
|
868
|
+
"itemCount": 3,
|
|
869
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
870
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
871
|
+
}
|
|
233
872
|
```
|
|
234
873
|
|
|
874
|
+
</details>
|
|
875
|
+
|
|
235
876
|
### Shared
|
|
236
877
|
|
|
237
|
-
Public read-only endpoints for accessing shared lists and groups
|
|
878
|
+
Public read-only endpoints for accessing shared lists and groups. These require only the merchant `apiKey` — no customer access token needed.
|
|
879
|
+
|
|
880
|
+
> [View full Shared API reference](https://wishlist.devteam.run/docs#/shared)
|
|
881
|
+
|
|
882
|
+
---
|
|
883
|
+
|
|
884
|
+
#### `shared.getSharedList(listId)`
|
|
885
|
+
|
|
886
|
+
Fetch a public shared list with hydrated product details.
|
|
887
|
+
|
|
888
|
+
- **Endpoint:** `GET /api/shared/list/{listId}`
|
|
889
|
+
- **Parameters:** `listId` — `string`
|
|
890
|
+
- **Returns:** `Promise<GetSharedListResponse>` — same response shape as [`lists.getById`](#listsgetbyidlistid-query)
|
|
891
|
+
|
|
892
|
+
```ts
|
|
893
|
+
const list = await client.shared.getSharedList('list-id');
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
---
|
|
897
|
+
|
|
898
|
+
#### `shared.getSharedGroup(groupId)`
|
|
238
899
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
900
|
+
Fetch a public shared group and its lists.
|
|
901
|
+
|
|
902
|
+
- **Endpoint:** `GET /api/shared/group/{groupId}`
|
|
903
|
+
- **Parameters:** `groupId` — `string`
|
|
904
|
+
- **Returns:** `Promise<GetSharedGroupResponse>` — same response shape as [`groups.getById`](#groupsgetbyidgroupid-query)
|
|
905
|
+
|
|
906
|
+
```ts
|
|
907
|
+
const group = await client.shared.getSharedGroup('group-id');
|
|
908
|
+
```
|
|
243
909
|
|
|
244
910
|
## TypeScript Types
|
|
245
911
|
|
|
246
|
-
The package exports all types
|
|
912
|
+
The package exports all request, response, and domain types. Import what you need:
|
|
247
913
|
|
|
248
914
|
```ts
|
|
249
915
|
import type {
|
|
250
|
-
// Client
|
|
916
|
+
// Client
|
|
251
917
|
CreateWishlistStackClientOptions,
|
|
252
918
|
WishlistStackClient,
|
|
253
919
|
|
|
254
|
-
//
|
|
920
|
+
// Errors
|
|
255
921
|
WishlistStackApiError,
|
|
256
922
|
WishlistStackApiErrorDetails,
|
|
257
923
|
|
|
258
|
-
//
|
|
924
|
+
// Groups
|
|
259
925
|
GetGroupsResponse,
|
|
260
926
|
GetGroupResponse,
|
|
261
927
|
GroupSummary,
|
|
262
928
|
GroupDetail,
|
|
929
|
+
GroupDetailList,
|
|
930
|
+
CreateGroupBody,
|
|
931
|
+
UpdateGroupBody,
|
|
932
|
+
ReorderGroupBody,
|
|
933
|
+
|
|
934
|
+
// Lists
|
|
263
935
|
GetListsResponse,
|
|
264
936
|
GetListResponse,
|
|
265
937
|
ListSummary,
|
|
266
938
|
ListDetail,
|
|
939
|
+
CreateListBody,
|
|
940
|
+
UpdateListBody,
|
|
941
|
+
AddItemsToListBody,
|
|
942
|
+
UpdateListItemBody,
|
|
943
|
+
|
|
944
|
+
// Shared
|
|
945
|
+
GetSharedListResponse,
|
|
946
|
+
GetSharedGroupResponse,
|
|
947
|
+
|
|
948
|
+
// Items & Products
|
|
267
949
|
HydratedWishlistItem,
|
|
268
950
|
HydratedProduct,
|
|
269
951
|
HydratedVariant,
|
|
952
|
+
Money,
|
|
953
|
+
SelectedOption,
|
|
954
|
+
Metafield,
|
|
270
955
|
|
|
271
|
-
// Common
|
|
956
|
+
// Common
|
|
272
957
|
Pagination,
|
|
273
958
|
PaginationParams,
|
|
959
|
+
OkResponse,
|
|
960
|
+
Image,
|
|
961
|
+
FeaturedItem,
|
|
274
962
|
} from '@sdg.la/wishlist-stack-sdk';
|
|
275
963
|
```
|
|
276
964
|
|
|
965
|
+
### Domain Types
|
|
966
|
+
|
|
967
|
+
Below are the key domain types returned by the SDK. Expand any section to see the full shape.
|
|
968
|
+
|
|
969
|
+
<details>
|
|
970
|
+
<summary><code>Pagination</code></summary>
|
|
971
|
+
|
|
972
|
+
```ts
|
|
973
|
+
type Pagination = {
|
|
974
|
+
page: number;
|
|
975
|
+
pageSize: number;
|
|
976
|
+
totalCount: number;
|
|
977
|
+
totalPages: number;
|
|
978
|
+
};
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
</details>
|
|
982
|
+
|
|
983
|
+
<details>
|
|
984
|
+
<summary><code>GroupSummary</code></summary>
|
|
985
|
+
|
|
986
|
+
```ts
|
|
987
|
+
type GroupSummary = {
|
|
988
|
+
id: string;
|
|
989
|
+
name: string;
|
|
990
|
+
description: string | null;
|
|
991
|
+
position: number;
|
|
992
|
+
shared: boolean;
|
|
993
|
+
listCount: number;
|
|
994
|
+
featuredItems: FeaturedItem[];
|
|
995
|
+
createdAt: string;
|
|
996
|
+
updatedAt: string;
|
|
997
|
+
};
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
</details>
|
|
1001
|
+
|
|
1002
|
+
<details>
|
|
1003
|
+
<summary><code>GroupDetail</code></summary>
|
|
1004
|
+
|
|
1005
|
+
```ts
|
|
1006
|
+
type GroupDetail = {
|
|
1007
|
+
id: string;
|
|
1008
|
+
name: string;
|
|
1009
|
+
description: string | null;
|
|
1010
|
+
position: number;
|
|
1011
|
+
shared: boolean;
|
|
1012
|
+
listCount: number;
|
|
1013
|
+
createdAt: string;
|
|
1014
|
+
updatedAt: string;
|
|
1015
|
+
listsCount: number;
|
|
1016
|
+
lists: GroupDetailList[];
|
|
1017
|
+
pagination: Pagination;
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
type GroupDetailList = {
|
|
1021
|
+
id: string;
|
|
1022
|
+
position: number;
|
|
1023
|
+
name: string;
|
|
1024
|
+
description: string | null;
|
|
1025
|
+
isShared: boolean;
|
|
1026
|
+
itemCount: number;
|
|
1027
|
+
items: string[];
|
|
1028
|
+
featuredItems: FeaturedItem[];
|
|
1029
|
+
};
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
</details>
|
|
1033
|
+
|
|
1034
|
+
<details>
|
|
1035
|
+
<summary><code>ListSummary</code></summary>
|
|
1036
|
+
|
|
1037
|
+
```ts
|
|
1038
|
+
type ListSummary = {
|
|
1039
|
+
id: string;
|
|
1040
|
+
name: string;
|
|
1041
|
+
description: string | null;
|
|
1042
|
+
position: number;
|
|
1043
|
+
shared: boolean;
|
|
1044
|
+
itemCount: number;
|
|
1045
|
+
createdAt: string;
|
|
1046
|
+
updatedAt: string;
|
|
1047
|
+
featuredProducts?: FeaturedItem[];
|
|
1048
|
+
};
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
</details>
|
|
1052
|
+
|
|
1053
|
+
<details>
|
|
1054
|
+
<summary><code>ListDetail</code></summary>
|
|
1055
|
+
|
|
1056
|
+
```ts
|
|
1057
|
+
type ListDetail = {
|
|
1058
|
+
id: string;
|
|
1059
|
+
name: string;
|
|
1060
|
+
description: string | null;
|
|
1061
|
+
position: number;
|
|
1062
|
+
shared: boolean;
|
|
1063
|
+
itemCount: number;
|
|
1064
|
+
createdAt: string;
|
|
1065
|
+
updatedAt: string;
|
|
1066
|
+
items: HydratedWishlistItem[];
|
|
1067
|
+
};
|
|
1068
|
+
```
|
|
1069
|
+
|
|
1070
|
+
</details>
|
|
1071
|
+
|
|
1072
|
+
<details>
|
|
1073
|
+
<summary><code>HydratedWishlistItem</code></summary>
|
|
1074
|
+
|
|
1075
|
+
```ts
|
|
1076
|
+
type HydratedWishlistItem = {
|
|
1077
|
+
id: string;
|
|
1078
|
+
userNote?: string | null;
|
|
1079
|
+
quantity: number;
|
|
1080
|
+
position: number;
|
|
1081
|
+
product: HydratedProduct;
|
|
1082
|
+
properties?: Record<string, unknown> | null;
|
|
1083
|
+
};
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
</details>
|
|
1087
|
+
|
|
1088
|
+
<details>
|
|
1089
|
+
<summary><code>HydratedProduct</code> / <code>HydratedVariant</code></summary>
|
|
1090
|
+
|
|
1091
|
+
```ts
|
|
1092
|
+
type HydratedProduct = {
|
|
1093
|
+
id: string | number;
|
|
1094
|
+
title: string;
|
|
1095
|
+
description: string;
|
|
1096
|
+
availableForSale: boolean;
|
|
1097
|
+
handle: string;
|
|
1098
|
+
productType: string | null;
|
|
1099
|
+
category: string | null;
|
|
1100
|
+
tags: string[];
|
|
1101
|
+
onlineStoreUrl: string | null;
|
|
1102
|
+
metafields: Metafield[];
|
|
1103
|
+
variant: HydratedVariant;
|
|
1104
|
+
vendor: string | null;
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
type HydratedVariant = {
|
|
1108
|
+
id: string | number;
|
|
1109
|
+
title: string;
|
|
1110
|
+
sku?: string | null;
|
|
1111
|
+
price: Money;
|
|
1112
|
+
compareAtPrice?: Money | null;
|
|
1113
|
+
availableForSale: boolean;
|
|
1114
|
+
currentlyNotInStock: boolean;
|
|
1115
|
+
selectedOptions: SelectedOption[];
|
|
1116
|
+
image?: Image | null;
|
|
1117
|
+
metafields: Metafield[];
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
type Money = { amount: string; currencyCode: string };
|
|
1121
|
+
type SelectedOption = { name: string; value: string };
|
|
1122
|
+
type Metafield = { key: string; value: string };
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
</details>
|
|
1126
|
+
|
|
1127
|
+
<details>
|
|
1128
|
+
<summary><code>Image</code> / <code>FeaturedItem</code></summary>
|
|
1129
|
+
|
|
1130
|
+
```ts
|
|
1131
|
+
type Image = {
|
|
1132
|
+
altText?: string | null;
|
|
1133
|
+
url: string;
|
|
1134
|
+
width?: number | null;
|
|
1135
|
+
height?: number | null;
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
type FeaturedItem = {
|
|
1139
|
+
variantId: string | number;
|
|
1140
|
+
image?: Image | null;
|
|
1141
|
+
};
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
</details>
|
|
1145
|
+
|
|
1146
|
+
<details>
|
|
1147
|
+
<summary><code>OkResponse</code></summary>
|
|
1148
|
+
|
|
1149
|
+
```ts
|
|
1150
|
+
type OkResponse = { ok: true };
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
</details>
|
|
1154
|
+
|
|
277
1155
|
## Related Packages
|
|
278
1156
|
|
|
279
|
-
|
|
280
|
-
|---------|-------------|
|
|
281
|
-
| [`@sdg.la/wishlist-stack-hydrogen`](https://www.npmjs.com/package/@sdg.la/wishlist-stack-hydrogen) | Hydrogen/Remix integration with React hooks and middleware |
|
|
1157
|
+
- [`@sdg.la/wishlist-stack-hydrogen`](https://www.npmjs.com/package/@sdg.la/wishlist-stack-hydrogen) — Hydrogen/Remix integration with React hooks and middleware
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED