@sdg.la/wishlist-stack-sdk 0.9.4 → 0.9.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 +926 -53
- 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,979 @@ 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?)`
|
|
216
524
|
|
|
217
|
-
|
|
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>`
|
|
218
532
|
|
|
219
533
|
```ts
|
|
220
|
-
|
|
221
|
-
|
|
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
|
+
---
|
|
222
598
|
|
|
223
|
-
|
|
224
|
-
{ name?: string; description?: string, groupId?: string }
|
|
599
|
+
#### `lists.create(body)`
|
|
225
600
|
|
|
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)
|
|
601
|
+
Create a new list, optionally assigned to a group.
|
|
229
602
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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' });
|
|
233
609
|
```
|
|
234
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>
|
|
647
|
+
|
|
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 (quantity, note, position, or custom properties).
|
|
724
|
+
|
|
725
|
+
- **Endpoint:** `PATCH /api/lists/{listId}/items/{itemId}`
|
|
726
|
+
- **Parameters:**
|
|
727
|
+
- `listId` — `string`
|
|
728
|
+
- `itemId` — `string`
|
|
729
|
+
- `body` — `{ 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
|
+
|
|
736
|
+
<details>
|
|
737
|
+
<summary>Example response</summary>
|
|
738
|
+
|
|
739
|
+
```json
|
|
740
|
+
{
|
|
741
|
+
"id": "cml8dveoj0002jf09vsqw10r2",
|
|
742
|
+
"userNote": "Updated note",
|
|
743
|
+
"quantity": 3,
|
|
744
|
+
"position": 1,
|
|
745
|
+
"product": {
|
|
746
|
+
"id": "gid://shopify/Product/123456789",
|
|
747
|
+
"title": "Classic T-Shirt",
|
|
748
|
+
"description": "A comfortable classic t-shirt",
|
|
749
|
+
"availableForSale": true,
|
|
750
|
+
"handle": "classic-t-shirt",
|
|
751
|
+
"productType": "Apparel",
|
|
752
|
+
"category": null,
|
|
753
|
+
"tags": ["summer", "casual"],
|
|
754
|
+
"onlineStoreUrl": "https://example.myshopify.com/products/classic-t-shirt",
|
|
755
|
+
"metafields": [],
|
|
756
|
+
"variant": {
|
|
757
|
+
"id": "gid://shopify/ProductVariant/46932429275374",
|
|
758
|
+
"title": "Medium / Blue",
|
|
759
|
+
"sku": "TSHIRT-M-BLUE",
|
|
760
|
+
"price": { "amount": "29.99", "currencyCode": "USD" },
|
|
761
|
+
"compareAtPrice": null,
|
|
762
|
+
"availableForSale": true,
|
|
763
|
+
"currentlyNotInStock": false,
|
|
764
|
+
"selectedOptions": [
|
|
765
|
+
{ "name": "Size", "value": "Medium" },
|
|
766
|
+
{ "name": "Color", "value": "Blue" }
|
|
767
|
+
],
|
|
768
|
+
"image": {
|
|
769
|
+
"altText": "Classic T-Shirt in Blue",
|
|
770
|
+
"url": "https://cdn.shopify.com/s/files/1/example.jpg",
|
|
771
|
+
"width": 800,
|
|
772
|
+
"height": 800
|
|
773
|
+
},
|
|
774
|
+
"metafields": []
|
|
775
|
+
},
|
|
776
|
+
"vendor": "Example Brand"
|
|
777
|
+
},
|
|
778
|
+
"properties": null
|
|
779
|
+
}
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
</details>
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
#### `lists.removeItem(listId, itemId)`
|
|
787
|
+
|
|
788
|
+
Remove an item from a list.
|
|
789
|
+
|
|
790
|
+
- **Endpoint:** `DELETE /api/lists/{listId}/items/{itemId}`
|
|
791
|
+
- **Parameters:**
|
|
792
|
+
- `listId` — `string`
|
|
793
|
+
- `itemId` — `string`
|
|
794
|
+
- **Returns:** `Promise<RemoveItemFromListResponse>`
|
|
795
|
+
|
|
796
|
+
```ts
|
|
797
|
+
await client.lists.removeItem('list-id', 'item-id');
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
<details>
|
|
801
|
+
<summary>Example response</summary>
|
|
802
|
+
|
|
803
|
+
```json
|
|
804
|
+
{ "ok": true }
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
</details>
|
|
808
|
+
|
|
809
|
+
---
|
|
810
|
+
|
|
811
|
+
#### `lists.share(listId)`
|
|
812
|
+
|
|
813
|
+
Mark a list as shared (public read-only).
|
|
814
|
+
|
|
815
|
+
- **Endpoint:** `POST /api/lists/{listId}/share`
|
|
816
|
+
- **Parameters:** `listId` — `string`
|
|
817
|
+
- **Returns:** `Promise<MarkListSharedResponse>`
|
|
818
|
+
|
|
819
|
+
```ts
|
|
820
|
+
await client.lists.share('list-id');
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
<details>
|
|
824
|
+
<summary>Example response</summary>
|
|
825
|
+
|
|
826
|
+
```json
|
|
827
|
+
{
|
|
828
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
829
|
+
"name": "Gift Ideas",
|
|
830
|
+
"description": "Birthday gift ideas",
|
|
831
|
+
"position": 1,
|
|
832
|
+
"shared": true,
|
|
833
|
+
"itemCount": 3,
|
|
834
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
835
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
836
|
+
}
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
</details>
|
|
840
|
+
|
|
841
|
+
---
|
|
842
|
+
|
|
843
|
+
#### `lists.unshare(listId)`
|
|
844
|
+
|
|
845
|
+
Revoke sharing for a list.
|
|
846
|
+
|
|
847
|
+
- **Endpoint:** `DELETE /api/lists/{listId}/share`
|
|
848
|
+
- **Parameters:** `listId` — `string`
|
|
849
|
+
- **Returns:** `Promise<RevokeListSharedResponse>`
|
|
850
|
+
|
|
851
|
+
```ts
|
|
852
|
+
await client.lists.unshare('list-id');
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
<details>
|
|
856
|
+
<summary>Example response</summary>
|
|
857
|
+
|
|
858
|
+
```json
|
|
859
|
+
{
|
|
860
|
+
"id": "cml8drg8x0003js093j4ua6p8",
|
|
861
|
+
"name": "Gift Ideas",
|
|
862
|
+
"description": "Birthday gift ideas",
|
|
863
|
+
"position": 1,
|
|
864
|
+
"shared": false,
|
|
865
|
+
"itemCount": 3,
|
|
866
|
+
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
867
|
+
"updatedAt": "2025-01-22T09:15:00.000Z"
|
|
868
|
+
}
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
</details>
|
|
872
|
+
|
|
235
873
|
### Shared
|
|
236
874
|
|
|
237
|
-
Public read-only endpoints for accessing shared lists and groups
|
|
875
|
+
Public read-only endpoints for accessing shared lists and groups. These require only the merchant `apiKey` — no customer access token needed.
|
|
876
|
+
|
|
877
|
+
> [View full Shared API reference](https://wishlist.devteam.run/docs#/shared)
|
|
878
|
+
|
|
879
|
+
---
|
|
880
|
+
|
|
881
|
+
#### `shared.getSharedList(listId)`
|
|
882
|
+
|
|
883
|
+
Fetch a public shared list with hydrated product details.
|
|
884
|
+
|
|
885
|
+
- **Endpoint:** `GET /api/shared/list/{listId}`
|
|
886
|
+
- **Parameters:** `listId` — `string`
|
|
887
|
+
- **Returns:** `Promise<GetSharedListResponse>` — same response shape as [`lists.getById`](#listsgetbyidlistid-query)
|
|
888
|
+
|
|
889
|
+
```ts
|
|
890
|
+
const list = await client.shared.getSharedList('list-id');
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
---
|
|
894
|
+
|
|
895
|
+
#### `shared.getSharedGroup(groupId)`
|
|
896
|
+
|
|
897
|
+
Fetch a public shared group and its lists.
|
|
238
898
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
899
|
+
- **Endpoint:** `GET /api/shared/group/{groupId}`
|
|
900
|
+
- **Parameters:** `groupId` — `string`
|
|
901
|
+
- **Returns:** `Promise<GetSharedGroupResponse>` — same response shape as [`groups.getById`](#groupsgetbyidgroupid-query)
|
|
902
|
+
|
|
903
|
+
```ts
|
|
904
|
+
const group = await client.shared.getSharedGroup('group-id');
|
|
905
|
+
```
|
|
243
906
|
|
|
244
907
|
## TypeScript Types
|
|
245
908
|
|
|
246
|
-
The package exports all types
|
|
909
|
+
The package exports all request, response, and domain types. Import what you need:
|
|
247
910
|
|
|
248
911
|
```ts
|
|
249
912
|
import type {
|
|
250
|
-
// Client
|
|
913
|
+
// Client
|
|
251
914
|
CreateWishlistStackClientOptions,
|
|
252
915
|
WishlistStackClient,
|
|
253
916
|
|
|
254
|
-
//
|
|
917
|
+
// Errors
|
|
255
918
|
WishlistStackApiError,
|
|
256
919
|
WishlistStackApiErrorDetails,
|
|
257
920
|
|
|
258
|
-
//
|
|
921
|
+
// Groups
|
|
259
922
|
GetGroupsResponse,
|
|
260
923
|
GetGroupResponse,
|
|
261
924
|
GroupSummary,
|
|
262
925
|
GroupDetail,
|
|
926
|
+
GroupDetailList,
|
|
927
|
+
CreateGroupBody,
|
|
928
|
+
UpdateGroupBody,
|
|
929
|
+
ReorderGroupBody,
|
|
930
|
+
|
|
931
|
+
// Lists
|
|
263
932
|
GetListsResponse,
|
|
264
933
|
GetListResponse,
|
|
265
934
|
ListSummary,
|
|
266
935
|
ListDetail,
|
|
936
|
+
CreateListBody,
|
|
937
|
+
UpdateListBody,
|
|
938
|
+
AddItemsToListBody,
|
|
939
|
+
UpdateListItemBody,
|
|
940
|
+
|
|
941
|
+
// Shared
|
|
942
|
+
GetSharedListResponse,
|
|
943
|
+
GetSharedGroupResponse,
|
|
944
|
+
|
|
945
|
+
// Items & Products
|
|
267
946
|
HydratedWishlistItem,
|
|
268
947
|
HydratedProduct,
|
|
269
948
|
HydratedVariant,
|
|
949
|
+
Money,
|
|
950
|
+
SelectedOption,
|
|
951
|
+
Metafield,
|
|
270
952
|
|
|
271
|
-
// Common
|
|
953
|
+
// Common
|
|
272
954
|
Pagination,
|
|
273
955
|
PaginationParams,
|
|
956
|
+
OkResponse,
|
|
957
|
+
Image,
|
|
958
|
+
FeaturedItem,
|
|
274
959
|
} from '@sdg.la/wishlist-stack-sdk';
|
|
275
960
|
```
|
|
276
961
|
|
|
962
|
+
### Domain Types
|
|
963
|
+
|
|
964
|
+
Below are the key domain types returned by the SDK. Expand any section to see the full shape.
|
|
965
|
+
|
|
966
|
+
<details>
|
|
967
|
+
<summary><code>Pagination</code></summary>
|
|
968
|
+
|
|
969
|
+
```ts
|
|
970
|
+
type Pagination = {
|
|
971
|
+
page: number;
|
|
972
|
+
pageSize: number;
|
|
973
|
+
totalCount: number;
|
|
974
|
+
totalPages: number;
|
|
975
|
+
};
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
</details>
|
|
979
|
+
|
|
980
|
+
<details>
|
|
981
|
+
<summary><code>GroupSummary</code></summary>
|
|
982
|
+
|
|
983
|
+
```ts
|
|
984
|
+
type GroupSummary = {
|
|
985
|
+
id: string;
|
|
986
|
+
name: string;
|
|
987
|
+
description: string | null;
|
|
988
|
+
position: number;
|
|
989
|
+
shared: boolean;
|
|
990
|
+
listCount: number;
|
|
991
|
+
featuredItems: FeaturedItem[];
|
|
992
|
+
createdAt: string;
|
|
993
|
+
updatedAt: string;
|
|
994
|
+
};
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
</details>
|
|
998
|
+
|
|
999
|
+
<details>
|
|
1000
|
+
<summary><code>GroupDetail</code></summary>
|
|
1001
|
+
|
|
1002
|
+
```ts
|
|
1003
|
+
type GroupDetail = {
|
|
1004
|
+
id: string;
|
|
1005
|
+
name: string;
|
|
1006
|
+
description: string | null;
|
|
1007
|
+
position: number;
|
|
1008
|
+
shared: boolean;
|
|
1009
|
+
listCount: number;
|
|
1010
|
+
createdAt: string;
|
|
1011
|
+
updatedAt: string;
|
|
1012
|
+
listsCount: number;
|
|
1013
|
+
lists: GroupDetailList[];
|
|
1014
|
+
pagination: Pagination;
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
type GroupDetailList = {
|
|
1018
|
+
id: string;
|
|
1019
|
+
position: number;
|
|
1020
|
+
name: string;
|
|
1021
|
+
description: string | null;
|
|
1022
|
+
isShared: boolean;
|
|
1023
|
+
itemCount: number;
|
|
1024
|
+
items: string[];
|
|
1025
|
+
featuredItems: FeaturedItem[];
|
|
1026
|
+
};
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
</details>
|
|
1030
|
+
|
|
1031
|
+
<details>
|
|
1032
|
+
<summary><code>ListSummary</code></summary>
|
|
1033
|
+
|
|
1034
|
+
```ts
|
|
1035
|
+
type ListSummary = {
|
|
1036
|
+
id: string;
|
|
1037
|
+
name: string;
|
|
1038
|
+
description: string | null;
|
|
1039
|
+
position: number;
|
|
1040
|
+
shared: boolean;
|
|
1041
|
+
itemCount: number;
|
|
1042
|
+
createdAt: string;
|
|
1043
|
+
updatedAt: string;
|
|
1044
|
+
featuredProducts?: FeaturedItem[];
|
|
1045
|
+
};
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
</details>
|
|
1049
|
+
|
|
1050
|
+
<details>
|
|
1051
|
+
<summary><code>ListDetail</code></summary>
|
|
1052
|
+
|
|
1053
|
+
```ts
|
|
1054
|
+
type ListDetail = {
|
|
1055
|
+
id: string;
|
|
1056
|
+
name: string;
|
|
1057
|
+
description: string | null;
|
|
1058
|
+
position: number;
|
|
1059
|
+
shared: boolean;
|
|
1060
|
+
itemCount: number;
|
|
1061
|
+
createdAt: string;
|
|
1062
|
+
updatedAt: string;
|
|
1063
|
+
items: HydratedWishlistItem[];
|
|
1064
|
+
};
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
</details>
|
|
1068
|
+
|
|
1069
|
+
<details>
|
|
1070
|
+
<summary><code>HydratedWishlistItem</code></summary>
|
|
1071
|
+
|
|
1072
|
+
```ts
|
|
1073
|
+
type HydratedWishlistItem = {
|
|
1074
|
+
id: string;
|
|
1075
|
+
userNote?: string | null;
|
|
1076
|
+
quantity: number;
|
|
1077
|
+
position: number;
|
|
1078
|
+
product: HydratedProduct;
|
|
1079
|
+
properties?: Record<string, unknown> | null;
|
|
1080
|
+
};
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
</details>
|
|
1084
|
+
|
|
1085
|
+
<details>
|
|
1086
|
+
<summary><code>HydratedProduct</code> / <code>HydratedVariant</code></summary>
|
|
1087
|
+
|
|
1088
|
+
```ts
|
|
1089
|
+
type HydratedProduct = {
|
|
1090
|
+
id: string | number;
|
|
1091
|
+
title: string;
|
|
1092
|
+
description: string;
|
|
1093
|
+
availableForSale: boolean;
|
|
1094
|
+
handle: string;
|
|
1095
|
+
productType: string | null;
|
|
1096
|
+
category: string | null;
|
|
1097
|
+
tags: string[];
|
|
1098
|
+
onlineStoreUrl: string | null;
|
|
1099
|
+
metafields: Metafield[];
|
|
1100
|
+
variant: HydratedVariant;
|
|
1101
|
+
vendor: string | null;
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
type HydratedVariant = {
|
|
1105
|
+
id: string | number;
|
|
1106
|
+
title: string;
|
|
1107
|
+
sku?: string | null;
|
|
1108
|
+
price: Money;
|
|
1109
|
+
compareAtPrice?: Money | null;
|
|
1110
|
+
availableForSale: boolean;
|
|
1111
|
+
currentlyNotInStock: boolean;
|
|
1112
|
+
selectedOptions: SelectedOption[];
|
|
1113
|
+
image?: Image | null;
|
|
1114
|
+
metafields: Metafield[];
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
type Money = { amount: string; currencyCode: string };
|
|
1118
|
+
type SelectedOption = { name: string; value: string };
|
|
1119
|
+
type Metafield = { key: string; value: string };
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
</details>
|
|
1123
|
+
|
|
1124
|
+
<details>
|
|
1125
|
+
<summary><code>Image</code> / <code>FeaturedItem</code></summary>
|
|
1126
|
+
|
|
1127
|
+
```ts
|
|
1128
|
+
type Image = {
|
|
1129
|
+
altText?: string | null;
|
|
1130
|
+
url: string;
|
|
1131
|
+
width?: number | null;
|
|
1132
|
+
height?: number | null;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
type FeaturedItem = {
|
|
1136
|
+
variantId: string | number;
|
|
1137
|
+
image?: Image | null;
|
|
1138
|
+
};
|
|
1139
|
+
```
|
|
1140
|
+
|
|
1141
|
+
</details>
|
|
1142
|
+
|
|
1143
|
+
<details>
|
|
1144
|
+
<summary><code>OkResponse</code></summary>
|
|
1145
|
+
|
|
1146
|
+
```ts
|
|
1147
|
+
type OkResponse = { ok: true };
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
</details>
|
|
1151
|
+
|
|
277
1152
|
## Related Packages
|
|
278
1153
|
|
|
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 |
|
|
1154
|
+
- [`@sdg.la/wishlist-stack-hydrogen`](https://www.npmjs.com/package/@sdg.la/wishlist-stack-hydrogen) — Hydrogen/Remix integration with React hooks and middleware
|